source: binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs@ 329

Last change on this file since 329 was 326, checked in by alloc, 6 years ago

More cleanup, allocation improvements

File size: 566 bytes
RevLine 
[309]1using System.Text;
[188]2
[325]3namespace AllocsFixes.JSON {
4 public class JSONNull : JSONValue {
5 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) {
[309]6 stringBuilder.Append ("null");
[188]7 }
8
[325]9 public static JSONNull Parse (string json, ref int offset) {
[188]10 //Log.Out ("ParseNull enter (" + offset + ")");
11
[326]12 if (!json.Substring (offset, 4).Equals ("null")) {
13 throw new MalformedJSONException ("No valid null value found");
[188]14 }
[325]15
[326]16 //Log.Out ("JSON:Parsed Null");
17 offset += 4;
18 return new JSONNull ();
[188]19 }
20 }
[325]21}
Note: See TracBrowser for help on using the repository browser.