예제 #1
0
        void Parse(Stream s)
        {
            s.Position = 0;
            BinaryReader r = new BinaryReader(s);

            version     = r.ReadUInt32();
            tgiOffset   = r.ReadUInt32() + 8;
            presetCount = r.ReadUInt32();
            if (presetCount != 0)
            {
                throw new Exception("Found non-zero one");
            }
            name = BigEndianUnicodeString.Read(s);

            sortPriority            = r.ReadSingle();
            this.secondarySortIndex = r.ReadUInt16();
            propertyID                      = r.ReadUInt32();
            this.auralMaterialHash          = r.ReadUInt32();
            this.parmFlags                  = (ParmFlag)r.ReadByte();
            this.excludePartFlags           = (ExcludePartFlag)r.ReadUInt64();
            this.excludeModifierRegionFlags = r.ReadUInt32();

            flagList = new FlagList(OnResourceChanged, s);

            this.simlolencePrice    = r.ReadUInt32();
            this.partTitleKey       = r.ReadUInt32();
            this.partDesptionKey    = r.ReadUInt32();
            this.uniqueTextureSpace = r.ReadByte();
            this.bodyType           = r.ReadInt32();
            this.unused1            = r.ReadInt32();
            this.ageGender          = (AgeGenderFlags)r.ReadUInt32();
            this.unused2            = r.ReadByte();
            this.unused3            = r.ReadByte();

            swatchColorCode = new SwatchColorList(OnResourceChanged, s);

            this.buffResKey          = r.ReadByte();
            this.varientThumbnailKey = r.ReadByte();
            if (this.version >= 0x1C)
            {
                this.voiceEffectHash = r.ReadUInt64();
            }
            this.nakedKey  = r.ReadByte();
            this.parentKey = r.ReadByte();
            this.sortLayer = r.ReadInt32();

            // Don't move any of this before the -----
            // TGI block list
            long currentPosition = r.BaseStream.Position;

            r.BaseStream.Position = tgiOffset;
            byte count4 = r.ReadByte();

            tgiList = new CountedTGIBlockList(OnResourceChanged, "IGT", count4, s);
            r.BaseStream.Position = currentPosition;
            lodBlockList          = new LODBlockList(null, s, tgiList);
            //-------------

            byte count = r.ReadByte();

            this.slotKey = new SimpleList <byte>(null);
            for (byte i = 0; i < count; i++)
            {
                this.slotKey.Add(r.ReadByte());
            }

            this.diffuseShadowKey  = r.ReadByte();
            this.shadowKey         = r.ReadByte();
            this.compositionMethod = r.ReadByte();
            this.regionMapKey      = r.ReadByte();
            this.overrides         = r.ReadByte();
            this.normalMapKey      = r.ReadByte();
            this.specularMapKey    = r.ReadByte();
            if (this.version >= 0x1B)
            {
                this.sharedUVMapSpace = r.ReadUInt32();
            }
        }
예제 #2
0
        private void Parse(Stream s)
        {
            s.Position = 0;
            var r = new BinaryReader(s);

            this.version     = r.ReadUInt32();
            this.TGIoffset   = r.ReadUInt32() + 8;
            this.presetCount = r.ReadUInt32();
            if (this.presetCount != 0)
            {
                throw new Exception("Found non-zero one");
            }
            this.name = BigEndianUnicodeString.Read(s);

            this.sortPriority       = r.ReadSingle();
            this.secondarySortIndex = r.ReadUInt16();
            this.propertyID         = r.ReadUInt32();
            this.auralMaterialHash  = r.ReadUInt32();
            this.parmFlags          = (ParmFlag)r.ReadByte();
            this.excludePartFlags   = (ExcludePartFlag)r.ReadUInt64();
            if (this.version >= 36)
            {
                this.excludeModifierRegionFlags = r.ReadUInt64();
            }
            else
            {
                this.excludeModifierRegionFlags = r.ReadUInt32();
            }

            if (this.version >= 37)
            {
                this.flagList = new FlagList(this.OnResourceChanged, s);
            }
            else
            {
                this.flagList = FlagList.CreateWithUInt16Flags(this.OnResourceChanged, s, recommendedApiVersion);
            }

            this.deprecatedPrice    = r.ReadUInt32();
            this.partTitleKey       = r.ReadUInt32();
            this.partDesptionKey    = r.ReadUInt32();
            this.uniqueTextureSpace = r.ReadByte();
            this.bodyType           = (BodyType)r.ReadInt32();
            this.bodySubType        = r.ReadInt32();
            this.ageGender          = (AgeGenderFlags)r.ReadUInt32();
            if (this.version >= 0x20)
            {
                this.reserved1 = r.ReadUInt32();
            }
            if (this.version >= 34)
            {
                this.packID    = r.ReadInt16();
                this.packFlags = (PackFlag)r.ReadByte();
                this.reserved2 = r.ReadBytes(9);
            }
            else
            {
                this.packID  = 0;
                this.unused2 = r.ReadByte();
                if (this.unused2 > 0)
                {
                    this.unused3 = r.ReadByte();
                }
            }

            this.swatchColorCode = new SwatchColorList(this.OnResourceChanged, s);

            this.buffResKey          = r.ReadByte();
            this.varientThumbnailKey = r.ReadByte();
            if (this.version >= 0x1C)
            {
                this.voiceEffectHash = r.ReadUInt64();
            }
            if (this.version >= 0x1E)
            {
                this.usedMaterialCount = r.ReadByte();
                if (this.usedMaterialCount > 0)
                {
                    this.materialSetUpperBodyHash = r.ReadUInt32();
                    this.materialSetLowerBodyHash = r.ReadUInt32();
                    this.materialSetShoesHash     = r.ReadUInt32();
                }
            }
            if (this.version >= 0x1F)
            {
                this.hideForOccultFlags = (OccultTypesDisabled)r.ReadUInt32();
            }
            this.nakedKey  = r.ReadByte();
            this.parentKey = r.ReadByte();
            this.sortLayer = r.ReadInt32();

            // Don't move any of this before the -----
            // TGI block list
            var currentPosition = r.BaseStream.Position;

            r.BaseStream.Position = this.TGIoffset;
            var count4 = r.ReadByte();

            this.tgiList          = new CountedTGIBlockList(this.OnResourceChanged, "IGT", count4, s);
            r.BaseStream.Position = currentPosition;
            this.lodBlockList     = new LODBlockList(null, s, this.tgiList);
            //-------------

            var count = r.ReadByte();

            this.slotKey = new SimpleList <byte>(null);
            for (byte i = 0; i < count; i++)
            {
                this.slotKey.Add(r.ReadByte());
            }

            this.diffuseShadowKey  = r.ReadByte();
            this.shadowKey         = r.ReadByte();
            this.compositionMethod = r.ReadByte();
            this.regionMapKey      = r.ReadByte();
            this.overrides         = new OverrideList(null, s);
            this.normalMapKey      = r.ReadByte();
            this.specularMapKey    = r.ReadByte();
            if (this.version >= 0x1B)
            {
                this.sharedUVMapSpace = r.ReadUInt32();
            }
            if (this.version >= 0x1E)
            {
                this.emissionMapKey = r.ReadByte();
            }
        }