Inheritance: Glare.Assets.FolderAsset
Beispiel #1
0
        internal StringValue(StringBlock block, int index, uint offset, BinaryReader reader, StringPackage.Node[] nodes, char[] buffer)
            : base(block, "")
        {
            Index = index;

            reader.BaseStream.Position = offset;

            int bitCount = 0, bits = 0;
            int length = 0;

            while (true)
            {
                StringPackage.Node node = nodes[nodes.Length - 1];

                while (node.Left != 0xFF)
                {
                    if (bitCount == 0)
                    {
                        bits      = reader.ReadByte();
                        bitCount += 8;
                    }

                    if ((bits & 0x80) != 0)
                    {
                        node = nodes[node.Right];
                    }
                    else
                    {
                        node = nodes[node.Left];
                    }

                    bits <<= 1;
                    bitCount--;
                }

                char value = (char)node.Value;
                if (value == '|')
                {
                    break;
                }
                buffer[length++] = value;
            }

            Name = new string(buffer, 0, length);
        }
        internal StringValue(StringBlock block, int index, uint offset, BinaryReader reader, StringPackage.Node[] nodes, char[] buffer)
            : base(block, "")
        {
            Index = index;

            reader.BaseStream.Position = offset;

            int bitCount = 0, bits = 0;
            int length = 0;

            while (true) {
                StringPackage.Node node = nodes[nodes.Length - 1];

                while (node.Left != 0xFF) {
                    if (bitCount == 0) {
                        bits = reader.ReadByte();
                        bitCount += 8;
                    }

                    if ((bits & 0x80) != 0)
                        node = nodes[node.Right];
                    else
                        node = nodes[node.Left];

                    bits <<= 1;
                    bitCount--;
                }

                char value = (char)node.Value;
                if (value == '|')
                    break;
                buffer[length++] = value;
            }

            Name = new string(buffer, 0, length);
        }