Example #1
0
        /// <summary>
        /// 立即转换
        /// </summary>
        public void Convert()
        {
            //依次准备写
            fw.BeginToWrite();
            //依次读
            fr.BeginToStepRead();

            while (true)
            {
                var cache = fr.ReadNext();

                if (cache.lineName == "")
                {
                    break;
                }

                var cache2 = new ArrayList();
                var cache4 = new List <FileIO.FileOperation.seekIndexStruct>();

                foreach (string item in cache.lineUpStop.ToStringGroup())
                {
                    if (cache2.Contains(item) == false)
                    {
                        //没写过
                        cache2.Add(item);
                    }
                    else
                    {
                        //写了
                    }
                }
                foreach (string item in cache.lineDownStop.ToStringGroup())
                {
                    if (cache2.Contains(item) == false)
                    {
                        //没写过
                        cache2.Add(item);
                    }
                    else
                    {
                        //写了
                    }
                }

                //准备搜索
                foreach (object item in cache2)
                {
                    var cache3 = new FileIO.FileOperation.seekIndexStruct();
                    cache3.Head = item.ToString();
                    cache4.Add(cache3);
                }

                //立即搜索
                var seekResult = fr2.SeekRead(cache4);

                //找出结果
                foreach (StopFileBlockStruct item in seekResult)
                {
                    foreach (string item2 in item.stopCrossLine.ToStringGroup())
                    {
                        if (thisBusCanTranslate.Contains(item2) == false)
                        {
                            //添加
                            thisBusCanTranslate.Add(item2);
                        }
                    }
                }

                //准备数据
                var cache5 = new GuideLineBlockStruct();
                cache5.lineName      = cache.lineName;
                cache5.lineCrossLine = new StringGroup(thisBusCanTranslate, ",");

                //写入
                fw.WriteNext(cache5);

                //回归数据
                thisBusCanTranslate.Clear();
            }


            fr.StopStepReading();
            fw.StopWriting();
        }
Example #2
0
        /// <summary>
        /// 立即转换
        /// </summary>
        public void Convert()
        {
            //============================读取旧的
            fr2.BeginToStepRead();

            while (true)
            {
                var cache = fr2.ReadNext();

                if (cache.stopName == "")
                {
                    break;
                }

                oldSubway.Add(cache.stopName);
                oldSubwayExit.Add(cache.stopExit);
            }

            fr2.StopStepReading();

            //============================获取新的
            fr.BeginToStepRead();

            while (true)
            {
                var cache2 = fr.ReadNext();

                if (cache2.lineName == "")
                {
                    break;
                }
                if (cache2.lineType == enumLineType.Bus)
                {
                    continue;
                }

                foreach (string item in cache2.lineUpStop.ToStringGroup())
                {
                    var index = subwayStop.IndexOf(item);
                    if (index == -1)
                    {
                        //没写过
                        subwayStop.Add(item);
                    }
                    else
                    {
                        //写了
                        //不管
                    }
                }
                foreach (string item in cache2.lineDownStop.ToStringGroup())
                {
                    var index = subwayStop.IndexOf(item);
                    if (index == -1)
                    {
                        //没写过
                        subwayStop.Add(item);
                    }
                    else
                    {
                        //写了
                        //不管
                    }
                }
            }

            fr.StopStepReading();

            //============================写入

            fw.BeginToWrite();

            for (int a = 0; a < subwayStop.Count; a++)
            {
                int index  = oldSubway.IndexOf(subwayStop.Item(a));
                var cache3 = new SubwayFileBlockStruct();
                cache3.stopName = subwayStop.Item(a).ToString();

                if (index == -1)
                {
                    //没有以前的数据
                    var cache4 = new List <StringGroup>();
                    cache4.Add(new StringGroup("示例出口#通向遥远的地方", "#"));
                    cache3.stopExit = cache4;
                }
                else
                {
                    //有数据,直接写
                    cache3.stopExit = (List <StringGroup>)oldSubwayExit.Item(index);
                }

                fw.WriteNext(cache3);
            }

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