private void WriteNameTable(Dictionary <uint, string> nameTable, VexDrawTag tableKind) { if (nameTable.Count > 0) { WriteTag(tableKind); //uint idNBits = MinBits((uint)nameTable.Count); string[] names = nameTable.Values.ToArray(); uint namesNBits = GetMaxNBits(names); //WriteNBitsCount(idNBits); WriteNBitsCount(namesNBits); WriteBits(nameTable.Count, 16); foreach (uint id in nameTable.Keys) { WriteBits(id, idBitCount); string s = nameTable[id]; WriteBits(s.Length, 16); foreach (char c in s) { WriteBits((uint)c, namesNBits); } } FlushTag(); } }
private void WriteTag(VexDrawTag tag) { lastTag = tag; lastTagIndex = stream.Position; WriteBits((int)tag, 8); WriteBits(0xFFFFFF, 24); // length, tbd after write }
private void WriteTagLength() { // don't include tag type and length spedifier measures in taglen int tagHeaderSize = 4; long len = stream.Position - lastTagIndex - tagHeaderSize; stream.Seek(-(len + tagHeaderSize), SeekOrigin.Current); WriteBits((int)lastTag, 8); WriteBits((int)len, 24); stream.Seek(len, SeekOrigin.Current); lastTag = VexDrawTag.None; lastTagIndex = 0; }
private void WriteStringTable(List <string> stringTable, VexDrawTag tableKind) { WriteTag(tableKind); uint namesNBits = GetMaxNBits(stringTable); WriteNBitsCount(namesNBits); WriteBits(stringTable.Count, 16); foreach (string s in stringTable) { WriteBits(s.Length, 16); foreach (char c in s) { WriteBits((uint)c, namesNBits); } } FlushTag(); }
private void WriteStringTable(List<string> stringTable, VexDrawTag tableKind) { WriteTag(tableKind); uint namesNBits = GetMaxNBits(stringTable); WriteNBitsCount(namesNBits); WriteBits(stringTable.Count, 16); foreach (string s in stringTable) { WriteBits(s.Length, 16); foreach (char c in s) { WriteBits((uint)c, namesNBits); } } FlushTag(); }
private void WriteNameTable(Dictionary<uint, string> nameTable, VexDrawTag tableKind) { if (nameTable.Count > 0) { WriteTag(tableKind); //uint idNBits = MinBits((uint)nameTable.Count); string[] names = nameTable.Values.ToArray(); uint namesNBits = GetMaxNBits(names); //WriteNBitsCount(idNBits); WriteNBitsCount(namesNBits); WriteBits(nameTable.Count, 16); foreach (uint id in nameTable.Keys) { WriteBits(id, idBitCount); string s = nameTable[id]; WriteBits(s.Length, 16); foreach (char c in s) { WriteBits((uint)c, namesNBits); } } FlushTag(); } }