本文整理汇总了C#中PBXDictionary类的典型用法代码示例。如果您正苦于以下问题:C# PBXDictionary类的具体用法?C# PBXDictionary怎么用?C# PBXDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PBXDictionary类属于命名空间,在下文中一共展示了PBXDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XCProject
public XCProject(string filePath) : this()
{
if (!System.IO.Directory.Exists(filePath))
{
Debug.LogWarning("Path does not exists.");
return;
}
if (filePath.EndsWith(".xcodeproj"))
{
this.projectRootPath = Path.GetDirectoryName(filePath);
this.filePath = filePath;
}
else
{
string[] projects = System.IO.Directory.GetDirectories(filePath, "*.xcodeproj");
if (projects.Length == 0)
{
Debug.LogWarning("Error: missing xcodeproj file");
return;
}
this.projectRootPath = filePath;
this.filePath = projects[0];
}
projectFileInfo = new FileInfo(Path.Combine(this.filePath, "project.pbxproj"));
StreamReader sr = projectFileInfo.OpenText();
string contents = sr.ReadToEnd();
sr.Close();
PBXParser parser = new PBXParser();
_datastore = parser.Decode(contents);
if (_datastore == null)
{
throw new System.Exception("Project file not found at file path " + filePath);
}
if (!_datastore.ContainsKey("objects"))
{
Debug.Log("Errore " + _datastore.Count);
return;
}
_objects = (PBXDictionary) _datastore["objects"];
modified = false;
_rootObjectKey = (string) _datastore["rootObject"];
if (!string.IsNullOrEmpty(_rootObjectKey))
{
_project = new PBXProject(_rootObjectKey, (PBXDictionary) _objects[_rootObjectKey]);
_rootGroup = new PBXGroup(_rootObjectKey, (PBXDictionary) _objects[_project.mainGroupID]);
}
else
{
Debug.LogWarning("Error: project has no root object");
_project = null;
_rootGroup = null;
}
}
示例2: PBXObject
public PBXObject()
{
_data = new PBXDictionary();
_data[ISA_KEY] = this.GetType().Name;
_guid = GenerateGuid();
internalNewlines = false;
}
示例3: Encode
public string Encode( PBXDictionary pbxData, bool readable = false )
{
StringBuilder builder = new StringBuilder( PBX_HEADER_TOKEN, BUILDER_CAPACITY );
bool success = SerializeValue( pbxData, builder, readable );
return ( success ? builder.ToString() : null );
}
示例4: PBXBuildFile
public PBXBuildFile(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
if (!this.data.ContainsKey(SETTINGS_KEY))
{
return;
}
object settingsObj = this.data[SETTINGS_KEY];
if (!(settingsObj is PBXDictionary))
{
return;
}
PBXDictionary settingsDict = (PBXDictionary) settingsObj;
settingsDict.internalNewlines = false;
if (!settingsDict.ContainsKey(ATTRIBUTES_KEY))
{
return;
}
object attributesObj = settingsDict[ATTRIBUTES_KEY];
if (!(attributesObj is PBXList))
{
return;
}
PBXList attributesCast = (PBXList) attributesObj;
attributesCast.internalNewlines = false;
}
示例5: SetWeakLink
public void SetWeakLink( bool weak)
{
PBXDictionary settings = null;
PBXList attributes = null;
if (_data.ContainsKey (SETTINGS_KEY)) {
settings = _data[SETTINGS_KEY] as PBXDictionary;
if (settings.ContainsKey(ATTRIBUTES_KEY)) {
attributes = settings[ATTRIBUTES_KEY] as PBXList;
}
}
if (weak) {
if (settings == null) {
settings = new PBXDictionary();
settings.internalNewlines = false;
_data.Add(SETTINGS_KEY, settings);
}
if (attributes == null) {
attributes = new PBXList();
attributes.internalNewlines = false;
attributes.Add(WEAK_VALUE);
settings.Add(ATTRIBUTES_KEY, attributes);
}
}
else {
if(attributes != null && attributes.Contains(WEAK_VALUE)) {
attributes.Remove(WEAK_VALUE);
}
}
}
示例6: SetWeakLink
public bool SetWeakLink(bool weak = false)
{
PBXDictionary settings = null;
PBXList attributes = null;
if (!_data.ContainsKey(SETTINGS_KEY))
{
if (weak)
{
attributes = new PBXList();
attributes.internalNewlines = false;
attributes.Add(WEAK_VALUE);
settings = new PBXDictionary();
settings.Add(ATTRIBUTES_KEY, attributes);
settings.internalNewlines = false;
this.Add(SETTINGS_KEY, settings);
}
return true;
}
settings = _data[SETTINGS_KEY] as PBXDictionary;
settings.internalNewlines = false;
if (!settings.ContainsKey(ATTRIBUTES_KEY))
{
if (weak)
{
attributes = new PBXList();
attributes.internalNewlines = false;
attributes.Add(WEAK_VALUE);
settings.Add(ATTRIBUTES_KEY, attributes);
return true;
}
else
{
return false;
}
}
else
{
attributes = settings[ATTRIBUTES_KEY] as PBXList;
}
attributes.internalNewlines = false;
if (weak)
{
attributes.Add(WEAK_VALUE);
}
else
{
attributes.Remove(WEAK_VALUE);
}
settings.Add(ATTRIBUTES_KEY, attributes);
this.Add(SETTINGS_KEY, settings);
return true;
}
示例7: PBXObject
public PBXObject( string guid, PBXDictionary dictionary ) : this( guid )
{
if( !dictionary.ContainsKey( ISA_KEY ) || ((string)dictionary[ ISA_KEY ]).CompareTo( this.GetType().Name ) != 0 )
Debug.LogError( "PBXDictionary is not a valid ISA object" );
foreach( KeyValuePair<string, object> item in dictionary ) {
_data[ item.Key ] = item.Value;
}
}
示例8: Encode
public string Encode(PBXDictionary pbxData)
{
indent = 0;
StringBuilder builder = new StringBuilder(PBX_HEADER_TOKEN, BUILDER_CAPACITY);
bool success = SerializeValue(pbxData, builder);
return (success ? builder.ToString() : null);
}
示例9: XCProject
public XCProject( string filePath )
: this()
{
if( !System.IO.Directory.Exists( filePath ) ) {
Debug.LogWarning( "XCode project path does not exist: " + filePath );
return;
}
if( filePath.EndsWith( ".xcodeproj" ) ) {
Debug.Log( "Opening project " + filePath );
this.projectRootPath = Path.GetDirectoryName( filePath );
this.filePath = filePath;
} else {
Debug.Log( "Looking for xcodeproj files in " + filePath );
string[] projects = System.IO.Directory.GetDirectories( filePath, "*.xcodeproj" );
if( projects.Length == 0 ) {
Debug.LogWarning( "Error: missing xcodeproj file" );
return;
}
this.projectRootPath = filePath;
//if the path is relative to the project, we need to make it absolute
if (!System.IO.Path.IsPathRooted(projectRootPath))
projectRootPath = Application.dataPath.Replace("Assets", "") + projectRootPath;
//Debug.Log ("projectRootPath adjusted to " + projectRootPath);
this.filePath = projects[ 0 ];
}
projectFileInfo = new FileInfo( Path.Combine( this.filePath, "project.pbxproj" ) );
string contents = projectFileInfo.OpenText().ReadToEnd();
PBXParser parser = new PBXParser();
_datastore = parser.Decode( contents );
if( _datastore == null ) {
throw new System.Exception( "Project file not found at file path " + filePath );
}
if( !_datastore.ContainsKey( "objects" ) ) {
Debug.Log( "Errore " + _datastore.Count );
return;
}
_objects = (PBXDictionary)_datastore["objects"];
modified = false;
_rootObjectKey = (string)_datastore["rootObject"];
if( !string.IsNullOrEmpty( _rootObjectKey ) ) {
_project = new PBXProject( _rootObjectKey, (PBXDictionary)_objects[ _rootObjectKey ] );
_rootGroup = new PBXGroup( _rootObjectKey, (PBXDictionary)_objects[ _project.mainGroupID ] );
}
else {
Debug.LogWarning( "error: project has no root object" );
_project = null;
_rootGroup = null;
}
}
示例10: AddCodeSignOnCopy
//CodeSignOnCopy
public bool AddCodeSignOnCopy()
{
if( !_data.ContainsKey( SETTINGS_KEY ) )
_data[ SETTINGS_KEY ] = new PBXDictionary();
var settings = _data[ SETTINGS_KEY ] as PBXDictionary;
if( !settings.ContainsKey( ATTRIBUTES_KEY ) ) {
var attributes = new PBXList();
attributes.Add( "CodeSignOnCopy" );
attributes.Add( "RemoveHeadersOnCopy" );
settings.Add( ATTRIBUTES_KEY, attributes );
}
else {
var attributes = settings[ ATTRIBUTES_KEY ] as PBXList;
attributes.Add( "CodeSignOnCopy" );
attributes.Add( "RemoveHeadersOnCopy" );
}
return true;
}
示例11: AddCompilerFlag
public bool AddCompilerFlag( string flag )
{
if( !_data.ContainsKey( SETTINGS_KEY ) )
_data[ SETTINGS_KEY ] = new PBXDictionary();
if( !((PBXDictionary)_data[ SETTINGS_KEY ]).ContainsKey( COMPILER_FLAGS_KEY ) ) {
((PBXDictionary)_data[ SETTINGS_KEY ]).Add( COMPILER_FLAGS_KEY, flag );
return true;
}
string[] flags = ((string)((PBXDictionary)_data[ SETTINGS_KEY ])[ COMPILER_FLAGS_KEY ]).Split( ' ' );
foreach( string item in flags ) {
if( item.CompareTo( flag ) == 0 )
return false;
}
((PBXDictionary)_data[ SETTINGS_KEY ])[ COMPILER_FLAGS_KEY ] = ( string.Join( " ", flags ) + " " + flag );
return true;
}
示例12: AddCompilerFlag
public bool AddCompilerFlag( string flag )
{
if( !_data.ContainsKey( SETTINGS_KEY ) )
_data[ SETTINGS_KEY ] = new PBXDictionary();
if( !((PBXDictionary)_data[ SETTINGS_KEY ]).ContainsKey( COMPILER_FLAGS_KEY ) ) {
((PBXDictionary)_data[ SETTINGS_KEY ]).Add( COMPILER_FLAGS_KEY, flag );
return true;
}
string[] flags = ((string)((PBXDictionary)_data[ SETTINGS_KEY ])[ COMPILER_FLAGS_KEY ]).Split( ' ' );
foreach( string item in flags ) {
if( item.CompareTo( flag ) == 0 )
return false;
}
((PBXDictionary)_data[ SETTINGS_KEY ])[ COMPILER_FLAGS_KEY ] = ( string.Join( " ", flags ) + " " + flag );
return true;
// 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)
}
示例13: PBXVariantGroup
public PBXVariantGroup(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
示例14: PBXContainerItemProxy
public PBXContainerItemProxy(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
示例15: PBXReferenceProxy
public PBXReferenceProxy(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}