forked from onevcat/XUPorter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXCMod.cs
More file actions
executable file
·222 lines (200 loc) · 5.68 KB
/
XCMod.cs
File metadata and controls
executable file
·222 lines (200 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
using UnityEngine;
using System.Collections;
using System.IO;
namespace UnityEditor.XCodeEditor
{
public class XCMod
{
private Hashtable _datastore = new Hashtable();
private ArrayList _libs = null;
public string name { get; private set; }
public string path { get; private set; }
public string group {
get {
if (_datastore != null && _datastore.Contains("group"))
return (string)_datastore["group"];
return string.Empty;
}
}
public ArrayList patches {
get {
//return (ArrayList)_datastore["patches"];
ArrayList p_ = (ArrayList)_datastore["patches"];
if ( null == p_ )
{
return new ArrayList();
}
return p_;
}
}
public ArrayList libs {
get {
if( _libs == null ) {
_libs = new ArrayList( ((ArrayList)_datastore["libs"]).Count );
foreach( string fileRef in (ArrayList)_datastore["libs"] ) {
Debug.Log("Adding to Libs: "+fileRef);
_libs.Add( new XCModFile( fileRef ) );
}
}
return _libs;
}
}
public ArrayList frameworks {
get {
//return (ArrayList)_datastore["frameworks"];
ArrayList p_ = (ArrayList)_datastore["frameworks"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList headerpaths {
get {
//return (ArrayList)_datastore["headerpaths"];
ArrayList p_ = (ArrayList)_datastore["headerpaths"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList files {
get {
//return (ArrayList)_datastore["files"];
ArrayList p_ = (ArrayList)_datastore["files"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList folders {
get {
//return (ArrayList)_datastore["folders"];
ArrayList p_ = (ArrayList)_datastore["folders"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList excludes {
get {
//return (ArrayList)_datastore["excludes"];
ArrayList p_ = (ArrayList)_datastore["excludes"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList compiler_flags {
get {
//return (ArrayList)_datastore["compiler_flags"];
ArrayList p_ = (ArrayList)_datastore["compiler_flags"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList linker_flags {
get {
//return (ArrayList)_datastore["linker_flags"];
ArrayList p_ = (ArrayList)_datastore["linker_flags"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public ArrayList embed_binaries {
get {
//return (ArrayList)_datastore["embed_binaries"];
ArrayList p_ = (ArrayList)_datastore["embed_binaries"];
if (null == p_)
{
return new ArrayList();
}
return p_;
}
}
public Hashtable plist {
get {
//return (Hashtable)_datastore["plist"];
Hashtable p_ = (Hashtable)_datastore["plist"];
if (null == p_)
{
return new Hashtable();
}
return p_;
}
}
public Hashtable settings
{
get {
//return (Hashtable)_datastore["settings"];
Hashtable p_ = (Hashtable)_datastore["settings"];
if (null == p_)
{
return new Hashtable();
}
return p_;
}
}
public Hashtable textModify
{
get
{
//return (Hashtable)_datastore["textModify"];
Hashtable p_ = (Hashtable)_datastore["textModify"];
if (null == p_)
{
return new Hashtable();
}
return p_;
}
}
public XCMod( string filename )
{
FileInfo projectFileInfo = new FileInfo( filename );
if( !projectFileInfo.Exists ) {
Debug.LogWarning( "File does not exist." );
}
name = System.IO.Path.GetFileNameWithoutExtension( filename );
path = System.IO.Path.GetDirectoryName( filename );
string contents = projectFileInfo.OpenText().ReadToEnd();
Debug.Log (contents);
_datastore = (Hashtable)XUPorterJSON.MiniJSON.jsonDecode( contents );
if (_datastore == null || _datastore.Count == 0) {
Debug.Log (contents);
throw new UnityException("Parse error in file " + System.IO.Path.GetFileName(filename) + "! Check for typos such as unbalanced quotation marks, etc.");
}
}
}
public class XCModFile
{
public string filePath { get; private set; }
public bool isWeak { get; private set; }
public XCModFile( string inputString )
{
isWeak = false;
if( inputString.Contains( ":" ) ) {
string[] parts = inputString.Split( ':' );
filePath = parts[0];
isWeak = ( parts[1].CompareTo( "weak" ) == 0 );
}
else {
filePath = inputString;
}
}
}
}