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 CASPartResource.SwatchColorList(OnResourceChanged, s); this.flagList = new CASPartResource.FlagList(OnResourceChanged, s); }
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 CASPartResource.SwatchColorList(OnResourceChanged); this.colorList.UnParse(ms); if (this.flagList == null) this.flagList = new CASPartResource.FlagList(OnResourceChanged); this.flagList.UnParse(ms); ms.Position = 0; return ms; }