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

Last change on this file since 319 was 309, checked in by alloc, 7 years ago

Fixes 14_16_21

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