Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public StringQueuedFile(string fileName)
        {
            this.FileName = fileName;
            this.dataFile = new StreamRW(fileName);
            this.SyObject = new object();
            if (this.dataFile.Length == 0L)
            {
                this.dataFile.WriteFileHeader(0, 0, 0);
                this.count = (this.current = 0);
                this.dataFile.Seek(0L, SeekOrigin.End);
                this.realCursor = (this.cursor = (int)this.dataFile.Position);
                return;
            }
            FileHeader fileHeader = this.dataFile.ReadFileHeader();

            this.count       = fileHeader.Count;
            this.realCurrent = (this.current = fileHeader.Current);
            this.realCursor  = (this.cursor = fileHeader.Position);
            this.dataFile.Seek((long)this.cursor, SeekOrigin.Begin);
        }
Ejemplo n.º 3
0
        public UniqueStringQueuedFile(string fileName, bool caseSensitive)
        {
            this.CaseSensitive = caseSensitive;
            this.FileName      = fileName;
            this.dataFile      = new StreamRW(fileName);
            this.SyObject      = new object();
            if (this.dataFile.Length == 0L)
            {
                this.dataFile.WriteFileHeader(0, 0, 0);
                this.count = (this.current = 0);
                this.dataFile.Seek(0L, SeekOrigin.End);
                this.realCursor = (this.cursor = (int)this.dataFile.Position);
                this.AllItems   = new Queue <string>();
                return;
            }
            FileHeader fileHeader = this.dataFile.ReadFileHeader();

            this.count       = fileHeader.Count;
            this.realCurrent = (this.current = fileHeader.Current);
            this.realCursor  = (this.cursor = fileHeader.Position);
            this.AllItems    = this.dataFile.ReadAllStringInQueue();
            this.dataFile.Seek((long)this.cursor, SeekOrigin.Begin);
        }