forked from onevcat/XUPorter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXCMod.cs
109 lines (92 loc) · 2.14 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
using UnityEngine;
using System.Collections;
using System.IO;
namespace UnityEditor.XCodeEditor
{
public class XCMod
{
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 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 linker_flags {
get {
return (ArrayList)_datastore["linker_flags"];
}
}
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)XUPorterJSON.MiniJSON.jsonDecode( contents );
}
}
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;
}
}
}
}