public static void Deserialize(string _Input, out ValidateResponse Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "ValidateResponse" : { ValidateResponse Result = new ValidateResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }
public static void Deserialize(string _Input, out QResponse Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "QResponse" : { Out = null; throw new Exception ("Can't create abstract type"); } case "QueryConnectResponse" : { QueryConnectResponse Result = new QueryConnectResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "AdvertiseResponse" : { AdvertiseResponse Result = new AdvertiseResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ValidateResponse" : { ValidateResponse Result = new ValidateResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "CredentialPasswordResponse" : { CredentialPasswordResponse Result = new CredentialPasswordResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }