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

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

Fixes 14_16_21

File size: 631 bytes
Line 
1using System;
2using System.Text;
3
4namespace AllocsFixes.JSON
5{
6 public class JSONNull : JSONValue
7 {
8 public JSONNull ()
9 {
10 }
11
12 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0)
13 {
14 stringBuilder.Append ("null");
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.