public static void Deserialize(string _Input, out ValidateRequest Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "ValidateRequest" : { ValidateRequest Result = new ValidateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }
public override void Validate(byte [] Certificate) { ValidateRequest ValidateRequest = new ValidateRequest (); Credential Credential = new Credential (); Credential.Data = Certificate; Credential.Type = "application/x-x509-server-cert"; ValidateRequest.Credential = Credential; QResponse ResponseOut = WebBinding.RequestResponse (ValidateRequest); }
public static void Deserialize(string _Input, out QRequest Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "QRequest" : { Out = null; throw new Exception ("Can't create abstract type"); } case "QueryConnectRequest" : { QueryConnectRequest Result = new QueryConnectRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "AdvertiseRequest" : { AdvertiseRequest Result = new AdvertiseRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ValidateRequest" : { ValidateRequest Result = new ValidateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "CredentialPasswordRequest" : { CredentialPasswordRequest Result = new CredentialPasswordRequest (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }