-
Notifications
You must be signed in to change notification settings - Fork 101
/
PBXBuildFile.cs
102 lines (87 loc) · 2.26 KB
/
PBXBuildFile.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
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.XCodeEditor
{
public class PBXBuildFile : PBXType
{
const string SETTINGS_KEY = "settings";
const string ATTRIBUTES_KEY = "ATTRIBUTES";
const string WEAK_VALUE = "Weak";
const string COMPILER_FLAGS_KEY = "COMPILER_FLAGS";
public PBXBuildFile( string fileRef, bool weak = false ) : base()
{
// def Create(cls, file_ref, weak=False):
// if isinstance(file_ref, PBXFileReference):
// file_ref = file_ref.id
//
// bf = cls()
// bf.id = cls.GenerateId()
// bf['fileRef'] = file_ref
//
// if weak:
// bf.set_weak_link(True)
//
// return bf
}
public bool SetWeakLink( bool weak = false )
{
PBXDictionary settings = this[SETTINGS_KEY] as PBXDictionary;
PBXList attributes = null;
if( settings == null ) {
if( weak ) {
attributes = new PBXList();
attributes.Add( WEAK_VALUE );
settings = new PBXDictionary();
settings.Add( ATTRIBUTES_KEY, attributes );
}
return true;
}
attributes = settings[ ATTRIBUTES_KEY ] as PBXList;
if( attributes == null ) {
if( weak ) {
attributes = new PBXList();
}
else {
return false;
}
}
if( weak ) {
attributes.Add( WEAK_VALUE );
}
else {
attributes.Remove( WEAK_VALUE );
}
settings.Add( ATTRIBUTES_KEY, attributes );
this.Add( SETTINGS_KEY, settings );
return true;
}
public bool AddCompilerFlag( string flag )
{
// if( !this.ContainsKey( SETTINGS_KEY ) )
// this[ SETTINGS_KEY ] = new PBXDictionary();
//
// if( !(PBXDictionary)this[ SETTINGS_KEY ]
return false;
// def add_compiler_flag(self, flag):
// k_settings = 'settings'
// k_attributes = 'COMPILER_FLAGS'
//
// if not self.has_key(k_settings):
// self[k_settings] = PBXDict()
//
// if not self[k_settings].has_key(k_attributes):
// self[k_settings][k_attributes] = flag
// return True
//
// flags = self[k_settings][k_attributes].split(' ')
//
// if flag in flags:
// return False
//
// flags.append(flag)
//
// self[k_settings][k_attributes] = ' '.join(flags)
}
}
}