/// <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; }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new MeshRequest FromTagged (JSONReader JSONReader) { MeshRequest Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "MeshRequest" : { var Result = new MeshRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "HelloRequest" : { var Result = new HelloRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ValidateRequest" : { var Result = new ValidateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "CreateRequest" : { var Result = new CreateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "GetRequest" : { var Result = new GetRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "PublishRequest" : { var Result = new PublishRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "StatusRequest" : { var Result = new StatusRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStartRequest" : { var Result = new ConnectStartRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStartResponse" : { var Result = new ConnectStartResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStatusRequest" : { var Result = new ConnectStatusRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStatusResponse" : { var Result = new ConnectStatusResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectPendingRequest" : { var Result = new ConnectPendingRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectPendingResponse" : { var Result = new ConnectPendingResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectCompleteRequest" : { var Result = new ConnectCompleteRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectCompleteResponse" : { var Result = new ConnectCompleteResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "TransferRequest" : { var Result = new TransferRequest (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> /// <param name="JSONReader">Input stream</param> /// <param name="Out">The created object</param> 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 "DataItem" : { var Result = new DataItem (); Result.Deserialize (JSONReader); Out = Result; break; } case "Header" : { var Result = new Header (); Result.Deserialize (JSONReader); Out = Result; break; } case "Delta" : { var Result = new Delta (); Result.Deserialize (JSONReader); Out = Result; break; } case "IndexTerm" : { var Result = new IndexTerm (); Result.Deserialize (JSONReader); Out = Result; break; } case "Final" : { var Result = new Final (); Result.Deserialize (JSONReader); Out = Result; break; } case "Terminal" : { var Result = new Terminal (); Result.Deserialize (JSONReader); Out = Result; break; } case "IndexIndex" : { var Result = new IndexIndex (); Result.Deserialize (JSONReader); Out = Result; break; } case "Index" : { var Result = new Index (); Result.Deserialize (JSONReader); Out = Result; break; } case "IndexEntry" : { var Result = new IndexEntry (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <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> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> /// <param name="JSONReader">Input stream</param> /// <param name="Out">The created object</param> 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 "MeshRequest" : { var Result = new MeshRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "MeshResponse" : { var Result = new MeshResponse (); 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 "KeyValue" : { var Result = new KeyValue (); Result.Deserialize (JSONReader); Out = Result; break; } case "SearchConstraints" : { var Result = new SearchConstraints (); 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 "ValidateRequest" : { var Result = new ValidateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ValidateResponse" : { var Result = new ValidateResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "CreateRequest" : { var Result = new CreateRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "CreateResponse" : { var Result = new CreateResponse (); 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 "PublishRequest" : { var Result = new PublishRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "PublishResponse" : { var Result = new PublishResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "StatusRequest" : { var Result = new StatusRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "StatusResponse" : { var Result = new StatusResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStartRequest" : { var Result = new ConnectStartRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStartResponse" : { var Result = new ConnectStartResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStatusRequest" : { var Result = new ConnectStatusRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectStatusResponse" : { var Result = new ConnectStatusResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectPendingRequest" : { var Result = new ConnectPendingRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectPendingResponse" : { var Result = new ConnectPendingResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectCompleteRequest" : { var Result = new ConnectCompleteRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectCompleteResponse" : { var Result = new ConnectCompleteResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "TransferRequest" : { var Result = new TransferRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "TransferResponse" : { var Result = new TransferResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> /// <param name="JSONReader">Input stream</param> /// <param name="Out">The created object</param> 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 "SSHProfile" : { var Result = new SSHProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SSHProfilePrivate" : { var Result = new SSHProfilePrivate (); Result.Deserialize (JSONReader); Out = Result; break; } case "DeviceEntry" : { var Result = new DeviceEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "HostEntry" : { var Result = new HostEntry (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new SignedProfile FromTagged (JSONReader JSONReader) { SignedProfile Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "SignedProfile" : { var Result = new SignedProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedDeviceProfile" : { var Result = new SignedDeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedMasterProfile" : { var Result = new SignedMasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedPersonalProfile" : { var Result = new SignedPersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedApplicationProfile" : { var Result = new SignedApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionRequest" : { var Result = new SignedConnectionRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionResult" : { var Result = new SignedConnectionResult (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
public static void Deserialize(string _Input, out CredentialPasswordRequest Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { 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? }
public static void Deserialize(string _Input, out BindRequest Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "BindRequest" : { Out = null; throw new Exception ("Can't create abstract type"); } case "OpenRequest" : { OpenRequest Result = new OpenRequest (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }
/// <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 "JoseWebSignature" : { var Result = new JoseWebSignature (); Result.Deserialize (JSONReader); Out = Result; break; } case "JoseWebEncryption" : { var Result = new JoseWebEncryption (); Result.Deserialize (JSONReader); Out = Result; break; } case "Signed" : { var Result = new Signed (); Result.Deserialize (JSONReader); Out = Result; break; } case "Encrypted" : { var Result = new Encrypted (); Result.Deserialize (JSONReader); Out = Result; break; } case "KeyData" : { var Result = new KeyData (); Result.Deserialize (JSONReader); Out = Result; break; } case "Header" : { var Result = new Header (); Result.Deserialize (JSONReader); Out = Result; break; } case "Key" : { var Result = new Key (); Result.Deserialize (JSONReader); Out = Result; break; } case "Recipient" : { var Result = new Recipient (); Result.Deserialize (JSONReader); Out = Result; break; } case "PublicKeyRSA" : { var Result = new PublicKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } case "PrivateKeyRSA" : { var Result = new PrivateKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
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? }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new KeyData FromTagged (JSONReader JSONReader) { KeyData Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "KeyData" : { var Result = new KeyData (); Result.Deserialize (JSONReader); Out = Result; break; } case "Header" : { var Result = new Header (); Result.Deserialize (JSONReader); Out = Result; break; } case "Key" : { var Result = new Key (); Result.Deserialize (JSONReader); Out = Result; break; } case "PublicKeyRSA" : { var Result = new PublicKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } case "PrivateKeyRSA" : { var Result = new PrivateKeyRSA (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <summary> /// Construct an instance from the specified tagged JSONReader stream. /// </summary> /// <param name="JSONReader">Input stream</param> /// <param name="Out">The created object</param> 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 "PublicKey" : { var Result = new PublicKey (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedData" : { var Result = new SignedData (); Result.Deserialize (JSONReader); Out = Result; break; } case "EncryptedData" : { var Result = new EncryptedData (); Result.Deserialize (JSONReader); Out = Result; break; } case "Connection" : { var Result = new Connection (); Result.Deserialize (JSONReader); Out = Result; break; } case "Entry" : { var Result = new Entry (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedProfile" : { var Result = new SignedProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "Profile" : { Out = null; throw new Exception ("Can't create abstract type"); } case "SignedDeviceProfile" : { var Result = new SignedDeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "DeviceProfile" : { var Result = new DeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "DevicePrivateProfile" : { var Result = new DevicePrivateProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedMasterProfile" : { var Result = new SignedMasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "MasterProfile" : { var Result = new MasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedPersonalProfile" : { var Result = new SignedPersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "PersonalProfile" : { var Result = new PersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedApplicationProfile" : { var Result = new SignedApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "EncryptedProfile" : { var Result = new EncryptedProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfile" : { var Result = new ApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfilePrivate" : { var Result = new ApplicationProfilePrivate (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfileEntry" : { var Result = new ApplicationProfileEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "EscrowEntry" : { var Result = new EscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "OfflineEscrowEntry" : { var Result = new OfflineEscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "OnlineEscrowEntry" : { var Result = new OnlineEscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "EscrowedKeySet" : { var Result = new EscrowedKeySet (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionRequest" : { var Result = new ConnectionRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionRequest" : { var Result = new SignedConnectionRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "ConnectionResult" : { var Result = new ConnectionResult (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionResult" : { var Result = new SignedConnectionResult (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new Profile FromTagged (JSONReader JSONReader) { Profile Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "Profile" : { Out = null; throw new Exception ("Can't create abstract type"); } case "DeviceProfile" : { var Result = new DeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "MasterProfile" : { var Result = new MasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "PersonalProfile" : { var Result = new PersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfile" : { var Result = new ApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <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 (); }
public static void Deserialize(string _Input, out ErrorResponse Out) { StringReader _Reader = new StringReader (_Input); JSONReader JSONReader = new JSONReader (_Reader); JSONReader.StartObject (); string token = JSONReader.ReadToken (); Out = null; switch (token) { case "ErrorResponse" : { ErrorResponse Result = new ErrorResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { throw new Exception ("Not supported"); } } JSONReader.EndObject (); // should we check for EOF here? }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader"></param> public static new RecryptResponse FromTagged (JSONReader JSONReader) { RecryptResponse Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "RecryptResponse" : { var Result = new RecryptResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "HelloResponse" : { var Result = new HelloResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "SetResponse" : { var Result = new SetResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "GetResponse" : { var Result = new GetResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "DeleteResponse" : { var Result = new DeleteResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "SearchResponse" : { var Result = new SearchResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "JoinResponse" : { var Result = new JoinResponse (); Result.Deserialize (JSONReader); Out = Result; break; } case "LeaveResponse" : { var Result = new LeaveResponse (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <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; }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new HostEntry FromTagged (JSONReader JSONReader) { HostEntry Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "HostEntry" : { var Result = new HostEntry (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }
/// <summary> /// Deserialize a tagged stream /// </summary> /// <param name="JSONReader">The input stream</param> /// <returns>The created object.</returns> public static new Entry FromTagged (JSONReader JSONReader) { Entry Out = null; JSONReader.StartObject (); if (JSONReader.EOR) { return null; } string token = JSONReader.ReadToken (); switch (token) { case "Entry" : { var Result = new Entry (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedProfile" : { var Result = new SignedProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedDeviceProfile" : { var Result = new SignedDeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedMasterProfile" : { var Result = new SignedMasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedPersonalProfile" : { var Result = new SignedPersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedApplicationProfile" : { var Result = new SignedApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionRequest" : { var Result = new SignedConnectionRequest (); Result.Deserialize (JSONReader); Out = Result; break; } case "SignedConnectionResult" : { var Result = new SignedConnectionResult (); Result.Deserialize (JSONReader); Out = Result; break; } case "Profile" : { Out = null; throw new Exception ("Can't create abstract type"); } case "DeviceProfile" : { var Result = new DeviceProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "MasterProfile" : { var Result = new MasterProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "PersonalProfile" : { var Result = new PersonalProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfile" : { var Result = new ApplicationProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "EncryptedProfile" : { var Result = new EncryptedProfile (); Result.Deserialize (JSONReader); Out = Result; break; } case "ApplicationProfilePrivate" : { var Result = new ApplicationProfilePrivate (); Result.Deserialize (JSONReader); Out = Result; break; } case "EscrowEntry" : { var Result = new EscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "OfflineEscrowEntry" : { var Result = new OfflineEscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } case "OnlineEscrowEntry" : { var Result = new OnlineEscrowEntry (); Result.Deserialize (JSONReader); Out = Result; break; } default : { //Ignore the unknown data //throw new Exception ("Not supported"); break; } } JSONReader.EndObject (); return Out; }