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

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

            switch (token) {

                case "Connection" : {
                    Connection Result = new Connection ();
                    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 new void DeserializeToken(JSONReader JSONReader, string Tag)
        {
            switch (Tag) {
                case "Cryptographic" : {
                    bool _Going = JSONReader.StartArray ();
                    Cryptographic = new List <Cryptographic> ();
                    while (_Going) {
                        Cryptographic _Item = new Cryptographic (JSONReader);
                        Cryptographic.Add (_Item);
                        _Going = JSONReader.NextArray ();
                        }

                    break;
                    }
                case "Service" : {
                    bool _Going = JSONReader.StartArray ();
                    Service = new List <Connection> ();
                    while (_Going) {
                        Connection _Item = new Connection (JSONReader);
                        Service.Add (_Item);
                        _Going = JSONReader.NextArray ();
                        }

                    break;
                    }
                default : {
                    ((Response)this).DeserializeToken(JSONReader, Tag);
                    break;
                    }
                }
            // check up that all the required elements are present
        }