public override void ProcessChunkFile(Stream stream, string chunkFullFilename) { using var reader = new Reader(new BinaryReader(stream, Encoding.UTF8, true), chunkFullFilename); var header = LanguageHeaderPrimitive.Read(reader); LanguageInfoEntryPrimitive[] infoEntries = ReadInfoEntries(reader, header); // Skip buckets. reader.Offset(8 * 256); byte[] keyBlock = reader.ReadBytes((int)header.KeyBlockSize); byte[] stringBlock = reader.ReadBytes((int)header.StringBlockSize); if (stringBlock.Length == 0) return; List<string> values = ParseStringBlock(stringBlock); foreach (LanguageInfoEntryPrimitive infoEntry in infoEntries) { int index = (int)infoEntry.KeyOffset; string key = NativeUtils.GetNextString(keyBlock, ref index, Encoding.ASCII); string value = values[(int)infoEntry.StringIndex]; TryAddEntry(header.LanguageId, infoEntry.StringIndex, key, value); } }
private static List<string> ParseStringBlock(byte[] stringBlock) { int index = 0; var values = new List<string>(); while (index < stringBlock.Length) values.Add(NativeUtils.GetNextString(stringBlock, ref index, Encoding.UTF8)); return values; }