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