Inheritance: ValveResourceFormat.Blocks.ResourceData
Ejemplo n.º 1
0
        public override void Read(BinaryReader reader, Resource resource)
        {
            Resource = resource;

            if (!resource.ContainsBlockType(BlockType.NTRO))
            {
                var kv3 = new BinaryKV3(KVBlockType)
                {
                    Offset = Offset,
                    Size   = Size,
                };
                kv3.Read(reader, resource);
                Data        = kv3.Data;
                BackingData = kv3;
            }
            else
            {
                var ntro = new NTRO
                {
                    StructName = IntrospectionStructName,
                    Offset     = Offset,
                    Size       = Size,
                };
                ntro.Read(reader, resource);
                Data        = ntro.Output;
                BackingData = ntro;
            }
        }
        public override void Read(BinaryReader reader, Resource resource)
        {
            reader.BaseStream.Position = Offset;

            if (resource.ContainsBlockType(BlockType.NTRO))
            {
                var ntro = new NTRO
                {
                    StructName = "ResourceManifest_t",
                    Offset     = Offset,
                    Size       = Size,
                };
                ntro.Read(reader, resource);

                Resources = new List <List <string> >
                {
                    new List <string>(ntro.Output.GetArray <string>("m_ResourceFileNameList")),
                };

                return;
            }

            var version = reader.ReadInt32();

            if (version != 8)
            {
                throw new UnexpectedMagicException("Unknown version", version, nameof(version));
            }

            Resources = new List <List <string> >();

            var blockCount = reader.ReadInt32();

            for (var block = 0; block < blockCount; block++)
            {
                var strings        = new List <string>();
                var originalOffset = reader.BaseStream.Position;
                var offset         = reader.ReadInt32();
                var count          = reader.ReadInt32();

                reader.BaseStream.Position = originalOffset + offset;

                for (var i = 0; i < count; i++)
                {
                    var returnOffset = reader.BaseStream.Position;
                    var stringOffset = reader.ReadInt32();
                    reader.BaseStream.Position = returnOffset + stringOffset;

                    var value = reader.ReadNullTermString(Encoding.UTF8);
                    strings.Add(value);

                    reader.BaseStream.Position = returnOffset + 4;
                }

                reader.BaseStream.Position = originalOffset + 8;

                Resources.Add(strings);
            }
        }
Ejemplo n.º 3
0
        public override void Read(BinaryReader reader, Resource resource)
        {
            Reader = reader;

            reader.BaseStream.Position = this.Offset;

            if(resource.Blocks.ContainsKey(BlockType.NTRO))
            {
                NTROBlock = new NTRO();
                NTROBlock.Offset = this.Offset;
                NTROBlock.Size = this.Size;
                NTROBlock.Read(reader, resource);
            }

            DataOffset = this.Offset + this.Size;
        }
Ejemplo n.º 4
0
        public override void Read(BinaryReader reader, Resource resource)
        {
            Reader = reader;

            reader.BaseStream.Position = this.Offset;

            if (resource.Blocks.ContainsKey(BlockType.NTRO))
            {
                NTROBlock        = new NTRO();
                NTROBlock.Offset = this.Offset;
                NTROBlock.Size   = this.Size;
                NTROBlock.Read(reader, resource);
            }

            DataOffset = this.Offset + this.Size;
        }
 public AnimationGroupLoader(Resource resource, string filename, Skeleton skeleton)
 {
     data = (NTRO)resource.Blocks[BlockType.DATA];
     LoadAnimationGroup(filename, skeleton);
 }