/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> public static void Deserialize(JSONReader JSONReader, out JSONObject Out) { JSONReader.StartObject (); if (JSONReader.EOR) { Out = null; return; } string token = JSONReader.ReadToken (); Out = null; switch (token) { case "RecryptRequest" : { var Result = new RecryptRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "RecryptResponse" : { var Result = new RecryptResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "Version" : { var Result = new Version (); Result.Deserialize (JSONReader); Out = Result; break; } case "Encoding" : { var Result = new Encoding (); Result.Deserialize (JSONReader); Out = Result; break; } case "Resource" : { var Result = new Resource (); Result.Deserialize (JSONReader); Out = Result; break; } case "Static" : { var Result = new Static (); Result.Deserialize (JSONReader); Out = Result; break; } case "Dynamic" : { var Result = new Dynamic (); Result.Deserialize (JSONReader); Out = Result; break; } case "ResourceSet" : { var Result = new ResourceSet (); Result.Deserialize (JSONReader); Out = Result; break; } case "User" : { var Result = new User (); Result.Deserialize (JSONReader); Out = Result; break; } case "Label" : { var Result = new Label (); Result.Deserialize (JSONReader); Out = Result; break; } case "KeySet" : { var Result = new KeySet (); Result.Deserialize (JSONReader); Out = Result; break; } case "HelloRequest" : { var Result = new HelloRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "HelloResponse" : { var Result = new HelloResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "SetRequest" : { var Result = new SetRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "SetResponse" : { var Result = new SetResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "GetRequest" : { var Result = new GetRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "GetResponse" : { var Result = new GetResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "DeleteRequest" : { var Result = new DeleteRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "DeleteResponse" : { var Result = new DeleteResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "SearchRequest" : { var Result = new SearchRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "SearchResponse" : { var Result = new SearchResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "JoinRequest" : { var Result = new JoinRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "JoinResponse" : { var Result = new JoinResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "LeaveRequest" : { var Result = new LeaveRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "LeaveResponse" : { var Result = new LeaveResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new User FromTagged (JSONReader JSONReader) { User Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "User" : { var Result = new User (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <summary> /// Having read a tag, process the corresponding value data. /// </summary> /// <param name="JSONReader"></param> /// <param name="Tag"></param> public override void DeserializeToken (JSONReader JSONReader, string Tag) { switch (Tag) { case "Account" : { Account = JSONReader.ReadString (); break; } case "Administrators" : { // Have a sequence of values bool _Going = JSONReader.StartArray (); Administrators = new List <User> (); while (_Going) { // an untagged structure. var _Item = new User (JSONReader); Administrators.Add (_Item); _Going = JSONReader.NextArray (); } break; } case "Readers" : { // Have a sequence of values bool _Going = JSONReader.StartArray (); Readers = new List <User> (); while (_Going) { // an untagged structure. var _Item = new User (JSONReader); Readers.Add (_Item); _Going = JSONReader.NextArray (); } break; } default : { base.DeserializeToken(JSONReader, Tag); break; } } // check up that all the required elements are present }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new Resource FromTagged (JSONReader JSONReader) { Resource Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "Resource" : { var Result = new Resource (); Result.Deserialize (JSONReader); Out = Result; break; } case "Static" : { var Result = new Static (); Result.Deserialize (JSONReader); Out = Result; break; } case "Dynamic" : { var Result = new Dynamic (); Result.Deserialize (JSONReader); Out = Result; break; } case "ResourceSet" : { var Result = new ResourceSet (); Result.Deserialize (JSONReader); Out = Result; break; } case "User" : { var Result = new User (); Result.Deserialize (JSONReader); Out = Result; break; } case "Label" : { var Result = new Label (); Result.Deserialize (JSONReader); Out = Result; break; } case "KeySet" : { var Result = new KeySet (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }