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

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

Finished up REST API base
Made API handler look for APIs in all loaded mods

File size: 803 bytes
RevLine 
[389]1using System;
[309]2using System.Text;
[188]3
[325]4namespace AllocsFixes.JSON {
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
[351]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")) {
[326]14 throw new MalformedJSONException ("No valid null value found");
[188]15 }
[325]16
[326]17 //Log.Out ("JSON:Parsed Null");
[351]18 _offset += 4;
[326]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.