-
Notifications
You must be signed in to change notification settings - Fork 99
/
XCMod.cs
142 lines (121 loc) · 3.28 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
136
137
138
139
140
141
142
using UnityEngine;
using System.Collections;
using System.IO;
using Json = MiniJSON;
namespace UnityEditor.XCodeEditor
{
public class XCMod
{
// private string group;
// private ArrayList patches;
// private ArrayList libs;
// private ArrayList frameworks;
// private ArrayList headerpaths;
// private ArrayList files;
// private ArrayList folders;
// private ArrayList excludes;
private Hashtable _datastore;
private ArrayList _libs;
public string name { get; private set; }
public string path { get; private set; }
public string group {
get {
return (string)_datastore["group"];
}
}
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"] ) {
_libs.Add( new XCModFile( fileRef ) );
}
}
return _libs;
}
}
public ArrayList frameworks {
get {
return (ArrayList)_datastore["frameworks"];
}
}
public ArrayList headerpaths {
get {
return (ArrayList)_datastore["headerpaths"];
}
}
public Hashtable buildSettings {
get {
return (Hashtable)_datastore["buildSettings"];
}
}
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 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();
_datastore = (Hashtable)XMiniJSON.jsonDecode( contents );
// group = (string)_datastore["group"];
// patches = (ArrayList)_datastore["patches"];
// libs = (ArrayList)_datastore["libs"];
// frameworks = (ArrayList)_datastore["frameworks"];
// headerpaths = (ArrayList)_datastore["headerpaths"];
// files = (ArrayList)_datastore["files"];
// folders = (ArrayList)_datastore["folders"];
// excludes = (ArrayList)_datastore["excludes"];
}
// "group": "GameCenter",
// "patches": [],
// "libs": [],
// "frameworks": ["GameKit.framework"],
// "headerpaths": ["Editor/iOS/GameCenter/**"],
// "files": ["Editor/iOS/GameCenter/GameCenterBinding.m",
// "Editor/iOS/GameCenter/GameCenterController.h",
// "Editor/iOS/GameCenter/GameCenterController.mm",
// "Editor/iOS/GameCenter/GameCenterManager.h",
// "Editor/iOS/GameCenter/GameCenterManager.m"],
// "folders": [],
// "excludes": ["^.*\\.meta$", "^.*\\.mdown^", "^.*\\.pdf$"]
}
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;
}
}
}
}