예제 #1
0
        private ZtrFileEntry[] ExtractLittleEndianUncompressedDictionary(int count)
        {
            if (count < 0 || count > 102400)
            {
                throw new ArgumentOutOfRangeException(nameof(count), count.ToString());
            }

            ZtrFileEntry[] entries = new ZtrFileEntry[count];
            entries.InitializeElements();

            int[] offsets = new int[count * 2];
            for (int i = 0; i < count * 2; i++)
            {
                offsets[i] = _br.ReadInt32();
            }

            for (int i = 0; i < count; i++)
            {
                _input.Position  = offsets[i * 2];
                entries[i].Key   = _input.ReadNullTerminatedString(Encoding.ASCII, 1);
                _input.Position  = offsets[i * 2 + 1];
                entries[i].Value = _input.ReadNullTerminatedString(_encoding, 2);
            }

            return(entries);
        }
예제 #2
0
        private ZtrFileEntry[] ExtractBigEndianCompressedDictionary()
        {
            ZtrFileHeader header = new ZtrFileHeader();
            header.ReadFromStream(_input);

            ZtrFileEntry[] result = new ZtrFileEntry[header.Count];
            result.InitializeElements();

            ZtrFileKeysUnpacker keysUnpacker = new ZtrFileKeysUnpacker(_input, result);
            keysUnpacker.Unpack(header.KeysUnpackedSize);

            ZtrFileTextUnpacker textUnpacker = new ZtrFileTextUnpacker(_input, result, header.TextLinesTable, _encoding);
            textUnpacker.Unpack(header.TextBlockTable[header.TextBlockTable.Length - 1]);

            return result;
        }
예제 #3
0
        private ZtrFileEntry[] ExtractBigEndianCompressedDictionary()
        {
            ZtrFileHeader header = new ZtrFileHeader();

            header.ReadFromStream(_input);

            ZtrFileEntry[] result = new ZtrFileEntry[header.Count];
            result.InitializeElements();

            ZtrFileKeysUnpacker keysUnpacker = new ZtrFileKeysUnpacker(_input, result);

            keysUnpacker.Unpack(header.KeysUnpackedSize);

            ZtrFileTextUnpacker textUnpacker = new ZtrFileTextUnpacker(_input, result, header.TextLinesTable, _encoding);

            textUnpacker.Unpack(header.TextBlockTable[header.TextBlockTable.Length - 1]);

            return(result);
        }
예제 #4
0
        private ZtrFileEntry[] ExtractLittleEndianUncompressedDictionary(int count)
        {
            if (count < 0 || count > 102400)
                throw new ArgumentOutOfRangeException(nameof(count), count.ToString());

            ZtrFileEntry[] entries = new ZtrFileEntry[count];
            entries.InitializeElements();

            int[] offsets = new int[count * 2];
            for (int i = 0; i < count * 2; i++)
                offsets[i] = _br.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                _input.Position = offsets[i * 2];
                entries[i].Key = _input.ReadNullTerminatedString(Encoding.ASCII, 1);
                _input.Position = offsets[i * 2 + 1];
                entries[i].Value = _input.ReadNullTerminatedString(_encoding, 2);
            }

            return entries;
        }