当前位置: 首页>>代码示例>>C#>>正文


C# PBXDictionary.Add方法代码示例

本文整理汇总了C#中PBXDictionary.Add方法的典型用法代码示例。如果您正苦于以下问题:C# PBXDictionary.Add方法的具体用法?C# PBXDictionary.Add怎么用?C# PBXDictionary.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PBXDictionary的用法示例。


在下文中一共展示了PBXDictionary.Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: 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

示例3: Consolidate

 public void Consolidate()
 {
     PBXDictionary consolidated = new PBXDictionary();
     consolidated.Append<PBXBuildFile>( this.buildFiles );
     consolidated.Append<PBXCopyFilesBuildPhase>( this.copyBuildPhases );
     consolidated.Append<PBXFileReference>( this.fileReferences );
     consolidated.Append<PBXFrameworksBuildPhase>( this.frameworkBuildPhases );
     consolidated.Append<PBXGroup>( this.groups );
     consolidated.Append<PBXNativeTarget>( this.nativeTargets );
     consolidated.Add( project.guid, project.data );
     consolidated.Append<PBXResourcesBuildPhase>( this.resourcesBuildPhases );
     consolidated.Append<PBXShellScriptBuildPhase>( this.shellScriptBuildPhases );
     consolidated.Append<PBXSourcesBuildPhase>( this.sourcesBuildPhases );
     consolidated.Append<XCBuildConfiguration>( this.buildConfigurations );
     consolidated.Append<XCConfigurationList>( this.configurationLists );
     _objects = consolidated;
     consolidated = null;
 }
开发者ID:nsdevaraj,项目名称:UnityIOS,代码行数:18,代码来源:XCProject.cs

示例4: 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

示例5: Save

        /// <summary>
        /// Saves a project after editing.
        /// </summary>
        public void Save()
        {
            PBXDictionary result = new PBXDictionary();
            result.internalNewlines = true;
            result.Add( "archiveVersion", 1 );
            result.Add( "classes", new PBXDictionary() );
            result.Add( "objectVersion", 46 );

            Consolidate();
            result.Add( "objects", _objects );

            result.Add( "rootObject", _rootObjectKey );

            Backup();

            PBXParser parser = new PBXParser();
            StreamWriter saveFile = File.CreateText( System.IO.Path.Combine( this.filePath, "project.pbxproj" ) );
            saveFile.Write( parser.Encode( result ) );
            saveFile.Close();
        }
开发者ID:BoyanKatsarski,项目名称:KnightsUnity,代码行数:23,代码来源:SPXCProject.cs

示例6: 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

示例7: AddFile

//		public PBXDictionary<PBXBuildPhase> GetBuildPhase( string buildPhase )
//		{
//			switch( buildPhase ) {
//				case "PBXFrameworksBuildPhase":
//					return (PBXDictionary<PBXBuildPhase>)frameworkBuildPhases;
//				case "PBXResourcesBuildPhase":
//					return (PBXDictionary<PBXBuildPhase>)resourcesBuildPhases;
//				case "PBXShellScriptBuildPhase":
//					return (PBXDictionary<PBXBuildPhase>)shellScriptBuildPhases;
//				case "PBXSourcesBuildPhase":
//					return (PBXDictionary<PBXBuildPhase>)sourcesBuildPhases;
//				case "PBXCopyFilesBuildPhase":
//					return (PBXDictionary<PBXBuildPhase>)copyBuildPhases;
//				default:
//					return default(T);
//			}
//		}
		
		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;
//				Debug.Log( "Is rooted: " + absPath );
			}
			else if( tree.CompareTo( "SDKROOT" ) != 0) {
				absPath = Path.Combine( Application.dataPath.Replace("Assets", ""), filePath );
//				Debug.Log( "RElative: " + absPath );
			}
			
			if( !( File.Exists( absPath ) || Directory.Exists( absPath ) ) && tree.CompareTo( "SDKROOT" ) != 0 ) {
				Debug.Log( "Missing file: " + absPath + " > " + filePath );
				return results;
			}
			else if( tree.CompareTo( "SOURCE_ROOT" ) == 0 || tree.CompareTo( "GROUP" ) == 0 ) {
				System.Uri fileURI = new System.Uri( absPath );
				System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
				filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
			}
//			else {
//				tree = "<absolute>";
//				Debug.Log( "3: " + filePath );
//			}
//			Debug.Log( "Add file result path: " + filePath );
			
			if( parent == null ) {
				parent = _rootGroup;
			}
			
			// TODO: Aggiungere controllo se file già presente
			PBXFileReference fileReference = GetFile( System.IO.Path.GetFileName( filePath ) );	
			if( fileReference != null ) {
//				Debug.Log( "File già presente." );
				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 ) {
//				PBXDictionary<PBXBuildPhase> currentPhase = GetBuildPhase( fileReference.buildPhase );
				PBXBuildFile buildFile;
				switch( fileReference.buildPhase ) {
					case "PBXFrameworksBuildPhase":
						foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases ) {
							buildFile = new PBXBuildFile( fileReference, weak );
							buildFiles.Add( buildFile );
							currentObject.Value.AddBuildFile( buildFile );
						}

						if ( !string.IsNullOrEmpty( absPath ) && File.Exists(absPath) && tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
							//Debug.LogError(absPath);
							string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
							this.AddLibrarySearchPaths( new PBXList(libraryPath) );
						}
						else if (!string.IsNullOrEmpty( absPath ) && Directory.Exists(absPath) && absPath.EndsWith(".framework") && tree.CompareTo("GROUP") == 0) { // Annt: Add framework search path for FacebookSDK
							string frameworkPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
							this.AddFrameworkSearchPaths(new PBXList(frameworkPath));
						}
						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":
//.........这里部分代码省略.........
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:101,代码来源:XCProject.cs

示例8: 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", 45 );
			
			Consolidate();
			result.Add( "objects", _objects );
			
			result.Add( "rootObject", _rootObjectKey );
			
			Backup();
			
			// Parse result object directly into file
			PBXParser parser = new PBXParser();
			StreamWriter saveFile = File.CreateText( System.IO.Path.Combine( this.filePath, "project.pbxproj" ) );
			saveFile.Write( parser.Encode( result, false ) );
			saveFile.Close();

//			Xcode4Controller.Connect();
//			Xcode4Controller.OpenProject(filePath);
		}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:26,代码来源:XCProject.cs

示例9: ParseDictionary

        //        private T Convert<T>( PBXDictionary dictionary )
        //        {
        //            if( dictionary.ContainsKey( "isa" ) ){
        ////				((string)dictionary["isa"]).CompareTo(
        //                Type targetType = Type.GetType( (string)dictionary["isa"] );
        //                if( targetType.IsSubclassOf( typeof(PBXObject) ) ) {
        //                    Debug.Log( "ok" );
        //                    T converted = (T)Activator.CreateInstance( targetType );
        //                    return converted;
        //                }
        //                else {
        //                    Debug.Log( "Warning: unknown PBX type: " + targetType.Name );
        //                    return default(T);
        //                }
        //                
        //            }
        //            return default(T);
        //            
        //        }
        private PBXDictionary ParseDictionary()
        {
            SkipWhitespaces();
            PBXDictionary dictionary = new PBXDictionary();
            string keyString = string.Empty;
            object valueObject = null;

            bool complete = false;
            while( !complete ) {
                switch( NextToken() ) {
                    case END_OF_FILE:
                        Debug.Log( "Error: reached end of file inside a dictionary: " + index );
                        complete = true;
                        break;

                    case DICTIONARY_ITEM_DELIMITER_TOKEN:
                        keyString = string.Empty;
                        valueObject = null;
                        break;

                    case DICTIONARY_END_TOKEN:
                        keyString = string.Empty;
                        valueObject = null;
                        complete = true;
                        break;

                    case DICTIONARY_ASSIGN_TOKEN:
                        valueObject = ParseValue();
                        dictionary.Add( keyString, valueObject );
                        break;

                    default:
                        StepBackward();
                        keyString = ParseValue() as string;
                        break;
                }
            }
            return dictionary;
        }
开发者ID:robterrell,项目名称:XcodeEditor,代码行数:58,代码来源:PBXParser.cs

示例10: Consolidate

    public void Consolidate()
    {
        PBXDictionary consolidated = new PBXDictionary();
        consolidated.internalNewlines = true;
        consolidated.Append<PBXBuildFile>(this.buildFiles);
        consolidated.Append<PBXContainerItemProxy>(this.containerItemProxies);
        consolidated.Append<PBXCopyFilesBuildPhase>(this.copyBuildPhases);
        consolidated.Append<PBXFileReference>(this.fileReferences);
        consolidated.Append<PBXFrameworksBuildPhase>(this.frameworkBuildPhases);
        consolidated.Append<PBXGroup>(this.groups);
        consolidated.Append<PBXNativeTarget>(this.nativeTargets);
        consolidated.Append<PBXReferenceProxy>(this.referenceProxies);
        consolidated.Add(project.guid, project.data);
        consolidated.Append<PBXResourcesBuildPhase>(this.resourcesBuildPhases);
        consolidated.Append<PBXShellScriptBuildPhase>(this.shellScriptBuildPhases);
        consolidated.Append<PBXSourcesBuildPhase>(this.sourcesBuildPhases);
        consolidated.Append<PBXTargetDependency>(this.targetDependencies);
        consolidated.Append<PBXVariantGroup>(this.variantGroups);
        consolidated.Append<XCBuildConfiguration>(this.buildConfigurations);
        consolidated.Append<XCConfigurationList>(this.configurationLists);

        _objects = consolidated;
        consolidated = null;
    }
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:24,代码来源:XCProject.cs

示例11: 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 (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
        PBXFileReference fileReference = GetFile(System.IO.Path.GetFileName(filePath));
        if (fileReference != null)
        {
            return null;
        }

        fileReference = new PBXFileReference(filePath, (TreeEnum) System.Enum.Parse(typeof(TreeEnum), tree));
        parent.AddChild(fileReference);
        fileReferences.Add(fileReference);
        results.Add(fileReference.guid, fileReference);

        // Find test target
        PBXNativeTarget nativeTestTarget = null;
        foreach (KeyValuePair<string, PBXNativeTarget> currentObject in nativeTargets)
        {
            PBXNativeTarget nativeTargetObj = currentObject.Value;

            if (nativeTargetObj != null && nativeTargetObj.data.ContainsKey("name"))
            {
                string name = (string) nativeTargetObj.data["name"];

                if (name != null && name.Contains("Unity-iPhone Tests"))
                {
                    nativeTestTarget = nativeTargetObj;
                    break;
                }
            }
        }

        //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)
                {
                    if (nativeTestTarget == null || !nativeTestTarget.HasBuildphase(currentObject.Key.Split(' ')[0]))
                    {
                        buildFile = new PBXBuildFile(fileReference, weak);
                        buildFiles.Add(buildFile);
                        currentObject.Value.AddBuildFile(buildFile);
                    }
                }
                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)
                {
                    if (nativeTestTarget == null || !nativeTestTarget.HasBuildphase(currentObject.Key.Split(' ')[0]))
                    {
                        buildFile = new PBXBuildFile(fileReference, weak);
                        buildFiles.Add(buildFile);
                        currentObject.Value.AddBuildFile(buildFile);
                    }
                }
                break;
            case "PBXShellScriptBuildPhase":
                foreach (KeyValuePair<string, PBXShellScriptBuildPhase> currentObject in shellScriptBuildPhases)
                {
                    if (nativeTestTarget == null || !nativeTestTarget.HasBuildphase(currentObject.Key.Split(' ')[0]))
                    {
                        buildFile = new PBXBuildFile(fileReference, weak);
                        buildFiles.Add(buildFile);
                        currentObject.Value.AddBuildFile(buildFile);
                    }
                }
                break;
//.........这里部分代码省略.........
开发者ID:jose-castillo,项目名称:SoundPuzzle,代码行数:101,代码来源:XCProject.cs

示例12: AddFile

		public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tree = "SOURCE_ROOT", bool createBuildFiles = true, bool weak = false, string compilerFlags = null)
		{
			//Debug.Log("AddFile " + filePath + ", " + parent + ", " + tree + ", " + (createBuildFiles? "TRUE":"FALSE") + ", " + (weak? "TRUE":"FALSE") ); 
			
			PBXDictionary results = new PBXDictionary();
			if (filePath == null) {
				Debug.LogError ("AddFile called with null filePath");
				return results;
			}

			string absPath = string.Empty;
			
			if( Path.IsPathRooted( filePath ) ) {
				Debug.Log( "Path is Rooted" );
				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 ) {
				Debug.Log( "Source Root File" );
				System.Uri fileURI = new System.Uri( absPath );
				System.Uri rootURI = new System.Uri( ( projectRootPath + "/." ) );
				filePath = rootURI.MakeRelativeUri( fileURI ).ToString();
			}
			else if( tree.CompareTo("GROUP") == 0) {
				Debug.Log( "Group File" );
				filePath = Path.GetFileName( filePath );
			}

			if( parent == null ) {
				parent = _rootGroup;
			}
			
			//Check if there is already a file
			PBXFileReference fileReference = GetFile( Path.GetFileName( filePath ) );	
			if( fileReference != null ) 
			{
				//Updating internal data with this call.
				fileReference.GuessFileType();	
			}
			else
			{
				fileReference = new PBXFileReference( filePath, (TreeEnum)System.Enum.Parse( typeof(TreeEnum), tree ) );
			}

			// Adding compiler flag
			if (!string.IsNullOrEmpty(compilerFlags))
			{
				fileReference.compilerFlags	= compilerFlags;
			}

			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 ) {
							Debug.Log( "Adding Resources Build File" );
							BuildAddFile(fileReference,currentObject,weak);
						}
						break;
					case "PBXShellScriptBuildPhase":
						foreach( KeyValuePair<string, PBXShellScriptBuildPhase> currentObject in shellScriptBuildPhases ) {
							Debug.Log( "Adding Script Build File" );
							BuildAddFile(fileReference,currentObject,weak);
						}
						break;
					case "PBXSourcesBuildPhase":
						foreach( KeyValuePair<string, PBXSourcesBuildPhase> currentObject in sourcesBuildPhases ) {
							Debug.Log( "Adding Source Build File" );
							BuildAddFile(fileReference,currentObject,weak);
						}
						break;
					case "PBXCopyFilesBuildPhase":
						foreach( KeyValuePair<string, PBXCopyFilesBuildPhase> currentObject in copyBuildPhases ) {
							Debug.Log( "Adding Copy Files Build Phase" );
//.........这里部分代码省略.........
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:101,代码来源:XCProject.cs

示例13: SetDevTeamID

        public static void SetDevTeamID(IIgorModule ModuleInst, string ProjectPath, string DevTeamID)
        {
            if(IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                string ProjectGUID = CurrentProject.project.guid;

                object ProjectSectionObj = CurrentProject.GetObject(ProjectGUID);

                if(IgorAssert.EnsureTrue(ModuleInst, ProjectSectionObj != null, "Can't find Project Section in XCodeProj."))
                {
                    PBXDictionary ProjectSection = (PBXDictionary)ProjectSectionObj;

                    object AttributesSectionObj = ProjectSection["attributes"];

                    if(IgorAssert.EnsureTrue(ModuleInst, AttributesSectionObj != null, "Can't find Attributes Section in Project Section."))
                    {
                        object TargetAttributesObj = ((PBXDictionary)AttributesSectionObj)["TargetAttributes"];

                        if(IgorAssert.EnsureTrue(ModuleInst, TargetAttributesObj != null, "Can't find TargetAttributes Section in Attributes Section."))
                        {
                            PBXDictionary TargetAttributes = (PBXDictionary)TargetAttributesObj;

                            object TargetsObj = ProjectSection["targets"];

                            if(IgorAssert.EnsureTrue(ModuleInst, TargetsObj != null, "Can't find Targets Section in Project Section."))
                            {
                                PBXList TargetsList = ((PBXList)TargetsObj);

                                if(IgorAssert.EnsureTrue(ModuleInst, TargetsList.Count > 0, "No build targets defined in XCodeProj."))
                                {
                                    string PrimaryBuildTargetGUID = (string)(TargetsList[0]);

                                    PBXDictionary PrimaryBuildTargetToDevTeam = new PBXDictionary();
                                    PBXDictionary DevTeamIDDictionary = new PBXDictionary();

                                    DevTeamIDDictionary.Add("DevelopmentTeam", DevTeamID);

                                    PrimaryBuildTargetToDevTeam.Add(PrimaryBuildTargetGUID, DevTeamIDDictionary);

                                    if(TargetAttributes.ContainsKey(PrimaryBuildTargetGUID))
                                    {
                                        object ExistingPrimaryBuildTargetObj = TargetAttributes[PrimaryBuildTargetGUID];

                                        if(ExistingPrimaryBuildTargetObj != null)
                                        {
                                            PBXDictionary ExistingPrimaryBuildTarget = (PBXDictionary)ExistingPrimaryBuildTargetObj;

                                            if(!ExistingPrimaryBuildTarget.ContainsKey("DevelopmentTeam"))
                                            {
                                                ExistingPrimaryBuildTarget.Append(DevTeamIDDictionary);

                                                IgorDebug.Log(ModuleInst, "Added Development Team to XCodeProj.");
                                            }
                                            else
                                            {
                                                IgorDebug.Log(ModuleInst, "Development Team already set up in XCodeProj.");
                                            }
                                        }
                                        else
                                        {
                                            IgorDebug.LogError(ModuleInst, "Primary build target already has a key in TargetAttributes, but the value stored is invalid.");
                                        }
                                    }
                                    else
                                    {
                                        TargetAttributes.Append(PrimaryBuildTargetToDevTeam);

                                        IgorDebug.Log(ModuleInst, "Added Development Team to XCodeProj.");
                                    }

                                    CurrentProject.Save();
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:RagtagShawn,项目名称:Igor,代码行数:82,代码来源:IgorXCodeProjUtils.cs

示例14: 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.Replace("Assets", ""), filePath );
			}
			
			if( !( File.Exists( absPath ) || Directory.Exists( absPath ) ) && tree.CompareTo( "SDKROOT" ) != 0 ) {
				Debug.Log( "Missing file: " + absPath + " > " + filePath );
				return results;
			}
			else if( tree.CompareTo( "SOURCE_ROOT" ) == 0 || tree.CompareTo( "GROUP" ) == 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
			PBXFileReference fileReference = GetFile( System.IO.Path.GetFileName( filePath ) );	
			if( fileReference != null ) {
				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 ) {
				PBXBuildFile buildFile;
				switch( fileReference.buildPhase ) {
					case "PBXFrameworksBuildPhase":
						foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases ) {
							buildFile = new PBXBuildFile( fileReference, weak );
							buildFiles.Add( buildFile );
							currentObject.Value.AddBuildFile( buildFile );
						}

						if ( !string.IsNullOrEmpty( absPath ) && File.Exists(absPath) && tree.CompareTo( "SOURCE_ROOT" ) == 0 ) {
							//Debug.LogError(absPath);
							string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
							this.AddLibrarySearchPaths( new PBXList(libraryPath) );
						}
						else if (!string.IsNullOrEmpty( absPath ) && Directory.Exists(absPath) && absPath.EndsWith(".framework") && tree.CompareTo("GROUP") == 0) { // Annt: Add framework search path for FacebookSDK
							string frameworkPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
							this.AddFrameworkSearchPaths(new PBXList(frameworkPath));
						}
						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 );
							buildFiles.Add( buildFile );
							currentObject.Value.AddBuildFile( buildFile );
						}
						break;
					case "PBXCopyFilesBuildPhase":
						foreach( KeyValuePair<string, PBXCopyFilesBuildPhase> currentObject in copyBuildPhases ) {
							buildFile = new PBXBuildFile( fileReference, weak );
							buildFiles.Add( buildFile );
							currentObject.Value.AddBuildFile( buildFile );
						}
						break;
					case null:
						Debug.LogWarning( "fase non supportata null" );
						break;
					default:
						Debug.LogWarning( "fase non supportata def" );
						return null;
				}
			}
			
			return results;
		}
开发者ID:ashishsfb,项目名称:Save-The-Kitty,代码行数:97,代码来源:XCProject.cs


注:本文中的PBXDictionary.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。