/// <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 "PortalEntry" : { Out = null; throw new Exception ("Can't create abstract type"); } case "Account" : { var Result = new Account (); Result.Deserialize (JSONReader); Out = Result; break; } case "AccountProfile" : { var Result = new AccountProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionsPending" : { var Result = new ConnectionsPending (); 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 Account FromTagged (JSONReader JSONReader) { Account Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "Account" : { var Result = new Account (); Result.Deserialize (JSONReader); Out = Result; break; } case "AccountProfile" : { var Result = new AccountProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionsPending" : { var Result = new ConnectionsPending (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }