Ejemplo n.º 1
0
        public static void Deserialize(string _Input, out TicketRequest Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

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

            switch (token) {

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

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

            // should we check for EOF here?
        }
Ejemplo n.º 2
0
        public static void Deserialize(string _Input, out Message Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

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

            switch (token) {

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

                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;
                    }

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

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

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

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

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

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

            // should we check for EOF here?
        }