Esempio n. 1
0
        private void AddBuildFileImpl(string targetGuid, string fileGuid, bool weak, string compileFlags)
        {
            PBXNativeTargetData  target = this.nativeTargets[targetGuid];
            PBXFileReferenceData data2  = this.FileRefsGet(fileGuid);
            string extension            = Path.GetExtension(data2.path);

            if (FileTypeUtils.IsBuildable(extension, data2.isFolderReference) && (this.BuildFilesGetForSourceFile(targetGuid, fileGuid) == null))
            {
                PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(fileGuid, weak, compileFlags);
                this.BuildFilesAdd(targetGuid, buildFile);
                this.BuildSectionAny(target, extension, data2.isFolderReference).files.AddGUID(buildFile.guid);
            }
        }
Esempio n. 2
0
 public string FindFileGuidByRealPath(string path)
 {
     path = PBXPath.FixSlashes(path);
     foreach (PBXSourceTree tree in FileTypeUtils.AllAbsoluteSourceTrees())
     {
         string str = this.FindFileGuidByRealPath(path, tree);
         if (str != null)
         {
             return(str);
         }
     }
     return(null);
 }
Esempio n. 3
0
        void AddBuildFileImpl(string targetGuid, string fileGuid, bool weak, string compileFlags)
        {
            PBXNativeTarget target = nativeTargets[targetGuid];
            string          ext    = Path.GetExtension(fileRefs[fileGuid].path);

            if (FileTypeUtils.IsBuildable(ext) &&
                GetBuildFileForFileRef(target, fileGuid, ext) == null)
            {
                PBXBuildFile buildFile = PBXBuildFile.CreateFromFile(fileGuid, weak, compileFlags);
                buildFiles.AddEntry(buildFile);
                BuildSection(target, ext).AddGUID(buildFile.guid);
            }
        }
Esempio n. 4
0
        public void FileRefsRemove(string guid)
        {
            PBXFileReferenceData fileReferenceData = this.fileRefs[guid];

            this.fileRefs.RemoveEntry(guid);
            this.m_ProjectPathToFileRefMap.Remove(this.m_FileRefGuidToProjectPathMap[guid]);
            this.m_FileRefGuidToProjectPathMap.Remove(guid);
            foreach (PBXSourceTree index in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                this.m_RealPathToFileRefMap[index].Remove(fileReferenceData.path);
            }
            this.m_GuidToParentGroupMap.Remove(guid);
        }
Esempio n. 5
0
        public void FileRefsRemove(string guid)
        {
            PBXFileReferenceData fileRef = fileRefs[guid];

            fileRefs.RemoveEntry(guid);
            m_ProjectPathToFileRefMap.Remove(m_FileRefGuidToProjectPathMap[guid]);
            m_FileRefGuidToProjectPathMap.Remove(guid);
            foreach (var tree in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                m_RealPathToFileRefMap[tree].Remove(fileRef.path);
            }
            m_GuidToParentGroupMap.Remove(guid);
        }
Esempio n. 6
0
        public string FindFileGuidByRealPath(string path)
        {
            path = Utils.FixSlashesInPath(path);

            foreach (var tree in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                string res = FindFileGuidByRealPath(path, tree);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
Esempio n. 7
0
        FileGUIDListBase BuildSection(PBXNativeTarget target, string path)
        {
            string ext   = Path.GetExtension(path);
            var    phase = FileTypeUtils.GetFileType(ext);

            switch (phase)
            {
            case PBXFileType.Framework:
                foreach (var guid in target.phase)
                {
                    if (frameworks.entry.ContainsKey(guid))
                    {
                        return(frameworks.entry[guid]);
                    }
                }
                break;

            case PBXFileType.Resource:
                foreach (var guid in target.phase)
                {
                    if (resources.entry.ContainsKey(guid))
                    {
                        return(resources.entry[guid]);
                    }
                }
                break;

            case PBXFileType.Source:
                foreach (var guid in target.phase)
                {
                    if (sources.entry.ContainsKey(guid))
                    {
                        return(sources.entry[guid]);
                    }
                }
                break;

            case PBXFileType.CopyFile:
                foreach (var guid in target.phase)
                {
                    if (copyFiles.entry.ContainsKey(guid))
                    {
                        return(copyFiles.entry[guid]);
                    }
                }
                break;
            }
            return(null);
        }
Esempio n. 8
0
        public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef)
        {
            string ext   = Path.GetExtension(path);
            var    phase = FileTypeUtils.GetFileType(ext, isFolderRef);

            switch (phase)
            {
            case PBXFileType.Framework:
                foreach (var guid in target.phases)
                {
                    if (frameworks.HasEntry(guid))
                    {
                        return(frameworks[guid]);
                    }
                }
                break;

            case PBXFileType.Resource:
                foreach (var guid in target.phases)
                {
                    if (resources.HasEntry(guid))
                    {
                        return(resources[guid]);
                    }
                }
                break;

            case PBXFileType.Source:
                foreach (var guid in target.phases)
                {
                    if (sources.HasEntry(guid))
                    {
                        return(sources[guid]);
                    }
                }
                break;

            case PBXFileType.CopyFile:
                foreach (var guid in target.phases)
                {
                    if (copyFiles.HasEntry(guid))
                    {
                        return(copyFiles[guid]);
                    }
                }
                break;
            }
            return(null);
        }
Esempio n. 9
0
        public void AddExternalLibraryDependency(string targetGuid, string filename, string remoteFileGuid, string projectPath, string remoteInfo)
        {
            PBXNativeTargetData target = this.nativeTargets[targetGuid];

            filename    = PBXPath.FixSlashes(filename);
            projectPath = PBXPath.FixSlashes(projectPath);
            string containerRef = this.FindFileGuidByRealPath(projectPath);

            if (containerRef == null)
            {
                throw new Exception("No such project");
            }
            string guid = null;

            foreach (ProjectReference reference in this.project.project.projectReferences)
            {
                if (reference.projectRef == containerRef)
                {
                    guid = reference.group;
                    break;
                }
            }
            if (guid == null)
            {
                throw new Exception("Malformed project: no project in project references");
            }
            PBXGroupData data2     = this.GroupsGet(guid);
            string       extension = Path.GetExtension(filename);

            if (!FileTypeUtils.IsBuildableFile(extension))
            {
                throw new Exception("Wrong file extension");
            }
            PBXContainerItemProxyData data3 = PBXContainerItemProxyData.Create(containerRef, "2", remoteFileGuid, remoteInfo);

            this.containerItems.AddEntry(data3);
            string typeName             = FileTypeUtils.GetTypeName(extension);
            PBXReferenceProxyData data4 = PBXReferenceProxyData.Create(filename, typeName, data3.guid, "BUILT_PRODUCTS_DIR");

            this.references.AddEntry(data4);
            PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(data4.guid, false, null);

            this.BuildFilesAdd(targetGuid, buildFile);
            this.BuildSectionAny(target, extension, false).files.AddGUID(buildFile.guid);
            data2.children.AddGUID(data4.guid);
        }
Esempio n. 10
0
        public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef)
        {
            switch (FileTypeUtils.GetFileType(Path.GetExtension(path), isFolderRef))
            {
            case PBXFileType.Framework:
                foreach (string str2 in (IEnumerable <string>)target.phases)
                {
                    if (this.frameworks.HasEntry(str2))
                    {
                        return(this.frameworks[str2]);
                    }
                }
                break;

            case PBXFileType.Source:
                foreach (string str4 in (IEnumerable <string>)target.phases)
                {
                    if (this.sources.HasEntry(str4))
                    {
                        return(this.sources[str4]);
                    }
                }
                break;

            case PBXFileType.Resource:
                foreach (string str3 in (IEnumerable <string>)target.phases)
                {
                    if (this.resources.HasEntry(str3))
                    {
                        return(this.resources[str3]);
                    }
                }
                break;

            case PBXFileType.CopyFile:
                foreach (string str5 in (IEnumerable <string>)target.phases)
                {
                    if (this.copyFiles.HasEntry(str5))
                    {
                        return(this.copyFiles[str5]);
                    }
                }
                break;
            }
            return(null);
        }
Esempio n. 11
0
        public static PBXFileReference CreateFromFile(string path, string projectFileName,
                                                      PBXSourceTree tree)
        {
            string guid = PBXGUID.Generate();

            var fileRef = new PBXFileReference();

            fileRef.guid = guid;

            fileRef.path = path;
            fileRef.name = projectFileName;
            fileRef.text = String.Format("{{isa = PBXFileReference; lastKnownFileType = {0}; name = {1}; path = {2}; sourceTree = {3}; }}",
                                         FileTypeUtils.GetTypeName(Path.GetExtension(fileRef.name)),
                                         PBXStream.QuoteStringIfNeeded(fileRef.name),
                                         PBXStream.QuoteStringIfNeeded(fileRef.path),
                                         PBXStream.QuoteStringIfNeeded(FileTypeUtils.SourceTreeDesc(tree)));
            return(fileRef);
        }
Esempio n. 12
0
 public static bool IsBuildable(string ext) =>
 FileTypeUtils.IsBuildableFile(ext);
Esempio n. 13
0
        /** This function must be called only after the project the library is in has
         *  been added as a dependency via AddExternalProjectDependency. projectPath must be
         *  the same as the 'path' parameter passed to the AddExternalProjectDependency.
         *  remoteFileGuid must be the guid of the referenced file as specified in
         *  PBXFileReference section of the external project
         *
         *  TODO: what. is remoteInfo entry in PBXContainerItemProxy? Is in referenced project name or
         *  referenced library name without extension?
         */
        public void AddExternalLibraryDependency(string targetGuid, string filename, string remoteFileGuid, string projectPath,
                                                 string remoteInfo)
        {
            PBXNativeTargetData target = nativeTargets[targetGuid];

            filename    = Utils.FixSlashesInPath(filename);
            projectPath = Utils.FixSlashesInPath(projectPath);

            // find the products group to put the new library in
            string projectGuid = FindFileGuidByRealPath(projectPath);

            if (projectGuid == null)
            {
                throw new Exception("No such project");
            }

            string productsGroupGuid = null;

            foreach (var proj in project.project.projectReferences)
            {
                if (proj.projectRef == projectGuid)
                {
                    productsGroupGuid = proj.group;
                    break;
                }
            }

            if (productsGroupGuid == null)
            {
                throw new Exception("Malformed project: no project in project references");
            }

            PBXGroupData productGroup = GroupsGet(productsGroupGuid);

            // verify file extension
            string ext = Path.GetExtension(filename);

            if (!FileTypeUtils.IsBuildableFile(ext))
            {
                throw new Exception("Wrong file extension");
            }

            // create ContainerItemProxy object
            var container = PBXContainerItemProxyData.Create(projectGuid, "2", remoteFileGuid, remoteInfo);

            containerItems.AddEntry(container);

            // create a reference and build file for the library
            string typeName = FileTypeUtils.GetTypeName(ext);

            var libRef = PBXReferenceProxyData.Create(filename, typeName, container.guid, "BUILT_PRODUCTS_DIR");

            references.AddEntry(libRef);
            PBXBuildFileData libBuildFile = PBXBuildFileData.CreateFromFile(libRef.guid, false, null);

            BuildFilesAdd(targetGuid, libBuildFile);
            BuildSectionAny(target, ext, false).files.AddGUID(libBuildFile.guid);

            // add to products folder
            productGroup.children.AddGUID(libRef.guid);
        }
Esempio n. 14
0
        public FileGUIDListBase BuildSectionAny(PBXNativeTargetData target, string path, bool isFolderRef)
        {
            switch (FileTypeUtils.GetFileType(Path.GetExtension(path), isFolderRef))
            {
            case PBXFileType.NotBuildable:
                return((FileGUIDListBase)null);

            case PBXFileType.Framework:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.frameworks.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.frameworks[current]);
                        }
                    }
                    break;
                }

            case PBXFileType.Source:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.sources.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.sources[current]);
                        }
                    }
                    break;
                }

            case PBXFileType.Header:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.headers.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.headers[current]);
                        }
                    }
                    break;
                }

            case PBXFileType.Resource:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.resources.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.resources[current]);
                        }
                    }
                    break;
                }

            case PBXFileType.CopyFile:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.copyFiles.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.copyFiles[current]);
                        }
                    }
                    break;
                }

            case PBXFileType.ShellScript:
                using (IEnumerator <string> enumerator = ((IEnumerable <string>)target.phases).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.Current;
                        if (this.shellScripts.HasEntry(current))
                        {
                            return((FileGUIDListBase)this.shellScripts[current]);
                        }
                    }
                    break;
                }
            }
            throw new Exception(string.Format("The given path {0} does not refer to a file in a known build section", (object)path));
        }
Esempio n. 15
0
 public static bool IsBuildable(string ext)
 {
     return(FileTypeUtils.IsBuildableFile(ext));
 }
Esempio n. 16
0
 public static bool IsKnownExtension(string ext)
 {
     return(FileTypeUtils.IsKnownExtension(ext));
 }
Esempio n. 17
0
        public void Clear()
        {
            this.buildFiles         = new KnownSectionBase <PBXBuildFileData>("PBXBuildFile");
            this.fileRefs           = new KnownSectionBase <PBXFileReferenceData>("PBXFileReference");
            this.groups             = new KnownSectionBase <PBXGroupData>("PBXGroup");
            this.containerItems     = new KnownSectionBase <PBXContainerItemProxyData>("PBXContainerItemProxy");
            this.references         = new KnownSectionBase <PBXReferenceProxyData>("PBXReferenceProxy");
            this.sources            = new KnownSectionBase <PBXSourcesBuildPhaseData>("PBXSourcesBuildPhase");
            this.headers            = new KnownSectionBase <PBXHeadersBuildPhaseData>("PBXHeadersBuildPhase");
            this.frameworks         = new KnownSectionBase <PBXFrameworksBuildPhaseData>("PBXFrameworksBuildPhase");
            this.resources          = new KnownSectionBase <PBXResourcesBuildPhaseData>("PBXResourcesBuildPhase");
            this.copyFiles          = new KnownSectionBase <PBXCopyFilesBuildPhaseData>("PBXCopyFilesBuildPhase");
            this.shellScripts       = new KnownSectionBase <PBXShellScriptBuildPhaseData>("PBXShellScriptBuildPhase");
            this.nativeTargets      = new KnownSectionBase <PBXNativeTargetData>("PBXNativeTarget");
            this.targetDependencies = new KnownSectionBase <PBXTargetDependencyData>("PBXTargetDependency");
            this.variantGroups      = new KnownSectionBase <PBXVariantGroupData>("PBXVariantGroup");
            this.buildConfigs       = new KnownSectionBase <XCBuildConfigurationData>("XCBuildConfiguration");
            this.buildConfigLists   = new KnownSectionBase <XCConfigurationListData>("XCConfigurationList");
            this.project            = new PBXProjectSection();
            this.m_UnknownSections  = new Dictionary <string, KnownSectionBase <PBXObjectData> >();
            Dictionary <string, SectionBase> dictionary = new Dictionary <string, SectionBase>();
            string key1 = "PBXBuildFile";
            KnownSectionBase <PBXBuildFileData> knownSectionBase1 = this.buildFiles;

            dictionary.Add(key1, (SectionBase)knownSectionBase1);
            string key2 = "PBXFileReference";
            KnownSectionBase <PBXFileReferenceData> knownSectionBase2 = this.fileRefs;

            dictionary.Add(key2, (SectionBase)knownSectionBase2);
            string key3 = "PBXGroup";
            KnownSectionBase <PBXGroupData> knownSectionBase3 = this.groups;

            dictionary.Add(key3, (SectionBase)knownSectionBase3);
            string key4 = "PBXContainerItemProxy";
            KnownSectionBase <PBXContainerItemProxyData> knownSectionBase4 = this.containerItems;

            dictionary.Add(key4, (SectionBase)knownSectionBase4);
            string key5 = "PBXReferenceProxy";
            KnownSectionBase <PBXReferenceProxyData> knownSectionBase5 = this.references;

            dictionary.Add(key5, (SectionBase)knownSectionBase5);
            string key6 = "PBXSourcesBuildPhase";
            KnownSectionBase <PBXSourcesBuildPhaseData> knownSectionBase6 = this.sources;

            dictionary.Add(key6, (SectionBase)knownSectionBase6);
            string key7 = "PBXHeadersBuildPhase";
            KnownSectionBase <PBXHeadersBuildPhaseData> knownSectionBase7 = this.headers;

            dictionary.Add(key7, (SectionBase)knownSectionBase7);
            string key8 = "PBXFrameworksBuildPhase";
            KnownSectionBase <PBXFrameworksBuildPhaseData> knownSectionBase8 = this.frameworks;

            dictionary.Add(key8, (SectionBase)knownSectionBase8);
            string key9 = "PBXResourcesBuildPhase";
            KnownSectionBase <PBXResourcesBuildPhaseData> knownSectionBase9 = this.resources;

            dictionary.Add(key9, (SectionBase)knownSectionBase9);
            string key10 = "PBXCopyFilesBuildPhase";
            KnownSectionBase <PBXCopyFilesBuildPhaseData> knownSectionBase10 = this.copyFiles;

            dictionary.Add(key10, (SectionBase)knownSectionBase10);
            string key11 = "PBXShellScriptBuildPhase";
            KnownSectionBase <PBXShellScriptBuildPhaseData> knownSectionBase11 = this.shellScripts;

            dictionary.Add(key11, (SectionBase)knownSectionBase11);
            string key12 = "PBXNativeTarget";
            KnownSectionBase <PBXNativeTargetData> knownSectionBase12 = this.nativeTargets;

            dictionary.Add(key12, (SectionBase)knownSectionBase12);
            string key13 = "PBXTargetDependency";
            KnownSectionBase <PBXTargetDependencyData> knownSectionBase13 = this.targetDependencies;

            dictionary.Add(key13, (SectionBase)knownSectionBase13);
            string key14 = "PBXVariantGroup";
            KnownSectionBase <PBXVariantGroupData> knownSectionBase14 = this.variantGroups;

            dictionary.Add(key14, (SectionBase)knownSectionBase14);
            string key15 = "XCBuildConfiguration";
            KnownSectionBase <XCBuildConfigurationData> knownSectionBase15 = this.buildConfigs;

            dictionary.Add(key15, (SectionBase)knownSectionBase15);
            string key16 = "XCConfigurationList";
            KnownSectionBase <XCConfigurationListData> knownSectionBase16 = this.buildConfigLists;

            dictionary.Add(key16, (SectionBase)knownSectionBase16);
            string            key17             = "PBXProject";
            PBXProjectSection pbxProjectSection = this.project;

            dictionary.Add(key17, (SectionBase)pbxProjectSection);
            this.m_Section        = dictionary;
            this.m_RootElements   = new PBXElementDict();
            this.m_UnknownObjects = new PBXElementDict();
            this.m_ObjectVersion  = (string)null;
            List <string> list = new List <string>();
            string        str1 = "PBXBuildFile";

            list.Add(str1);
            string str2 = "PBXContainerItemProxy";

            list.Add(str2);
            string str3 = "PBXCopyFilesBuildPhase";

            list.Add(str3);
            string str4 = "PBXFileReference";

            list.Add(str4);
            string str5 = "PBXFrameworksBuildPhase";

            list.Add(str5);
            string str6 = "PBXGroup";

            list.Add(str6);
            string str7 = "PBXHeadersBuildPhase";

            list.Add(str7);
            string str8 = "PBXNativeTarget";

            list.Add(str8);
            string str9 = "PBXProject";

            list.Add(str9);
            string str10 = "PBXReferenceProxy";

            list.Add(str10);
            string str11 = "PBXResourcesBuildPhase";

            list.Add(str11);
            string str12 = "PBXShellScriptBuildPhase";

            list.Add(str12);
            string str13 = "PBXSourcesBuildPhase";

            list.Add(str13);
            string str14 = "PBXTargetDependency";

            list.Add(str14);
            string str15 = "PBXVariantGroup";

            list.Add(str15);
            string str16 = "XCBuildConfiguration";

            list.Add(str16);
            string str17 = "XCConfigurationList";

            list.Add(str17);
            this.m_SectionOrder                = list;
            this.m_FileGuidToBuildFileMap      = new Dictionary <string, Dictionary <string, PBXBuildFileData> >();
            this.m_ProjectPathToFileRefMap     = new Dictionary <string, PBXFileReferenceData>();
            this.m_FileRefGuidToProjectPathMap = new Dictionary <string, string>();
            this.m_RealPathToFileRefMap        = new Dictionary <PBXSourceTree, Dictionary <string, PBXFileReferenceData> >();
            foreach (PBXSourceTree key18 in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                this.m_RealPathToFileRefMap.Add(key18, new Dictionary <string, PBXFileReferenceData>());
            }
            this.m_ProjectPathToGroupMap     = new Dictionary <string, PBXGroupData>();
            this.m_GroupGuidToProjectPathMap = new Dictionary <string, string>();
            this.m_GuidToParentGroupMap      = new Dictionary <string, PBXGroupData>();
        }
Esempio n. 18
0
        public void Clear()
        {
            this.buildFiles         = new KnownSectionBase <PBXBuildFileData>("PBXBuildFile");
            this.fileRefs           = new KnownSectionBase <PBXFileReferenceData>("PBXFileReference");
            this.groups             = new KnownSectionBase <PBXGroupData>("PBXGroup");
            this.containerItems     = new KnownSectionBase <PBXContainerItemProxyData>("PBXContainerItemProxy");
            this.references         = new KnownSectionBase <PBXReferenceProxyData>("PBXReferenceProxy");
            this.sources            = new KnownSectionBase <PBXSourcesBuildPhaseData>("PBXSourcesBuildPhase");
            this.frameworks         = new KnownSectionBase <PBXFrameworksBuildPhaseData>("PBXFrameworksBuildPhase");
            this.resources          = new KnownSectionBase <PBXResourcesBuildPhaseData>("PBXResourcesBuildPhase");
            this.copyFiles          = new KnownSectionBase <PBXCopyFilesBuildPhaseData>("PBXCopyFilesBuildPhase");
            this.shellScripts       = new KnownSectionBase <PBXShellScriptBuildPhaseData>("PBXShellScriptBuildPhase");
            this.nativeTargets      = new KnownSectionBase <PBXNativeTargetData>("PBXNativeTarget");
            this.targetDependencies = new KnownSectionBase <PBXTargetDependencyData>("PBXTargetDependency");
            this.variantGroups      = new KnownSectionBase <PBXVariantGroupData>("PBXVariantGroup");
            this.buildConfigs       = new KnownSectionBase <XCBuildConfigurationData>("XCBuildConfiguration");
            this.configs            = new KnownSectionBase <XCConfigurationListData>("XCConfigurationList");
            this.project            = new PBXProjectSection();
            this.m_UnknownSections  = new Dictionary <string, KnownSectionBase <PBXObjectData> >();
            Dictionary <string, SectionBase> dictionary = new Dictionary <string, SectionBase> {
                {
                    "PBXBuildFile",
                    this.buildFiles
                },
                {
                    "PBXFileReference",
                    this.fileRefs
                },
                {
                    "PBXGroup",
                    this.groups
                },
                {
                    "PBXContainerItemProxy",
                    this.containerItems
                },
                {
                    "PBXReferenceProxy",
                    this.references
                },
                {
                    "PBXSourcesBuildPhase",
                    this.sources
                },
                {
                    "PBXFrameworksBuildPhase",
                    this.frameworks
                },
                {
                    "PBXResourcesBuildPhase",
                    this.resources
                },
                {
                    "PBXCopyFilesBuildPhase",
                    this.copyFiles
                },
                {
                    "PBXShellScriptBuildPhase",
                    this.shellScripts
                },
                {
                    "PBXNativeTarget",
                    this.nativeTargets
                },
                {
                    "PBXTargetDependency",
                    this.targetDependencies
                },
                {
                    "PBXVariantGroup",
                    this.variantGroups
                },
                {
                    "XCBuildConfiguration",
                    this.buildConfigs
                },
                {
                    "XCConfigurationList",
                    this.configs
                },
                {
                    "PBXProject",
                    this.project
                }
            };

            this.m_Section        = dictionary;
            this.m_RootElements   = new PBXElementDict();
            this.m_UnknownObjects = new PBXElementDict();
            this.m_ObjectVersion  = null;
            List <string> list = new List <string> {
                "PBXBuildFile",
                "PBXContainerItemProxy",
                "PBXCopyFilesBuildPhase",
                "PBXFileReference",
                "PBXFrameworksBuildPhase",
                "PBXGroup",
                "PBXNativeTarget",
                "PBXProject",
                "PBXReferenceProxy",
                "PBXResourcesBuildPhase",
                "PBXShellScriptBuildPhase",
                "PBXSourcesBuildPhase",
                "PBXTargetDependency",
                "PBXVariantGroup",
                "XCBuildConfiguration",
                "XCConfigurationList"
            };

            this.m_SectionOrder                = list;
            this.m_FileGuidToBuildFileMap      = new Dictionary <string, Dictionary <string, PBXBuildFileData> >();
            this.m_ProjectPathToFileRefMap     = new Dictionary <string, PBXFileReferenceData>();
            this.m_FileRefGuidToProjectPathMap = new Dictionary <string, string>();
            this.m_RealPathToFileRefMap        = new Dictionary <PBXSourceTree, Dictionary <string, PBXFileReferenceData> >();
            foreach (PBXSourceTree tree in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                this.m_RealPathToFileRefMap.Add(tree, new Dictionary <string, PBXFileReferenceData>());
            }
            this.m_ProjectPathToGroupMap     = new Dictionary <string, PBXGroupData>();
            this.m_GroupGuidToProjectPathMap = new Dictionary <string, string>();
            this.m_GuidToParentGroupMap      = new Dictionary <string, PBXGroupData>();
        }
Esempio n. 19
0
        public void Clear()
        {
            buildFiles         = new PBXBuildFileSection("PBXBuildFile");
            fileRefs           = new PBXFileReferenceSection("PBXFileReference");
            groups             = new PBXGroupSection("PBXGroup");
            containerItems     = new PBXContainerItemProxySection("PBXContainerItemProxy");
            references         = new PBXReferenceProxySection("PBXReferenceProxy");
            sources            = new PBXSourcesBuildPhaseSection("PBXSourcesBuildPhase");
            frameworks         = new PBXFrameworksBuildPhaseSection("PBXFrameworksBuildPhase");
            resources          = new PBXResourcesBuildPhaseSection("PBXResourcesBuildPhase");
            copyFiles          = new PBXCopyFilesBuildPhaseSection("PBXCopyFilesBuildPhase");
            shellScripts       = new PBXShellScriptBuildPhaseSection("PBXShellScriptBuildPhase");
            nativeTargets      = new PBXNativeTargetSection("PBXNativeTarget");
            targetDependencies = new PBXTargetDependencySection("PBXTargetDependency");
            variantGroups      = new PBXVariantGroupSection("PBXVariantGroup");
            buildConfigs       = new XCBuildConfigurationSection("XCBuildConfiguration");
            configs            = new XCConfigurationListSection("XCConfigurationList");
            project            = new PBXProjectSection();
            m_UnknownSections  = new Dictionary <string, UnknownSection>();

            m_Section = new Dictionary <string, SectionBase>
            {
                { "PBXBuildFile", buildFiles },
                { "PBXFileReference", fileRefs },
                { "PBXGroup", groups },
                { "PBXContainerItemProxy", containerItems },
                { "PBXReferenceProxy", references },
                { "PBXSourcesBuildPhase", sources },
                { "PBXFrameworksBuildPhase", frameworks },
                { "PBXResourcesBuildPhase", resources },
                { "PBXCopyFilesBuildPhase", copyFiles },
                { "PBXShellScriptBuildPhase", shellScripts },
                { "PBXNativeTarget", nativeTargets },
                { "PBXTargetDependency", targetDependencies },
                { "PBXVariantGroup", variantGroups },
                { "XCBuildConfiguration", buildConfigs },
                { "XCConfigurationList", configs },

                { "PBXProject", project },
            };
            m_RootElements   = new PBXElementDict();
            m_UnknownObjects = new PBXElementDict();
            m_ObjectVersion  = null;
            m_SectionOrder   = new List <string> {
                "PBXBuildFile", "PBXContainerItemProxy", "PBXCopyFilesBuildPhase", "PBXFileReference",
                "PBXFrameworksBuildPhase", "PBXGroup", "PBXNativeTarget", "PBXProject", "PBXReferenceProxy",
                "PBXResourcesBuildPhase", "PBXShellScriptBuildPhase", "PBXSourcesBuildPhase", "PBXTargetDependency",
                "PBXVariantGroup", "XCBuildConfiguration", "XCConfigurationList"
            };
            m_FileGuidToBuildFileMap      = new Dictionary <string, Dictionary <string, PBXBuildFileData> >();
            m_ProjectPathToFileRefMap     = new Dictionary <string, PBXFileReferenceData>();
            m_FileRefGuidToProjectPathMap = new Dictionary <string, string>();
            m_RealPathToFileRefMap        = new Dictionary <PBXSourceTree, Dictionary <string, PBXFileReferenceData> >();
            foreach (var tree in FileTypeUtils.AllAbsoluteSourceTrees())
            {
                m_RealPathToFileRefMap.Add(tree, new Dictionary <string, PBXFileReferenceData>());
            }
            m_ProjectPathToGroupMap     = new Dictionary <string, PBXGroupData>();
            m_GroupGuidToProjectPathMap = new Dictionary <string, string>();
            m_GuidToParentGroupMap      = new Dictionary <string, PBXGroupData>();
        }
Esempio n. 20
0
 public static bool IsKnownExtension(string ext) =>
 FileTypeUtils.IsKnownExtension(ext);