Ejemplo n.º 1
0
        public Input GetInputData()
        {
            HttpWebResponse result = Request("GetInputData");
            Encoding        encode = Encoding.GetEncoding("utf-8");
            Stream          stream = result.GetResponseStream();

            StreamReader  readStream = new StreamReader(stream, encode);
            JsonSerialize js         = new JsonSerialize();

            return(js.DeSerialize(readStream.ReadToEnd()));
        }
Ejemplo n.º 2
0
        private string GetAnswer(string str)
        {
            Input         input;
            Output        output;
            Data          data = new Data();
            JsonSerialize js   = new JsonSerialize();

            input  = js.DeSerialize(str);
            output = data.Result(input);
            return(js.Serialize(output));
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            switch (str)
            {
            case "Xml":
            {
                str = Console.ReadLine();
                XmlSerialize XS = new XmlSerialize();

                Input  input  = new Input();
                Output output = new Output();
                input = XS.DeSerialize(str);

                Data data = new Data();
                output = data.Result(input);

                str = XS.Serialize(output);

                Console.WriteLine(str);
            }
            break;

            case "Json":
            {
                str = Console.ReadLine();
                JsonSerialize JS = new JsonSerialize();

                Input  input  = new Input();
                Output output = new Output();
                input = JS.DeSerialize(str);

                Data data = new Data();
                output = data.Result(input);

                str = JS.Serialize(output);

                Console.WriteLine(str);
            }
            break;

            default:
                new Exception("What can I do?");
                break;
            }
        }