Exemplo n.º 1
0
        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?
        }
Exemplo n.º 2
0
        public static void Deserialize(string _Input, out Response Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

            JSONReader.StartObject ();
            string token = JSONReader.ReadToken ();
            Out = null;

            switch (token) {

                case "Response" : {
                    Out = null;
                    throw new Exception ("Can't create abstract type");
                    }

                case "ErrorResponse" : {
                    ErrorResponse Result = new ErrorResponse ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                case "BindResponse" : {
                    Out = null;
                    throw new Exception ("Can't create abstract type");
                    }

                case "OpenResponse" : {
                    OpenResponse Result = new OpenResponse ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                case "TicketResponse" : {
                    TicketResponse Result = new TicketResponse ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                case "UnbindResponse" : {
                    UnbindResponse Result = new UnbindResponse ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                default : {
                    throw new Exception ("Not supported");
                    }
                }
            JSONReader.EndObject ();

            // should we check for EOF here?
        }