protected void WriteProjectAttributeListProperty(string prop, TextWriter sw, GUIDToCommentMap comments) { foreach (string line in m_AttributeLines) { sw.WriteLine(line); } }
public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine(String.Format("\t\t{0} = {{isa = PBXBuildFile; fileRef = {1}; {2}}};", CommentedGUID.Write(guid, comments), CommentedGUID.Write(fileRef, comments), postfix)); }
public void Write(TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine("\t\t\t\t{"); sw.WriteLine(String.Format("\t\t\t\t\tProductGroup = {0};", CommentedGUID.Write(group, comments))); sw.WriteLine(String.Format("\t\t\t\t\tProjectRef = {0};", CommentedGUID.Write(projectRef, comments))); sw.WriteLine("\t\t\t\t},"); }
public override void WriteSection(TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine(); foreach (string s in text) { sw.WriteLine(s); } }
protected void WriteBuildPropertiesListProperty(string prop, TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine("\t\t\tbuildSettings = {"); foreach (BuildConfigEntry e in entry.Values) { e.Write(sw, comments); } sw.WriteLine("\t\t\t};"); }
public static string Write(string guid, GUIDToCommentMap comments) { string comment = comments[guid]; if (comment == null) { return(guid); } return(String.Format("{0} /* {1} */", guid, comment)); }
public override void WriteSection(TextWriter sw, GUIDToCommentMap comments) { if (entry.Count == 0) { return; // do not write empty sections } sw.WriteLine(); sw.WriteLine(String.Format("/* Begin {0} section */", m_Name)); foreach (T obj in entry.Values) { obj.WriteToSection(sw, comments); } sw.WriteLine(String.Format("/* End {0} section */", m_Name)); }
protected void WriteProjectReferenceListProperty(string prop, TextWriter sw, GUIDToCommentMap comments) { if (projectReferences.Count == 0) { return; } sw.WriteLine("\t\t\tprojectReferences = ("); foreach (var projRef in projectReferences) { projRef.Write(sw, comments); } sw.WriteLine("\t\t\t);"); }
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);"); } }
protected void WriteCommentedGuidListProperty(string prop, TextWriter sw, GUIDToCommentMap comments) { List <string> list = m_ListProperties[prop]; bool sortCommentedGuidLists = false; if (sortCommentedGuidLists) { // useful in large projects as Xcode does not sort directory contents by default var sorted = new List <KeyValuePair <string, string> >(); foreach (string v in list) { sorted.Add(new KeyValuePair <string, string>(comments[v], v)); } sorted.Sort((a, b) => { if (a.Key != null && b.Key != null) { return(String.Compare(a.Key, b.Key, false)); } else { return(0); } }); list.Clear(); foreach (var kv in sorted) { list.Add(kv.Value); } } sw.WriteLine("\t\t\t{0} = (", prop); foreach (string v in list) { sw.WriteLine("\t\t\t\t{0},", CommentedGUID.Write(v, comments)); } sw.WriteLine("\t\t\t);"); }
public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments) { // TODO: the implementation works but is not elegant var processedProperties = new HashSet <string>(); var allProps = new List <string>(); allProps.AddRange(GetPropertyNames()); allProps.Sort(); sw.WriteLine(String.Format("\t\t{0} = {{", CommentedGUID.Write(guid, comments))); WritePropertyWrapper("isa", processedProperties, sw, comments); // always the first foreach (var prop in allProps) { WritePropertyWrapper(prop, processedProperties, sw, comments); } foreach (var line in m_BadLines) { sw.WriteLine(line); } sw.WriteLine("\t\t};"); }
private void BuildCommentMapForBuildFiles(GUIDToCommentMap comments, List <string> guids, string sectName) { foreach (var guid in guids) { var buildFile = buildFiles[guid]; if (buildFile != null) { var fileRef = fileRefs[buildFile.fileRef]; if (fileRef != null) { comments.Add(guid, String.Format("{0} in {1}", fileRef.name, sectName)); } else { var reference = references[buildFile.fileRef]; if (reference != null) { comments.Add(guid, String.Format("{0} in {1}", reference.path, sectName)); } } } } }
private GUIDToCommentMap BuildCommentMap() { GUIDToCommentMap comments = new GUIDToCommentMap(); // buildFiles are handled below // filerefs are handled below foreach (var e in groups.entry.Values) { comments.Add(e.guid, e.name); } foreach (var e in containerItems.entry.Values) { comments.Add(e.guid, "PBXContainerItemProxy"); } foreach (var e in references.entry.Values) { comments.Add(e.guid, e.path); } foreach (var e in sources.entry.Values) { comments.Add(e.guid, "Sources"); BuildCommentMapForBuildFiles(comments, e.file, "Sources"); } foreach (var e in resources.entry.Values) { comments.Add(e.guid, "Resources"); BuildCommentMapForBuildFiles(comments, e.file, "Resources"); } foreach (var e in frameworks.entry.Values) { comments.Add(e.guid, "Frameworks"); BuildCommentMapForBuildFiles(comments, e.file, "Frameworks"); } foreach (var e in copyFiles.entry.Values) { string sectName = e.name; if (sectName == null) { sectName = "CopyFiles"; } comments.Add(e.guid, sectName); BuildCommentMapForBuildFiles(comments, e.file, sectName); } foreach (var e in shellScripts.entry.Values) { comments.Add(e.guid, "ShellScript"); } foreach (var e in targetDependencies.entry.Values) { comments.Add(e.guid, "PBXTargetDependency"); } foreach (var e in nativeTargets.entry.Values) { comments.Add(e.guid, e.name); comments.Add(e.buildConfigList, String.Format("Build configuration list for PBXNativeTarget \"{0}\"", e.name)); } foreach (var e in variantGroups.entry.Values) { comments.Add(e.guid, e.name); } foreach (var e in buildConfigs.entry.Values) { comments.Add(e.guid, e.name); } foreach (var e in project.entry.Values) { comments.Add(e.guid, "Project object"); comments.Add(e.buildConfigList, "Build configuration list for PBXProject \"Unity-iPhone\""); // FIXME: project name is hardcoded } foreach (var e in fileRefs.entry.Values) { comments.Add(e.guid, e.name); } return(comments); }
protected override void WriteProperty(PropertyType propType, string prop, TextWriter sw, GUIDToCommentMap comments) { if (propType == PropertyType.Regular) { WriteRegularProperty(prop, sw); } else if (propType == PropertyType.CommentedGuid) { WriteCommentedGuidProperty(prop, sw, comments); } else if (propType == PropertyType.RegularList) { WriteRegularListProperty(prop, sw); } else if (propType == PropertyType.CommentedGuidList) { WriteCommentedGuidListProperty(prop, sw, comments); } else if (propType == PropertyType.ProjectAttributeList) { WriteProjectAttributeListProperty(prop, sw, comments); } else if (propType == PropertyType.ProjectReferenceList) { WriteProjectReferenceListProperty(prop, sw, comments); } }
protected void WriteCommentedGuidProperty(string prop, TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine("\t\t\t{0} = {1};", prop, CommentedGUID.Write(m_Properties[prop], comments)); }
public abstract void WriteSection(TextWriter sw, GUIDToCommentMap comments);
protected virtual void WriteProperty(PropertyType propType, string prop, TextWriter sw, GUIDToCommentMap comments) { if (propType == PropertyType.Regular) { WriteRegularProperty(prop, sw); } else if (propType == PropertyType.CommentedGuid) { WriteCommentedGuidProperty(prop, sw, comments); } }
public override void WriteToSection(TextWriter sw, GUIDToCommentMap comments) { sw.WriteLine(String.Format("\t\t{0} = {1};", CommentedGUID.Write(guid, comments), text)); }
protected override void WriteProperty(PropertyType propType, string prop, TextWriter sw, GUIDToCommentMap comments) { if (propType == PropertyType.Regular) { WriteRegularProperty(prop, sw); } else if (propType == PropertyType.CommentedGuid) { WriteCommentedGuidProperty(prop, sw, comments); } else if (propType == PropertyType.BuildPropertiesList) { WriteBuildPropertiesListProperty(prop, sw, comments); } }
private void WritePropertyWrapper(string prop, HashSet <string> processed, TextWriter sw, GUIDToCommentMap comments) { if (processed.Contains(prop)) { return; } if (!knownProperties.ContainsKey(prop)) { return; } WriteProperty(knownProperties[prop], prop, sw, comments); processed.Add(prop); }