Example #1
0
 public StopManagement()
 {
     nowStop         = new StopFileBlockStruct();
     nearbyStops     = new HashSet <NearbyStopStructure>();
     supportingStops = new HashSet <string>();
     haveStopReader  = new BlockReader <StopFileBlockStruct>();
     stopReader      = new SeekReader <StopFileBlockStruct>();
 }
Example #2
0
 /// <summary>
 /// 以选择站台刷新
 /// </summary>
 /// <param name="stopName">选择的站台名</param>
 /// <returns></returns>
 private Task UpdateStop(string stopName)
 {
     return(Task.Run(() => {
         nowStop = stopReader.SeekRead(new List <FileIO.FileOperation.seekIndexStruct> {
             new FileIO.FileOperation.seekIndexStruct {
                 Head = stopName
             }
         })[0];
     }));
 }
Example #3
0
        /// <summary>
        /// 立即转换
        /// </summary>
        public void Convert()
        {
            //===========================读取每条线路所有站台内容

            fr.BeginToStepRead();

            while (true)
            {
                var cache = fr.ReadNext();
                if (cache.lineName == "")
                {
                    break;
                }                                       //没有了

                foreach (string item in cache.lineUpStop.ToStringGroup())
                {
                    var index = busStop.IndexOf(item);
                    if (index == -1)
                    {
                        //没写过
                        busStop.Add(item);
                        busLine.Add(cache.lineName + ",");
                    }
                    else
                    {
                        //写了
                        if (CheckWordHaveBus(busLine.Item(index).ToString(), cache.lineName) == false)
                        {
                            busLine.Replace(index, busLine.Item(index).ToString() + cache.lineName + ",");
                        }
                    }
                }
                foreach (string item in cache.lineDownStop.ToStringGroup())
                {
                    var index = busStop.IndexOf(item);
                    if (index == -1)
                    {
                        //没写过
                        busStop.Add(item);
                        busLine.Add(cache.lineName + ",");
                    }
                    else
                    {
                        //写了
                        if (CheckWordHaveBus(busLine.Item(index).ToString(), cache.lineName) == false)
                        {
                            busLine.Replace(index, busLine.Item(index).ToString() + cache.lineName + ",");
                        }
                    }
                }
            }
            fr.StopStepReading();

            //===========================写入
            fw.BeginToWrite();
            for (int a = 0; a < busStop.Count; a++)
            {
                var cache = new StopFileBlockStruct();
                cache.stopName = busStop.Item(a).ToString();
                string cache2 = busLine.Item(a).ToString();
                cache.stopCrossLine = new StringGroup(cache2.Substring(0, cache2.Length - 1), ",");

                fw.WriteNext(cache);
            }

            fw.StopWriting();
        }