Example #1
0
        protected override Stream UnParse()
        {
            MemoryStream ms = new MemoryStream();
            BinaryWriter w  = new BinaryWriter(ms);

            w.Write(this.version);
            w.Write(this.rleInstance);
            if (this.overlayList == null)
            {
                this.overlayList = new OverlayReferenceList(this.OnResourceChanged);
            }
            this.overlayList.UnParse(ms);
            w.Write(this.colorizeSaturation);
            w.Write(this.colorizeHue);
            w.Write(this.colorizeOpacity);

            this.flagList = this.flagList ?? new FlagList(this.OnResourceChanged);
            if (this.version > 6)
            {
                this.flagList.UnParse(ms);
            }
            else
            {
                this.flagList.WriteUInt16Flags(ms);
            }
            w.Write(this.makeupOpacity);
            if (this.swatchList == null)
            {
                this.swatchList = new SwatchColorList(this.OnResourceChanged);
            }
            this.swatchList.UnParse(ms);
            w.Write(this.sortOrder);
            w.Write(this.makeupOpacity2);
            return(ms);
        }
 protected override Stream UnParse()
 {
     var s = base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     if (this.modlList == null)
     {                                           
         TGIBlock[] tgiList = new TGIBlock[8];
         for (int i = 0; i < 8; i++) tgiList[i] = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
         this.modlList = new CountedTGIBlockList(OnResourceChanged, tgiList);
     }
     foreach (var tgi in this.modlList)
     {
         // There is a bug in Peter's code.
         // The TGIBlcok being copied for several times and the TGI order got lost
         w.Write(tgi.Instance);
         w.Write(tgi.ResourceType);
         w.Write(tgi.ResourceGroup);
     }
     w.Write(this.unknown1);
     w.Write(this.unknown2);
     w.Write(this.unknown3);
     if (colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     return s;
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            this.unknown1 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(7 * 4));
            this.unknownFlags1 = r.ReadUInt32();
            this.unknownFlags2 = r.ReadUInt32();
            this.unknownFlags3 = r.ReadUInt32();
            this.unknownFlags4 = r.ReadUInt32();
            this.unknownFlags5 = r.ReadUInt32();
            this.unknownInstance1 = r.ReadUInt64();
            this.unknown2 = r.ReadByte();
            this.unknownInstance2 = r.ReadUInt64();
            this.unknown3 = r.ReadByte();
            this.colorList = new SwatchColorList(OnResourceChanged, s);
            this.unknownFlags = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(5));
            this.buildBuyMode = r.ReadBoolean();

            if (base.Version >= 0x19)
            {
                this.unknown4 = r.ReadUInt32();
                this.unknown5 = r.ReadUInt32();
                this.unknown6 = r.ReadUInt32();
                this.unknown7 = r.ReadUInt32();
            }
        }
Example #4
0
        protected override Stream UnParse()
        {
            MemoryStream ms = new MemoryStream();
            BinaryWriter w  = new BinaryWriter(ms);

            w.Write(this.version);
            w.Write((uint)this.ageGender);
            w.Write(this.groupingID);
            w.Write(this.unknown1);
            w.Write(this.simOutfitReference);
            w.Write(this.textureReference);
            w.Write(this.simDataReference);
            w.Write(this.nameHash);
            w.Write(this.descHash);
            this.unknown2.UnParse(ms);
            w.Write(this.unknown3);
            w.Write(this.animationReference1);
            w.Write(Encoding.ASCII.GetByteCount(this.animationStateName1));
            w.Write(Encoding.ASCII.GetBytes(this.animationStateName1));
            w.Write(this.animationReference2);
            w.Write(Encoding.ASCII.GetByteCount(this.animationStateName2));
            w.Write(Encoding.ASCII.GetBytes(this.animationStateName2));
            if (this.colorList == null)
            {
                this.colorList = new SwatchColorList(OnResourceChanged);
            }
            this.colorList.UnParse(ms);
            if (this.flagList == null)
            {
                this.flagList = new FlagList(OnResourceChanged);
            }
            this.flagList.UnParse(ms);
            ms.Position = 0;
            return(ms);
        }
Example #5
0
 protected override void Parse(Stream s)
 {
     base.Parse(s);
     BinaryReader r = new BinaryReader(s);
     this.unknown = r.ReadUInt32();
     this.matdTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.cflrTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.catalogGroupID = r.ReadUInt64();
     this.colorList = new SwatchColorList(OnResourceChanged, s);
 }
Example #6
0
 protected override void Parse(Stream s)
 {
     BinaryReader r = new BinaryReader(s);
     base.Parse(s);
     this.matdList = new MATDList(OnResourceChanged, s);
     this.thumList = new ThumbnailList(OnResourceChanged, s);
     this.unknown1 = r.ReadUInt32();
     this.colorList = new SwatchColorList(OnResourceChanged, s);
     this.catalogGroupID = r.ReadUInt64();
 }
 protected override void Parse(Stream s)
 {
     BinaryReader r = new BinaryReader(s);
     base.Parse(s);
     TGIBlock[] tgiList = new TGIBlock[8];
     for (int i = 0; i < 8; i++) tgiList[i] = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlList = new CountedTGIBlockList(OnResourceChanged, "ITG", tgiList);
     this.unknown1 = r.ReadUInt32();
     this.unknown2 = r.ReadUInt64();
     this.unknown3 = r.ReadUInt32();
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList = new SwatchColorList(OnResourceChanged, s);
 }
Example #8
0
 protected override Stream UnParse()
 {
     var s = base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     w.Write(this.unknown);
     if (this.matdTGIReference == null) this.matdTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.matdTGIReference.UnParse(s);
     if (this.cflrTGIReference == null) this.cflrTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.cflrTGIReference.UnParse(s);
     w.Write(this.catalogGroupID);
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     return s;
 }
Example #9
0
 protected override Stream UnParse()
 {
     var s =  base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     if (this.matdList == null) this.matdList = new MATDList(OnResourceChanged);
     matdList.UnParse(s);
     if (this.thumList == null) this.thumList = new ThumbnailList(OnResourceChanged);
     this.thumList.UnParse(s);
     w.Write(this.unknown1);
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     w.Write(this.catalogGroupID);
     return s;
 }
 protected override void Parse(Stream s)
 {
     base.Parse(s);
     BinaryReader r = new BinaryReader(s);
     this.modlEntryList1 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList2 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList3 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList4 = new ModlEntryList(OnResourceChanged, s);
     this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.unknown = r.ReadUInt32();
     this.catalogGroupID = r.ReadUInt64();
     this.colorList = new SwatchColorList(OnResourceChanged, s);
 }
Example #11
0
        void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            s.Position               = 0;
            this.version             = r.ReadUInt32();
            this.ageGender           = (AgeGenderFlags)r.ReadUInt32();
            this.groupingID          = r.ReadUInt64();
            this.unknown1            = r.ReadByte();
            this.simOutfitReference  = r.ReadUInt64();
            this.textureReference    = r.ReadUInt64();
            this.simDataReference    = r.ReadUInt64();
            this.nameHash            = r.ReadUInt32();
            this.descHash            = r.ReadUInt32();
            this.unknown2            = new DataBlobHandler(recommendedApiVersion, OnResourceChanged, r.ReadBytes(14));
            this.unknown3            = r.ReadUInt32();
            this.animationReference1 = r.ReadUInt64();
            this.animationStateName1 = System.Text.Encoding.ASCII.GetString(r.ReadBytes(r.ReadInt32()));
            this.animationReference2 = r.ReadUInt64();
            this.animationStateName2 = System.Text.Encoding.ASCII.GetString(r.ReadBytes(r.ReadInt32()));
            this.colorList           = new SwatchColorList(OnResourceChanged, s);
            this.flagList            = new FlagList(OnResourceChanged, s);
        }
Example #12
0
        private void Parse(Stream s)
        {
            BinaryReader reader = new BinaryReader(s);

            s.Position              = 0;
            this.version            = reader.ReadUInt32();
            this.rleInstance        = reader.ReadUInt64();
            this.overlayList        = new OverlayReferenceList(this.OnResourceChanged, s);
            this.colorizeSaturation = reader.ReadUInt16();
            this.colorizeHue        = reader.ReadUInt16();
            this.colorizeOpacity    = reader.ReadUInt32();
            if (this.version > 6)
            {
                this.flagList = new FlagList(this.OnResourceChanged, s);
            }
            else
            {
                this.flagList = FlagList.CreateWithUInt16Flags(this.OnResourceChanged, s, SkinToneResource.recommendedApiVersion);
            }
            this.makeupOpacity  = reader.ReadSingle();
            this.swatchList     = new SwatchColorList(this.OnResourceChanged, s);
            this.sortOrder      = reader.ReadSingle();
            this.makeupOpacity2 = reader.ReadSingle();
        }
Example #13
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();
            }
        }
Example #14
0
        protected override Stream UnParse()
        {
            MemoryStream s = new MemoryStream();
            BinaryWriter w = new BinaryWriter(s);

            w.Write(this.version);
            w.Write(0); // tgi offset
            w.Write(presetCount);
            BigEndianUnicodeString.Write(s, name);
            w.Write(sortPriority);
            w.Write(secondarySortIndex);
            w.Write(propertyID);
            w.Write(auralMaterialHash);
            w.Write((byte)parmFlags);
            w.Write((ulong)excludePartFlags);
            w.Write(excludeModifierRegionFlags);
            if (this.flagList == null)
            {
                this.flagList = new FlagList(OnResourceChanged);
            }
            flagList.UnParse(s);
            w.Write(simlolencePrice);
            w.Write(partTitleKey);
            w.Write(partDesptionKey);
            w.Write(uniqueTextureSpace);
            w.Write(bodyType);
            w.Write(unused1);
            w.Write((uint)ageGender);
            w.Write(unused2);
            w.Write(unused3);
            if (this.swatchColorCode == null)
            {
                this.swatchColorCode = new SwatchColorList(OnResourceChanged);
            }
            swatchColorCode.UnParse(s);
            w.Write(buffResKey);
            w.Write(varientThumbnailKey);
            if (this.version >= 0x1C)
            {
                w.Write(voiceEffectHash);
            }
            w.Write(nakedKey);
            w.Write(parentKey);
            w.Write(sortLayer);
            if (this.lodBlockList == null)
            {
                this.lodBlockList = new LODBlockList(OnResourceChanged);
            }
            lodBlockList.UnParse(s);
            if (this.slotKey == null)
            {
                this.slotKey = new SimpleList <byte>(OnResourceChanged);
            }
            w.Write((byte)this.slotKey.Count);
            foreach (var b in this.slotKey)
            {
                w.Write(b);
            }
            w.Write(diffuseShadowKey);
            w.Write(shadowKey);
            w.Write(compositionMethod);
            w.Write(regionMapKey);
            w.Write(overrides);
            w.Write(normalMapKey);
            w.Write(specularMapKey);
            if (this.version >= 0x1B)
            {
                w.Write(sharedUVMapSpace);
            }
            long tgiPosition = w.BaseStream.Position;

            w.BaseStream.Position = 4;
            w.Write(tgiPosition - 8);
            w.BaseStream.Position = tgiPosition;
            if (this.tgiList == null)
            {
                this.tgiList = new CountedTGIBlockList(OnResourceChanged);
            }
            w.Write((byte)tgiList.Count);
            foreach (var tgi in tgiList)
            {
                tgi.UnParse(s);
            }

            return(s);
        }
        protected override Stream UnParse()
        {
            var s =  base.UnParse();
            BinaryWriter w = new BinaryWriter(s);
            if (this.unknown1 == null) this.unknown1 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, new byte[7 * 4]);
            this.unknown1.UnParse(s);
            w.Write(this.unknownFlags1);
            w.Write(this.unknownFlags2);
            w.Write(this.unknownFlags3);
            w.Write(this.unknownFlags4);
            w.Write(this.unknownFlags5);
            w.Write(this.unknownInstance1);
            w.Write(this.unknown2);
            w.Write(this.unknownInstance2);
            w.Write(this.unknown3);
            if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
            this.colorList.UnParse(s);
            if (this.unknownFlags == null) this.unknownFlags = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, new byte[5]);
            this.unknownFlags.UnParse(s);
            w.Write(this.buildBuyMode);

            if (base.Version >= 0x19)
            {
                w.Write(this.unknown4);
                w.Write(this.unknown5);
                w.Write(this.unknown6);
                w.Write(this.unknown7);
            }
            return s;
        }
Example #16
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();
            }
        }
Example #17
0
        protected override Stream UnParse()
        {
            var s = new MemoryStream();
            var w = new BinaryWriter(s);

            w.Write(this.version);
            w.Write(0); // tgi offset
            w.Write(this.presetCount);
            BigEndianUnicodeString.Write(s, this.name);
            w.Write(this.sortPriority);
            w.Write(this.secondarySortIndex);
            w.Write(this.propertyID);
            w.Write(this.auralMaterialHash);
            w.Write((byte)this.parmFlags);
            w.Write((ulong)this.excludePartFlags);
            if (this.version >= 36)
            {
                w.Write(this.excludeModifierRegionFlags);
            }
            else
            {
                w.Write((uint)this.excludeModifierRegionFlags);
            }

            this.flagList = this.flagList ?? new FlagList(this.OnResourceChanged);
            if (this.version >= 37)
            {
                this.flagList.UnParse(s);
            }
            else
            {
                this.flagList.WriteUInt16Flags(s);
            }
            w.Write(this.deprecatedPrice);
            w.Write(this.partTitleKey);
            w.Write(this.partDesptionKey);
            w.Write(this.uniqueTextureSpace);
            w.Write((uint)this.bodyType);
            w.Write(this.bodySubType);
            w.Write((uint)this.ageGender);
            if (this.version >= 0x20)
            {
                w.Write(this.reserved1);
            }
            if (this.version >= 34)
            {
                w.Write(this.packID);
                w.Write((byte)this.packFlags);
                if (this.reserved2 == null)
                {
                    this.reserved2 = new byte[9];
                }
                w.Write(this.reserved2);
            }
            else
            {
                w.Write(this.unused2);
                if (this.unused2 > 0)
                {
                    w.Write(this.unused3);
                }
            }
            if (this.swatchColorCode == null)
            {
                this.swatchColorCode = new SwatchColorList(this.OnResourceChanged);
            }
            this.swatchColorCode.UnParse(s);
            w.Write(this.buffResKey);
            w.Write(this.varientThumbnailKey);
            if (this.version >= 0x1C)
            {
                w.Write(this.voiceEffectHash);
            }
            if (this.version >= 0x1E)
            {
                w.Write(this.usedMaterialCount);
                if (this.usedMaterialCount > 0)
                {
                    w.Write(this.materialSetUpperBodyHash);
                    w.Write(this.materialSetLowerBodyHash);
                    w.Write(this.materialSetShoesHash);
                }
            }
            if (this.version >= 0x1F)
            {
                w.Write((uint)this.hideForOccultFlags);
            }
            w.Write(this.nakedKey);
            w.Write(this.parentKey);
            w.Write(this.sortLayer);
            if (this.lodBlockList == null)
            {
                this.lodBlockList = new LODBlockList(this.OnResourceChanged);
            }
            this.lodBlockList.UnParse(s);
            if (this.slotKey == null)
            {
                this.slotKey = new SimpleList <byte>(this.OnResourceChanged);
            }
            w.Write((byte)this.slotKey.Count);
            foreach (var b in this.slotKey)
            {
                w.Write(b);
            }
            w.Write(this.diffuseShadowKey);
            w.Write(this.shadowKey);
            w.Write(this.compositionMethod);
            w.Write(this.regionMapKey);
            if (this.overrides == null)
            {
                this.overrides = new OverrideList(this.OnResourceChanged);
            }
            this.overrides.UnParse(s);
            w.Write(this.normalMapKey);
            w.Write(this.specularMapKey);
            if (this.version >= 0x1B)
            {
                w.Write(this.sharedUVMapSpace);
            }
            if (this.version >= 0x1E)
            {
                w.Write(this.emissionMapKey);
            }
            var tgiPosition = w.BaseStream.Position;

            w.BaseStream.Position = 4;
            w.Write(tgiPosition - 8);
            w.BaseStream.Position = tgiPosition;
            if (this.tgiList == null)
            {
                this.tgiList = new CountedTGIBlockList(this.OnResourceChanged);
            }
            w.Write((byte)this.tgiList.Count);
            foreach (var tgi in this.tgiList)
            {
                tgi.UnParse(s);
            }

            return(s);
        }
Example #18
0
        protected override void Parse(Stream s)
        {
            base.Parse(s);
            BinaryReader r = new BinaryReader(s);
            this.unknown1 = r.ReadUInt32();
            this.unknown2 = r.ReadUInt32();
            this.unknown3 = r.ReadUInt32();
            this.unknown4 = r.ReadUInt32();
            this.unknown5 = r.ReadUInt32();
            this.unknown6 = r.ReadUInt32();
            this.unknown7 = r.ReadUInt32();
            this.dataBlob1 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(17));
            this.unknown8 = r.ReadUInt32();
            this.unknown9 = r.ReadUInt64();
            this.catalogGroupID = r.ReadUInt64();
            this.unknown10 = r.ReadByte();
            this.colorList = new SwatchColorList(OnResourceChanged, s);
            this.unknown11 = r.ReadUInt32();
            this.unknown12 = r.ReadUInt16();
            if (base.Version >= 0x19) this.dataBlob2 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(16));
            this.unknown13 = r.ReadUInt32();
            this.tgiReferenceFlag = r.ReadUInt32();

            if (this.tgiReferenceFlag == 0x01)
            {
                this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference8 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.modlTGIReference9 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);

                this.ftptTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference8 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.ftptTGIReference9 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
            }
            else
            {
                this.nullTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.nullTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.nullTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
                this.nullTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
            }
        }
Example #19
0
        protected override Stream UnParse()
        {
            var s = base.UnParse();
            BinaryWriter w = new BinaryWriter(s);
            w.Write(this.unknown1);
            w.Write(this.unknown2);
            w.Write(this.unknown3);
            w.Write(this.unknown4);
            w.Write(this.unknown5);
            w.Write(this.unknown6);
            w.Write(this.unknown7);
            if (this.dataBlob1 == null) this.dataBlob1 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, new byte[17]);
            this.dataBlob1.UnParse(s);
            w.Write(this.unknown8);
            w.Write(this.unknown9);
            w.Write(this.catalogGroupID);
            w.Write(this.unknown10);
            if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
            this.colorList.UnParse(s);
            w.Write(this.unknown11);
            w.Write(this.unknown12);
            if (base.Version >= 0x19)
            {
                if (this.dataBlob2 == null) this.dataBlob2 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, new byte[16]);
                this.dataBlob2.UnParse(s);
            }
            w.Write(this.unknown13);
            w.Write(this.tgiReferenceFlag);

            if (this.tgiReferenceFlag == 0x01)
            {
                if (this.modlTGIReference1 == null) this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference1.UnParse(s);
                if (this.modlTGIReference2 == null) this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference2.UnParse(s);
                if (this.modlTGIReference3 == null) this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference3.UnParse(s);
                if (this.modlTGIReference4 == null) this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference4.UnParse(s);
                if (this.modlTGIReference5 == null) this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference5.UnParse(s);
                if (this.modlTGIReference6 == null) this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference6.UnParse(s);
                if (this.modlTGIReference7 == null) this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference7.UnParse(s);
                if (this.modlTGIReference8 == null) this.modlTGIReference8 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference8.UnParse(s);
                if (this.modlTGIReference9 == null) this.modlTGIReference9 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.modlTGIReference9.UnParse(s);

                if (this.ftptTGIReference1 == null) this.ftptTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference1.UnParse(s);
                if (this.ftptTGIReference2 == null) this.ftptTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference2.UnParse(s);
                if (this.ftptTGIReference3 == null) this.ftptTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference3.UnParse(s);
                if (this.ftptTGIReference4 == null) this.ftptTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference4.UnParse(s);
                if (this.ftptTGIReference5 == null) this.ftptTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference5.UnParse(s);
                if (this.ftptTGIReference6 == null) this.ftptTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference6.UnParse(s);
                if (this.ftptTGIReference7 == null) this.ftptTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference7.UnParse(s);
                if (this.ftptTGIReference8 == null) this.ftptTGIReference8 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference8.UnParse(s);
                if (this.ftptTGIReference9 == null) this.ftptTGIReference9 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.ftptTGIReference9.UnParse(s);
            }
            else
            {
                if (this.nullTGIReference1 == null) this.nullTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.nullTGIReference1.UnParse(s);
                if (this.nullTGIReference2 == null) this.nullTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.nullTGIReference2.UnParse(s);
                if (this.nullTGIReference3 == null) this.nullTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.nullTGIReference3.UnParse(s);
                if (this.nullTGIReference4 == null) this.nullTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
                this.nullTGIReference4.UnParse(s);
            }
            return s;
        }
Example #20
0
 protected override Stream UnParse()
 {
     var s = base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     if (this.modlEntryList1 == null) this.modlEntryList1 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList1.UnParse(s);
     if (this.modlEntryList2 == null) this.modlEntryList2 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList2.UnParse(s);
     if (this.modlEntryList3 == null) this.modlEntryList3 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList3.UnParse(s);
     if (this.modlEntryList4 == null) this.modlEntryList4 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList4.UnParse(s);
     if (this.modlTGIReference1 == null) this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference1.UnParse(s);
     if (this.modlTGIReference2 == null) this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference2.UnParse(s);
     if (this.modlTGIReference3 == null) this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference3.UnParse(s);
     if (this.modlTGIReference4 == null) this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference4.UnParse(s);
     if (this.modlTGIReference5 == null) this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference5.UnParse(s);
     if (this.modlTGIReference6 == null) this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference6.UnParse(s);
     if (this.modlTGIReference7 == null) this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference7.UnParse(s);
     w.Write(this.unknown1);
     w.Write(this.unknown2);
     w.Write(this.unknown3);
     w.Write(this.catalogGroupID);
     if (this.rsltTGIReference == null) this.rsltTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.rsltTGIReference.UnParse(s);            
     if (this.unknownList1 == null) this.unknownList1 = new SimpleList<uint>(OnResourceChanged);
     w.Write((ushort)this.unknownList1.Count);
     foreach (var i in this.unknownList1) w.Write(i);            
     if (this.unknownList2 == null) this.unknownList2 = new SimpleList<uint>(OnResourceChanged);
     w.Write((ushort)this.unknownList2.Count);
     foreach (var i in this.unknownList2) w.Write(i);
     if (this.unknownList3 == null) this.unknownList3 = new SimpleList<uint>(OnResourceChanged);
     w.Write((ushort)this.unknownList3.Count);
     foreach (var i in this.unknownList3) w.Write(i);        
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     w.Write(this.unknown1);
     return s;
 }
Example #21
0
 protected override void Parse(Stream s)
 {
     base.Parse(s);
     BinaryReader r = new BinaryReader(s);
     this.modlEntryList1 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList2 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList3 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList4 = new ModlEntryList(OnResourceChanged, s);
     this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.unknown1 = r.ReadUInt32();
     this.unknown2 = r.ReadByte();
     this.unknown3 = r.ReadUInt32();
     this.catalogGroupID = r.ReadUInt64();
     this.rsltTGIReference = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG", s);
     this.unknownList1 = new SimpleList<uint>(OnResourceChanged);
     ushort count = r.ReadUInt16();
     for (int i = 0; i < count; i++) this.unknownList1.Add(r.ReadUInt32());
     this.unknownList2 = new SimpleList<uint>(OnResourceChanged);
     count = r.ReadUInt16();
     for (int i = 0; i < count; i++) this.unknownList2.Add(r.ReadUInt32());
     count = r.ReadUInt16();
     this.unknownList3 = new SimpleList<uint>(OnResourceChanged);
     for (int i = 0; i < count; i++) this.unknownList3.Add(r.ReadUInt32());
     this.colorList = new SwatchColorList(OnResourceChanged, s);
     this.unknown4 = r.ReadUInt32();
 }
 protected override Stream UnParse()
 {
     var s = base.UnParse();
     BinaryWriter w = new BinaryWriter(s);
     if (this.modlEntryList1 == null) this.modlEntryList1 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList1.UnParse(s);
     if (this.modlEntryList2 == null) this.modlEntryList2 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList2.UnParse(s);
     if (this.modlEntryList3 == null) this.modlEntryList3 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList3.UnParse(s);
     if (this.modlEntryList4 == null) this.modlEntryList4 = new ModlEntryList(OnResourceChanged, s);
     this.modlEntryList4.UnParse(s);
     if (this.modlTGIReference1 == null) this.modlTGIReference1 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference1.UnParse(s);
     if (this.modlTGIReference2 == null) this.modlTGIReference2 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference2.UnParse(s);
     if (this.modlTGIReference3 == null) this.modlTGIReference3 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference3.UnParse(s);
     if (this.modlTGIReference4 == null) this.modlTGIReference4 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference4.UnParse(s);
     if (this.modlTGIReference5 == null) this.modlTGIReference5 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference5.UnParse(s);
     if (this.modlTGIReference6 == null) this.modlTGIReference6 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference6.UnParse(s);
     if (this.modlTGIReference7 == null) this.modlTGIReference7 = new TGIBlock(RecommendedApiVersion, OnResourceChanged, "ITG");
     this.modlTGIReference7.UnParse(s);
     w.Write(this.unknown);
     w.Write(this.catalogGroupID);
     if (this.colorList == null) this.colorList = new SwatchColorList(OnResourceChanged);
     this.colorList.UnParse(s);
     return s;
 }