示例#1
0
 public TransferData StoreShowDeserializer(string jsonStr)
 {
     int extCode = 0;
     TransferData oTransferData = new TransferData();
     Dictionary<string, string> result = new Dictionary<string, string>();
     JObject jobject = JObject.Parse(jsonStr);
     if (jobject.Property("error") != null)
     {
         extCode = int.Parse(jobject["error"].ToString());
         if (extCode != 0)
         {
             return null;
         }
     }
     string jsonText1 = jobject["data"].ToString();
     JObject jobject2 = JObject.Parse(jsonText1);
     //"type": 1,
     //"startstation": "乌鲁木齐",
     //"endstation": "桂林",
     int type = int.Parse(jobject2["type"].ToString());
     string startstation = jobject2["startstation"].ToString() ?? "";
     string endstation = jobject2["endstation"].ToString() ?? "";
     string jsonText2 = jobject2["ways"].ToString();
     JArray ja = (JArray)JsonConvert.DeserializeObject(jsonText2);
     //jsonText2 = jsonText2.TrimStart('[').TrimEnd(']');
     Segment[][] segments = JsonConvert.DeserializeObject<Segment[][]>(jsonText2);
     oTransferData.type = type;
     oTransferData.startstation = startstation;
     oTransferData.endstation = endstation;
     oTransferData.ways = segments;
     return oTransferData;
 }
示例#2
0
        private static void Ht_FileWatchEvent(object sender, CompleteEventArgs e)
        {
            TransferData td = new TransferData();
            StoreServer ss = new StoreServer();
            td = ss.StoreShowDeserializer(e.Node);
            Console.WriteLine(td.startstation + ">" + td.endstation);
               List<string> wayList= td.ways[0][0].ways.Split(',').ToList<string>();
            Tickets t = new Tickets();
            var leftCollects = TrainTicketLeftQuery.DoQueryTrainTicketLeftCollects(DateTime.Now.AddDays(3).ToString("yyyy-MM-dd"), "GZQ", "BJP", "");

            t.getTickets("GZQ", "XAY", td.ways[0][0].starttime);
            Console.WriteLine(td.ways[0][0]);
            Console.ReadLine();
        }