private void ReadNames(Stream s)
{
#if DEBUG_LSF_SERIALIZATION
Console.WriteLine(" ----- DUMP OF NAME TABLE -----");
#endif
// Format:
// 32-bit hash entry count (N)
// N x 16-bit chain length (L)
// L x 16-bit string length (S)
// [S bytes of UTF-8 string data]
Names = new List<List<String>>();
using (var reader = new BinaryReader(s))
{
var numHashEntries = reader.ReadUInt32();
while (numHashEntries-- > 0)
{
var hash = new List<String>();
Names.Add(hash);
var numStrings = reader.ReadUInt16();
while (numStrings-- > 0)
{
var nameLen = reader.ReadUInt16();
byte[] bytes = reader.ReadBytes(nameLen);
var name = System.Text.Encoding.UTF8.GetString(bytes);
hash.Add(name);
#if DEBUG_LSF_SERIALIZATION
Console.WriteLine(String.Format("{0,3:X}/{1}: {2}", Names.Count - 1, hash.Count - 1, name));
#endif
}
}
}
}