- Timestamp:
- Aug 9, 2017, 7:43:07 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/JSON/JSONObject.cs
r187 r309 32 32 } 33 33 34 public override string ToString (bool prettyPrint = false, int currentLevel = 0)34 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 35 35 { 36 StringBuilder sb = new StringBuilder("{");36 stringBuilder.Append ("{"); 37 37 if (prettyPrint) 38 s b.Append ('\n');38 stringBuilder.Append ('\n'); 39 39 foreach (KeyValuePair<string, JSONNode> kvp in nodes) { 40 40 if (prettyPrint) 41 s b.Append (new String ('\t', currentLevel + 1));42 s b.Append (String.Format ("\"{0}\":", kvp.Key));41 stringBuilder.Append (new String ('\t', currentLevel + 1)); 42 stringBuilder.Append (String.Format ("\"{0}\":", kvp.Key)); 43 43 if (prettyPrint) 44 s b.Append (" ");45 sb.Append (kvp.Value.ToString (prettyPrint, currentLevel + 1));46 s b.Append (",");44 stringBuilder.Append (" "); 45 kvp.Value.ToString (stringBuilder, prettyPrint, currentLevel + 1); 46 stringBuilder.Append (","); 47 47 if (prettyPrint) 48 s b.Append ('\n');48 stringBuilder.Append ('\n'); 49 49 } 50 if (s b.Length > 1)51 s b.Remove (sb.Length - (prettyPrint ? 2 : 1), 1);50 if (stringBuilder.Length > 1) 51 stringBuilder.Remove (stringBuilder.Length - (prettyPrint ? 2 : 1), 1); 52 52 if (prettyPrint) 53 sb.Append (new String ('\t', currentLevel)); 54 sb.Append ("}"); 55 return sb.ToString (); 53 stringBuilder.Append (new String ('\t', currentLevel)); 54 stringBuilder.Append ("}"); 56 55 } 57 56
Note:
See TracChangeset
for help on using the changeset viewer.