Пример #1
0
        public UserDB(Reader reader)
        {
            Reader creader = reader.GetCompressedStreamRaw();

            creader.BaseStream.Position += 8;

            ushort EntryCount = creader.ReadUInt16();

            ValuesPerEntry = creader.ReadByte();

            for (int i = 0; i < ValuesPerEntry; i++)
            {
                ValueIDs.Add(creader.ReadByte());

                string str   = "";
                char   c     = 'n';
                int    count = 0;
                while (c != 0)
                {
                    c = creader.ReadChar();
                    count++;
                    if (c != 0)
                    {
                        str += c;
                    }
                }
                ValueNames.Add(str);
                creader.ReadBytes(16 - count);
            }

            for (int i = 0; i < EntryCount; i++)
            {
                Entries.Add(new Entry(creader, this));
            }



            byte[] array = new byte[creader.BaseStream.Length];
            creader.BaseStream.Position = 0;
            creader.Read(array, 0, (int)creader.BaseStream.Length);
            Writer writer = new Writer("UserDB.bin");

            writer.Write(array);
            writer.Close();
            creader.Close();
            reader.Close();
        }