public bool AddOtherCFlags( string flag )
 {
     //Debug.Log( "INIZIO 1" );
     PBXList flags = new PBXList();
     flags.Add( flag );
     return AddOtherCFlags( flags );
 }
        public bool AddOtherCFlags( PBXList flags )
        {
            //Debug.Log( "INIZIO 2" );

            bool modified = false;

            if( !ContainsKey( BUILDSETTINGS_KEY ) )
                this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );

            foreach( string flag in flags ) {

                if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( OTHER_C_FLAGS_KEY ) ) {
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( OTHER_C_FLAGS_KEY, new PBXList() );
                }
                else if ( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_C_FLAGS_KEY ] is string ) {
                    string tempString = (string)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY];
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_C_FLAGS_KEY ] = new PBXList();
                    ((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Add( tempString );
                }

                if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Contains( flag ) ) {
                    ((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_C_FLAGS_KEY]).Add( flag );
                    modified = true;
                }
            }

            return modified;
        }
Beispiel #3
0
        public static void SortGUIDIntoGroup(IIgorModule ModuleInst, string ProjectPath, string FileGUID, string GroupPath)
        {
            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if (IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    bool bFoundGroup = false;

                    foreach (KeyValuePair <string, PBXGroup> CurrentGroup in CurrentProject.groups)
                    {
                        if (CurrentGroup.Value.path == GroupPath)
                        {
                            if (IgorAssert.EnsureTrue(ModuleInst, CurrentGroup.Value.ContainsKey("children"), "XCodeProj PBXGroup " + GroupPath + " doesn't have a children array."))
                            {
                                object GroupChildrenObj = CurrentGroup.Value.data["children"];

                                if (IgorAssert.EnsureTrue(ModuleInst, GroupChildrenObj != null, "XCodeProj PBXGroup " + GroupPath + " has a children key, but it can't be retrieved."))
                                {
                                    if (IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(GroupChildrenObj.GetType()), "XCodeProj PBXGroup " + GroupPath + " has a children key, but it can't be cast to PBXList."))
                                    {
                                        PBXList GroupChildrenList = (PBXList)GroupChildrenObj;

                                        if (IgorAssert.EnsureTrue(ModuleInst, GroupChildrenList != null, "XCodeProj casted Children List is null."))
                                        {
                                            if (GroupChildrenList.Contains(FileGUID))
                                            {
                                                IgorDebug.Log(ModuleInst, "FileGUID " + FileGUID + " has already been added to the Group " + CurrentGroup.Key + ".");
                                            }
                                            else
                                            {
                                                GroupChildrenList.Add(FileGUID);

                                                CurrentGroup.Value.data["children"] = GroupChildrenList;

                                                IgorDebug.Log(ModuleInst, "Added the " + FileGUID + " file to the Group " + CurrentGroup.Key + ".");
                                            }
                                        }
                                    }
                                }

                                bFoundGroup = true;

                                break;
                            }
                        }
                    }

                    IgorAssert.EnsureTrue(ModuleInst, bFoundGroup, "Couldn't find a PBXGroup with path " + GroupPath + " in the XCodeProj.");

                    CurrentProject.Save();
                }
            }
        }
Beispiel #4
0
        public bool SetWeakLink(bool weak = false)
        {
            PBXDictionary settings   = null;
            PBXList       attributes = null;

            if (!_data.ContainsKey(SETTINGS_KEY))
            {
                if (weak)
                {
                    attributes = new PBXList();
                    attributes.Add(WEAK_VALUE);

                    settings = new PBXDictionary();
                    settings.Add(ATTRIBUTES_KEY, attributes);

                    _data.Add(SETTINGS_KEY, settings);
                }
                return(true);
            }

            settings = _data[SETTINGS_KEY] as PBXDictionary;
            if (!settings.ContainsKey(ATTRIBUTES_KEY))
            {
                if (weak)
                {
                    attributes = new PBXList();
                    attributes.Add(WEAK_VALUE);
                    settings.Add(ATTRIBUTES_KEY, attributes);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                attributes = settings[ATTRIBUTES_KEY] as PBXList;
            }

            if (weak)
            {
                attributes.Add(WEAK_VALUE);
            }
            else
            {
                attributes.Remove(WEAK_VALUE);
            }

            settings.Add(ATTRIBUTES_KEY, attributes);
            this.Add(SETTINGS_KEY, settings);

            return(true);
        }
Beispiel #5
0
    // Because of Xcode's file format, a single item in a list is often represented simply as a
    // string, not a PBXList.  This function ensures that the value is read as a list
    private static List <string> SafeToStringList(object stringOrPBXList)
    {
        var retVal = new List <string>();

        if (stringOrPBXList is PBXList)
        {
            PBXList pbxList = (PBXList)stringOrPBXList;
            retVal.AddRange(pbxList.Cast <string>());
        }
        else if (stringOrPBXList is string)
        {
            retVal.Add((string)stringOrPBXList);
        }
        return(retVal);
    }
		public bool SetWeakLink( bool weak = false )
		{
			PBXDictionary settings = null;
			PBXList attributes = null;

			_data.Remove(SETTINGS_KEY);
			
			if( !_data.ContainsKey( SETTINGS_KEY ) ) {
				if( weak ) {
					attributes = new PBXList();
					attributes.Add( WEAK_VALUE );
					
					settings = new PBXDictionary();
					settings.Add( ATTRIBUTES_KEY, attributes );

					_data.Add( SETTINGS_KEY, settings );
				}
				return true;
			}
			
			settings = _data[ SETTINGS_KEY ] as PBXDictionary;
			if( !settings.ContainsKey( ATTRIBUTES_KEY ) ) {
				if( weak ) {
					attributes = new PBXList();
					attributes.Add( WEAK_VALUE );
					settings.Add( ATTRIBUTES_KEY, attributes );
					return true;
				}
				else {
					return false;
				}
			}
			else {
				attributes = settings[ ATTRIBUTES_KEY ] as PBXList;
			}
			
			if( weak ) {
				attributes.Add( WEAK_VALUE );
			}
			else {
				attributes.Remove( WEAK_VALUE );
			}
			
			settings.Add( ATTRIBUTES_KEY, attributes );
			this.Add( SETTINGS_KEY, settings );
			
			return true;
		}
        //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;
        }
		protected bool AddSearchPaths( PBXList paths, string key, bool recursive = true, bool quoted = false ) //we want no quoting whenever we can get away with it
		{	
			//Debug.Log ("AddSearchPaths " + paths + key + (recursive?" recursive":"") + " " + (quoted?" quoted":""));
			bool modified = false;
			
			if( !ContainsKey( BUILDSETTINGS_KEY ) )
				this.Add( BUILDSETTINGS_KEY, new PBXSortedDictionary() );
			
			foreach( string path in paths ) {
				string currentPath = path;
				//Debug.Log ("path " + currentPath);
				if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( key ) ) {
					((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( key, new PBXList() );
				}
				else if( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] is string ) {
					PBXList list = new PBXList();
					list.Add( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] );
					((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] = list;
				}
				
				//Xcode uses space as the delimiter here, so if there's a space in the filename, we *must* quote. Escaping with slash may work when you are in the Xcode UI, in some situations, but it doesn't work here.
				if (currentPath.Contains(@" ")) quoted = true;
				
				if (quoted) {
					//if it ends in "/**", it wants to be recursive, and the "/**" needs to be _outside_ the quotes
					if (currentPath.EndsWith("/**")) {
						currentPath = "\\\"" + currentPath.Replace("/**", "\\\"/**");
					} else {
						currentPath = "\\\"" + currentPath + "\\\"";
					}
				}
				//Debug.Log ("currentPath = " + currentPath);
				if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Contains( currentPath ) ) {
					((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Add( currentPath );
					modified = true;
				}
			}
		
			return modified;
		}
        protected bool AddSearchPaths(PBXList paths, string key, bool recursive = true)
        {
            bool modified = false;

            if (!ContainsKey(BUILDSETTINGS_KEY))
            {
                this.Add(BUILDSETTINGS_KEY, new PBXDictionary());
            }

            foreach (string path in paths)
            {
                string currentPath = path;
                if (recursive && !path.EndsWith("/**"))
                {
                    currentPath += "/**";
                }

                if (!((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey(key))
                {
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add(key, new PBXList());
                }
                else if (((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] is string)
                {
                    PBXList list = new PBXList();
                    list.Add(((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]);
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] = list;
                }

                currentPath = "\\\"" + currentPath + "\\\"";

                if (!((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Contains(currentPath))
                {
                    ((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Add(currentPath);
                    modified = true;
                }
            }

            return(modified);
        }
 private PBXList ParseArray()
 {
     PBXList list = new PBXList();
     bool complete = false;
     while( !complete ) {
         switch( NextToken() ) {
             case END_OF_FILE:
                 Debug.Log( "Error: Reached end of file inside a list: " + list );
                 complete = true;
                 break;
             case ARRAY_END_TOKEN:
                 complete = true;
                 break;
             case ARRAY_ITEM_DELIMITER_TOKEN:
                 break;
             default:
                 StepBackward();
                 list.Add( ParseValue() );
                 break;
         }
     }
     return list;
 }
Beispiel #11
0
        //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);
        }
 public bool AddFrameworkSearchPaths(PBXList paths, bool recursive = true)
 {
     return this.AddSearchPaths(paths, FRAMEWORK_SEARCH_PATHS_KEY, recursive);
 }
        protected bool AddSearchPaths( PBXList paths, string key, bool recursive = true )
        {
            bool modified = false;

            if( !ContainsKey( BUILDSETTINGS_KEY ) )
                this.Add( BUILDSETTINGS_KEY, new PBXDictionary() );

            foreach( string path in paths ) {
                string currentPath = path;
                if( recursive && !path.EndsWith( "/**" ) )
                    currentPath += "/**";

            //				Debug.Log( "adding: " + currentPath );
                if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( key ) ) {
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( key, new PBXList() );
                }
                else if( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] is string ) {
                    PBXList list = new PBXList();
                    list.Add( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] );
                    ((PBXDictionary)_data[BUILDSETTINGS_KEY])[key] = list;
                }

                currentPath = "\\\"" + currentPath + "\\\"";

                if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Contains( currentPath ) ) {
                    ((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[key]).Add( currentPath );
                    modified = true;
                }
            }

            return modified;
        }
 protected bool AddSearchPaths( string path, string key, bool recursive = true )
 {
     PBXList paths = new PBXList();
     paths.Add( path );
     return AddSearchPaths( paths, key, recursive );
 }
		public bool AddOtherLinkerFlags( PBXList flags )
		{
			foreach( KeyValuePair<string, XCBuildConfiguration> buildConfig in buildConfigurations ) {
				buildConfig.Value.AddOtherLinkerFlags( flags );
			}
			modified = true;
			return modified;	
		}
 public bool AddFrameworkSearchPaths(PBXList paths, bool recursive = true)
 {
     return(this.AddSearchPaths(paths, FRAMEWORK_SEARCH_PATHS_KEY, recursive));
 }
 public bool AddLibrarySearchPaths(PBXList paths, bool recursive = true)
 {
     return(this.AddSearchPaths(paths, LIBRARY_SEARCH_PATHS_KEY, recursive));
 }
		public bool AddLibrarySearchPaths( PBXList paths )
		{
			Debug.Log ("AddLibrarySearchPaths " + paths);
			foreach( KeyValuePair<string, XCBuildConfiguration> buildConfig in buildConfigurations ) {
				buildConfig.Value.AddLibrarySearchPaths( paths );
			}
			modified = true;
			return modified;
		}
Beispiel #19
0
        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();
                                }
                            }
                        }
                    }
                }
            }
        }
		public bool overwriteBuildSetting(string settingName, string settingValue) {
			Debug.Log ("overwriteBuildSetting " + settingName + " " + settingValue);
			bool modified = false;
			
			if( !ContainsKey( BUILDSETTINGS_KEY ) ) {
				Debug.Log ("creating key " + BUILDSETTINGS_KEY);
				this.Add( BUILDSETTINGS_KEY, new PBXSortedDictionary() );
			}
				
			if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( settingName ) ) {
				Debug.Log("adding key " + settingName);
				 ((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( settingName, new PBXList() );
			}
			else if ( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ settingName ] is string ) {
				//Debug.Log("key is string:" + settingName);
				//string tempString = (string)((PBXDictionary)_data[BUILDSETTINGS_KEY])[settingName];
				((PBXDictionary)_data[BUILDSETTINGS_KEY])[ settingName ] = new PBXList();
				//((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[settingName]).Add( tempString );
			}
			
			if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[settingName]).Contains( settingValue ) ) {
				Debug.Log("setting " + settingName + " to " + settingValue);
				((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[settingName]).Add( settingValue );
				modified = true;
				}
			
			return modified;
		}			
Beispiel #21
0
    // flattens framework search paths into the target level, to fix some incompatibilities with other plugins
    private static void FlattenFrameworks(XCProject project)
    {
        var allFrameworkSearchPaths = new HashSet <string>();

        // collect & remove search paths from the project level
        {
            var projectBuildConfigListId = project.project.data["buildConfigurationList"] as string;
            var buildConfigurations      = GetBuildConfigurations(project, projectBuildConfigListId);

            foreach (var xcBuildConfig in buildConfigurations)
            {
                // collect all unique search paths
                if (xcBuildConfig.buildSettings.ContainsKey("FRAMEWORK_SEARCH_PATHS"))
                {
                    var frameworkSearchPaths = xcBuildConfig.buildSettings["FRAMEWORK_SEARCH_PATHS"];
                    foreach (var searchPath in SafeToStringList(frameworkSearchPaths))
                    {
                        allFrameworkSearchPaths.Add(searchPath);
                    }

                    // remove from project level, all items will be moved to target level
                    xcBuildConfig.buildSettings.Remove("FRAMEWORK_SEARCH_PATHS");
                }
            }
        }

        // collect framework search paths from target level
        foreach (var target in project.nativeTargets.Values)
        {
            var configurationListId = target.data["buildConfigurationList"] as string;
            var buildConfigurations = GetBuildConfigurations(project, configurationListId);

            foreach (var xcBuildConfig in buildConfigurations)
            {
                // collect all unique search paths
                if (xcBuildConfig.buildSettings.ContainsKey("FRAMEWORK_SEARCH_PATHS"))
                {
                    var frameworkSearchPaths = xcBuildConfig.buildSettings["FRAMEWORK_SEARCH_PATHS"];
                    foreach (var searchPath in SafeToStringList(frameworkSearchPaths))
                    {
                        allFrameworkSearchPaths.Add(searchPath);
                    }

                    // remove, we'll build a new list to add later
                    xcBuildConfig.buildSettings.Remove("FRAMEWORK_SEARCH_PATHS");
                }
            }
        }

        // the double quoted ""$(inherited)"" causes all sorts of issues, remove it
        allFrameworkSearchPaths.Remove("\"\\\"$(inherited)\\\"\"");

        // rebuild framework search paths for the target level
        var finalFrameworkSearchPaths = new PBXList();

        foreach (var searchPath in allFrameworkSearchPaths)
        {
            finalFrameworkSearchPaths.Add(searchPath);
        }

        // set FRAMEWORK_SEARCH_PATHS for each native target
        foreach (var target in project.nativeTargets.Values)
        {
            var configurationListId = target.data["buildConfigurationList"] as string;
            var buildConfigurations = GetBuildConfigurations(project, configurationListId);

            foreach (var xcBuildConfig in buildConfigurations)
            {
                xcBuildConfig.buildSettings.Add("FRAMEWORK_SEARCH_PATHS", finalFrameworkSearchPaths);
            }
        }
    }
		public bool AddOtherLinkerFlags( string flag )
		{
			PBXList flags = new PBXList();
			flags.Add( flag );
			return AddOtherLinkerFlags( flags );
		}
Beispiel #23
0
        public static void AddFramework(IIgorModule ModuleInst, string ProjectPath, string Filename, TreeEnum TreeBase, string Path = "", int FileEncoding = -1, string LastKnownFileType = "", string Name = "")
        {
            string FrameworkFileRefGUID = AddNewFileReference(ModuleInst, ProjectPath, Filename, TreeBase, Path, FileEncoding, LastKnownFileType, Name);

            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if (IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    bool bFoundFrameworksGroup = false;

                    foreach (KeyValuePair <string, PBXGroup> CurrentGroup in CurrentProject.groups)
                    {
                        if (CurrentGroup.Value.name == "Frameworks")
                        {
                            if (IgorAssert.EnsureTrue(ModuleInst, CurrentGroup.Value.ContainsKey("children"), "XCodeProj Frameworks PBXGroup doesn't have a children array."))
                            {
                                object FrameworkChildrenObj = CurrentGroup.Value.data["children"];

                                if (IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenObj != null, "XCodeProj Frameworks PBXGroup has a children key, but it can't be retrieved."))
                                {
                                    if (IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkChildrenObj.GetType()), "XCodeProj Frameworks PBXGroup has a children key, but it can't be cast to PBXList."))
                                    {
                                        PBXList FrameworkChildrenList = (PBXList)FrameworkChildrenObj;

                                        if (IgorAssert.EnsureTrue(ModuleInst, FrameworkChildrenList != null, "XCodeProj casted Framework Children List is null."))
                                        {
                                            if (FrameworkChildrenList.Contains(FrameworkFileRefGUID))
                                            {
                                                IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                            else
                                            {
                                                FrameworkChildrenList.Add(FrameworkFileRefGUID);

                                                CurrentGroup.Value.data["children"] = FrameworkChildrenList;

                                                IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Group " + CurrentGroup.Key + ".");
                                            }
                                        }
                                    }
                                }

                                bFoundFrameworksGroup = true;

                                break;
                            }
                        }
                    }

                    IgorAssert.EnsureTrue(ModuleInst, bFoundFrameworksGroup, "Couldn't find a Frameworks PBXGroup in the XCodeProj.");

                    CurrentProject.Save();
                }
            }

            string FrameworkBuildFileGUID = AddNewBuildFile(ModuleInst, ProjectPath, FrameworkFileRefGUID);

            if (IgorAssert.EnsureTrue(ModuleInst, Directory.Exists(ProjectPath), "XCodeProj doesn't exist at path " + ProjectPath))
            {
                XCProject CurrentProject = new XCProject(ProjectPath);

                CurrentProject.Backup();

                if (IgorAssert.EnsureTrue(ModuleInst, CurrentProject != null, "XCodeProj couldn't be loaded."))
                {
                    foreach (KeyValuePair <string, PBXFrameworksBuildPhase> CurrentTarget in CurrentProject.frameworkBuildPhases)
                    {
                        if (IgorAssert.EnsureTrue(ModuleInst, CurrentTarget.Value.ContainsKey("files"), "XCodeProj Framework Build Phase doesn't have a files array."))
                        {
                            object FrameworkFilesObj = CurrentTarget.Value.data["files"];

                            if (IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesObj != null, "XCodeProj Framework Build Phase has a files key, but it can't be retrieved."))
                            {
                                if (IgorAssert.EnsureTrue(ModuleInst, typeof(PBXList).IsAssignableFrom(FrameworkFilesObj.GetType()), "XCodeProj Framework Build Phase has a files key, but it can't be cast to PBXList."))
                                {
                                    PBXList FrameworkFilesList = (PBXList)FrameworkFilesObj;

                                    if (IgorAssert.EnsureTrue(ModuleInst, FrameworkFilesList != null, "XCodeProj casted Framework File List is null."))
                                    {
                                        if (FrameworkFilesList.Contains(FrameworkBuildFileGUID))
                                        {
                                            IgorDebug.Log(ModuleInst, "Framework " + Filename + " has already been added to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                        else
                                        {
                                            FrameworkFilesList.Add(FrameworkBuildFileGUID);

                                            CurrentTarget.Value.data["files"] = FrameworkFilesList;

                                            IgorDebug.Log(ModuleInst, "Added the " + Filename + " framework to the Framework Build Phase " + CurrentTarget.Key + ".");
                                        }
                                    }
                                }
                            }
                        }
                    }

                    CurrentProject.Save();
                }
            }
        }
 public bool AddHeaderSearchPaths( PBXList paths, bool recursive = true )
 {
     return this.AddSearchPaths( paths, HEADER_SEARCH_PATHS_KEY, recursive );
 }
 public bool AddHeaderSearchPaths(PBXList paths, bool recursive = true)
 {
     return(this.AddSearchPaths(paths, HEADER_SEARCH_PATHS_KEY, recursive));
 }
 public bool AddLibrarySearchPaths( PBXList paths, bool recursive = true )
 {
     return this.AddSearchPaths( paths, LIBRARY_SEARCH_PATHS_KEY, recursive );
 }
		public bool AddFrameworkSearchPaths( PBXList paths )
		{
			foreach( KeyValuePair<string, XCBuildConfiguration> buildConfig in buildConfigurations ) {
				buildConfig.Value.AddFrameworkSearchPaths( paths );
			}
			modified = true;
			return modified;
		}
		public bool AddOtherLinkerFlags( PBXList flags )
		{
			bool modified = false;

			if( !ContainsKey( BUILDSETTINGS_KEY ) )
				this.Add( BUILDSETTINGS_KEY, new PBXSortedDictionary() );

			foreach( string flag in flags ) {
				
				if( !((PBXDictionary)_data[BUILDSETTINGS_KEY]).ContainsKey( OTHER_LDFLAGS_KEY ) ) {
					((PBXDictionary)_data[BUILDSETTINGS_KEY]).Add( OTHER_LDFLAGS_KEY, new PBXList() );
				}
				else if ( ((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_LDFLAGS_KEY ] is string ) {
					string tempString = (string)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LDFLAGS_KEY];
					((PBXDictionary)_data[BUILDSETTINGS_KEY])[ OTHER_LDFLAGS_KEY ] = new PBXList();
					if( !string.IsNullOrEmpty(tempString) ) {
						((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LDFLAGS_KEY]).Add( tempString );
					}
				}
				
				if( !((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LDFLAGS_KEY]).Contains( flag ) ) {
					((PBXList)((PBXDictionary)_data[BUILDSETTINGS_KEY])[OTHER_LDFLAGS_KEY]).Add( flag );
					modified = true;
				}
			}

			return modified;
		}
 public bool AddHeaderSearchPaths( PBXList paths )
 {
     foreach( KeyValuePair<string, XCBuildConfiguration> buildConfig in buildConfigurations ) {
     //				Debug.Log( "ADDING HEADER PATH: " + paths + " to " + buildConfig.Key );
         buildConfig.Value.AddHeaderSearchPaths( paths );
     }
     modified = true;
     return modified;
 }