source: binary-improvements2/7dtd-server-fixes/src/JSON/JSONNull.cs@ 391

Last change on this file since 391 was 391, checked in by alloc, 2 years ago

Major refactoring/cleanup

File size: 803 bytes
Line 
1using System;
2using System.Text;
3
4namespace AllocsFixes.JSON {
5 public class JsonNull : JsonValue {
6 public override void ToString (StringBuilder _stringBuilder, bool _prettyPrint = false, int _currentLevel = 0) {
7 _stringBuilder.Append ("null");
8 }
9
10 public static JsonNull Parse (string _json, ref int _offset) {
11 //Log.Out ("ParseNull enter (" + offset + ")");
12
13 if (!_json.Substring (_offset, 4).Equals ("null")) {
14 throw new MalformedJsonException ("No valid null value found");
15 }
16
17 //Log.Out ("JSON:Parsed Null");
18 _offset += 4;
19 return new JsonNull ();
20 }
21
22 public override string AsString => throw new NotSupportedException ();
23 public override int AsInt => throw new NotSupportedException ();
24 public override double AsDouble => throw new NotSupportedException ();
25 }
26}
Note: See TracBrowser for help on using the repository browser.