Beispiel #1
0
        public Queue <KeyValuePair <string, string> > DequeueOneLine(Queue <KeyValuePair <string, string> > orgQueue)
        {
            Queue <KeyValuePair <string, string> > queue = new Queue <KeyValuePair <string, string> >();
            int  mark = 0;
            bool loop = true;

            while (loop && (orgQueue.Count != 0))
            {
                if ((orgQueue.First().Key.Equals(Constant.StrSrc)) && (mark == 0))
                {
                    KeyValuePair <string, string> pair = orgQueue.Dequeue();
                    queue.Enqueue(new KeyValuePair <string, string>(pair.Key, pair.Value.GetNumCode()));
                }
                else if (orgQueue.First().Key.Equals(Constant.StrDes))
                {
                    KeyValuePair <string, string> pair = orgQueue.Dequeue();
                    if (!FileProcessor.CheckCodeExist(queue, pair))
                    {
                        queue.Enqueue(new KeyValuePair <string, string>(pair.Key, pair.Value.GetNumCode()));
                    }
                    else if (pair.Value.Equals(Constant.StrEmpty))
                    {
                        queue.Enqueue(new KeyValuePair <string, string>(pair.Key, Constant.StrEmpty));
                    }
                    mark = 1;
                }
                else //key equalto src whil mark =1 , next line start
                {
                    loop = false;
                }
            }
            return(queue);
        }