UnityEditor.XCodeEditor.XCProject.GetObject C# (CSharp) Method

GetObject() public method

public GetObject ( string guid ) : object
guid string
return object
        public object GetObject( string guid )
        {
            return _objects[guid];
        }

Usage Example

コード例 #1
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();
                                }
                            }
                        }
                    }
                }
            }
        }