public static void WriteArray(StringBuilder sb, PBXElementArray el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments)
 {
     sb.Append("(");
     foreach (PBXElement element in el.values)
     {
         if (!compact)
         {
             sb.Append("\n");
             sb.Append(GetIndent(indent + 1));
         }
         if (element is PBXElementString)
         {
             WriteStringImpl(sb, element.AsString(), checker.CheckStringValueInArray(element.AsString()), comments);
         }
         else if (element is PBXElementDict)
         {
             WriteDict(sb, element.AsDict(), indent + 1, compact, checker.NextLevel("*"), comments);
         }
         else if (element is PBXElementArray)
         {
             WriteArray(sb, element.AsArray(), indent + 1, compact, checker.NextLevel("*"), comments);
         }
         sb.Append(",");
         if (compact)
         {
             sb.Append(" ");
         }
     }
     if (!compact)
     {
         sb.Append("\n");
         sb.Append(GetIndent(indent));
     }
     sb.Append(")");
 }
Beispiel #2
0
        public static void WriteDictKeyValue(StringBuilder sb, string key, PBXElement value, int indent, bool compact,
                                             PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            WriteStringImpl(sb, key, checker.CheckKeyInDict(key), comments);
            sb.Append(" = ");

            if (value is PBXElementString)
            {
                WriteStringImpl(sb, value.AsString(), checker.CheckStringValueInDict(key, value.AsString()), comments);
            }
            else if (value is PBXElementDict)
            {
                WriteDict(sb, value.AsDict(), indent, compact, checker.NextLevel(key), comments);
            }
            else if (value is PBXElementArray)
            {
                WriteArray(sb, value.AsArray(), indent, compact, checker.NextLevel(key), comments);
            }
            sb.Append(";");
            if (compact)
            {
                sb.Append(" ");
            }
        }
Beispiel #3
0
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact,
                                     PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");

            if (el.Contains("isa"))
            {
                WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
            }
            var keys = new List <string>(el.values.Keys);

            keys.Sort(StringComparer.Ordinal);
            foreach (var key in keys)
            {
                if (key != "isa")
                {
                    WriteDictKeyValue(sb, key, el[key], indent + 1, compact, checker, comments);
                }
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append("}");
        }
Beispiel #4
0
 static void WriteStringImpl(StringBuilder sb, string s, bool comment, GUIDToCommentMap comments)
 {
     if (comment)
     {
         comments.WriteStringBuilder(sb, s);
     }
     else
     {
         sb.Append(PBXStream.QuoteStringIfNeeded(s));
     }
 }
Beispiel #5
0
 public override void WriteSection(StringBuilder sb, GUIDToCommentMap comments)
 {
     if (entries.Count == 0)
     {
         return;            // do not write empty sections
     }
     sb.AppendFormat("\n\n/* Begin {0} section */", m_Name);
     foreach (T obj in entries.Values)
     {
         obj.UpdateProps();
         sb.AppendFormat("\n\t\t{0} = ", comments.Write(obj.guid));
         Serializer.WriteDict(sb, obj.GetPropertiesWhenSerializing(), 2,
                              obj.shouldCompact, obj.checker, comments);
         sb.Append(";");
     }
     sb.AppendFormat("\n/* End {0} section */", m_Name);
 }
 public override void WriteSection(StringBuilder sb, GUIDToCommentMap comments)
 {
     if (this.m_Entries.Count != 0)
     {
         sb.AppendFormat("\n\n/* Begin {0} section */", this.m_Name);
         List <string> list = new List <string>(this.m_Entries.Keys);
         list.Sort(StringComparer.Ordinal);
         foreach (string str in list)
         {
             T local = this.m_Entries[str];
             local.UpdateProps();
             sb.Append("\n\t\t");
             comments.WriteStringBuilder(sb, local.guid);
             sb.Append(" = ");
             Serializer.WriteDict(sb, local.GetPropertiesWhenSerializing(), 2, local.shouldCompact, local.checker, comments);
             sb.Append(";");
         }
         sb.AppendFormat("\n/* End {0} section */", this.m_Name);
     }
 }
Beispiel #7
0
        public override void WriteSection(StringBuilder sb, GUIDToCommentMap comments)
        {
            if (this.m_Entries.Count == 0)
            {
                return;
            }
            sb.AppendFormat("\n\n/* Begin {0} section */", (object)this.m_Name);
            List <string> list = new List <string>((IEnumerable <string>) this.m_Entries.Keys);

            list.Sort((IComparer <string>)StringComparer.Ordinal);
            foreach (string index in list)
            {
                T obj = this.m_Entries[index];
                obj.UpdateProps();
                sb.Append("\n\t\t");
                comments.WriteStringBuilder(sb, obj.guid);
                sb.Append(" = ");
                Serializer.WriteDict(sb, obj.GetPropertiesWhenSerializing(), 2, obj.shouldCompact, obj.checker, comments);
                sb.Append(";");
            }
            sb.AppendFormat("\n/* End {0} section */", (object)this.m_Name);
        }
Beispiel #8
0
        public static void WriteArray(StringBuilder sb, PBXElementArray el, int indent, bool compact,
                                      PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("(");
            foreach (var value in el.values)
            {
                if (!compact)
                {
                    sb.Append("\n");
                    sb.Append(GetIndent(indent + 1));
                }

                if (value is PBXElementString)
                {
                    WriteStringImpl(sb, value.AsString(), checker.CheckStringValueInArray(value.AsString()), comments);
                }
                else if (value is PBXElementDict)
                {
                    WriteDict(sb, value.AsDict(), indent + 1, compact, checker.NextLevel("*"), comments);
                }
                else if (value is PBXElementArray)
                {
                    WriteArray(sb, value.AsArray(), indent + 1, compact, checker.NextLevel("*"), comments);
                }
                sb.Append(",");
                if (compact)
                {
                    sb.Append(" ");
                }
            }

            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append(")");
        }
Beispiel #9
0
        public override void WriteSection(StringBuilder sb, GUIDToCommentMap comments)
        {
            if (m_Entries.Count == 0)
            {
                return;            // do not write empty sections
            }
            sb.AppendFormat("\n\n/* Begin {0} section */", m_Name);
            var keys = new List <string>(m_Entries.Keys);

            keys.Sort(StringComparer.Ordinal);
            foreach (string key in keys)
            {
                T obj = m_Entries[key];
                obj.UpdateProps();
                sb.Append("\n\t\t");
                comments.WriteStringBuilder(sb, obj.guid);
                sb.Append(" = ");
                Serializer.WriteDict(sb, obj.GetPropertiesWhenSerializing(), 2,
                                     obj.shouldCompact, obj.checker, comments);
                sb.Append(";");
            }
            sb.AppendFormat("\n/* End {0} section */", m_Name);
        }
 static void WriteStringImpl(StringBuilder sb, string s, bool comment, GUIDToCommentMap comments)
 {
     if (comment)
         comments.WriteStringBuilder(sb, s);
     else
         sb.Append(PBXStream.QuoteStringIfNeeded(s));
 }
        public static void WriteDictKeyValue(StringBuilder sb, string key, PBXElement value, int indent, bool compact, 
                                             PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            WriteStringImpl(sb, key, checker.CheckKeyInDict(key), comments);
            sb.Append(" = ");

            if (value is PBXElementString)
                WriteStringImpl(sb, value.AsString(), checker.CheckStringValueInDict(key, value.AsString()), comments);
            else if (value is PBXElementDict)
                WriteDict(sb, value.AsDict(), indent, compact, checker.NextLevel(key), comments);
            else if (value is PBXElementArray)
                WriteArray(sb, value.AsArray(), indent, compact, checker.NextLevel(key), comments);
            sb.Append(";");
            if (compact)
                sb.Append(" ");
        }
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, 
                                     PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");

            if (el.Contains("isa"))
                WriteDictKeyValue(sb, "isa", el["isa"], indent+1, compact, checker, comments);
            var keys = new List<string>(el.values.Keys);
            keys.Sort(StringComparer.Ordinal);
            foreach (var key in keys)
            {
                if (key != "isa")
                    WriteDictKeyValue(sb, key, el[key], indent+1, compact, checker, comments);
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(GetIndent(indent));
            }
            sb.Append("}");
        }
Beispiel #13
0
        public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments)
        {
            sb.Append("{");
            if (el.Contains("isa"))
            {
                Serializer.WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
            }
            List <string> list = new List <string>((IEnumerable <string>)el.values.Keys);

            list.Sort((IComparer <string>)StringComparer.Ordinal);
            foreach (string key in list)
            {
                if (key != "isa")
                {
                    Serializer.WriteDictKeyValue(sb, key, el[key], indent + 1, compact, checker, comments);
                }
            }
            if (!compact)
            {
                sb.Append("\n");
                sb.Append(Serializer.GetIndent(indent));
            }
            sb.Append("}");
        }
Beispiel #14
0
 public static void WriteDict(StringBuilder sb, PBXElementDict el, int indent, bool compact, PropertyCommentChecker checker, GUIDToCommentMap comments)
 {
     sb.Append("{");
     if (el.Contains("isa"))
     {
         WriteDictKeyValue(sb, "isa", el["isa"], indent + 1, compact, checker, comments);
     }
     List<string> list = new List<string>(el.values.Keys);
     list.Sort(StringComparer.Ordinal);
     foreach (string str in list)
     {
         if (str != "isa")
         {
             WriteDictKeyValue(sb, str, el[str], indent + 1, compact, checker, comments);
         }
     }
     if (!compact)
     {
         sb.Append("\n");
         sb.Append(GetIndent(indent));
     }
     sb.Append("}");
 }
Beispiel #15
0
 public abstract void WriteSection(StringBuilder sb, GUIDToCommentMap comments);
 public abstract void WriteSection(StringBuilder sb, GUIDToCommentMap comments);