public UniqueStringQueuedFile(string fileName, bool caseSensitive)
        {
            CaseSensitive = caseSensitive;
            FileName      = fileName;
            dataFile      = new StreamRW(fileName);
            SyObject      = new object();

            if (dataFile.Length == 0)
            {
                dataFile.WriteFileHeader(0, 0, 0);
                count = current = 0;
                dataFile.Seek(0, SeekOrigin.End);
                realCursor = cursor = (int)dataFile.Position;
                AllItems   = new Queue <string>();
            }
            else
            {
                var tmp = dataFile.ReadFileHeader();
                count       = tmp.Count;
                realCurrent = current = tmp.Current;
                realCursor  = cursor = tmp.Position;

                AllItems = dataFile.ReadAllStringInQueue();

                dataFile.Seek(cursor, SeekOrigin.Begin);
            }
        }
Example #2
0
        /*////////////////////////////////////////////////////////////////////////////////////////*/

        #region Ctor

        public StringQueuedFile(string fileName)
        {
            FileName = fileName;
            dataFile = new StreamRW(fileName);
            SyObject = new object();

            if (dataFile.Length == 0)
            {
                dataFile.WriteFileHeader(0, 0, 0);
                count = current = 0;
                dataFile.Seek(0, SeekOrigin.End);
                realCursor = cursor = (int)dataFile.Position;
            }
            else
            {
                var tmp = dataFile.ReadFileHeader();
                count       = tmp.Count;
                realCurrent = current = tmp.Current;
                realCursor  = cursor = tmp.Position;

                dataFile.Seek(cursor, SeekOrigin.Begin);
            }
        }
Example #3
0
        public List <string> ShadowDequeueAll()
        {
            lock (this.SyObject)
            {
                List <string> R = new List <string>();
                using (var tmpFile = new StreamRW(FileName))
                {
                    tmpFile.Seek(12, SeekOrigin.Begin);

                    while (true)
                    {
                        var E = tmpFile.ReadStringEntry();

                        if (E == null)
                        {
                            return(R);
                        }

                        R.Add(E.Value);
                    }
                    return(R);
                }
            }
        }