Пример #1
0
        public string AddChild(PBXObject child)
        {
            if (child is PBXFileReference || child is PBXGroup)
            {
                children.Add(child.guid);
                return(child.guid);
            }

            return(null);
        }
        public string ResolveName(string guid)
        {
            if (!this.objects.ContainsKey(guid))
            {
                Debug.LogWarning(this + " ResolveName could not resolve " + guid);
                return(string.Empty);                //"UNRESOLVED GUID:" + guid;
            }

            object entity = this.objects[guid];

            if (entity is PBXBuildFile)
            {
                return(ResolveName(((PBXBuildFile)entity).fileRef));
            }
            else if (entity is PBXFileReference)
            {
                PBXFileReference casted = (PBXFileReference)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXGroup)
            {
                PBXGroup casted = (PBXGroup)entity;
                return(casted.name != null ? casted.name : casted.path);
            }
            else if (entity is PBXProject || guid == this.rootObject)
            {
                return("Project object");
            }
            else if (entity is PBXFrameworksBuildPhase)
            {
                return("Frameworks");
            }
            else if (entity is PBXResourcesBuildPhase)
            {
                return("Resources");
            }
            else if (entity is PBXShellScriptBuildPhase)
            {
                return("ShellScript");
            }
            else if (entity is PBXSourcesBuildPhase)
            {
                return("Sources");
            }
            else if (entity is PBXCopyFilesBuildPhase)
            {
                return("CopyFiles");
            }
            else if (entity is XCConfigurationList)
            {
                XCConfigurationList casted = (XCConfigurationList)entity;
                //Debug.LogWarning ("XCConfigurationList " + guid + " " + casted.ToString());

                if (casted.data.ContainsKey("defaultConfigurationName"))
                {
                    //Debug.Log ("XCConfigurationList " + (string)casted.data[ "defaultConfigurationName" ] + " " + guid);
                    return((string)casted.data["defaultConfigurationName"]);
                }

                return(null);
            }
            else if (entity is PBXNativeTarget)
            {
                PBXNativeTarget obj = (PBXNativeTarget)entity;
                //Debug.LogWarning ("PBXNativeTarget " + guid + " " + obj.ToString());

                if (obj.data.ContainsKey("name"))
                {
                    //Debug.Log ("PBXNativeTarget " + (string)obj.data[ "name" ] + " " + guid);
                    return((string)obj.data["name"]);
                }

                return(null);
            }
            else if (entity is XCBuildConfiguration)
            {
                XCBuildConfiguration obj = (XCBuildConfiguration)entity;
                //Debug.LogWarning ("XCBuildConfiguration UNRESOLVED GUID:" + guid + " " + (obj==null?"":obj.ToString()));

                if (obj.data.ContainsKey("name"))
                {
                    //Debug.Log ("XCBuildConfiguration " + (string)obj.data[ "name" ] + " " + guid + " " + (obj==null?"":obj.ToString()));
                    return((string)obj.data["name"]);
                }
            }
            else if (entity is PBXObject)
            {
                PBXObject obj = (PBXObject)entity;

                if (obj.data.ContainsKey("name"))
                {
                    Debug.Log("PBXObject " + (string)obj.data["name"] + " " + guid + " " + (obj == null?"":obj.ToString()));
                }
                return((string)obj.data["name"]);
            }

            //return "UNRESOLVED GUID:" + guid;
            Debug.LogWarning("UNRESOLVED GUID:" + guid);
            return(null);
        }