public static RegionType GetRegionType(ClothingCategoryFlags value) { uint raw = (uint)value; raw >>= 25; return((RegionType)(raw & 0x0F)); }
void Parse(Stream s) { int tgiPosn; BinaryReader r = new BinaryReader(s); version = r.ReadUInt32(); tgiPosn = r.ReadInt32() + 8; presets = new PresetList(OnResourceChanged, s); unknown1 = BigEndianUnicodeString.Read(s); sortPriority = r.ReadSingle(); unknown2 = r.ReadByte(); clothing = (ClothingType)r.ReadUInt32(); dataType = (DataTypeFlags)r.ReadUInt32(); ageGender = new AgeGenderFlags(0, OnResourceChanged, s); clothingCategory = (ClothingCategoryFlags)r.ReadUInt32(); casPart1Index = r.ReadByte(); casPart2Index = r.ReadByte(); blendInfoFatIndex = r.ReadByte(); blendInfoFitIndex = r.ReadByte(); blendInfoThinIndex = r.ReadByte(); blendInfoSpecialIndex = r.ReadByte(); overlayPriority = r.ReadUInt32(); vpxyIndexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); lodInfo = new LODInfoEntryList(OnResourceChanged, s); diffuse1Indexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); specular1Indexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); diffuse2Indexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); specular2Indexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); bondIndexes = new ByteIndexList(OnResourceChanged, s, ReadByte, WriteByte); unknown4 = BigEndianUnicodeString.Read(s); if (checking) { if (tgiPosn != s.Position) { throw new InvalidDataException(String.Format("Position of TGIBlock read: 0x{0:X8}, actual: 0x{1:X8}", tgiPosn, s.Position)); } } byte count = r.ReadByte(); tgiBlocks = new CountedTGIBlockList(OnResourceChanged, "IGT", count, s); vpxyIndexes.ParentTGIBlocks = diffuse1Indexes.ParentTGIBlocks = specular1Indexes.ParentTGIBlocks = diffuse2Indexes.ParentTGIBlocks = specular2Indexes.ParentTGIBlocks = bondIndexes.ParentTGIBlocks = tgiBlocks; }