本文整理汇总了C#中PBXDictionary类的典型用法代码示例。如果您正苦于以下问题:C# PBXDictionary类的具体用法?C# PBXDictionary怎么用?C# PBXDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PBXDictionary类属于命名空间,在下文中一共展示了PBXDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:60,代码来源:XCProject.cs
示例2: PBXObject
public PBXObject()
{
_data = new PBXDictionary();
_data[ISA_KEY] = this.GetType().Name;
_guid = GenerateGuid();
internalNewlines = false;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:7,代码来源:PBXObject.cs
示例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 );
}
开发者ID:ashishsfb,项目名称:Save-The-Kitty,代码行数:7,代码来源:PBXParser.cs
示例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;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:29,代码来源:PBXBuildFile.cs
示例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);
}
}
}
开发者ID:DefyGames,项目名称:FyberUnityDemo,代码行数:32,代码来源:FyberPBXBuildFile.cs
示例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;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:59,代码来源:PBXBuildFile.cs
示例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;
}
}
开发者ID:ashishsfb,项目名称:Save-The-Kitty,代码行数:9,代码来源:PBXObject.cs
示例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);
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:9,代码来源:PBXParser.cs
示例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;
}
}
开发者ID:gmosdk,项目名称:unity,代码行数:56,代码来源:XCProject.cs
示例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;
}
开发者ID:ChenKaiJung,项目名称:XCodeEditor-for-Unity,代码行数:20,代码来源:PBXBuildFile.cs
示例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;
}
开发者ID:ashishsfb,项目名称:Save-The-Kitty,代码行数:19,代码来源:PBXBuildFile.cs
示例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)
}
开发者ID:npnf-inc,项目名称:game-funny-studio,代码行数:39,代码来源:CPBXBuildFile.cs
示例13: PBXVariantGroup
public PBXVariantGroup(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:4,代码来源:PBXObject.cs
示例14: PBXContainerItemProxy
public PBXContainerItemProxy(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:4,代码来源:PBXObject.cs
示例15: PBXReferenceProxy
public PBXReferenceProxy(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:4,代码来源:PBXObject.cs
示例16: PBXNativeTarget
public PBXNativeTarget(string guid, PBXDictionary dictionary) : base(guid, dictionary)
{
internalNewlines = true;
}
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:4,代码来源:PBXObject.cs
示例17: AddFile
public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tree = "SOURCE_ROOT", bool createBuildFiles = true, bool weak = false, string[] compilerFlags = null )
{
PBXDictionary results = new PBXDictionary();
string absPath = string.Empty;
if( Path.IsPathRooted( filePath ) ) {
absPath = filePath;
}
else if( tree.CompareTo( "SDKROOT" ) != 0) {
absPath = Path.Combine( Application.dataPath, filePath );
}
if( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
System.Uri fileURI = new System.Uri( absPath );
System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
}
if( parent == null ) {
parent = _rootGroup;
}
// TODO: Aggiungere controllo se file già presente
String filename = System.IO.Path.GetFileName (filePath);
if (filename.Contains("+")) {
filename = string.Format ("\"{0}\"", filename);
}
PBXFileReference fileReference = GetFile(filename);
if (fileReference != null) {
//Weak references always taks precedence over strong reference
if (weak) {
PBXBuildFile buildFile = GetBuildFile(fileReference.guid);
if(buildFile != null) {
buildFile.SetWeakLink(weak);
}
}
// Dear future me: If they ever invent a time machine, please don't come back in time to hunt me down.
// From Unity 5, AdSupport is loaded dinamically, meaning that there will be a reference to the
// file in the project and it won't add it to the linking libraries. And we need that.
// TODO: The correct solution would be to check inside each phase if that file is already present.
if (filename.Contains("AdSupport.framework")) {
if (string.IsNullOrEmpty(fileReference.buildPhase)) {
fileReference.buildPhase = "PBXFrameworksBuildPhase";
}
} else {
return null;
}
}
if (fileReference == null) {
fileReference = new PBXFileReference (filePath, (TreeEnum)System.Enum.Parse (typeof(TreeEnum), tree));
parent.AddChild (fileReference);
fileReferences.Add (fileReference);
results.Add (fileReference.guid, fileReference);
}
//Create a build file for reference
if( !string.IsNullOrEmpty( fileReference.buildPhase ) && createBuildFiles ) {
PBXBuildFile buildFile;
switch( fileReference.buildPhase ) {
case "PBXFrameworksBuildPhase":
foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases ) {
PBXBuildFile newBuildFile = GetBuildFile(fileReference.guid);
if (newBuildFile == null){
newBuildFile = new PBXBuildFile( fileReference, weak );
buildFiles.Add( newBuildFile );
}
if (currentObject.Value.HasBuildFile(newBuildFile.guid)) {
continue;
}
currentObject.Value.AddBuildFile( newBuildFile );
}
if ( !string.IsNullOrEmpty( absPath ) && ( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) && File.Exists( absPath ) ) {
string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
this.AddLibrarySearchPaths( new PBXList( libraryPath ) );
}
break;
case "PBXResourcesBuildPhase":
foreach( KeyValuePair<string, PBXResourcesBuildPhase> currentObject in resourcesBuildPhases ) {
buildFile = new PBXBuildFile( fileReference, weak );
buildFiles.Add( buildFile );
currentObject.Value.AddBuildFile( buildFile );
}
break;
case "PBXShellScriptBuildPhase":
foreach( KeyValuePair<string, PBXShellScriptBuildPhase> currentObject in shellScriptBuildPhases ) {
buildFile = new PBXBuildFile( fileReference, weak );
buildFiles.Add( buildFile );
currentObject.Value.AddBuildFile( buildFile );
}
break;
case "PBXSourcesBuildPhase":
foreach( KeyValuePair<string, PBXSourcesBuildPhase> currentObject in sourcesBuildPhases ) {
buildFile = new PBXBuildFile( fileReference, weak );
foreach (string flag in compilerFlags) {
//.........这里部分代码省略.........
开发者ID:BoyanKatsarski,项目名称:KnightsUnity,代码行数:101,代码来源:SPXCProject.cs
示例18: PBXGroup
public PBXGroup( string guid, PBXDictionary dictionary )
: base(guid, dictionary)
{
}
开发者ID:gmosdk,项目名称:unity,代码行数:4,代码来源:PBXGroup.cs
示例19: Save
/// <summary>
/// Saves a project after editing.
/// </summary>
public void Save()
{
PBXDictionary result = new PBXDictionary();
result.Add( "archiveVersion", 1 );
result.Add( "classes", new PBXDictionary() );
result.Add( "objectVersion", 46 );
Consolidate();
result.Add( "objects", _objects );
result.Add( "rootObject", _rootObjectKey );
string projectPath = Path.Combine( this.filePath, "project.pbxproj" );
// Delete old project file, in case of an IOException 'Sharing violation on path Error'
DeleteExisting(projectPath);
// Parse result object directly into file
CreateNewProject(result,projectPath);
}
开发者ID:nsdevaraj,项目名称:UnityIOS,代码行数:23,代码来源:XCProject.cs
示例20: AddFile
public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tree = "SOURCE_ROOT", bool createBuildFiles = true, bool weak = false )
{
PBXDictionary results = new PBXDictionary();
string absPath = string.Empty;
if( Path.IsPathRooted( filePath ) ) {
absPath = filePath;
}
else if( tree.CompareTo( "SDKROOT" ) != 0) {
absPath = Path.Combine( Application.dataPath, filePath );
}
if( !( File.Exists( absPath ) || Directory.Exists( absPath ) ) && tree.CompareTo( "SDKROOT" ) != 0 ) {
Debug.Log( "Missing file: " + filePath );
return results;
}
else if( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
System.Uri fileURI = new System.Uri( absPath );
System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
}
if( parent == null ) {
parent = _rootGroup;
}
//Check if there is already a file
PBXFileReference fileReference = GetFile( System.IO.Path.GetFileName( filePath ) );
if( fileReference != null ) {
Debug.LogWarning("File is already exists: " + filePath);
return null;
}
fileReference = new PBXFileReference( filePath, (TreeEnum)System.Enum.Parse( typeof(TreeEnum), tree ) );
parent.AddChild( fileReference );
fileReferences.Add( fileReference );
results.Add( fileReference.guid, fileReference );
//Create a build file for reference
if( !string.IsNullOrEmpty( fileReference.buildPhase ) && createBuildFiles ) {
switch( fileReference.buildPhase ) {
case "PBXFrameworksBuildPhase":
foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
if ( !string.IsNullOrEmpty( absPath ) && ( tree.CompareTo( "SOURCE_ROOT" ) == 0 )) {
string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
if (File.Exists(absPath)) {
this.AddLibrarySearchPaths( new PBXList( libraryPath ) );
} else {
this.AddFrameworkSearchPaths( new PBXList( libraryPath ) );
}
}
break;
case "PBXResourcesBuildPhase":
foreach( KeyValuePair<string, PBXResourcesBuildPhase> currentObject in resourcesBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
break;
case "PBXShellScriptBuildPhase":
foreach( KeyValuePair<string, PBXShellScriptBuildPhase> currentObject in shellScriptBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
break;
case "PBXSourcesBuildPhase":
foreach( KeyValuePair<string, PBXSourcesBuildPhase> currentObject in sourcesBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
break;
case "PBXCopyFilesBuildPhase":
foreach( KeyValuePair<string, PBXCopyFilesBuildPhase> currentObject in copyBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
break;
case null:
Debug.LogWarning( "File Not Support: " + filePath );
break;
default:
Debug.LogWarning( "File Not Support." );
return null;
}
}
return results;
}
开发者ID:nsdevaraj,项目名称:UnityIOS,代码行数:86,代码来源:XCProject.cs
注:本文中的PBXDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论