-
Notifications
You must be signed in to change notification settings - Fork 240
/
XCMod.cs
executable file
·135 lines (115 loc) · 2.85 KB
/
XCMod.cs
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
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"];
}
}
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"];
}
}
public ArrayList headerpaths {
get {
return (ArrayList)_datastore["headerpaths"];
}
}
public ArrayList files {
get {
return (ArrayList)_datastore["files"];
}
}
public ArrayList folders {
get {
return (ArrayList)_datastore["folders"];
}
}
public ArrayList excludes {
get {
return (ArrayList)_datastore["excludes"];
}
}
public ArrayList compiler_flags {
get {
return (ArrayList)_datastore["compiler_flags"];
}
}
public ArrayList linker_flags {
get {
return (ArrayList)_datastore["linker_flags"];
}
}
public ArrayList embed_binaries {
get {
return (ArrayList)_datastore["embed_binaries"];
}
}
public Hashtable plist {
get {
return (Hashtable)_datastore["plist"];
}
}
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;
}
}
}
}