示例#1
0
        public List <object> ShadowDequeueAll()
        {
            object syObject;

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

            try
            {
                List <object> list = new List <object>();
                using (StreamRW streamRW = new StreamRW(this.FileName))
                {
                    streamRW.Seek(12L, SeekOrigin.Begin);
                    while (true)
                    {
                        BinaryEntry binaryEntry = streamRW.ReadBinaryEntry();
                        if (binaryEntry == null)
                        {
                            break;
                        }
                        list.Add(this.Deserialize(binaryEntry.Value));
                    }
                    result = list;
                }
            }
            finally
            {
                Monitor.Exit(syObject);
            }
            return(result);
        }
示例#2
0
        public Queue <byte[]> ReadAllBinaryInQueue()
        {
            Queue <byte[]> queue    = new Queue <byte[]>();
            long           position = this.Position;

            this.Seek(12L, SeekOrigin.Begin);
            while (this.Position < this.Length)
            {
                BinaryEntry binaryEntry = this.ReadBinaryEntry();
                queue.Enqueue(binaryEntry.Value);
            }
            this.Seek(position, SeekOrigin.Begin);
            return(queue);
        }
示例#3
0
        public BinaryEntry ReadBinaryEntry()
        {
            if (this.Position == this.Length)
            {
                return(null);
            }
            BinaryEntry binaryEntry = new BinaryEntry();

            binaryEntry.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);
            binaryEntry.Value = array;
            return(binaryEntry);
        }
示例#4
0
        public List <object> Dequeue(int n)
        {
            object syObject;

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

            try
            {
                this.UpdateState();
                List <object> list = new List <object>(n);
                int           num  = 0;
                while (true)
                {
                    BinaryEntry binaryEntry = this.dataFile.ReadBinaryEntry();
                    if (binaryEntry == null)
                    {
                        break;
                    }
                    list.Add(this.Deserialize(binaryEntry.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);
        }