protected void ReadRegularProperty(string curLine) { Match m = PBXRegex.KeyValue.Match(curLine.Trim()); string key = m.Groups[1].Value.Trim(); m_Properties[key] = PBXStream.UnquoteString(m.Groups[2].Value.Trim()); }
protected override void ReadFromSectionImpl(string curLine, TextReader sr) { Match m = PBXRegex.AnyKeyValue.Match(curLine.Trim()); text = m.Groups[2].Value; m = PBXRegex.FileRef.Match(curLine); name = path = PBXStream.UnquoteString(m.Groups[2].Value.Trim()); if (PBXRegex.FileRefName.IsMatch(curLine)) { name = PBXStream.UnquoteString(PBXRegex.FileRefName.Match(curLine).Groups[1].Value); } }
public void Read(string curLine, TextReader sr) { val.Clear(); if (PBXRegex.ListHeader.IsMatch(curLine)) { Match m = PBXRegex.ListHeader.Match(curLine); name = PBXStream.UnquoteString(m.Groups[1].Value); PBXStream.ReadLinesUntilConditionIsMet(sr, val, s => ExtractValue(s), s => s.Trim() == ");"); } else { Match m = PBXRegex.KeyValue.Match(curLine); name = PBXStream.UnquoteString(m.Groups[1].Value); AddValue(PBXStream.UnquoteString(m.Groups[2].Value)); } }
public void ReadFromStream(TextReader sr) { Clear(); PBXStream.ReadLinesWithConditionForLastLine(sr, m_Header, s => s.Trim() == "objects = {"); string line = PBXStream.ReadSkippingEmptyLines(sr); string prevSectionName = null; while (PBXRegex.BeginSection.IsMatch(line)) { string sectName = PBXRegex.BeginSection.Match(line).Groups[1].Value; // Duplicate sections (which should never appear) will be simply read again. if (m_Section.ContainsKey(sectName)) { m_Section[sectName].ReadSection(line, sr); } else { SectionBase sect = new TextSection(); sect.ReadSection(line, sr); m_Section.Add(sectName, sect); } // if the section is unknown, save its position relative to other sections if (!m_SectionOrder.Contains(sectName)) { int pos = 0; if (prevSectionName != null) { pos = m_SectionOrder.FindIndex(x => x == prevSectionName); // this never fails pos += 1; } m_SectionOrder.Insert(pos, sectName); } line = PBXStream.ReadSkippingEmptyLines(sr); } m_Footer.Add(line); PBXStream.ReadLinesFromFile(sr, m_Footer); RefreshAuxMaps(); }
public static PBXFileReference CreateFromFile(string path, string projectFileName, PBXSourceTree tree) { string guid = PBXGUID.Generate(); PBXFileReference fileRef = new PBXFileReference(); fileRef.guid = guid; fileRef.path = path; fileRef.name = projectFileName; fileRef.tree = tree; 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); }
public void Write(TextWriter sw, GUIDToCommentMap comments) { if (val.Count == 0) { return; } else if (val.Count == 1) { sw.WriteLine(String.Format("\t\t\t\t{0} = {1};", PBXStream.QuoteStringIfNeeded(name), PBXStream.QuoteStringIfNeeded(val[0]))); } else { sw.WriteLine(String.Format("\t\t\t\t{0} = (", PBXStream.QuoteStringIfNeeded(name))); foreach (string s in val) { sw.WriteLine(String.Format("\t\t\t\t\t{0},", PBXStream.QuoteStringIfNeeded(s))); } sw.WriteLine("\t\t\t\t);"); } }
public override void ReadSection(string curLine, TextReader sr) { if (!PBXRegex.BeginSection.IsMatch(curLine)) { throw new Exception("Can't read section"); } if (PBXRegex.BeginSection.Match(curLine).Groups[1].Value != m_Name) { throw new Exception("Wrong section"); } curLine = PBXStream.ReadSkippingEmptyLines(sr); while (!PBXRegex.EndSection.IsMatch(curLine)) { T obj = new T(); obj.ReadFromSection(curLine, sr); entry[obj.guid] = obj; curLine = sr.ReadLine(); } }
public override void ReadSection(string curLine, TextReader sr) { text.Add(curLine); PBXStream.ReadLinesWithConditionForLastLine(sr, text, s => PBXRegex.EndSection.IsMatch(s)); }
public static string ExtractValue(string src) { return(PBXStream.UnquoteString(src.Trim().TrimEnd(','))); }
protected void WriteRegularProperty(string prop, TextWriter sw) { sw.WriteLine("\t\t\t{0} = {1};", prop, PBXStream.QuoteStringIfNeeded(m_Properties[prop])); }