forked from dcariola/XCodeEditor-for-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPBXGroup.cs
113 lines (91 loc) · 2.09 KB
/
PBXGroup.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
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.XCodeEditor
{
public class PBXGroup : PBXObject
{
protected const string NAME_KEY = "name";
protected const string CHILDREN_KEY = "children";
protected const string PATH_KEY = "path";
protected const string SOURCETREE_KEY = "sourceTree";
#region Constructor
public PBXGroup( string name, string path = null, string tree = "SOURCE_ROOT" ) : base()
{
this.Add( NAME_KEY, name );
this.Add( CHILDREN_KEY, new PBXList() );
if( path != null ) {
this.Add( PATH_KEY, path );
this.Add( SOURCETREE_KEY, tree );
}
else {
this.Add( SOURCETREE_KEY, "\"<group>\"" );
}
internalNewlines = true;
}
public PBXGroup( string guid, PBXDictionary dictionary ) : base( guid, dictionary )
{
internalNewlines = true;
}
#endregion
#region Properties
public string name {
get {
if( !ContainsKey( NAME_KEY ) ) {
return null;
}
return (string)_data[NAME_KEY];
}
}
public PBXList children {
get {
if( !ContainsKey( CHILDREN_KEY ) ) {
this.Add( CHILDREN_KEY, new PBXList() );
}
return (PBXList)_data[CHILDREN_KEY];
}
}
public string path {
get {
if( !ContainsKey( PATH_KEY ) ) {
return null;
}
return (string)_data[PATH_KEY];
}
}
public string sourceTree {
get {
return (string)_data[SOURCETREE_KEY];
}
}
#endregion
public string AddChild( PBXObject child )
{
if( child is PBXFileReference || child is PBXGroup ) {
children.Add( child.guid );
return child.guid;
}
return null;
}
public void RemoveChild( string id )
{
if( !IsGuid( id ) )
return;
children.Remove( id );
}
public bool HasChild( string id )
{
if( !ContainsKey( CHILDREN_KEY ) ) {
this.Add( CHILDREN_KEY, new PBXList() );
return false;
}
if( !IsGuid( id ) )
return false;
return ((PBXList)_data[ CHILDREN_KEY ]).Contains( id );
}
public string GetName()
{
return (string)_data[ NAME_KEY ];
}
}
}