コード例 #1
0
        public List <string> ShadowDequeueAll()
        {
            object syObject;

            Monitor.Enter(syObject = this.SyObject);
            List <string> result;

            try
            {
                List <string> list = new List <string>();
                using (StreamRW streamRW = new StreamRW(this.FileName))
                {
                    streamRW.Seek(12L, SeekOrigin.Begin);
                    while (true)
                    {
                        StringEntry stringEntry = streamRW.ReadStringEntry();
                        if (stringEntry == null)
                        {
                            break;
                        }
                        list.Add(stringEntry.Value);
                    }
                    result = list;
                }
            }
            finally
            {
                Monitor.Exit(syObject);
            }
            return(result);
        }
コード例 #2
0
        public Queue <string> ReadAllStringInQueue()
        {
            Queue <string> queue    = new Queue <string>();
            long           position = this.Position;

            this.Seek(12L, SeekOrigin.Begin);
            while (this.Position < this.Length)
            {
                StringEntry stringEntry = this.ReadStringEntry();
                queue.Enqueue(stringEntry.Value);
            }
            this.Seek(position, SeekOrigin.Begin);
            return(queue);
        }
コード例 #3
0
        public StringEntry ReadStringEntry()
        {
            if (this.Position == this.Length)
            {
                return(null);
            }
            StringEntry stringEntry = new StringEntry();

            stringEntry.Pos = this.Position;
            byte[] array = new byte[4];
            this.Read(array, 0, 4);
            int num = BitConverter.ToInt32(array, 0);

            array = new byte[num];
            this.Read(array, 0, array.Length);
            stringEntry.Value = this.ReadString(array);
            return(stringEntry);
        }
コード例 #4
0
        public List <string> Dequeue(int n)
        {
            object syObject;

            Monitor.Enter(syObject = this.SyObject);
            List <string> result;

            try
            {
                this.UpdateState();
                List <string> list = new List <string>(n);
                int           num  = 0;
                while (true)
                {
                    StringEntry stringEntry = this.dataFile.ReadStringEntry();
                    if (stringEntry == null)
                    {
                        break;
                    }
                    list.Add(stringEntry.Value);
                    num++;
                    this.realCurrent++;
                    this.realCursor = (int)this.dataFile.Position;
                    if (num == n)
                    {
                        goto Block_4;
                    }
                }
                result = list;
                return(result);

Block_4:
                result = list;
            }
            finally
            {
                Monitor.Exit(syObject);
            }
            return(result);
        }