Ejemplo n.º 1
0
        private void Initialize()
        {
            using (var reader = new BigEndianReader(new StreamReader(m_uri).BaseStream))
            {
                var indexPos = reader.ReadInt();
                reader.Seek(indexPos, SeekOrigin.Begin);
                var indexLen = reader.ReadInt();

                for (int i = 0; i < indexLen; i += 8)
                {
                    var key = reader.ReadInt();
                    var dataPos = reader.ReadInt();
                    var pos = (int)reader.BaseStream.Position;
                    reader.Seek(dataPos, SeekOrigin.Begin);
                    m_indexes.Add(key, reader.ReadUTF());
                    reader.Seek(pos, SeekOrigin.Begin);
                }

                while (reader.BytesAvailable > 0)
                {
                    var key = reader.ReadUTF();
                    var dataPos = reader.ReadInt();
                    var pos = (int)reader.BaseStream.Position;
                    reader.Seek(dataPos, SeekOrigin.Begin);
                    m_textIndexes.Add(key, reader.ReadUTF());
                    reader.Seek(pos, SeekOrigin.Begin);
                }
            }
        }