Inheritance: Glare.Assets.ArchiveAsset
Exemplo n.º 1
0
        public override LoadMatchStrength LoadMatch(AssetLoader loader)
        {
            StringPackage.Node[] nodes = StringPackage.ReadNodes(loader.Reader);
            if (nodes == null || !nodes[nodes.Length - 1].CheckValidity(nodes.Length - 1, nodes))
            {
                return(LoadMatchStrength.None);
            }

            return(LoadMatchStrength.Medium);
        }
Exemplo n.º 2
0
        internal StringBlock(StringPackage package, int id, BinaryReader reader, uint offset, StringPackage.Node[] nodes)
            : base(package, id.ToString())
        {
            Id = id;

            reader.BaseStream.Position = offset;
            int count = reader.ReadUInt16();
            uint[] offsets = new uint[count];
            char[] buffer = new char[256 * 256];

            for (int index = 0; index < count; index++)
                offsets[index] = (uint)(offset + 2 + 2 * count + reader.ReadUInt16());
            for (int index = 0; index < count; index++)
                new StringValue(this, index, offsets[index], reader, nodes, buffer);
        }
Exemplo n.º 3
0
        internal StringBlock(StringPackage package, int id, BinaryReader reader, uint offset, StringPackage.Node[] nodes)
            : base(package, id.ToString())
        {
            Id = id;

            reader.BaseStream.Position = offset;
            int count = reader.ReadUInt16();

            uint[] offsets = new uint[count];
            char[] buffer  = new char[256 * 256];

            for (int index = 0; index < count; index++)
            {
                offsets[index] = (uint)(offset + 2 + 2 * count + reader.ReadUInt16());
            }
            for (int index = 0; index < count; index++)
            {
                new StringValue(this, index, offsets[index], reader, nodes, buffer);
            }
        }
Exemplo n.º 4
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);
        }