private void Update(BitStream bitStream, string tableName, int tableFlags, int numberOfEntries, int maxEntries, int userDataSize, int userDataSizeInBits, bool userDataIsFixedSize) { bool encodeUsingDictionaries = bitStream.ReadBit(); if (encodeUsingDictionaries) { Console.WriteLine("Cannot Decode StringTable Update"); return; } List<String> entryHistory = new List<String>(); int lastEntriesIndex = -1; for (int i = 0; i < numberOfEntries; i++) { int entryIndex = lastEntriesIndex + 1; int entryLength = (int)Math.Log(maxEntries, 2); if (!bitStream.ReadBit()) { entryIndex = (int)bitStream.ReadBits(entryLength); } lastEntriesIndex = entryIndex; if (entryIndex < 0 || entryIndex >= maxEntries) { Console.WriteLine("Invalid StringTableEntry Index"); return; } string entryName = ""; if (bitStream.ReadBit()) { bool substringCheck = bitStream.ReadBit(); if (substringCheck) { int index = (int)bitStream.ReadBits(5); int bytesToCopy = (int)bitStream.ReadBits(5); entryName = entryHistory[index].Substring(0, bytesToCopy); entryName += bitStream.ReadString(); } else { entryName = bitStream.ReadString(); } } if (entryHistory.Count > 31) { entryHistory.RemoveAt(0); } entryHistory.Add(entryName); byte[] entryData = null; if (bitStream.ReadBit()) { if (userDataIsFixedSize) { entryData = bitStream.ReadBitsToArray(userDataSizeInBits); } else { int bytesToRead = (int)bitStream.ReadBits(14); entryData = bitStream.ReadBytes(bytesToRead); } } StringTableEntry stringTableEntry = new StringTableEntry(entryName, entryIndex, entryData); Add(tableName, stringTableEntry); } }