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

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

Major refactoring/cleanup

File size: 803 bytes
RevLine 
[389]1using System;
[309]2using System.Text;
[188]3
[325]4namespace AllocsFixes.JSON {
[391]5 public class JsonNull : JsonValue {
[351]6 public override void ToString (StringBuilder _stringBuilder, bool _prettyPrint = false, int _currentLevel = 0) {
7 _stringBuilder.Append ("null");
[188]8 }
9
[391]10 public static JsonNull Parse (string _json, ref int _offset) {
[188]11 //Log.Out ("ParseNull enter (" + offset + ")");
12
[351]13 if (!_json.Substring (_offset, 4).Equals ("null")) {
[391]14 throw new MalformedJsonException ("No valid null value found");
[188]15 }
[325]16
[326]17 //Log.Out ("JSON:Parsed Null");
[351]18 _offset += 4;
[391]19 return new JsonNull ();
[188]20 }
[389]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 ();
[188]25 }
[325]26}
Note: See TracBrowser for help on using the repository browser.