public void Deserialize(Stream input, KeyTable keyTable) { this.Unknown00 = input.ReadValueU32(); this.Unknown04 = input.ReadValueU32(); this.Unknown08 = input.ReadValueU32(); this.Unknown0C = input.ReadValueU32(); this.Unknown10 = input.ReadValueU32(); this.Unknown18 = keyTable.Keys[input.ReadValueS32()]; }
public static KeyTable ReadKeyTable(this Stream stream, int headerSize) { long keyTableOffset = stream.ReadValueS32(); int keyTableSize = stream.ReadValueS32(); keyTableOffset += stream.Position; keyTableOffset -= headerSize; KeyTable keyTable = new KeyTable(); long originalPosition = stream.Position; stream.Seek(keyTableOffset, SeekOrigin.Begin); keyTable.Deserialize(stream); stream.Seek(originalPosition, SeekOrigin.Begin); return(keyTable); }
public void Deserialize(Stream input) { this.Version = input.ReadValueU32(); long keyTableOffset = input.ReadValueS32(); int keyTableSize = input.ReadValueS32(); keyTableOffset += input.Position; keyTableOffset -= 4; if (this.Version >= 3) { this.LocalizationKey = input.ReadValueU64(); } int count = input.ReadValueS32(); if (count < 1 || count > 2) { throw new InvalidOperationException("count cannot be < 1 or > 2"); } this.FacialBlendResourceKeyIndices = new int[count]; for (int i = 0; i < count; i++) { this.FacialBlendResourceKeyIndices[i] = input.ReadValueS32(); } if (this.Version < 3) { this.LocalizationKey = input.ReadValueU64(); } this.Bidirectional = input.ReadValueBoolean(); this.Category = input.ReadValueU32(); this.Region = input.ReadValueU32(); this.SortIndex = this.Version < 3 ? 0 : input.ReadValueU32(); input.Seek(keyTableOffset, SeekOrigin.Begin); this.KeyTable = new KeyTable(); this.KeyTable.Deserialize(input); }
public void Serialize(Stream output, KeyTable keyTable) { throw new NotImplementedException(); }
public Preset(Stream input, KeyTable keyTable) { this.Deserialize(input, keyTable); }
public override void Deserialize(Stream input) { uint version = input.ReadValueU32(); if (version < 17) { throw new FormatException("unsupported version < 17"); } else if (version > 21) { throw new FormatException("unsupported version > 21"); } KeyTable keyTable = input.ReadKeyTable(4); this.DesignModePresets = new List <PresetReference>(); if (version >= 17) { uint count = input.ReadValueU32(); for (uint i = 0; i < count; i++) { PresetReference reference = new PresetReference(); reference.Internal = version >= 21 ? input.ReadValueBoolean() : false; if (reference.Internal == true) { reference.Stream = input.ReadToMemoryStream(input.ReadValueU32()); } else { reference.Name = input.ReadStringUTF16(input.ReadValueU32()); } reference.Unknown = input.ReadValueU32(); this.DesignModePresets.Add(reference); } } base.Deserialize(input); this.Unknown90 = keyTable.Keys[input.ReadValueS32()]; this.UnknownA0 = input.ReadValueU32(); this.UnknownA8 = input.ReadValueU32(); this.UnknownAC = input.ReadValueU32(); this.UnknownDC = input.ReadValueU32(); this.UnknownE0 = input.ReadValueU32(); this.Presets = new List <Preset>(); { byte count = input.ReadValueU8(); for (byte i = 0; i < count; i++) { this.Presets.Add(new Preset(input, keyTable)); } } this.UnknownF8 = input.ReadValueBoolean(); this.Unknown100 = keyTable.Keys[input.ReadValueS32()]; this.UnknownE4 = input.ReadValueU32(); if (version >= 20) { this.RoomTypeFlags = input.ReadValueU32(); this.BuyCategoryFlags = input.ReadValueU32(); this.BuySubCategoryFlags = input.ReadValueU64(); this.BuyRoomSubCategoryFlags = input.ReadValueU64(); this.BuildCategoryFlags = input.ReadValueU32(); } else { this.RoomTypeFlags = input.ReadValueU32(); this.BuyCategoryFlags = input.ReadValueU32(); this.BuySubCategoryFlags = input.ReadValueU64(); this.BuildCategoryFlags = input.ReadValueU32(); } if (this.RoomTypeFlags == 0) { this.RoomTypeFlags = 0x80000000; } if (this.BuyCategoryFlags == 0) { this.BuyCategoryFlags = 0x80000000; } if (this.BuySubCategoryFlags == 0) { this.BuySubCategoryFlags = 0x8000000000000000; } if (this.BuyRoomSubCategoryFlags == 0) { this.BuyRoomSubCategoryFlags = 0x8000000000000000; } if (this.BuildCategoryFlags == 0) { this.BuildCategoryFlags = 0x80000000; } this.FixBuildCategoryFlags(); this.Unknown110 = keyTable.Keys[input.ReadValueS32()]; this.UnknownA4 = input.ReadValueU32(); this.UnknownString1 = input.ReadStringUTF16(input.ReadValueU8(), false); this.UnknownString2 = input.ReadStringUTF16(input.ReadValueU8(), false); if (version >= 19) { this.Unknown150 = input.ReadValueU32(); this.Unknown154 = input.ReadValueU32(); this.Unknown158 = new List <UnknownClass2>(); uint count = input.ReadValueU32(); for (uint i = 0; i < count; i++) { this.Unknown158.Add(new UnknownClass2(input)); } } if (version >= 18) { this.Unknown120 = keyTable.Keys[input.ReadValueS32()]; } }