示例#1
0
 public static Station FromBaseCSV(string row)
 {
     List<string> itemList = row.Split(new string[]{"\t"}, StringSplitOptions.None).ToList();
     Station obj = new Station();
     obj.ID = itemList[0];
     obj.Name = itemList[1];
     obj.TelCode = itemList[2];
     obj.PinYin = itemList[3];
     obj.PY = itemList[4];
     obj.PYCode = itemList[5];
     return obj;
 }
示例#2
0
 public Timetable(JObject jsonObj)
 {
     StationNO = jsonObj["station_no"].ToString();
     Station = Train.AllStationList.Find(p => p.Name == jsonObj["station_name"].ToString().Replace(" ", string.Empty));
     ArriveTime = jsonObj["arrive_time"].ToString();
     StartTime = jsonObj["start_time"].ToString();
     StopoverTime = jsonObj["stopover_time"].ToString();
     IsEnabled = jsonObj["isEnabled"].ToString();
 }
示例#3
0
 static void Step2()
 {
     CreateDirectory(GetStepPath(STEP_2));
     //var station_names ='@bjb|北京北|VAP|beijingbei|bjb|0@bjd|北京东|BOP|beijingdong|bjd|1';
     string text = ReadFile(GetStepFile(STEP_1, FILE_1)).Trim();
     text = SubText(text, "'", "'");
     List<Station> stationList = new List<Station>();
     List<string> rowList = SplitText(text, "@", StringSplitOptions.RemoveEmptyEntries);
     foreach (string str in rowList)
     {
         List<string> itemList = SplitText(str.Trim(), "|");
         Station station = new Station();
         station.ID = itemList[5];
         station.Name = itemList[1];
         station.TelCode = itemList[2];
         station.PinYin = itemList[3];
         station.PY = itemList[4];
         station.PYCode = itemList[0];
         stationList.Add(station);
     }
     stationList.Sort((obj1, obj2) => Convert.ToInt32(obj1.ID).CompareTo(Convert.ToInt32(obj2.ID)));
     List<string> outputList = new List<string>();
     foreach (Station station in stationList)
     {
         outputList.Add(station.ToBaseCSV());
     }
     WriteFile(GetStepFile(STEP_2, FILE_2), string.Join("\r\n", outputList.ToArray()) + StationNotFoundIn12306);
 }