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(" ");
            }
        }
예제 #2
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("}");
        }
        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(")");
        }
예제 #4
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(")");
 }
예제 #5
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);
     foreach (var key in el.values.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("}");
 }
예제 #6
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(" ");
        }