public override void AddObject(string key, PBXElementDict value) { T obj = new T(); obj.guid = key; obj.SetPropertiesWhenSerializing(value); obj.UpdateVars(); m_Entries[obj.guid] = obj; }
public override void UpdateProps() { SetPropertyString("fileRef", fileRef); PBXElementDict settings = null; if (m_Properties.Contains("settings")) { settings = m_Properties["settings"].AsDict(); } if (compileFlags != null && compileFlags != "") { if (settings == null) { settings = m_Properties.CreateDict("settings"); } settings.SetString("COMPILER_FLAGS", compileFlags); } else { if (settings != null) { settings.Remove("COMPILER_FLAGS"); } } settings = UpdatePropsAttribute(settings, weak, "Weak"); settings = UpdatePropsAttribute(settings, codeSignOnCopy, "CodeSignOnCopy"); settings = UpdatePropsAttribute(settings, removeHeadersOnCopy, "RemoveHeadersOnCopy"); if (assetTags.Count > 0) { if (settings == null) { settings = m_Properties.CreateDict("settings"); } var tagsArray = settings.CreateArray("ASSET_TAGS"); foreach (string tag in assetTags) { tagsArray.AddString(tag); } } else { if (settings != null) { settings.Remove("ASSET_TAGS"); } } if (settings != null && settings.values.Count == 0) { m_Properties.Remove("settings"); } }
public static PBXElementDict ParseTreeAST(TreeAST ast, TokenList tokens, string text) { var el = new PBXElementDict(); foreach (var kv in ast.values) { PBXElementString key = ParseIdentifierAST(kv.key, tokens, text); PBXElement value = ParseValueAST(kv.value, tokens, text); el[key.value] = value; } return(el); }
public string WriteToString() { GUIDToCommentMap comments1 = this.BuildCommentMap(); PropertyCommentChecker checker1 = new PropertyCommentChecker(); GUIDToCommentMap comments2 = new GUIDToCommentMap(); StringBuilder sb1 = new StringBuilder(); if (this.m_ObjectVersion != null) { sb1.AppendFormat("objectVersion = {0};\n\t", (object)this.m_ObjectVersion); } sb1.Append("objects = {"); foreach (string key in this.m_SectionOrder) { if (this.m_Section.ContainsKey(key)) { this.m_Section[key].WriteSection(sb1, comments1); } else if (this.m_UnknownSections.ContainsKey(key)) { this.m_UnknownSections[key].WriteSection(sb1, comments1); } } foreach (KeyValuePair <string, PBXElement> keyValuePair in (IEnumerable <KeyValuePair <string, PBXElement> >) this.m_UnknownObjects.values) { Serializer.WriteDictKeyValue(sb1, keyValuePair.Key, keyValuePair.Value, 2, false, checker1, comments2); } sb1.Append("\n\t};"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("// !$*UTF8*$!\n"); StringBuilder sb2 = stringBuilder; PBXElementDict el = this.m_RootElements; int indent = 0; int num = 0; string[] strArray = new string[1]; int index = 0; string str = "rootObject/*"; strArray[index] = str; PropertyCommentChecker checker2 = new PropertyCommentChecker((IEnumerable <string>)strArray); GUIDToCommentMap comments3 = comments1; Serializer.WriteDict(sb2, el, indent, num != 0, checker2, comments3); stringBuilder.Append("\n"); return(stringBuilder.ToString().Replace("objects = OBJMARKER;", sb1.ToString())); }
PBXElementDict UpdatePropsAttribute(PBXElementDict settings, bool value, string attributeName) { PBXElementArray attrs = null; if (value) { if (settings == null) { settings = m_Properties.CreateDict("settings"); } } if (settings != null && settings.Contains("ATTRIBUTES")) { attrs = settings["ATTRIBUTES"].AsArray(); } if (value) { if (attrs == null) { attrs = settings.CreateArray("ATTRIBUTES"); } bool exists = attrs.values.Any(attr => { return(attr is PBXElementString && attr.AsString() == attributeName); }); if (!exists) { attrs.AddString(attributeName); } } else { if (attrs != null) { attrs.values.RemoveAll(el => (el is PBXElementString && el.AsString() == attributeName)); if (attrs.values.Count == 0) { settings.Remove("ATTRIBUTES"); } } } return(settings); }
/* * Allows the setting of target attributes in the project section such as Provisioning Style and Team ID for each target * * The Target Attributes are structured like so: * attributes = { * TargetAttributes = { * 1D6058900D05DD3D006BFB54 = { * DevelopmentTeam = Z6SFPV59E3; * ProvisioningStyle = Manual; * }; * 5623C57217FDCB0800090B9E = { * DevelopmentTeam = Z6SFPV59E3; * ProvisioningStyle = Manual; * TestTargetID = 1D6058900D05DD3D006BFB54; * }; * }; * }; */ internal void SetTargetAttributes(string key, string value) { PBXElementDict properties = project.project.GetPropertiesRaw(); PBXElementDict attributes; PBXElementDict targetAttributes; if (properties.Contains("attributes")) { attributes = properties["attributes"] as PBXElementDict; } else { attributes = properties.CreateDict("attributes"); } if (attributes.Contains("TargetAttributes")) { targetAttributes = attributes["TargetAttributes"] as PBXElementDict; } else { targetAttributes = attributes.CreateDict("TargetAttributes"); } foreach (KeyValuePair <string, PBXNativeTargetData> target in nativeTargets.GetEntries()) { PBXElementDict targetAttributesRaw; if (targetAttributes.Contains(target.Key)) { targetAttributesRaw = targetAttributes[target.Key].AsDict(); } else { targetAttributesRaw = targetAttributes.CreateDict(target.Key); } targetAttributesRaw.SetString(key, value); } project.project.UpdateVars(); }
internal void SetTargetAttributes(string key, string value) { PBXElementDict dict2; PBXElementDict dict3; PBXElementDict propertiesRaw = this.project.project.GetPropertiesRaw(); if (propertiesRaw.Contains("attributes")) { dict2 = propertiesRaw["attributes"] as PBXElementDict; } else { dict2 = propertiesRaw.CreateDict("attributes"); } if (dict2.Contains("TargetAttributes")) { dict3 = dict2["TargetAttributes"] as PBXElementDict; } else { dict3 = dict2.CreateDict("TargetAttributes"); } foreach (KeyValuePair <string, PBXNativeTargetData> pair in this.nativeTargets.GetEntries()) { PBXElementDict dict4; if (dict3.Contains(pair.Key)) { dict4 = dict3[pair.Key].AsDict(); } else { dict4 = dict3.CreateDict(pair.Key); } dict4.SetString(key, value); } this.project.project.UpdateVars(); }
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"); buildConfigLists = 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", buildConfigLists }, { "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>(); }
public void ReadFromStream(TextReader sr) { Clear(); m_RootElements = ParseContent(sr.ReadToEnd()); if (!m_RootElements.Contains("objects")) { throw new Exception("Invalid PBX project file: no objects element"); } var objects = m_RootElements["objects"].AsDict(); m_RootElements.Remove("objects"); m_RootElements.SetString("objects", "OBJMARKER"); if (m_RootElements.Contains("objectVersion")) { m_ObjectVersion = m_RootElements["objectVersion"].AsString(); m_RootElements.Remove("objectVersion"); } var allGuids = new List <string>(); string prevSectionName = null; foreach (var kv in objects.values) { allGuids.Add(kv.Key); var el = kv.Value; if (!(el is PBXElementDict) || !el.AsDict().Contains("isa")) { m_UnknownObjects.values.Add(kv.Key, el); continue; } var dict = el.AsDict(); var sectionName = dict["isa"].AsString(); if (m_Section.ContainsKey(sectionName)) { var section = m_Section[sectionName]; section.AddObject(kv.Key, dict); } else { UnknownSection section; if (m_UnknownSections.ContainsKey(sectionName)) { section = m_UnknownSections[sectionName]; } else { section = new UnknownSection(sectionName); m_UnknownSections.Add(sectionName, section); } section.AddObject(kv.Key, dict); // update section order if (!m_SectionOrder.Contains(sectionName)) { int pos = 0; if (prevSectionName != null) { // this never fails, because we already added any previous unknown sections // to m_SectionOrder pos = m_SectionOrder.FindIndex(x => x == prevSectionName); pos += 1; } m_SectionOrder.Insert(pos, sectionName); } } prevSectionName = sectionName; } RepairStructure(allGuids); RefreshAuxMaps(); }
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>(); }
public abstract void AddObject(string key, PBXElementDict value);
public override void UpdateVars() { projectReferences = new List <ProjectReference>(); if (m_Properties.Contains("projectReferences")) { var el = m_Properties["projectReferences"].AsArray(); foreach (var value in el.values) { PBXElementDict dict = value.AsDict(); if (dict.Contains("ProductGroup") && dict.Contains("ProjectRef")) { string group = dict["ProductGroup"].AsString(); string projectRef = dict["ProjectRef"].AsString(); projectReferences.Add(ProjectReference.Create(group, projectRef)); } } } targets = GetPropertyList("targets"); buildConfigList = GetPropertyString("buildConfigurationList"); // update knownAssetTags knownAssetTags = new List <string>(); if (m_Properties.Contains("attributes")) { var el = m_Properties["attributes"].AsDict(); if (el.Contains("knownAssetTags")) { var tags = el["knownAssetTags"].AsArray(); foreach (var tag in tags.values) { knownAssetTags.Add(tag.AsString()); } } capabilities = new List <PBXCapabilityType.TargetCapabilityPair>(); teamIDs = new Dictionary <string, string>(); if (el.Contains("TargetAttributes")) { var targetAttr = el["TargetAttributes"].AsDict(); foreach (var target in targetAttr.values) { foreach (var attr in target.Value.AsDict().values) { if (attr.Key == "DevelopmentTeam") { teamIDs.Add(attr.Key, attr.Value.AsString()); } if (attr.Key == "SystemCapabilities") { //var caps = el["SystemCapabilities"].AsDict(); foreach (var cap in attr.Value.AsDict().values) { var capab = PBXCapabilityType.StringToPBXCapabilityType(cap.Key); var capabValue = cap.Value.AsDict(); bool isEnabled = false; if (capabValue.Contains("enabled")) { string enabledString = capabValue.values["enabled"].AsString(); isEnabled = string.IsNullOrEmpty(enabledString) ? false : enabledString.Equals("1"); } capabilities.Add(new PBXCapabilityType.TargetCapabilityPair(attr.Key, capab, isEnabled)); } } } } } } }
internal void SetPropertiesWhenSerializing(PBXElementDict props) { m_Properties = props; }
public PBXElementDict CreateDict(string key) { var v = new PBXElementDict(); values[key] = v; return v; }
public PBXElementDict AddDict() { var v = new PBXElementDict(); values.Add(v); return v; }
public void ReadFromStream(TextReader sr) { this.Clear(); this.m_RootElements = PBXProjectData.ParseContent(sr.ReadToEnd()); if (!this.m_RootElements.Contains("objects")) { throw new Exception("Invalid PBX project file: no objects element"); } PBXElementDict pbxElementDict1 = this.m_RootElements["objects"].AsDict(); this.m_RootElements.Remove("objects"); this.m_RootElements.SetString("objects", "OBJMARKER"); if (this.m_RootElements.Contains("objectVersion")) { this.m_ObjectVersion = this.m_RootElements["objectVersion"].AsString(); this.m_RootElements.Remove("objectVersion"); } List <string> allGuids = new List <string>(); // ISSUE: reference to a compiler-generated field string prevSectionName = null; foreach (KeyValuePair <string, PBXElement> keyValuePair in (IEnumerable <KeyValuePair <string, PBXElement> >)pbxElementDict1.values) { allGuids.Add(keyValuePair.Key); PBXElement pbxElement = keyValuePair.Value; if (!(pbxElement is PBXElementDict) || !pbxElement.AsDict().Contains("isa")) { this.m_UnknownObjects.values.Add(keyValuePair.Key, pbxElement); } else { PBXElementDict pbxElementDict2 = pbxElement.AsDict(); string index1 = pbxElementDict2["isa"].AsString(); if (this.m_Section.ContainsKey(index1)) { this.m_Section[index1].AddObject(keyValuePair.Key, pbxElementDict2); } else { KnownSectionBase <PBXObjectData> knownSectionBase; if (this.m_UnknownSections.ContainsKey(index1)) { knownSectionBase = this.m_UnknownSections[index1]; } else { knownSectionBase = new KnownSectionBase <PBXObjectData>(index1); this.m_UnknownSections.Add(index1, knownSectionBase); } knownSectionBase.AddObject(keyValuePair.Key, pbxElementDict2); if (!this.m_SectionOrder.Contains(index1)) { int pos = 0; if (prevSectionName != null) { // this never fails, because we already added any previous unknown sections // to m_SectionOrder pos = m_SectionOrder.FindIndex(x => x == prevSectionName); pos += 1; } m_SectionOrder.Insert(pos, index1); } } // ISSUE: reference to a compiler-generated field prevSectionName = index1; } } this.RepairStructure(allGuids); this.RefreshAuxMaps(); }
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>(); }
public void ReadFromStream(TextReader sr) { this.Clear(); this.m_RootElements = PBXProjectData.ParseContent(sr.ReadToEnd()); if (!this.m_RootElements.Contains("objects")) { throw new Exception("Invalid PBX project file: no objects element"); } PBXElementDict pbxElementDict1 = this.m_RootElements["objects"].AsDict(); this.m_RootElements.Remove("objects"); this.m_RootElements.SetString("objects", "OBJMARKER"); if (this.m_RootElements.Contains("objectVersion")) { this.m_ObjectVersion = this.m_RootElements["objectVersion"].AsString(); this.m_RootElements.Remove("objectVersion"); } List <string> allGuids = new List <string>(); string prevSectionName = (string)null; foreach (KeyValuePair <string, PBXElement> keyValuePair in (IEnumerable <KeyValuePair <string, PBXElement> >)pbxElementDict1.values) { allGuids.Add(keyValuePair.Key); PBXElement pbxElement = keyValuePair.Value; if (!(pbxElement is PBXElementDict) || !pbxElement.AsDict().Contains("isa")) { this.m_UnknownObjects.values.Add(keyValuePair.Key, pbxElement); } else { PBXElementDict pbxElementDict2 = pbxElement.AsDict(); string index1 = pbxElementDict2["isa"].AsString(); if (this.m_Section.ContainsKey(index1)) { this.m_Section[index1].AddObject(keyValuePair.Key, pbxElementDict2); } else { KnownSectionBase <PBXObjectData> knownSectionBase; if (this.m_UnknownSections.ContainsKey(index1)) { knownSectionBase = this.m_UnknownSections[index1]; } else { knownSectionBase = new KnownSectionBase <PBXObjectData>(index1); this.m_UnknownSections.Add(index1, knownSectionBase); } knownSectionBase.AddObject(keyValuePair.Key, pbxElementDict2); if (!this.m_SectionOrder.Contains(index1)) { int index2 = 0; if (prevSectionName != null) { index2 = this.m_SectionOrder.FindIndex((Predicate <string>)(x => x == prevSectionName)) + 1; } this.m_SectionOrder.Insert(index2, index1); } } prevSectionName = index1; } } this.RepairStructure(allGuids); this.RefreshAuxMaps(); }