forked from dcariola/XCodeEditor-for-Unity
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXCMod.cs
More file actions
134 lines (109 loc) · 2.75 KB
/
XCMod.cs
File metadata and controls
134 lines (109 loc) · 2.75 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
using UnityEngine;
using Facebook.MiniJSON;
using System.Collections;
using System.Collections.Generic;
using System.IO;
namespace thevolary.rise.UnityEditor.XCodeEditor
{
public class XCMod
{
private Hashtable _datastore;
private List<object> _libs;
public string name { get; private set; }
public string path { get; set; }
public string group {
get {
return (string)_datastore["group"];
}
}
public List<object> patches
{
get {
return (List<object>)_datastore["patches"];
}
}
public List<object> libs {
get {
if( _libs == null ) {
List<object> libsCast = (List<object>)_datastore["libs"];
int count = libsCast.Count;
_libs = new List<object>( count );
foreach( string fileRef in libsCast ) {
_libs.Add( new XCModFile( fileRef ) );
}
}
return _libs;
}
}
public List<object> librarysearchpaths {
get {
return (List<object>)_datastore["librarysearchpaths"];
}
}
public List<object> frameworks {
get {
return (List<object>)_datastore["frameworks"];
}
}
public List<object> frameworksearchpath {
get {
return (List<object>)_datastore["frameworksearchpaths"];
}
}
public List<object> headerpaths {
get {
return (List<object>)_datastore["headerpaths"];
}
}
public List<object> files {
get {
return (List<object>)_datastore["files"];
}
}
public List<object> folders {
get {
return (List<object>)_datastore["folders"];
}
}
public List<object> excludes {
get {
return (List<object>)_datastore["excludes"];
}
}
public XCMod( string projectPath, string filename )
{
FileInfo projectFileInfo = new FileInfo( filename );
if( !projectFileInfo.Exists ) {
Debug.LogWarning( "File does not exist." );
}
name = System.IO.Path.GetFileNameWithoutExtension( filename );
path = projectPath;//System.IO.Path.GetDirectoryName( filename );
string contents = projectFileInfo.OpenText().ReadToEnd();
Dictionary<string, object> dictJson = Json.Deserialize(contents) as Dictionary<string,object>;;
_datastore = new Hashtable(dictJson);
}
}
public class XCModFile
{
public string filePath { get; private set; }
public bool isWeak { get; private set; }
public string sourceTree {get; private set;}
public XCModFile( string inputString )
{
isWeak = false;
sourceTree = "SDKROOT";
if( inputString.Contains( ":" ) ) {
string[] parts = inputString.Split( ':' );
filePath = parts[0];
isWeak = System.Array.IndexOf(parts, "weak", 1) > 0;
if(System.Array.IndexOf(parts, "<group>", 1) > 0)
sourceTree = "GROUP";
else
sourceTree = "SDKROOT";
}
else {
filePath = inputString;
}
}
}
}