Example #1
0
        public TextureNative_0015 FromBytes(byte[] data)
        {
            BinaryReader binaryReader = new BinaryReader(new MemoryStream(data));

            sectionIdentifier = (Section)binaryReader.ReadInt32();
            if (sectionIdentifier != Section.TextureNative)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }

            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section textureNativeStructSection = (Section)binaryReader.ReadInt32();

            if (textureNativeStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            textureNativeStruct = new TextureNativeStruct_0001().Read(binaryReader);

            Section textureNativeExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureNativeExtensionSection == Section.Extension)
            {
                textureNativeExtension = new Extension_0003().Read(binaryReader);
            }

            return(this);
        }
Example #2
0
        public TextureNative_0015 Read(BinaryReader binaryReader)
        {
            sectionIdentifier = Section.TextureNative;
            sectionSize       = binaryReader.ReadInt32();
            renderWareVersion = binaryReader.ReadInt32();

            Section textureNativeStructSection = (Section)binaryReader.ReadInt32();

            if (textureNativeStructSection != Section.Struct)
            {
                throw new Exception(binaryReader.BaseStream.Position.ToString());
            }
            textureNativeStruct = new TextureNativeStruct_0001().Read(binaryReader);

            Section textureNativeExtensionSection = (Section)binaryReader.ReadInt32();

            if (textureNativeExtensionSection == Section.Extension)
            {
                textureNativeExtension = new Extension_0003().Read(binaryReader);
            }

            return(this);
        }