示例#1
0
        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();
            }
        }
示例#2
0
 private void WriteTag(VexDrawTag tag)
 {
     lastTag      = tag;
     lastTagIndex = stream.Position;
     WriteBits((int)tag, 8);
     WriteBits(0xFFFFFF, 24); // length, tbd after write
 }
示例#3
0
        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;
        }
示例#4
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();
        }
示例#5
0
        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;
        }
示例#6
0
 private void WriteTag(VexDrawTag tag)
 {
     lastTag = tag;
     lastTagIndex = stream.Position;
     WriteBits((int)tag, 8);
     WriteBits(0xFFFFFF, 24); // length, tbd after write
 }
示例#7
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();
        }
示例#8
0
        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();
            }
        }