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"); } }
protected void SetPropertyString(string name, string value) { if (value == null) { m_Properties.Remove(name); } else { m_Properties.SetString(name, value); } }
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(); }