From 49cdd6ad0431f81683d0c91a0f3c53327b4ff474 Mon Sep 17 00:00:00 2001 From: Cam Sinclair Date: Sat, 16 Nov 2024 22:23:24 +1000 Subject: [PATCH] Update to use SerdesNet 3.0.1 --- src/Config/AssetId.cs | 4 +- src/Config/IAssetContainer.cs | 2 +- src/Config/IAssetLoader.cs | 4 +- src/Config/UAlbion.Config.csproj | 4 +- src/Core/UAlbion.Core.csproj | 4 +- src/Formats/AlbionReader.cs | 2 +- src/Formats/AlbionWriter.cs | 2 +- src/Formats/Assets/AlbionPalette.cs | 2 +- src/Formats/Assets/Automap.cs | 2 +- src/Formats/Assets/AutomapInfo.cs | 2 +- src/Formats/Assets/Bitmap.cs | 2 +- src/Formats/Assets/Block.cs | 2 +- src/Formats/Assets/BlockList.cs | 2 +- src/Formats/Assets/ColorRange.cs | 2 +- src/Formats/Assets/EventSet.cs | 2 +- src/Formats/Assets/Flic/CopyChunk.cs | 2 +- src/Formats/Assets/Flic/DeltaFlcChunk.cs | 2 +- src/Formats/Assets/Flic/DeltaFlcLine.cs | 2 +- src/Formats/Assets/Flic/DeltaFlcLineToken.cs | 2 +- src/Formats/Assets/Flic/FlicChunk.cs | 6 +- src/Formats/Assets/Flic/FlicFile.cs | 2 +- src/Formats/Assets/Flic/FlicFrame.cs | 2 +- .../Assets/Flic/FullByteOrientedRleChunk.cs | 4 +- src/Formats/Assets/Flic/Palette8Chunk.cs | 4 +- src/Formats/Assets/Flic/UnknownChunk.cs | 2 +- src/Formats/Assets/IFFChunk.cs | 4 +- src/Formats/Assets/InterlacedBitmap.cs | 18 +- src/Formats/Assets/Inv/Inventory.cs | 10 +- src/Formats/Assets/Inv/ItemData.cs | 2 +- src/Formats/Assets/Inv/ItemSlot.cs | 2 +- .../Assets/Labyrinth/FloorAndCeiling.cs | 2 +- src/Formats/Assets/Labyrinth/LabyrinthData.cs | 8 +- .../Assets/Labyrinth/LabyrinthObject.cs | 2 +- src/Formats/Assets/Labyrinth/ObjectGroup.cs | 12 +- src/Formats/Assets/Labyrinth/Overlay.cs | 2 +- src/Formats/Assets/Labyrinth/Wall.cs | 4 +- src/Formats/Assets/Maps/BaseMapData.cs | 14 +- src/Formats/Assets/Maps/MapData2D.cs | 2 +- src/Formats/Assets/Maps/MapData3D.cs | 4 +- src/Formats/Assets/Maps/MapEventZone.cs | 14 +- src/Formats/Assets/Maps/MapNpc.cs | 24 +- src/Formats/Assets/Maps/TileData.cs | 2 +- src/Formats/Assets/Maps/TilesetData.cs | 9 +- src/Formats/Assets/MonsterGroup.cs | 2 +- src/Formats/Assets/Save/FlagSet.cs | 4 +- src/Formats/Assets/Save/MapChange.cs | 2 +- .../Assets/Save/MapChangeCollection.cs | 2 +- src/Formats/Assets/Save/MiscState.cs | 2 +- src/Formats/Assets/Save/NpcMoveState.cs | 2 +- src/Formats/Assets/Save/NpcState.cs | 2 +- src/Formats/Assets/Save/SavedGame.cs | 82 +++--- src/Formats/Assets/Save/TickerSet.cs | 2 +- src/Formats/Assets/Save/VisitedEvent.cs | 2 +- src/Formats/Assets/Save/VisitedEventList.cs | 4 +- src/Formats/Assets/Save/XldDescriptor.cs | 2 +- .../Assets/Sheets/CharacterAttribute.cs | 2 +- src/Formats/Assets/Sheets/CharacterSheet.cs | 2 +- src/Formats/Assets/Sheets/MonsterData.cs | 4 +- src/Formats/Assets/SpellData.cs | 2 +- src/Formats/Assets/WaveLib.cs | 2 +- src/Formats/Assets/WaveLibSample.cs | 2 +- .../Containers/BinaryOffsetContainer.cs | 2 +- src/Formats/Containers/DirectoryContainer.cs | 2 +- src/Formats/Containers/DummyContainer.cs | 4 +- src/Formats/Containers/ItemListContainer.cs | 2 +- src/Formats/Containers/JsonObjectContainer.cs | 4 +- src/Formats/Containers/JsonStringContainer.cs | 4 +- src/Formats/Containers/RawContainer.cs | 2 +- src/Formats/Containers/SpellListContainer.cs | 2 +- src/Formats/Containers/XldContainer.cs | 20 +- src/Formats/Containers/ZipContainer.cs | 2 +- src/Formats/Exporters/Tiled/StampLoader.cs | 4 +- src/Formats/Exporters/Tiled/TiledMapLoader.cs | 8 +- .../Exporters/Tiled/TiledTilesetLoader.cs | 10 +- src/Formats/FormatUtil.cs | 6 +- src/Formats/GlobalSuppressions.cs | 4 +- src/Formats/Ids/AutomapId.g.cs | 6 +- src/Formats/Ids/BlockListId.g.cs | 6 +- src/Formats/Ids/ChestId.g.cs | 6 +- src/Formats/Ids/CombatBackgroundId.g.cs | 6 +- src/Formats/Ids/DoorId.g.cs | 6 +- src/Formats/Ids/EventSetId.g.cs | 6 +- src/Formats/Ids/FontId.g.cs | 6 +- src/Formats/Ids/InkId.g.cs | 6 +- src/Formats/Ids/ItemId.g.cs | 6 +- src/Formats/Ids/LabyrinthId.g.cs | 6 +- src/Formats/Ids/MapId.g.cs | 6 +- src/Formats/Ids/MapObjectid.g.cs | 6 +- src/Formats/Ids/MerchantId.g.cs | 6 +- src/Formats/Ids/MonsterGroupId.g.cs | 6 +- src/Formats/Ids/MonsterId.g.cs | 6 +- src/Formats/Ids/NpcSheetId.g.cs | 6 +- src/Formats/Ids/PaletteId.g.cs | 6 +- src/Formats/Ids/PartyMemberId.g.cs | 6 +- src/Formats/Ids/PictureId.g.cs | 6 +- src/Formats/Ids/PortraitId.g.cs | 6 +- src/Formats/Ids/SampleId.g.cs | 6 +- src/Formats/Ids/ScriptId.g.cs | 6 +- src/Formats/Ids/SheetId.g.cs | 6 +- src/Formats/Ids/SongId.g.cs | 6 +- src/Formats/Ids/SpecialId.g.cs | 6 +- src/Formats/Ids/SpellId.g.cs | 6 +- src/Formats/Ids/SpriteId.g.cs | 6 +- src/Formats/Ids/StringSetId.g.cs | 6 +- src/Formats/Ids/SwitchId.g.cs | 6 +- src/Formats/Ids/TargetId.g.cs | 6 +- src/Formats/Ids/TextId.g.cs | 6 +- src/Formats/Ids/TickerId.g.cs | 6 +- src/Formats/Ids/TilesetGfxId.g.cs | 6 +- src/Formats/Ids/TilesetId.g.cs | 6 +- src/Formats/Ids/VideoId.g.cs | 6 +- src/Formats/Ids/WaveLibraryId.g.cs | 6 +- src/Formats/Ids/WordId.g.cs | 6 +- src/Formats/MapEvents/ActionEvent.cs | 2 +- src/Formats/MapEvents/AddPartyMemberEvent.cs | 2 +- src/Formats/MapEvents/AskSurrenderEvent.cs | 2 +- src/Formats/MapEvents/ChangeAttributeEvent.cs | 2 +- src/Formats/MapEvents/ChangeEventSetEvent.cs | 2 +- src/Formats/MapEvents/ChangeIconEvent.cs | 2 +- src/Formats/MapEvents/ChangeItemEvent.cs | 2 +- src/Formats/MapEvents/ChangeLanguageEvent.cs | 2 +- .../MapEvents/ChangeNpcMovementEvent.cs | 2 +- src/Formats/MapEvents/ChangeNpcSpriteEvent.cs | 2 +- src/Formats/MapEvents/ChangeSkillEvent.cs | 2 +- src/Formats/MapEvents/ChangeSpellsEvent.cs | 2 +- src/Formats/MapEvents/ChangeStatusEvent.cs | 2 +- src/Formats/MapEvents/ChangeUsedItemEvent.cs | 2 +- src/Formats/MapEvents/ChangeWordSetEvent.cs | 2 +- src/Formats/MapEvents/ChestEvent.cs | 2 +- src/Formats/MapEvents/CloneAutomapEvent.cs | 2 +- src/Formats/MapEvents/CreateTransportEvent.cs | 2 +- src/Formats/MapEvents/DataChangeEvent.cs | 2 +- src/Formats/MapEvents/DoScriptEvent.cs | 2 +- src/Formats/MapEvents/DoorEvent.cs | 2 +- src/Formats/MapEvents/DummyMapEvent.cs | 2 +- src/Formats/MapEvents/EncounterEvent.cs | 2 +- src/Formats/MapEvents/EndDialogueEvent.cs | 2 +- src/Formats/MapEvents/EventChainOffEvent.cs | 2 +- src/Formats/MapEvents/ExecuteEvent.cs | 2 +- src/Formats/MapEvents/MapEvent.cs | 271 +++++++++--------- src/Formats/MapEvents/MapLightingEvent.cs | 2 +- src/Formats/MapEvents/ModifyDaysEvent.cs | 2 +- src/Formats/MapEvents/ModifyEvent.cs | 2 +- src/Formats/MapEvents/ModifyGoldEvent.cs | 2 +- src/Formats/MapEvents/ModifyHoursEvent.cs | 2 +- src/Formats/MapEvents/ModifyItemCountEvent.cs | 2 +- src/Formats/MapEvents/ModifyMTicksEvent.cs | 2 +- src/Formats/MapEvents/ModifyNpcOffEvent.cs | 2 +- src/Formats/MapEvents/ModifyRationsEvent.cs | 2 +- src/Formats/MapEvents/OffsetEvent.cs | 2 +- src/Formats/MapEvents/PauseEvent.cs | 2 +- src/Formats/MapEvents/PlaceActionEvent.cs | 2 +- src/Formats/MapEvents/PlayAnimationEvent.cs | 2 +- src/Formats/MapEvents/PromptPlayerEvent.cs | 2 +- .../MapEvents/PromptPlayerNumericEvent.cs | 2 +- .../MapEvents/QueryChainActiveEvent.cs | 2 +- src/Formats/MapEvents/QueryConsciousEvent.cs | 2 +- .../MapEvents/QueryDemoVersionEvent.cs | 2 +- src/Formats/MapEvents/QueryEvent.cs | 2 +- src/Formats/MapEvents/QueryEventUsedEvent.cs | 2 +- src/Formats/MapEvents/QueryGoldEvent.cs | 2 +- src/Formats/MapEvents/QueryHasItemEvent.cs | 2 +- .../MapEvents/QueryHasPartyMemberEvent.cs | 2 +- src/Formats/MapEvents/QueryHourEvent.cs | 2 +- src/Formats/MapEvents/QueryLeaderEvent.cs | 2 +- src/Formats/MapEvents/QueryMapEvent.cs | 2 +- src/Formats/MapEvents/QueryNpcActiveEvent.cs | 2 +- .../MapEvents/QueryNpcActiveOnMapEvent.cs | 2 +- src/Formats/MapEvents/QueryNpcXEvent.cs | 2 +- src/Formats/MapEvents/QueryNpcYEvent.cs | 2 +- .../QueryPreviousActionResultEvent.cs | 2 +- .../MapEvents/QueryRandomChanceEvent.cs | 2 +- .../MapEvents/QueryScriptDebugModeEvent.cs | 2 +- src/Formats/MapEvents/QuerySwitchEvent.cs | 2 +- src/Formats/MapEvents/QueryTickerEvent.cs | 2 +- .../MapEvents/QueryTriggerTypeEvent.cs | 2 +- src/Formats/MapEvents/QueryUnk19Event.cs | 2 +- src/Formats/MapEvents/QueryUnk1EEvent.cs | 2 +- src/Formats/MapEvents/QueryUnk21Event.cs | 2 +- src/Formats/MapEvents/QueryUnkCEvent.cs | 2 +- src/Formats/MapEvents/QueryUsedItemEvent.cs | 2 +- src/Formats/MapEvents/QueryVerbEvent.cs | 2 +- .../MapEvents/RemovePartyMemberEvent.cs | 2 +- src/Formats/MapEvents/SetChestOpenEvent.cs | 2 +- src/Formats/MapEvents/SetDoorOpenEvent.cs | 2 +- src/Formats/MapEvents/SetPartyLeaderEvent.cs | 2 +- src/Formats/MapEvents/SignalEvent.cs | 2 +- src/Formats/MapEvents/SimpleChestEvent.cs | 2 +- src/Formats/MapEvents/SoundEvent.cs | 2 +- src/Formats/MapEvents/SpinnerEvent.cs | 2 +- src/Formats/MapEvents/StartDialogueEvent.cs | 2 +- src/Formats/MapEvents/SwitchEvent.cs | 2 +- src/Formats/MapEvents/TeleportEvent.cs | 2 +- src/Formats/MapEvents/TextEvent.cs | 2 +- src/Formats/MapEvents/TickerEvent.cs | 2 +- src/Formats/MapEvents/TrapEvent.cs | 2 +- src/Formats/MapEvents/WipeEvent.cs | 2 +- src/Formats/MapEvents/WordKnownEvent.cs | 2 +- .../Parsers/AlbionStringTableLoader.cs | 4 +- src/Formats/Parsers/AmorphousSpriteLoader.cs | 8 +- src/Formats/Parsers/AutomapLoader.cs | 4 +- src/Formats/Parsers/BlockListLoader.cs | 4 +- src/Formats/Parsers/CharacterSheetLoader.cs | 4 +- src/Formats/Parsers/ChestLoader.cs | 4 +- src/Formats/Parsers/DummyLoader.cs | 2 +- src/Formats/Parsers/EventSetLoader.cs | 4 +- src/Formats/Parsers/EventSetScriptLoader.cs | 4 +- src/Formats/Parsers/FixedSizeSpriteLoader.cs | 10 +- src/Formats/Parsers/FlicLoader.cs | 2 +- src/Formats/Parsers/InputConfigLoader.cs | 6 +- src/Formats/Parsers/InterlacedBitmapLoader.cs | 4 +- src/Formats/Parsers/ItemDataLoader.cs | 4 +- .../Parsers/ItemNameCollectorLoader.cs | 4 +- src/Formats/Parsers/ItemNameLoader.cs | 10 +- src/Formats/Parsers/ItemNameMetaLoader.cs | 4 +- src/Formats/Parsers/JsonLoader.cs | 4 +- src/Formats/Parsers/JsonStringLoader.cs | 2 +- src/Formats/Parsers/LabyrinthDataLoader.cs | 4 +- src/Formats/Parsers/MapLoader.cs | 4 +- src/Formats/Parsers/MerchantLoader.cs | 4 +- src/Formats/Parsers/MonsterGroupLoader.cs | 4 +- .../Parsers/MultiHeaderSpriteLoader.cs | 8 +- src/Formats/Parsers/PackedChunks.cs | 8 +- src/Formats/Parsers/PaletteLoader.cs | 4 +- src/Formats/Parsers/RawLoader.cs | 4 +- src/Formats/Parsers/SampleLoader.cs | 8 +- src/Formats/Parsers/ScriptLoader.cs | 6 +- .../Parsers/SingleHeaderSpriteLoader.cs | 8 +- src/Formats/Parsers/SlabLoader.cs | 4 +- src/Formats/Parsers/SongLoader.cs | 4 +- src/Formats/Parsers/SpellLoader.cs | 4 +- .../Parsers/StringSetCollectorLoader.cs | 4 +- src/Formats/Parsers/StringSetStringLoader.cs | 4 +- src/Formats/Parsers/SystemTextLoader.cs | 4 +- src/Formats/Parsers/TilesetGraphicsLoader.cs | 4 +- src/Formats/Parsers/TilesetLoader.cs | 4 +- src/Formats/Parsers/Utf8Loader.cs | 4 +- src/Formats/Parsers/VarSetLoader.cs | 4 +- src/Formats/Parsers/WavLoader.cs | 8 +- src/Formats/Parsers/WaveLibLoader.cs | 4 +- src/Formats/Parsers/WaveLibWavLoader.cs | 8 +- src/Formats/Parsers/WordListLoader.cs | 4 +- src/Formats/StoreIncrementedConverter.cs | 103 ------- src/Formats/UAlbion.Formats.csproj | 4 +- .../Assets/IsometricLabyrinthLoader.cs | 5 +- src/Game.Veldrid/Assets/MeshLoader.cs | 4 +- src/Game.Veldrid/Assets/NpcTilesetLoader.cs | 2 +- src/Game.Veldrid/Assets/PalettePng32Loader.cs | 4 +- src/Game.Veldrid/Assets/Png32Loader.cs | 4 +- src/Game.Veldrid/Assets/Png8Loader.cs | 4 +- src/Game.Veldrid/Assets/PngSheetLoader.cs | 4 +- src/Game.Veldrid/Assets/PngTileLoader32Bit.cs | 4 +- src/Game.Veldrid/Assets/PngTileLoader8Bit.cs | 4 +- src/Game/Assets/AssetLocator.cs | 13 +- src/Game/Assets/SavedGameLoader.cs | 4 +- src/Game/Assets/SoundBankLoader.cs | 2 +- .../UAlbion.Base.Tests/RoundtripTests.cs | 4 +- .../UAlbion.Formats.Tests/SavedGameTests.cs | 6 +- .../SpriteLoaderTests.cs | 6 +- src/Tests/UAlbion.TestCommon/Asset.cs | 14 +- src/Tools/DumpSave/DumpSave.csproj | 4 +- src/Tools/DumpSave/Program.cs | 2 +- src/Tools/GenerateEnums/GenerateAssetIds.cs | 6 +- src/Tools/PaletteBuilder/Program.cs | 2 +- src/ualbion.full.sln | 16 +- 265 files changed, 706 insertions(+), 789 deletions(-) delete mode 100644 src/Formats/StoreIncrementedConverter.cs diff --git a/src/Config/AssetId.cs b/src/Config/AssetId.cs index c45960060..a7a3d9cbd 100644 --- a/src/Config/AssetId.cs +++ b/src/Config/AssetId.cs @@ -37,7 +37,7 @@ public static AssetId FromDisk(AssetType type, int disk, AssetMapping mapping) return AssetMapping.Global.EnumToId(enumType, enumValue); } - public static AssetId SerdesU8(string name, AssetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static AssetId SerdesU8(string name, AssetId id, AssetType type, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); @@ -46,7 +46,7 @@ public static AssetId SerdesU8(string name, AssetId id, AssetType type, AssetMap return FromDisk(type, diskValue, mapping); } - public static AssetId SerdesU16(string name, AssetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static AssetId SerdesU16(string name, AssetId id, AssetType type, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(mapping); ArgumentNullException.ThrowIfNull(s); diff --git a/src/Config/IAssetContainer.cs b/src/Config/IAssetContainer.cs index 55a9c6b4f..7bc315fc8 100644 --- a/src/Config/IAssetContainer.cs +++ b/src/Config/IAssetContainer.cs @@ -16,7 +16,7 @@ public interface IAssetContainer /// The path to the container file/directory /// The loader context, containing the JSON serialiser, file system access object etc /// - ISerializer Read(string path, AssetLoadContext context); + ISerdes Read(string path, AssetLoadContext context); /// /// Write all assets inside a container diff --git a/src/Config/IAssetLoader.cs b/src/Config/IAssetLoader.cs index 6afa33627..edd90091a 100644 --- a/src/Config/IAssetLoader.cs +++ b/src/Config/IAssetLoader.cs @@ -4,10 +4,10 @@ namespace UAlbion.Config; public interface IAssetLoader { - object Serdes(object existing, ISerializer s, AssetLoadContext context); + object Serdes(object existing, ISerdes s, AssetLoadContext context); } public interface IAssetLoader : IAssetLoader where T : class { - T Serdes(T existing, ISerializer s, AssetLoadContext context); // SerDes = Serialise / Deserialise. + T Serdes(T existing, ISerdes s, AssetLoadContext context); // SerDes = Serialise / Deserialise. } \ No newline at end of file diff --git a/src/Config/UAlbion.Config.csproj b/src/Config/UAlbion.Config.csproj index c35b2c234..f287202c5 100644 --- a/src/Config/UAlbion.Config.csproj +++ b/src/Config/UAlbion.Config.csproj @@ -24,10 +24,10 @@ - + - + diff --git a/src/Core/UAlbion.Core.csproj b/src/Core/UAlbion.Core.csproj index 9894a40c1..fd68bdadd 100644 --- a/src/Core/UAlbion.Core.csproj +++ b/src/Core/UAlbion.Core.csproj @@ -10,10 +10,10 @@ - + - + diff --git a/src/Formats/AlbionReader.cs b/src/Formats/AlbionReader.cs index edf192243..4b15bb7b2 100644 --- a/src/Formats/AlbionReader.cs +++ b/src/Formats/AlbionReader.cs @@ -5,7 +5,7 @@ namespace UAlbion.Formats; -public class AlbionReader : GenericBinaryReader +public class AlbionReader : ReaderSerdes { readonly BinaryReader _br; diff --git a/src/Formats/AlbionWriter.cs b/src/Formats/AlbionWriter.cs index 7601ca077..191d01117 100644 --- a/src/Formats/AlbionWriter.cs +++ b/src/Formats/AlbionWriter.cs @@ -4,7 +4,7 @@ namespace UAlbion.Formats; -public class AlbionWriter : GenericBinaryWriter +public class AlbionWriter : WriterSerdes { public AlbionWriter(BinaryWriter bw) : base(bw, FormatUtil.BytesFrom850String, ApiUtil.Assert) diff --git a/src/Formats/Assets/AlbionPalette.cs b/src/Formats/Assets/AlbionPalette.cs index f345c2222..dc2fcc78e 100644 --- a/src/Formats/Assets/AlbionPalette.cs +++ b/src/Formats/Assets/AlbionPalette.cs @@ -178,7 +178,7 @@ public uint[] GetUnambiguousPalette() public ReadOnlySpan GetPaletteAtTime(int i) => _texture.GetLayerBuffer(0).GetRow(i % _texture.Height); public override string ToString() { return string.IsNullOrEmpty(Name) ? $"Palette {Id}" : $"{Name} ({Id})"; } - public static AlbionPalette Serdes(AlbionPalette p, AssetLoadContext context, ISerializer s) + public static AlbionPalette Serdes(AlbionPalette p, AssetLoadContext context, ISerdes s) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Assets/Automap.cs b/src/Formats/Assets/Automap.cs index c0752c57b..984723183 100644 --- a/src/Formats/Assets/Automap.cs +++ b/src/Formats/Assets/Automap.cs @@ -44,7 +44,7 @@ public Automap(int width, int height) _discovered = new BitArray(width * height); } - public static Automap Serdes(Automap map, ISerializer s) + public static Automap Serdes(Automap map, ISerdes s) { ArgumentNullException.ThrowIfNull(s); int length; diff --git a/src/Formats/Assets/AutomapInfo.cs b/src/Formats/Assets/AutomapInfo.cs index faf84af5f..0c8e2047a 100644 --- a/src/Formats/Assets/AutomapInfo.cs +++ b/src/Formats/Assets/AutomapInfo.cs @@ -16,7 +16,7 @@ public class AutomapInfo // Total size 0x13 = 19 bytes /// public string Name { get; set; } // name length = 15 - public static AutomapInfo Serdes(int _, AutomapInfo existing, ISerializer s) + public static AutomapInfo Serdes(int _, AutomapInfo existing, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var info = existing ?? new AutomapInfo(); diff --git a/src/Formats/Assets/Bitmap.cs b/src/Formats/Assets/Bitmap.cs index 9cfe7f18a..3dd84e978 100644 --- a/src/Formats/Assets/Bitmap.cs +++ b/src/Formats/Assets/Bitmap.cs @@ -25,7 +25,7 @@ public Bitmap8Bit(uint width, uint[] palette, byte[] pixels) public IList Palette { get; private set; } public byte[] Pixels { get; private set; } - public static Bitmap8Bit Serdes(Bitmap8Bit b, ISerializer s) + public static Bitmap8Bit Serdes(Bitmap8Bit b, ISerdes s) { ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/Block.cs b/src/Formats/Assets/Block.cs index be376a5cc..bfff669be 100644 --- a/src/Formats/Assets/Block.cs +++ b/src/Formats/Assets/Block.cs @@ -35,7 +35,7 @@ public byte[] RawLayout set => _tiles = MapTile.FromPacked(value, Width, 0, 0); } - public static Block Serdes(int _, Block b, ISerializer s) + public static Block Serdes(int _, Block b, ISerdes s) { ArgumentNullException.ThrowIfNull(s); b ??= new Block(); diff --git a/src/Formats/Assets/BlockList.cs b/src/Formats/Assets/BlockList.cs index 9aee27e51..bc2bfa529 100644 --- a/src/Formats/Assets/BlockList.cs +++ b/src/Formats/Assets/BlockList.cs @@ -8,7 +8,7 @@ namespace UAlbion.Formats.Assets; public class BlockList : List { public const int MaxCount = 4095; - public static BlockList Serdes(int blockNumber, BlockList blockList, ISerializer s) + public static BlockList Serdes(int blockNumber, BlockList blockList, ISerdes s) { ArgumentNullException.ThrowIfNull(s); blockList ??= []; diff --git a/src/Formats/Assets/ColorRange.cs b/src/Formats/Assets/ColorRange.cs index 98423fc34..3b449f4af 100644 --- a/src/Formats/Assets/ColorRange.cs +++ b/src/Formats/Assets/ColorRange.cs @@ -33,7 +33,7 @@ public class ColorRange /// /// Reads range from IFF stream. /// - public static ColorRange Serdes(int _, ColorRange c, ISerializer s) + public static ColorRange Serdes(int _, ColorRange c, ISerdes s) { ArgumentNullException.ThrowIfNull(s); c ??= new ColorRange(); diff --git a/src/Formats/Assets/EventSet.cs b/src/Formats/Assets/EventSet.cs index 0bf2ece97..be904fbd4 100644 --- a/src/Formats/Assets/EventSet.cs +++ b/src/Formats/Assets/EventSet.cs @@ -48,7 +48,7 @@ public EventSet(EventSetId id, IEnumerable nodes, IEnumerable } } - public static EventSet Serdes(EventSetId id, EventSet set, AssetMapping mapping, ISerializer s) + public static EventSet Serdes(EventSetId id, EventSet set, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); set ??= new EventSet { Id = id }; diff --git a/src/Formats/Assets/Flic/CopyChunk.cs b/src/Formats/Assets/Flic/CopyChunk.cs index 23e6b5a07..c0389975d 100644 --- a/src/Formats/Assets/Flic/CopyChunk.cs +++ b/src/Formats/Assets/Flic/CopyChunk.cs @@ -7,7 +7,7 @@ public class CopyChunk : FlicChunk { public byte[] PixelData { get; private set; } public override FlicChunkType Type => FlicChunkType.FullUncompressed; - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); PixelData = s.Bytes(null, null, (int)length); diff --git a/src/Formats/Assets/Flic/DeltaFlcChunk.cs b/src/Formats/Assets/Flic/DeltaFlcChunk.cs index a3365ae32..50e85a3ff 100644 --- a/src/Formats/Assets/Flic/DeltaFlcChunk.cs +++ b/src/Formats/Assets/Flic/DeltaFlcChunk.cs @@ -8,7 +8,7 @@ public class DeltaFlcChunk : FlicChunk DeltaFlcLine[] _lines; public override FlicChunkType Type => FlicChunkType.DeltaWordOrientedRle; - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var start = s.Offset; diff --git a/src/Formats/Assets/Flic/DeltaFlcLine.cs b/src/Formats/Assets/Flic/DeltaFlcLine.cs index 6dd9c0049..feb98af42 100644 --- a/src/Formats/Assets/Flic/DeltaFlcLine.cs +++ b/src/Formats/Assets/Flic/DeltaFlcLine.cs @@ -15,7 +15,7 @@ public override string ToString() => public byte? LastPixel { get; } public IList Tokens { get; } = []; - public DeltaFlcLine(ISerializer s) + public DeltaFlcLine(ISerdes s) { ArgumentNullException.ThrowIfNull(s); int remaining = 1; diff --git a/src/Formats/Assets/Flic/DeltaFlcLineToken.cs b/src/Formats/Assets/Flic/DeltaFlcLineToken.cs index dc4a172c7..c9727b692 100644 --- a/src/Formats/Assets/Flic/DeltaFlcLineToken.cs +++ b/src/Formats/Assets/Flic/DeltaFlcLineToken.cs @@ -15,7 +15,7 @@ public override string ToString() public sbyte SignedCount { get; } public ushort[] PixelData { get; } - public DeltaFlcLineToken(ISerializer s) + public DeltaFlcLineToken(ISerdes s) { ArgumentNullException.ThrowIfNull(s); ColumnSkipCount = s.UInt8(null, 0); diff --git a/src/Formats/Assets/Flic/FlicChunk.cs b/src/Formats/Assets/Flic/FlicChunk.cs index 92859d533..7d447f806 100644 --- a/src/Formats/Assets/Flic/FlicChunk.cs +++ b/src/Formats/Assets/Flic/FlicChunk.cs @@ -8,9 +8,9 @@ public abstract class FlicChunk { const uint ChunkHeaderSize = 6; public abstract FlicChunkType Type { get; } - protected abstract uint LoadChunk(uint length, ISerializer s); + protected abstract uint LoadChunk(uint length, ISerdes s); - public static FlicChunk Load(ISerializer s, int width, int height) + public static FlicChunk Load(ISerdes s, int width, int height) { ArgumentNullException.ThrowIfNull(s); @@ -57,4 +57,4 @@ public static FlicChunk Load(ISerializer s, int width, int height) ApiUtil.Assert(actualChunkSize == chunkSize); return c; } -} \ No newline at end of file +} diff --git a/src/Formats/Assets/Flic/FlicFile.cs b/src/Formats/Assets/Flic/FlicFile.cs index ee293d35a..d1f736a10 100644 --- a/src/Formats/Assets/Flic/FlicFile.cs +++ b/src/Formats/Assets/Flic/FlicFile.cs @@ -6,7 +6,7 @@ namespace UAlbion.Formats.Assets.Flic; public class FlicFile { - public FlicFile(ISerializer s) + public FlicFile(ISerdes s) { ArgumentNullException.ThrowIfNull(s); if (s.IsWriting()) diff --git a/src/Formats/Assets/Flic/FlicFrame.cs b/src/Formats/Assets/Flic/FlicFrame.cs index 90d0c688c..cb25bcc20 100644 --- a/src/Formats/Assets/Flic/FlicFrame.cs +++ b/src/Formats/Assets/Flic/FlicFrame.cs @@ -22,7 +22,7 @@ public FlicFrame(int width, int height) public ushort Width { get; private set; } // Overrides, usually 0. public ushort Height { get; private set; } - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var initialOffset = s.Offset; diff --git a/src/Formats/Assets/Flic/FullByteOrientedRleChunk.cs b/src/Formats/Assets/Flic/FullByteOrientedRleChunk.cs index d747c54d8..dd7c55e71 100644 --- a/src/Formats/Assets/Flic/FullByteOrientedRleChunk.cs +++ b/src/Formats/Assets/Flic/FullByteOrientedRleChunk.cs @@ -20,7 +20,7 @@ public FullByteOrientedRleChunk(int width, int height) public override FlicChunkType Type => FlicChunkType.FullByteOrientedRle; - public IEnumerable ReadLinePixels(ISerializer s) + public IEnumerable ReadLinePixels(ISerdes s) { ArgumentNullException.ThrowIfNull(s); @@ -53,7 +53,7 @@ public IEnumerable ReadLinePixels(ISerializer s) } } - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); int i = 0; diff --git a/src/Formats/Assets/Flic/Palette8Chunk.cs b/src/Formats/Assets/Flic/Palette8Chunk.cs index 24cf4822a..1291c8df2 100644 --- a/src/Formats/Assets/Flic/Palette8Chunk.cs +++ b/src/Formats/Assets/Flic/Palette8Chunk.cs @@ -11,7 +11,7 @@ sealed class PalettePacket public byte Skip { get; } public byte[] Triplets { get; } - public PalettePacket(ISerializer s) + public PalettePacket(ISerdes s) { ArgumentNullException.ThrowIfNull(s); Skip = s.UInt8(null, 0); @@ -30,7 +30,7 @@ public PalettePacket(ISerializer s) } public override FlicChunkType Type => FlicChunkType.Palette8Bit; - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); ushort packetCount = s.UInt16(null, 0); diff --git a/src/Formats/Assets/Flic/UnknownChunk.cs b/src/Formats/Assets/Flic/UnknownChunk.cs index 0ae24f270..3550626e6 100644 --- a/src/Formats/Assets/Flic/UnknownChunk.cs +++ b/src/Formats/Assets/Flic/UnknownChunk.cs @@ -9,7 +9,7 @@ public class UnknownChunk : FlicChunk public override FlicChunkType Type { get; } public UnknownChunk(FlicChunkType type) => Type = type; public override string ToString() => $"Unknown:{Type} ({Bytes.Length} bytes)"; - protected override uint LoadChunk(uint length, ISerializer s) + protected override uint LoadChunk(uint length, ISerdes s) { ArgumentNullException.ThrowIfNull(s); Bytes = s.Bytes(null, null, (int)length); diff --git a/src/Formats/Assets/IFFChunk.cs b/src/Formats/Assets/IFFChunk.cs index 60ad998be..e682cf1eb 100644 --- a/src/Formats/Assets/IFFChunk.cs +++ b/src/Formats/Assets/IFFChunk.cs @@ -16,7 +16,7 @@ public IffChunk(string typeId, int length) Length = length; } - public void WriteLength(ISerializer s) + public void WriteLength(ISerdes s) { ArgumentNullException.ThrowIfNull(s); var offset = s.Offset; @@ -25,7 +25,7 @@ public void WriteLength(ISerializer s) s.Seek(offset); } - public static IffChunk Serdes(int _, IffChunk c, ISerializer s) + public static IffChunk Serdes(int _, IffChunk c, ISerdes s) { ArgumentNullException.ThrowIfNull(s); c ??= new IffChunk(); diff --git a/src/Formats/Assets/InterlacedBitmap.cs b/src/Formats/Assets/InterlacedBitmap.cs index 7433476ae..fc8d2e355 100644 --- a/src/Formats/Assets/InterlacedBitmap.cs +++ b/src/Formats/Assets/InterlacedBitmap.cs @@ -28,7 +28,7 @@ public sealed class InterlacedBitmap public byte[] Thumbnail { get; set; } public byte[] ImageData { get; set; } - public static InterlacedBitmap Serdes(InterlacedBitmap img, ISerializer s) + public static InterlacedBitmap Serdes(InterlacedBitmap img, ISerdes s) { ArgumentNullException.ThrowIfNull(s); img ??= new InterlacedBitmap(); @@ -82,14 +82,14 @@ public static InterlacedBitmap Serdes(InterlacedBitmap img, ISerializer s) return img; } - static void WriteChunk(ISerializer s, string chunkType, Action serdes) + static void WriteChunk(ISerdes s, string chunkType, Action serdes) { var chunk = IffChunk.Serdes(0, new IffChunk(chunkType, 0), s); serdes(s, chunk.Length); chunk.WriteLength(s); } - void SerdesHeader(ISerializer s, int length) + void SerdesHeader(ISerdes s, int length) { if (length < 20) throw new FormatException($"ILBM header chunk was {length} bytes, expected at least 20"); @@ -111,7 +111,7 @@ void SerdesHeader(ISerializer s, int length) s.Bytes("UnexpectedHeaderData", null, length - 20); } - void SerdesPalette(ISerializer s, int length) + void SerdesPalette(ISerdes s, int length) { uint[] pal = Palette ?? new uint[length / 3]; for (int i = 0; i < pal.Length; i++) @@ -126,13 +126,13 @@ void SerdesPalette(ISerializer s, int length) Palette = pal; } - void SerdesHotspot(ISerializer s, int _) + void SerdesHotspot(ISerdes s, int _) { HotspotX = s.Int16(nameof(HotspotX), HotspotX); HotspotY = s.Int16(nameof(HotspotY), HotspotY); } - void SerdesThumbnail(ISerializer s, int length) + void SerdesThumbnail(ISerdes s, int length) { ThumbnailWidth = s.UInt16BE(nameof(ThumbnailWidth), ThumbnailWidth); ThumbnailHeight = s.UInt16BE(nameof(ThumbnailHeight), ThumbnailHeight); @@ -142,7 +142,7 @@ void SerdesThumbnail(ISerializer s, int length) : s.Bytes("Pixels", null, length - 4); } - void SerdesPixels(ISerializer s, int length) + void SerdesPixels(ISerdes s, int length) { ImageData = Compression == 1 ? s.IsReading() ? Unpack(s, length) : Pack(ImageData, s) @@ -150,10 +150,10 @@ void SerdesPixels(ISerializer s, int length) } // ReSharper disable UnusedParameter.Local - static byte[] Pack(byte[] data, ISerializer s) => throw new NotImplementedException(); + static byte[] Pack(byte[] data, ISerdes s) => throw new NotImplementedException(); // ReSharper restore UnusedParameter.Local - static byte[] Unpack(ISerializer s, int size) + static byte[] Unpack(ISerdes s, int size) { using MemoryStream ms = new MemoryStream(); var finalOffset = s.Offset + size; diff --git a/src/Formats/Assets/Inv/Inventory.cs b/src/Formats/Assets/Inv/Inventory.cs index c2e16dac8..0a3568bbb 100644 --- a/src/Formats/Assets/Inv/Inventory.cs +++ b/src/Formats/Assets/Inv/Inventory.cs @@ -57,13 +57,13 @@ public Inventory(InventoryId id) [JsonIgnore, DiagEdit(Style = DiagEditStyle.InvSlot)] public ItemSlot Feet => TrySlot(ItemSlotId.Feet); [JsonIgnore, DiagEdit(Style = DiagEditStyle.InvSlot)] public ItemSlot RightFinger => TrySlot(ItemSlotId.RightFinger); - public static Inventory SerdesChest(int n, Inventory inv, AssetMapping mapping, ISerializer s) => Serdes(n, inv, mapping, s, InventoryType.Chest); - public static Inventory SerdesMerchant(int n, Inventory inv, AssetMapping mapping, ISerializer s) => Serdes(n, inv, mapping, s, InventoryType.Merchant); - public static Inventory SerdesCharacter(int n, Inventory inv, AssetMapping mapping, ISerializer s) => Serdes(n, inv, mapping, s, InventoryType.Player); - public static Inventory SerdesMonster(int n, Inventory inv, AssetMapping mapping, ISerializer s) => Serdes(n, inv, mapping, s, InventoryType.Monster); + public static Inventory SerdesChest(int n, Inventory inv, AssetMapping mapping, ISerdes s) => Serdes(n, inv, mapping, s, InventoryType.Chest); + public static Inventory SerdesMerchant(int n, Inventory inv, AssetMapping mapping, ISerdes s) => Serdes(n, inv, mapping, s, InventoryType.Merchant); + public static Inventory SerdesCharacter(int n, Inventory inv, AssetMapping mapping, ISerdes s) => Serdes(n, inv, mapping, s, InventoryType.Player); + public static Inventory SerdesMonster(int n, Inventory inv, AssetMapping mapping, ISerdes s) => Serdes(n, inv, mapping, s, InventoryType.Monster); public IEnumerable EnumerateAll() => Slots.Where(x => x != null); - static Inventory Serdes(int n, Inventory inv, AssetMapping mapping, ISerializer s, InventoryType type) + static Inventory Serdes(int n, Inventory inv, AssetMapping mapping, ISerdes s, InventoryType type) { ArgumentNullException.ThrowIfNull(s); var invId = new InventoryId(type, (ushort)n); diff --git a/src/Formats/Assets/Inv/ItemData.cs b/src/Formats/Assets/Inv/ItemData.cs index e5dbf8e60..6b298be02 100644 --- a/src/Formats/Assets/Inv/ItemData.cs +++ b/src/Formats/Assets/Inv/ItemData.cs @@ -133,7 +133,7 @@ public override string ToString() return sb.ToString(); } - public static ItemData Serdes(AssetId id, ItemData item, ISerializer s, ISpellManager spellManager) + public static ItemData Serdes(AssetId id, ItemData item, ISerdes s, ISpellManager spellManager) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(spellManager); diff --git a/src/Formats/Assets/Inv/ItemSlot.cs b/src/Formats/Assets/Inv/ItemSlot.cs index fd25b8476..5bde8b80c 100644 --- a/src/Formats/Assets/Inv/ItemSlot.cs +++ b/src/Formats/Assets/Inv/ItemSlot.cs @@ -171,7 +171,7 @@ public static ItemSlot Parse(string s, InventorySlotId id) return slot; } - public static ItemSlot Serdes(InventorySlotId id, ItemSlot slot, AssetMapping mapping, ISerializer s) // 6 per slot + public static ItemSlot Serdes(InventorySlotId id, ItemSlot slot, AssetMapping mapping, ISerdes s) // 6 per slot { ArgumentNullException.ThrowIfNull(s); slot ??= new ItemSlot(id); diff --git a/src/Formats/Assets/Labyrinth/FloorAndCeiling.cs b/src/Formats/Assets/Labyrinth/FloorAndCeiling.cs index 84f74e4c0..8ac8318dc 100644 --- a/src/Formats/Assets/Labyrinth/FloorAndCeiling.cs +++ b/src/Formats/Assets/Labyrinth/FloorAndCeiling.cs @@ -30,7 +30,7 @@ public enum FcFlags : byte public ushort Unk8 { get; set; } public override string ToString() => $"FC.{SpriteId}:{FrameCount} {Properties}"; - public static FloorAndCeiling Serdes(int _, FloorAndCeiling existing, AssetMapping mapping, ISerializer s) + public static FloorAndCeiling Serdes(int _, FloorAndCeiling existing, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var fc = existing ?? new FloorAndCeiling(); diff --git a/src/Formats/Assets/Labyrinth/LabyrinthData.cs b/src/Formats/Assets/Labyrinth/LabyrinthData.cs index 1f277b72a..64ce26e8b 100644 --- a/src/Formats/Assets/Labyrinth/LabyrinthData.cs +++ b/src/Formats/Assets/Labyrinth/LabyrinthData.cs @@ -71,7 +71,7 @@ public int FrameCountForObjectGroup(int i) => .Where(x => x != null && x.ObjectInfoNumber < Objects.Count) .Select(x => (long)Objects[x.ObjectInfoNumber].FrameCount)); - public static LabyrinthData Serdes(LabyrinthData d, AssetId id, AssetMapping mapping, ISerializer s) + public static LabyrinthData Serdes(LabyrinthData d, AssetId id, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); d ??= new LabyrinthData { Id = id }; @@ -110,12 +110,12 @@ public static LabyrinthData Serdes(LabyrinthData d, AssetId id, AssetMapping map // MaxFloors = 50 var floorAndCeilingCount = s.UInt16("FloorAndCeilingCount", (ushort)d.FloorAndCeilings.Count); // 28 + objectGroupCount * 42 ApiUtil.Assert(floorAndCeilingCount <= 50, "A labyrinth cannot have more than 50 floors/ceilings"); - s.List(nameof(d.FloorAndCeilings), d.FloorAndCeilings, mapping, floorAndCeilingCount, FloorAndCeiling.Serdes); + s.ListWithContext(nameof(d.FloorAndCeilings), d.FloorAndCeilings, mapping, floorAndCeilingCount, FloorAndCeiling.Serdes); // MaxObjects = 100 ushort objectCount = s.UInt16("ObjectCount", (ushort)d.Objects.Count); // 2A + objectGroupCount * 42 + floorAndCeilingCount * A ApiUtil.Assert(objectCount <= 100, "A labyrinth cannot have more than 100 object types"); - s.List(nameof(d.Objects), d.Objects, mapping, objectCount, LabyrinthObject.Serdes); + s.ListWithContext(nameof(d.Objects), d.Objects, mapping, objectCount, LabyrinthObject.Serdes); // Populate objectIds on subobjects to improve debugging experience foreach (var so in d.ObjectGroups.SelectMany(x => x.SubObjects)) @@ -126,7 +126,7 @@ public static LabyrinthData Serdes(LabyrinthData d, AssetId id, AssetMapping map ushort wallCount = s.UInt16("WallCount", (ushort)d.Walls.Count); ApiUtil.Assert(objectCount <= MaxWalls, "A labyrinth cannot have more than 150 wall types"); - s.List(nameof(d.Walls), d.Walls, mapping, wallCount, Wall.Serdes); + s.ListWithContext(nameof(d.Walls), d.Walls, mapping, wallCount, Wall.Serdes); // PerfTracker.StartupEvent("Finish loading labyrinth data"); return d; } diff --git a/src/Formats/Assets/Labyrinth/LabyrinthObject.cs b/src/Formats/Assets/Labyrinth/LabyrinthObject.cs index 522e5b93e..ea6fe3cb1 100644 --- a/src/Formats/Assets/Labyrinth/LabyrinthObject.cs +++ b/src/Formats/Assets/Labyrinth/LabyrinthObject.cs @@ -20,7 +20,7 @@ public class LabyrinthObject // Length 0x10 (16) bytes public override string ToString() => $"EO.{Id}:{FrameCount} {Width}x{Height} [{MapWidth}x{MapHeight}] {Properties}"; - public static LabyrinthObject Serdes(int _, LabyrinthObject o, AssetMapping mapping, ISerializer s) + public static LabyrinthObject Serdes(int _, LabyrinthObject o, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); o ??= new LabyrinthObject(); diff --git a/src/Formats/Assets/Labyrinth/ObjectGroup.cs b/src/Formats/Assets/Labyrinth/ObjectGroup.cs index 92cc24010..33d0134ac 100644 --- a/src/Formats/Assets/Labyrinth/ObjectGroup.cs +++ b/src/Formats/Assets/Labyrinth/ObjectGroup.cs @@ -14,7 +14,7 @@ public class ObjectGroup public override string ToString() => $"Obj: AG{AutoGraphicsId} [ {string.Join("; ", SubObjects.Select(x => x.ToString()))} ]"; - public static ObjectGroup Serdes(int _, ObjectGroup og, ISerializer s) // total size 0x42 = 66 + public static ObjectGroup Serdes(int _, ObjectGroup og, ISerdes s) // total size 0x42 = 66 { ArgumentNullException.ThrowIfNull(s); og ??= new ObjectGroup(); @@ -29,11 +29,11 @@ public static ObjectGroup Serdes(int _, ObjectGroup og, ISerializer s) // total so.Z = s.Int16(nameof(so.Z), so.Z); so.Y = s.Int16(nameof(so.Y), so.Y); - so.ObjectInfoNumber = s.Transform( - nameof(so.ObjectInfoNumber), - so.ObjectInfoNumber, - S.UInt16, - StoreIncrementedConverter.Instance); + var incremented = (ushort)(so.ObjectInfoNumber + 1); + + incremented = s.UInt16(nameof(so.ObjectInfoNumber), incremented); + + so.ObjectInfoNumber = (ushort)(incremented - 1); if (so.ObjectInfoNumber == 0xffff) og.SubObjects[n] = null; diff --git a/src/Formats/Assets/Labyrinth/Overlay.cs b/src/Formats/Assets/Labyrinth/Overlay.cs index 4e640e36f..c761d977f 100644 --- a/src/Formats/Assets/Labyrinth/Overlay.cs +++ b/src/Formats/Assets/Labyrinth/Overlay.cs @@ -20,7 +20,7 @@ public class Overlay // 0xC bytes = 12 public override string ToString() => $"O.{SpriteId}:{AnimationFrames} ({XOffset}, {YOffset}) {Width}x{Height}"; - public static Overlay Serdes(int _, Overlay o, AssetMapping mapping, ISerializer s) + public static Overlay Serdes(int _, Overlay o, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); o ??= new Overlay(); diff --git a/src/Formats/Assets/Labyrinth/Wall.cs b/src/Formats/Assets/Labyrinth/Wall.cs index ae12c387a..58a1d89c0 100644 --- a/src/Formats/Assets/Labyrinth/Wall.cs +++ b/src/Formats/Assets/Labyrinth/Wall.cs @@ -37,7 +37,7 @@ public enum WallFlags : byte public override string ToString() => $"Wall.{SpriteId}:{FrameCount} {Width}x{Height} ({Properties}) [ {string.Join(", ", Overlays.Select(x => x.ToString()))} ]"; - public static Wall Serdes(int _, Wall w, AssetMapping mapping, ISerializer s) + public static Wall Serdes(int _, Wall w, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); w ??= new Wall(); @@ -57,7 +57,7 @@ public static Wall Serdes(int _, Wall w, AssetMapping mapping, ISerializer s) w.Height = s.UInt16(nameof(w.Height), w.Height); // C ushort overlayCount = s.UInt16("overlayCount", (ushort)w.Overlays.Count); // E - s.List(nameof(w.Overlays), w.Overlays, mapping, overlayCount, Overlay.Serdes); // 10 + s.ListWithContext(nameof(w.Overlays), w.Overlays, mapping, overlayCount, Overlay.Serdes); // 10 return w; } } \ No newline at end of file diff --git a/src/Formats/Assets/Maps/BaseMapData.cs b/src/Formats/Assets/Maps/BaseMapData.cs index cb6687389..44e323abc 100644 --- a/src/Formats/Assets/Maps/BaseMapData.cs +++ b/src/Formats/Assets/Maps/BaseMapData.cs @@ -127,13 +127,13 @@ protected BaseMapData(MapId id, PaletteId paletteId, int width, int height) Zones = new MapEventZone[width * height]; } - protected int SerdesZones(ISerializer s) + protected int SerdesZones(ISerdes s) { ArgumentNullException.ThrowIfNull(s); Zones ??= new MapEventZone[Width * Height]; int zoneCount = s.UInt16("GlobalZoneCount", (ushort)GlobalZones.Count); int totalCount = zoneCount; - GlobalZones = (List)s.List( + GlobalZones = (List)s.ListWithContext( nameof(GlobalZones), GlobalZones, (byte)255, @@ -150,7 +150,7 @@ protected int SerdesZones(ISerializer s) zoneCount = s.UInt16("RowZones", (ushort)(row?.Count ?? 0)); totalCount += zoneCount; - row = (List)s.List( + row = (List)s.ListWithContext( nameof(Zones), row, y, zoneCount, (_, zone, y2, s2) => MapEventZone.Serdes(zone, s2, (byte)y2), @@ -164,7 +164,7 @@ protected int SerdesZones(ISerializer s) return totalCount; } - protected void SerdesEvents(AssetMapping mapping, MapType mapType, ISerializer s) + protected void SerdesEvents(AssetMapping mapping, MapType mapType, ISerdes s) { ArgumentNullException.ThrowIfNull(s); ushort eventCount = s.UInt16("EventCount", (ushort)Events.Count); @@ -186,7 +186,7 @@ protected void SerdesEvents(AssetMapping mapping, MapType mapType, ISerializer s node.Unswizzle(Events); } - protected void SerdesChains(ISerializer s, int chainCount) + protected void SerdesChains(ISerdes s, int chainCount) { ArgumentNullException.ThrowIfNull(s); while (Chains.Count < chainCount) @@ -251,7 +251,7 @@ void AddEventReference(int id, object referrer) } #endif - protected void SerdesNpcWaypoints(ISerializer s) + protected void SerdesNpcWaypoints(ISerdes s) { ArgumentNullException.ThrowIfNull(s); for (var index = 0; index < Npcs.Count; index++) @@ -269,7 +269,7 @@ protected void SerdesNpcWaypoints(ISerializer s) } } - public static IMapData Serdes(AssetId id, IMapData existing, AssetMapping mapping, ISerializer s) + public static IMapData Serdes(AssetId id, IMapData existing, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); if (s.BytesRemaining == 0) diff --git a/src/Formats/Assets/Maps/MapData2D.cs b/src/Formats/Assets/Maps/MapData2D.cs index b820dc9d6..b1a2f9461 100644 --- a/src/Formats/Assets/Maps/MapData2D.cs +++ b/src/Formats/Assets/Maps/MapData2D.cs @@ -69,7 +69,7 @@ public MapData2D(MapId id, PaletteId paletteId, TilesetId tilesetId, byte width, Tiles = new MapTile[width * height]; } - public static MapData2D Serdes(AssetId id, MapData2D existing, AssetMapping mapping, ISerializer s) + public static MapData2D Serdes(AssetId id, MapData2D existing, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(mapping); ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/Maps/MapData3D.cs b/src/Formats/Assets/Maps/MapData3D.cs index 8f830cec0..1609932b0 100644 --- a/src/Formats/Assets/Maps/MapData3D.cs +++ b/src/Formats/Assets/Maps/MapData3D.cs @@ -70,7 +70,7 @@ public MapData3D(MapId id, PaletteId paletteId, LabyrinthId labyrinthId, int wid AutomapGraphics = new byte[AutomapGraphicsSize]; } - public static MapData3D Serdes(AssetId id, MapData3D existing, AssetMapping mapping, ISerializer s) + public static MapData3D Serdes(AssetId id, MapData3D existing, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); @@ -141,7 +141,7 @@ public static MapData3D Serdes(AssetId id, MapData3D existing, AssetMapping mapp return map; } - void SerdesAutomap(ISerializer s) + void SerdesAutomap(ISerdes s) { ushort automapInfoCount = s.UInt16("AutomapInfoCount", (ushort)Automap.Count); if (automapInfoCount != 0xffff) diff --git a/src/Formats/Assets/Maps/MapEventZone.cs b/src/Formats/Assets/Maps/MapEventZone.cs index 06b69362c..1b5e9c2fd 100644 --- a/src/Formats/Assets/Maps/MapEventZone.cs +++ b/src/Formats/Assets/Maps/MapEventZone.cs @@ -8,7 +8,7 @@ namespace UAlbion.Formats.Assets.Maps; -public class MapEventZone +public class MapEventZone { public bool Global { get; set; } public byte Unk1 { get; set; } @@ -18,13 +18,15 @@ public class MapEventZone [JsonIgnore] public AssetId ChainSource { get; set; } [JsonIgnore] public ushort Chain { get; set; } [JsonIgnore] public IEventNode Node { get; set; } - [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public ushort EventIndex + + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public ushort EventIndex { get => Node?.Id ?? 0xffff; set => Node = value == 0xffff ? null : new DummyEventNode(value); } - public static MapEventZone Serdes(MapEventZone existing, ISerializer s, byte y) + public static MapEventZone Serdes(MapEventZone existing, ISerdes s, byte y) { ArgumentNullException.ThrowIfNull(s); @@ -41,7 +43,11 @@ public static MapEventZone Serdes(MapEventZone existing, ISerializer s, byte y) // ApiUtil.Assert(global && zone.X == 0xff || !global && zone.X != 0xff); zone.Unk1 = s.UInt8(nameof(Unk1), zone.Unk1); zone.Trigger = s.EnumU16(nameof(Trigger), zone.Trigger); - ushort? nodeId = s.Transform(nameof(Node), zone.Node?.Id, S.UInt16, MaxToNullConverter.Instance); + + ushort rawNodeId = zone.Node?.Id ?? 0xffff; + rawNodeId = s.UInt16(nameof(Node), rawNodeId); + ushort? nodeId = rawNodeId == 0xffff ? null : rawNodeId; + if (nodeId != null && zone.Node == null) zone.Node = new DummyEventNode(nodeId.Value); diff --git a/src/Formats/Assets/Maps/MapNpc.cs b/src/Formats/Assets/Maps/MapNpc.cs index 9d1c5d2a4..f54affe59 100644 --- a/src/Formats/Assets/Maps/MapNpc.cs +++ b/src/Formats/Assets/Maps/MapNpc.cs @@ -26,9 +26,9 @@ public NpcType Type ((_raw & MapNpcFlags.Type2) != 0 ? 2 : 0)); set => _raw = _raw & ~MapNpcFlags.TypeMaskV2 - | (((int)value & 1) != 0 ? MapNpcFlags.Type1 : 0) - | (((int)value & 2) != 0 ? MapNpcFlags.Type2 : 0) - | (((int)value & 4) != 0 ? MapNpcFlags.Type4 : 0); + | (((int)value & 1) != 0 ? MapNpcFlags.Type1 : 0) + | (((int)value & 2) != 0 ? MapNpcFlags.Type2 : 0) + | (((int)value & 4) != 0 ? MapNpcFlags.Type4 : 0); } public MapNpcFlags Flags @@ -56,7 +56,9 @@ public NpcMovement Movement public NpcWaypoint[] Waypoints { get; set; } public ushort Chain { get; set; } [JsonIgnore] public IEventNode Node { get; set; } - [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public ushort EventIndex + + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public ushort EventIndex { get => Node?.Id ?? 0xffff; set => Node = value == 0xffff ? null : new DummyEventNode(value); @@ -64,7 +66,7 @@ public NpcMovement Movement public bool HasWaypoints(MapFlags mapFlags) => Movement is NpcMovement.Waypoints or NpcMovement.Waypoints2; - public static MapNpc Serdes(int _, MapNpc existing, MapType mapType, AssetMapping mapping, ISerializer s) + public static MapNpc Serdes(int _, MapNpc existing, MapType mapType, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); s.Begin("Npc"); @@ -75,7 +77,10 @@ public static MapNpc Serdes(int _, MapNpc existing, MapType mapType, AssetMappin id = s.UInt8(nameof(Id), id); npc.Sound = s.UInt8(nameof(Sound), npc.Sound); - ushort? eventNumber = MaxToNullConverter.Serdes(nameof(npc.Node), npc.Node?.Id, s.UInt16); + ushort rawEventNumber = npc.Node?.Id ?? 0xffff; + rawEventNumber = s.UInt16(nameof(npc.Node), rawEventNumber); + ushort? eventNumber = rawEventNumber == 0xffff ? null : rawEventNumber; + if (eventNumber != null && npc.Node == null) npc.Node = new DummyEventNode(eventNumber.Value); @@ -115,7 +120,7 @@ public static AssetType AssetTypeForNpcType(NpcType type, bool simpleMessageFlag }; } - public void LoadWaypoints(ISerializer s, bool useWaypoints) + public void LoadWaypoints(ISerdes s, bool useWaypoints) { ArgumentNullException.ThrowIfNull(s); if (useWaypoints) @@ -149,7 +154,10 @@ public void Unswizzle(MapId mapId, Func getEvent, Func $"U7:{Unk7} {(Bouncy ? "Bounce " : "")}{(UseUnderlayFlags ? "Fallback " : "")}{(DebugDot ? "Debug " : "")}" + $"{(NoDraw ? "NoDraw ":"")}{(Unk12 ? "Unk12 ":"")}{(Unk18 ? "Unk18 ":"")}"; - public static TileData Serdes(int _, TileData t, ISerializer s) + public static TileData Serdes(int _, TileData t, ISerdes s) { ArgumentNullException.ThrowIfNull(s); t ??= new TileData(); diff --git a/src/Formats/Assets/Maps/TilesetData.cs b/src/Formats/Assets/Maps/TilesetData.cs index a91ac1524..7ed8461f0 100644 --- a/src/Formats/Assets/Maps/TilesetData.cs +++ b/src/Formats/Assets/Maps/TilesetData.cs @@ -17,7 +17,7 @@ public TilesetData() { } public bool UseSmallGraphics { get; set; } // Careful if renaming: needs to match up to asset property in assets.json [JsonInclude] public List Tiles { get; private set; } = []; - public static TilesetData Serdes(TilesetData td, ISerializer s, AssetLoadContext context) + public static TilesetData Serdes(TilesetData td, ISerdes s, AssetLoadContext context) { const int dummyTileCount = 1; ArgumentNullException.ThrowIfNull(s); @@ -40,7 +40,12 @@ public static TilesetData Serdes(TilesetData td, ISerializer s, AssetLoadContext }); } - s.List(nameof(Tiles), td.Tiles, tileCount - dummyTileCount, dummyTileCount, S.Object(TileData.Serdes)); + s.List( + nameof(Tiles), + td.Tiles, + tileCount - dummyTileCount, + dummyTileCount, + static (i, x, s2) => s2.Object(i, x, TileData.Serdes)); if (s.IsReading()) for (ushort i = 0; i < td.Tiles.Count; i++) diff --git a/src/Formats/Assets/MonsterGroup.cs b/src/Formats/Assets/MonsterGroup.cs index 9aed49b7b..f0c1b2861 100644 --- a/src/Formats/Assets/MonsterGroup.cs +++ b/src/Formats/Assets/MonsterGroup.cs @@ -13,7 +13,7 @@ public class MonsterGroup [JsonInclude] public MonsterId[] Grid { get; private set; } = new MonsterId[SavedGame.CombatColumns * SavedGame.CombatRowsForMobs]; - public static MonsterGroup Serdes(int _, MonsterGroup m, AssetMapping mapping, ISerializer s) + public static MonsterGroup Serdes(int _, MonsterGroup m, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); m ??= new MonsterGroup(); diff --git a/src/Formats/Assets/Save/FlagSet.cs b/src/Formats/Assets/Save/FlagSet.cs index 4e49100be..92e7ed049 100644 --- a/src/Formats/Assets/Save/FlagSet.cs +++ b/src/Formats/Assets/Save/FlagSet.cs @@ -109,7 +109,7 @@ public void SetPacked(byte[] packed) } } - public void Serdes(string name, ISerializer s) + public void Serdes(string name, ISerdes s) { ArgumentNullException.ThrowIfNull(s); @@ -122,7 +122,7 @@ public void Serdes(string name, ISerializer s) Describe(s); } - void Describe(ISerializer s) + void Describe(ISerdes s) { var sb = new StringBuilder(); int lastMap = -1; diff --git a/src/Formats/Assets/Save/MapChange.cs b/src/Formats/Assets/Save/MapChange.cs index bad36fd18..11bc1997c 100644 --- a/src/Formats/Assets/Save/MapChange.cs +++ b/src/Formats/Assets/Save/MapChange.cs @@ -18,7 +18,7 @@ public class MapChange // Basically an IconChangeEvent without the MapEventType public MapId MapId { get; set; } public override string ToString() => $"MapΔ {X:X2} {Y:X2} {ChangeType} {Layers} {Value:X4} {MapId}"; - public static MapChange Serdes(int i, MapChange u, AssetMapping mapping, ISerializer s) + public static MapChange Serdes(int i, MapChange u, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); u ??= new MapChange(); diff --git a/src/Formats/Assets/Save/MapChangeCollection.cs b/src/Formats/Assets/Save/MapChangeCollection.cs index 8a30700e1..6034a576d 100644 --- a/src/Formats/Assets/Save/MapChangeCollection.cs +++ b/src/Formats/Assets/Save/MapChangeCollection.cs @@ -10,7 +10,7 @@ namespace UAlbion.Formats.Assets.Save; public class MapChangeCollection : List { - public static MapChangeCollection Serdes(int _, MapChangeCollection c, AssetMapping mapping, ISerializer s) + public static MapChangeCollection Serdes(int _, MapChangeCollection c, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); c ??= []; diff --git a/src/Formats/Assets/Save/MiscState.cs b/src/Formats/Assets/Save/MiscState.cs index 7b62d5a04..f33c54c25 100644 --- a/src/Formats/Assets/Save/MiscState.cs +++ b/src/Formats/Assets/Save/MiscState.cs @@ -31,7 +31,7 @@ public class MiscState public long UnkB0 { get; set; } public long UnkB8 { get; set; } - public static MiscState Serdes(string _, MiscState m, ISerializer s) + public static MiscState Serdes(string _, MiscState m, ISerdes s) { ArgumentNullException.ThrowIfNull(s); m ??= new MiscState(); diff --git a/src/Formats/Assets/Save/NpcMoveState.cs b/src/Formats/Assets/Save/NpcMoveState.cs index 3603839d3..75685ba30 100644 --- a/src/Formats/Assets/Save/NpcMoveState.cs +++ b/src/Formats/Assets/Save/NpcMoveState.cs @@ -19,7 +19,7 @@ public class NpcMoveState public ushort Unk14 { get; set; } // Sometimes has NPC index? public ushort Unk16 { get; set; } // Frame number? [0..11] - public static NpcMoveState Serdes(NpcMoveState ms, ISerializer s) + public static NpcMoveState Serdes(NpcMoveState ms, ISerdes s) { ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/Save/NpcState.cs b/src/Formats/Assets/Save/NpcState.cs index fd594b5b6..eee1cc607 100644 --- a/src/Formats/Assets/Save/NpcState.cs +++ b/src/Formats/Assets/Save/NpcState.cs @@ -11,7 +11,7 @@ namespace UAlbion.Formats.Assets.Save; public class NpcState : IMovementState { // Total size = 128 bytes - public static NpcState Serdes(int i, NpcState npc, (MapType mapType, AssetMapping mapping) c, ISerializer s) + public static NpcState Serdes(int i, NpcState npc, (MapType mapType, AssetMapping mapping) c, ISerdes s) { ArgumentNullException.ThrowIfNull(s); npc ??= new NpcState(); diff --git a/src/Formats/Assets/Save/SavedGame.cs b/src/Formats/Assets/Save/SavedGame.cs index 1da4f2d51..e4663fa98 100644 --- a/src/Formats/Assets/Save/SavedGame.cs +++ b/src/Formats/Assets/Save/SavedGame.cs @@ -50,11 +50,11 @@ public class SavedGame public IDictionary Inventories { get; } = new Dictionary(); // TODO: Change to InventoryId? public IDictionary Automaps { get; } = new Dictionary(); - readonly FlagSet _switches = new(SwitchCount); - readonly FlagSet _unlockedChests = new(ChestCount); - readonly FlagSet _unlockedDoors = new(DoorCount); - readonly FlagSet _removedNpcs = new(MapCount, NpcCountPerMap); - readonly FlagSet _disabledChains = new(MapCount, ChainCountPerMap); + readonly FlagSet _switches = new(SwitchCount); + readonly FlagSet _unlockedChests = new(ChestCount); + readonly FlagSet _unlockedDoors = new(DoorCount); + readonly FlagSet _removedNpcs = new(MapCount, NpcCountPerMap); + readonly FlagSet _disabledChains = new(MapCount, ChainCountPerMap); readonly FlagSet _automapMarkersFound = new(AutomapMarkerCount); readonly TickerSet _tickers = []; @@ -133,7 +133,7 @@ public void SetDoorOpen(DoorId id, bool value) public MiscState Misc { get; private set; } = new(); public byte[] Unknown5B8C { get; set; } public NpcState[] Npcs { get; } = new NpcState[NpcCountPerMap]; - public byte[] Unknown8Bb8 { get; set; } + public byte[] Unknown8Bb8 { get; set; } public MapChangeCollection PermanentMapChanges { get; private set; } = []; public MapChangeCollection TemporaryMapChanges { get; private set; } = []; HashSet _visitedSet = []; @@ -153,7 +153,7 @@ public static string GetName(BinaryReader br) return s.FixedLengthString(nameof(Name), null, nameLength); } - public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerializer s, ISpellManager spellManager) + public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerdes s, ISpellManager spellManager) { ArgumentNullException.ThrowIfNull(s); save ??= new SavedGame(); @@ -174,7 +174,7 @@ public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerializer // Comments with hex values after this point are relative to headerOffset // (i.e. a watch on "s.Offset - headerOffset" should match the comments while stepping through) - save.Unk9 = s.UInt32(nameof(Unk9), save.Unk9, 4); // 0 + save.Unk9 = s.UInt32(nameof(Unk9), save.Unk9); // 0 ushort days = s.UInt16("Days", (ushort)save.ElapsedTime.TotalDays); // 4 ushort hours = s.UInt16("Hours", (ushort)save.ElapsedTime.Hours); // 6 ushort minutes = s.UInt16("Minutes", (ushort)save.ElapsedTime.Minutes); // 8 @@ -189,7 +189,7 @@ public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerializer nameof(ActiveSpells), save.ActiveSpells, 0x50, - (_, x,s2) => s2.UInt16(null, x), + (_, x, s2) => s2.UInt16(null, x), n => new ushort[n]); // 11 save.UnkB1 = s.Bytes(nameof(UnkB1), save.UnkB1, 0xE5); // B1 @@ -232,9 +232,9 @@ public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerializer ApiUtil.Assert(s.Offset - headerOffset == 0x5b8c, $"Expected header to be 0x5b8c bytes, but it was {s.Offset - headerOffset:x}"); save.Unknown5B8C = s.Bytes(nameof(Unknown5B8C), save.Unknown5B8C, 0x2C); var mapType = MapType.TwoD; - s.List(nameof(save.Npcs), save.Npcs, (mapType, mapping), NpcCountPerMap, NpcState.Serdes); // 5bb8 + s.ListWithContext(nameof(save.Npcs), save.Npcs, (mapType, mapping), NpcCountPerMap, NpcState.Serdes); // 5bb8 - save.Unknown8Bb8 = s.Bytes( nameof(Unknown8Bb8), save.Unknown8Bb8, 0x8c0); // 8bb8 + save.Unknown8Bb8 = s.Bytes(nameof(Unknown8Bb8), save.Unknown8Bb8, 0x8c0); // 8bb8 // Temp + permanent map changes plus visited event details SerdesPermanentMapChanges(save, mapping, s); @@ -254,7 +254,7 @@ public static SavedGame Serdes(SavedGame save, AssetMapping mapping, ISerializer return save; } - static void SerdesPartyCharacters(SavedGame save, AssetMapping mapping, ISpellManager spellManager, ISerializer s) + static void SerdesPartyCharacters(SavedGame save, AssetMapping mapping, ISpellManager spellManager, ISerdes s) { var partyIds = save.Sheets.Keys.Where(x => x.Type == AssetType.PartySheet).Select(x => x.Id).ToList(); partyIds.Add(199); // Force extra XLD length fields to be written for empty objects to preserve compat with original game. @@ -267,7 +267,7 @@ static void SerdesPartyCharacters(SavedGame save, AssetMapping mapping, ISpellMa XldContainer.Serdes(XldCategory.PartyCharacter, 200, 299, context, s, SerdesPartyCharacter, partyIds); } - static void SerdesNpcCharacters(SavedGame save, AssetMapping mapping, ISpellManager spellManager, ISerializer s) + static void SerdesNpcCharacters(SavedGame save, AssetMapping mapping, ISpellManager spellManager, ISerdes s) { var npcIds = save.Sheets.Keys.Select(x => x.Id).ToList(); // TODO: Allow extension somehow npcIds.Add(299); @@ -277,7 +277,7 @@ static void SerdesNpcCharacters(SavedGame save, AssetMapping mapping, ISpellMana XldContainer.Serdes(XldCategory.NpcCharacter, 200, 299, context, s, SerdesNpcCharacter, npcIds); } - static void SerdesAutomaps(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesAutomaps(SavedGame save, AssetMapping mapping, ISerdes s) { var automapIds = save.Automaps.Keys.Select(x => x.Id).ToList(); // TODO: Allow extension somehow automapIds.Add(199); @@ -289,7 +289,7 @@ static void SerdesAutomaps(SavedGame save, AssetMapping mapping, ISerializer s) XldContainer.Serdes(XldCategory.Automap, 300, 399, context, s, SerdesAutomap, automapIds); } - static void SerdesChests(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesChests(SavedGame save, AssetMapping mapping, ISerdes s) { var chestIds = save.Inventories.Keys.Where(x => x.Type == AssetType.Chest).Select(x => x.Id).ToList(); // TODO: Allow extension somehow chestIds.Add(199); @@ -302,7 +302,7 @@ static void SerdesChests(SavedGame save, AssetMapping mapping, ISerializer s) XldContainer.Serdes(XldCategory.Chest, 500, 599, context, s, SerdesChest, chestIds); } - static void SerdesMerchants(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesMerchants(SavedGame save, AssetMapping mapping, ISerdes s) { var merchantIds = save.Inventories.Keys.Where(x => x.Type == AssetType.Merchant).Select(x => x.Id).ToList(); // TODO: Allow extension somehow merchantIds.Add(199); @@ -314,7 +314,7 @@ static void SerdesMerchants(SavedGame save, AssetMapping mapping, ISerializer s) XldContainer.Serdes(XldCategory.Merchant, 200, 299, context, s, SerdesMerchant, merchantIds); } - static void SerdesPermanentMapChanges(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesPermanentMapChanges(SavedGame save, AssetMapping mapping, ISerdes s) { uint permChangesSize = s.UInt32("PermanentMapChanges_Size", (uint)(save.PermanentMapChanges.Count * MapChange.SizeOnDisk + 2)); // 9478 ushort permChangesCount = s.UInt16("PermanentMapChanges_Count", (ushort)save.PermanentMapChanges.Count); // 947c @@ -326,16 +326,16 @@ static void SerdesPermanentMapChanges(SavedGame save, AssetMapping mapping, ISer permChangesCount = (ushort)((permChangesSize - 2) / MapChange.SizeOnDisk); } - save.PermanentMapChanges = (MapChangeCollection)s.List( // 947e + save.PermanentMapChanges = (MapChangeCollection)s.ListWithContext( // 947e nameof(PermanentMapChanges), save.PermanentMapChanges, mapping, permChangesCount, MapChange.Serdes, - _ => new MapChangeCollection()); + _ => (MapChangeCollection)[]); } - static void SerdesTemporaryMapChanges(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesTemporaryMapChanges(SavedGame save, AssetMapping mapping, ISerdes s) { uint tempChangesSize = s.UInt32("TemporaryMapChanges_Size", (uint)(save.TemporaryMapChanges.Count * MapChange.SizeOnDisk + 2)); ushort tempChangesCount = s.UInt16("TemporaryMapChanges_Count", (ushort)save.TemporaryMapChanges.Count); @@ -347,16 +347,16 @@ static void SerdesTemporaryMapChanges(SavedGame save, AssetMapping mapping, ISer tempChangesCount = (ushort)((tempChangesSize - 2) / MapChange.SizeOnDisk); } - save.TemporaryMapChanges = (MapChangeCollection)s.List( + save.TemporaryMapChanges = (MapChangeCollection)s.ListWithContext( nameof(TemporaryMapChanges), save.TemporaryMapChanges, mapping, tempChangesCount, MapChange.Serdes, - _ => new MapChangeCollection()); + _ => (MapChangeCollection)[]); } - static void SerdesVisitEventIds(SavedGame save, AssetMapping mapping, ISerializer s) + static void SerdesVisitEventIds(SavedGame save, AssetMapping mapping, ISerdes s) { uint visitedEventsSize = s.UInt32("VisitedEvents_Size", (uint)(save.VisitedEvents.Count * VisitedEvent.SizeOnDisk + 2)); ushort visitedEventsCount = s.UInt16("VisitedEvents_Count", (ushort)save.VisitedEvents.Count); @@ -368,17 +368,17 @@ static void SerdesVisitEventIds(SavedGame save, AssetMapping mapping, ISerialize visitedEventsCount = (ushort)((visitedEventsSize - 2) / VisitedEvent.SizeOnDisk); } - save._visitedEvents = - (List)s.List( + save._visitedEvents = + (List)s.ListWithContext( nameof(VisitedEvents), save._visitedEvents, mapping, visitedEventsCount, VisitedEvent.Serdes); - save._visitedSet = save._visitedEvents.ToHashSet(); + save._visitedSet = [.. save._visitedEvents]; } - static void SerdesPartyCharacter(int i, int size, (SavedGame save, AssetMapping mapping, ISpellManager spellManager) context, ISerializer serializer) + static void SerdesPartyCharacter(int i, int size, (SavedGame save, AssetMapping mapping, ISpellManager spellManager) context, ISerdes serdes) { if (i > 0xff) return; @@ -386,43 +386,43 @@ static void SerdesPartyCharacter(int i, int size, (SavedGame save, AssetMapping var id = SheetId.FromDisk(AssetType.PartySheet, i, context.mapping); CharacterSheet existing = null; if (size > 0 || context.save.Sheets.TryGetValue(id, out existing)) - context.save.Sheets[id] = CharacterSheet.Serdes(id, existing, context.mapping, serializer, context.spellManager); + context.save.Sheets[id] = CharacterSheet.Serdes(id, existing, context.mapping, serdes, context.spellManager); } - static void SerdesNpcCharacter(int i, int size, (SavedGame save, AssetMapping mapping, ISpellManager spellManager) context, ISerializer serializer) + static void SerdesNpcCharacter(int i, int size, (SavedGame save, AssetMapping mapping, ISpellManager spellManager) context, ISerdes serdes) { if (i > 0xff) return; var id = SheetId.FromDisk(AssetType.NpcSheet, i, context.mapping); CharacterSheet existing = null; - if (serializer.IsReading() || context.save.Sheets.TryGetValue(id, out existing)) - context.save.Sheets[id] = CharacterSheet.Serdes(id, existing, context.mapping, serializer, context.spellManager); + if (serdes.IsReading() || context.save.Sheets.TryGetValue(id, out existing)) + context.save.Sheets[id] = CharacterSheet.Serdes(id, existing, context.mapping, serdes, context.spellManager); } - static void SerdesAutomap(int i, int size, (SavedGame, AssetMapping) context, ISerializer serializer) + static void SerdesAutomap(int i, int size, (SavedGame, AssetMapping) context, ISerdes serdes) { var save = context.Item1; var mapping = context.Item2; var key = AutomapId.FromDisk(i, mapping); if (save.Automaps.TryGetValue(key, out _)) - serializer.Bytes(null, save.Automaps[key], save.Automaps[key].Length); - else if (serializer.IsReading()) - save.Automaps[key] = serializer.Bytes(null, null, size); + serdes.Bytes(null, save.Automaps[key], save.Automaps[key].Length); + else if (serdes.IsReading()) + save.Automaps[key] = serdes.Bytes(null, null, size); } - static void SerdesChest(int i, int size, (SavedGame, AssetMapping) context, ISerializer serializer) + static void SerdesChest(int i, int size, (SavedGame, AssetMapping) context, ISerdes serdes) { var save = context.Item1; var mapping = context.Item2; var key = ChestId.FromDisk(i, mapping); Inventory existing = null; - if (serializer.IsReading() || save.Inventories.TryGetValue(key, out existing)) - save.Inventories[key] = Inventory.SerdesChest(i, existing, mapping, serializer); + if (serdes.IsReading() || save.Inventories.TryGetValue(key, out existing)) + save.Inventories[key] = Inventory.SerdesChest(i, existing, mapping, serdes); } - static void SerdesMerchant(int i, int size, (SavedGame, AssetMapping) context, ISerializer serializer) + static void SerdesMerchant(int i, int size, (SavedGame, AssetMapping) context, ISerdes serdes) { if (i > 0xff) return; @@ -432,8 +432,8 @@ static void SerdesMerchant(int i, int size, (SavedGame, AssetMapping) context, I var key = MerchantId.FromDisk(i, mapping); Inventory existing = null; - if (serializer.IsReading() || save.Inventories.TryGetValue(key, out existing)) - save.Inventories[key] = Inventory.SerdesMerchant(i, existing, mapping, serializer); + if (serdes.IsReading() || save.Inventories.TryGetValue(key, out existing)) + save.Inventories[key] = Inventory.SerdesMerchant(i, existing, mapping, serdes); } public bool IsEventUsed(AssetId eventSetId, ActionEvent action) diff --git a/src/Formats/Assets/Save/TickerSet.cs b/src/Formats/Assets/Save/TickerSet.cs index 340069b69..3d27864be 100644 --- a/src/Formats/Assets/Save/TickerSet.cs +++ b/src/Formats/Assets/Save/TickerSet.cs @@ -9,7 +9,7 @@ public class TickerSet : Dictionary { const int Max = 255; - public static TickerSet Serdes(string _, TickerSet d, ISerializer s) + public static TickerSet Serdes(string _, TickerSet d, ISerdes s) { ArgumentNullException.ThrowIfNull(s); d ??= []; diff --git a/src/Formats/Assets/Save/VisitedEvent.cs b/src/Formats/Assets/Save/VisitedEvent.cs index ef816ef88..341b87074 100644 --- a/src/Formats/Assets/Save/VisitedEvent.cs +++ b/src/Formats/Assets/Save/VisitedEvent.cs @@ -26,7 +26,7 @@ public VisitedEvent(EventSetId eventSetId, ActionType type, AssetId argument) Argument = argument; } - public static VisitedEvent Serdes(int n, VisitedEvent u, AssetMapping mapping, ISerializer s) + public static VisitedEvent Serdes(int n, VisitedEvent u, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/Save/VisitedEventList.cs b/src/Formats/Assets/Save/VisitedEventList.cs index c3e399c6b..3962d5155 100644 --- a/src/Formats/Assets/Save/VisitedEventList.cs +++ b/src/Formats/Assets/Save/VisitedEventList.cs @@ -11,7 +11,7 @@ public class VisitedEventList public ushort NumChunks { get; set; } public VisitedEvent[] Contents { get; set; } - public static VisitedEventList Serdes(int _, VisitedEventList c, AssetMapping mapping, ISerializer s) + public static VisitedEventList Serdes(int _, VisitedEventList c, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); c ??= new VisitedEventList(); @@ -19,7 +19,7 @@ public static VisitedEventList Serdes(int _, VisitedEventList c, AssetMapping ma c.NumChunks = s.UInt16(nameof(NumChunks), c.NumChunks); ApiUtil.Assert(c.NumChunks == c.Size / VisitedEvent.SizeOnDisk); c.Contents ??= new VisitedEvent[(c.Size - 2) / VisitedEvent.SizeOnDisk]; - s.List(nameof(c.Contents), c.Contents, mapping, c.Contents.Length, VisitedEvent.Serdes); + s.ListWithContext(nameof(c.Contents), c.Contents, mapping, c.Contents.Length, VisitedEvent.Serdes); return c; } } \ No newline at end of file diff --git a/src/Formats/Assets/Save/XldDescriptor.cs b/src/Formats/Assets/Save/XldDescriptor.cs index 32aefa84b..64629a07a 100644 --- a/src/Formats/Assets/Save/XldDescriptor.cs +++ b/src/Formats/Assets/Save/XldDescriptor.cs @@ -10,7 +10,7 @@ public class XldDescriptor public XldCategory Category { get; set; } public ushort Number { get; set; } - public static XldDescriptor Serdes(string _, XldDescriptor d, ISerializer s) + public static XldDescriptor Serdes(string _, XldDescriptor d, ISerdes s) { ArgumentNullException.ThrowIfNull(s); d ??= new XldDescriptor(); diff --git a/src/Formats/Assets/Sheets/CharacterAttribute.cs b/src/Formats/Assets/Sheets/CharacterAttribute.cs index c52d5ed3e..e91d3f384 100644 --- a/src/Formats/Assets/Sheets/CharacterAttribute.cs +++ b/src/Formats/Assets/Sheets/CharacterAttribute.cs @@ -14,7 +14,7 @@ public class CharacterAttribute : ICharacterAttribute public CharacterAttribute DeepClone() => (CharacterAttribute)MemberwiseClone(); public override string ToString() => $"[{Current}/{Max}]{(Boost > 0 ? $"+{Boost}" : "")}{(Backup > 0 ? $" (was {Backup})" : "")}"; - public static CharacterAttribute Serdes(string name, CharacterAttribute attr, ISerializer s, bool hasBackup = true) + public static CharacterAttribute Serdes(string name, CharacterAttribute attr, ISerdes s, bool hasBackup = true) { ArgumentNullException.ThrowIfNull(s); s.Begin(name); diff --git a/src/Formats/Assets/Sheets/CharacterSheet.cs b/src/Formats/Assets/Sheets/CharacterSheet.cs index be99d7e31..fe3b9dd0a 100644 --- a/src/Formats/Assets/Sheets/CharacterSheet.cs +++ b/src/Formats/Assets/Sheets/CharacterSheet.cs @@ -175,7 +175,7 @@ static void SetSpellData( } } - public static CharacterSheet Serdes(SheetId id, CharacterSheet sheet, AssetMapping mapping, ISerializer s, ISpellManager spellManager) + public static CharacterSheet Serdes(SheetId id, CharacterSheet sheet, AssetMapping mapping, ISerdes s, ISpellManager spellManager) { ArgumentNullException.ThrowIfNull(mapping); ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/Sheets/MonsterData.cs b/src/Formats/Assets/Sheets/MonsterData.cs index 21dff2b64..698488344 100644 --- a/src/Formats/Assets/Sheets/MonsterData.cs +++ b/src/Formats/Assets/Sheets/MonsterData.cs @@ -23,7 +23,7 @@ public class MonsterData [JsonIgnore] // Exclude from JSON as it has a computed value. public SpriteId TacticalGfx => new(AssetType.TacticalGfx, CombatGfx.Id + 12); - public static MonsterData Serdes(MonsterData m, AssetMapping mapping, ISerializer s) + public static MonsterData Serdes(MonsterData m, AssetMapping mapping, ISerdes s) { m ??= new MonsterData(); var initial = s.Offset; @@ -78,7 +78,7 @@ public static MonsterData Serdes(MonsterData m, AssetMapping mapping, ISerialize return m; } - static void SerdesAnimation(string name, CombatAnimationId id, Dictionary animations, ISerializer s) + static void SerdesAnimation(string name, CombatAnimationId id, Dictionary animations, ISerdes s) { if (s.IsReading()) { diff --git a/src/Formats/Assets/SpellData.cs b/src/Formats/Assets/SpellData.cs index b21ff4b2b..287fbb465 100644 --- a/src/Formats/Assets/SpellData.cs +++ b/src/Formats/Assets/SpellData.cs @@ -29,7 +29,7 @@ public SpellData(SpellId id, SpellClass school, byte number) // For tests public byte LevelRequirement { get; set; } public SpellTargets Targets { get; set; } public byte Unused { get; set; } // Always 0 except for unused spells in school 6 - public static SpellData Serdes(SpellData d, AssetLoadContext context, ISerializer s) + public static SpellData Serdes(SpellData d, AssetLoadContext context, ISerdes s) { ArgumentNullException.ThrowIfNull(context); ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Assets/WaveLib.cs b/src/Formats/Assets/WaveLib.cs index 963f766cf..6c11bf325 100644 --- a/src/Formats/Assets/WaveLib.cs +++ b/src/Formats/Assets/WaveLib.cs @@ -10,7 +10,7 @@ public class WaveLib { public const int MaxSamples = 512; Dictionary _instrumentIndex; - public static WaveLib Serdes(WaveLib w, ISerializer s) + public static WaveLib Serdes(WaveLib w, ISerdes s) { ArgumentNullException.ThrowIfNull(s); w ??= new WaveLib(); diff --git a/src/Formats/Assets/WaveLibSample.cs b/src/Formats/Assets/WaveLibSample.cs index ff6cff1dd..838e808f4 100644 --- a/src/Formats/Assets/WaveLibSample.cs +++ b/src/Formats/Assets/WaveLibSample.cs @@ -22,7 +22,7 @@ public class WaveLibSample : ISample public override string ToString() => Active ? $"I:{Instrument} T:{Type} {Samples.Length} = {(MidiInstrument)Instrument}" : "None"; - public static WaveLibSample Serdes(WaveLibSample w, ISerializer s, ref uint nextBufferOffset) + public static WaveLibSample Serdes(WaveLibSample w, ISerdes s, ref uint nextBufferOffset) { ArgumentNullException.ThrowIfNull(s); w ??= new WaveLibSample(); diff --git a/src/Formats/Containers/BinaryOffsetContainer.cs b/src/Formats/Containers/BinaryOffsetContainer.cs index 6ed18d2e7..06373a758 100644 --- a/src/Formats/Containers/BinaryOffsetContainer.cs +++ b/src/Formats/Containers/BinaryOffsetContainer.cs @@ -16,7 +16,7 @@ public class BinaryOffsetContainer : IAssetContainer public static readonly IntAssetProperty Offset = new("Offset"); // int, used for BinaryOffsetContainer, e.g. MAIN.EXE public static readonly StringAssetProperty Hotspot = new("Hotspot"); // for cursors, formatted like "5 -2" - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Containers/DirectoryContainer.cs b/src/Formats/Containers/DirectoryContainer.cs index fc97b644f..08c360d2b 100644 --- a/src/Formats/Containers/DirectoryContainer.cs +++ b/src/Formats/Containers/DirectoryContainer.cs @@ -17,7 +17,7 @@ namespace UAlbion.Formats.Containers; public class DirectoryContainer : IAssetContainer { static readonly AssetPathPattern DefaultPattern = AssetPathPattern.Build("{0}_{1}_{2}.dat"); - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Containers/DummyContainer.cs b/src/Formats/Containers/DummyContainer.cs index aacfcbefb..745d44e5b 100644 --- a/src/Formats/Containers/DummyContainer.cs +++ b/src/Formats/Containers/DummyContainer.cs @@ -6,7 +6,7 @@ namespace UAlbion.Formats.Containers; public class DummyContainer : IAssetContainer { - static readonly EmptySerializer Empty = new(); - public ISerializer Read(string path, AssetLoadContext context) => Empty; + static readonly EmptySerdes Empty = new(); + public ISerdes Read(string path, AssetLoadContext context) => Empty; public void Write(string path, IList<(AssetLoadContext, byte[])> assets, ModContext context) { } } \ No newline at end of file diff --git a/src/Formats/Containers/ItemListContainer.cs b/src/Formats/Containers/ItemListContainer.cs index d8584fba6..37b741dbd 100644 --- a/src/Formats/Containers/ItemListContainer.cs +++ b/src/Formats/Containers/ItemListContainer.cs @@ -14,7 +14,7 @@ namespace UAlbion.Formats.Containers; /// public class ItemListContainer : IAssetContainer { - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); var stream = context.Disk.OpenRead(path); diff --git a/src/Formats/Containers/JsonObjectContainer.cs b/src/Formats/Containers/JsonObjectContainer.cs index 16d6c8463..8dc6036e4 100644 --- a/src/Formats/Containers/JsonObjectContainer.cs +++ b/src/Formats/Containers/JsonObjectContainer.cs @@ -16,7 +16,7 @@ namespace UAlbion.Formats.Containers; public class JsonObjectContainer : IAssetContainer { [SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "The serializer will handle it")] - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); if (!context.Disk.FileExists(path)) @@ -28,7 +28,7 @@ public ISerializer Read(string path, AssetLoadContext context) var ms = new MemoryStream(Encoding.UTF8.GetBytes(context.Json.Serialize(token))); var br = new BinaryReader(ms); - return new GenericBinaryReader( + return new ReaderSerdes( br, ms.Length, Encoding.UTF8.GetString, diff --git a/src/Formats/Containers/JsonStringContainer.cs b/src/Formats/Containers/JsonStringContainer.cs index 329271ab8..03fe98085 100644 --- a/src/Formats/Containers/JsonStringContainer.cs +++ b/src/Formats/Containers/JsonStringContainer.cs @@ -15,7 +15,7 @@ namespace UAlbion.Formats.Containers; public class JsonStringContainer : IAssetContainer { [SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope", Justification = "The serializer will handle it")] - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); @@ -28,7 +28,7 @@ public ISerializer Read(string path, AssetLoadContext context) var ms = new MemoryStream(Encoding.UTF8.GetBytes(value)); var br = new BinaryReader(ms); - return new GenericBinaryReader( + return new ReaderSerdes( br, ms.Length, Encoding.UTF8.GetString, diff --git a/src/Formats/Containers/RawContainer.cs b/src/Formats/Containers/RawContainer.cs index 9f25e41d9..d60340334 100644 --- a/src/Formats/Containers/RawContainer.cs +++ b/src/Formats/Containers/RawContainer.cs @@ -13,7 +13,7 @@ namespace UAlbion.Formats.Containers; /// public class RawContainer : IAssetContainer { - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); ApiUtil.Assert(context.Index == 0, "SubItem should always be 0 when accessing a non-container file"); diff --git a/src/Formats/Containers/SpellListContainer.cs b/src/Formats/Containers/SpellListContainer.cs index d63b3444b..3111c5aeb 100644 --- a/src/Formats/Containers/SpellListContainer.cs +++ b/src/Formats/Containers/SpellListContainer.cs @@ -15,7 +15,7 @@ namespace UAlbion.Formats.Containers; public class SpellListContainer : IAssetContainer { static readonly byte[] Blank = [0, 0, 0, 0, 0]; - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Containers/XldContainer.cs b/src/Formats/Containers/XldContainer.cs index 1a0658595..03a4538b1 100644 --- a/src/Formats/Containers/XldContainer.cs +++ b/src/Formats/Containers/XldContainer.cs @@ -19,7 +19,7 @@ public class XldContainer : IAssetContainer static readonly IntAssetProperty MinimumCount = new("MinimumCount"); static int HeaderSize(int itemCount) => MagicString.Length + 3 + 4 * itemCount; - public ISerializer Read(string path, AssetLoadContext context) + public ISerdes Read(string path, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); if (!context.Disk.FileExists(path)) @@ -95,7 +95,7 @@ static Dictionary LoadAll(IFileSystem disk, string path) return results; } - static int[] HeaderSerdes(int[] lengths, ISerializer s) + static int[] HeaderSerdes(int[] lengths, ISerdes s) { ArgumentNullException.ThrowIfNull(s); s.Begin("XldHeader"); @@ -117,8 +117,8 @@ static void ReadEmbedded( XldCategory category, int firstId, TContext context, - ISerializer s, - Action func) + ISerdes s, + Action func) { var descriptor = s.Object("XldDescriptor", (XldDescriptor)null, XldDescriptor.Serdes); ApiUtil.Assert(descriptor.Category == category); @@ -135,7 +135,7 @@ static void ReadEmbedded( if (lengths[i] == 0) continue; - using var window = new WindowingProxySerializer(s, null); + using var window = new WindowingProxySerdes(s, null); func(i + firstId, lengths[i], context, window); offset += lengths[i]; ApiUtil.Assert(offset == s.Offset); @@ -147,8 +147,8 @@ static void WriteEmbedded( int firstId, int lastId, TContext context, - ISerializer s, - Action func, + ISerdes s, + Action func, IList populatedIds) { int count = populatedIds.Where(x => x >= firstId && x <= lastId).Max() - firstId + 1; @@ -158,7 +158,7 @@ static void WriteEmbedded( for (int i = 0; i < count; i++) { - using var window = new WindowingProxySerializer(s, null); + using var window = new WindowingProxySerdes(s, null); func(i + firstId, 0, context, window); lengths[i] = (int)window.Offset; } @@ -183,8 +183,8 @@ public static void Serdes( int firstId, int lastId, TContext context, - ISerializer s, - Action func, + ISerdes s, + Action func, IList populatedIds) { ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/Containers/ZipContainer.cs b/src/Formats/Containers/ZipContainer.cs index bf5b4f56c..969c3166d 100644 --- a/src/Formats/Containers/ZipContainer.cs +++ b/src/Formats/Containers/ZipContainer.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.Containers; /// public class ZipContainer : IAssetContainer { - public ISerializer Read(string path, AssetLoadContext context) => throw new System.NotImplementedException(); + public ISerdes Read(string path, AssetLoadContext context) => throw new System.NotImplementedException(); public void Write(string path, IList<(AssetLoadContext, byte[])> assets, ModContext context) => throw new System.NotImplementedException(); } \ No newline at end of file diff --git a/src/Formats/Exporters/Tiled/StampLoader.cs b/src/Formats/Exporters/Tiled/StampLoader.cs index ddd583af8..96610d892 100644 --- a/src/Formats/Exporters/Tiled/StampLoader.cs +++ b/src/Formats/Exporters/Tiled/StampLoader.cs @@ -12,7 +12,7 @@ namespace UAlbion.Formats.Exporters.Tiled; public class StampLoader : IAssetLoader { public static readonly PathPatternProperty TilesetPattern = new("TilesetPattern", "../Tilesets/{0}_{2}.tsx"); - public BlockList Serdes(BlockList existing, ISerializer s, AssetLoadContext context) + public BlockList Serdes(BlockList existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -59,7 +59,7 @@ public BlockList Serdes(BlockList existing, ISerializer s, AssetLoadContext cont return list; } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((BlockList) existing, s, context); /* .stamp file diff --git a/src/Formats/Exporters/Tiled/TiledMapLoader.cs b/src/Formats/Exporters/Tiled/TiledMapLoader.cs index 8404a907c..2b9146fe9 100644 --- a/src/Formats/Exporters/Tiled/TiledMapLoader.cs +++ b/src/Formats/Exporters/Tiled/TiledMapLoader.cs @@ -22,10 +22,10 @@ public class TiledMapLoader : Component, IAssetLoader public static readonly PathPatternProperty TilesetPattern = new("TilesetPattern", "../Tilesets/{0}_{2}.tsx"); // string public static readonly PathPatternProperty ScriptPattern = new("ScriptPattern"); // string - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((BaseMapData) existing, s, context); - public BaseMapData Serdes(BaseMapData existing, ISerializer s, AssetLoadContext context) + public BaseMapData Serdes(BaseMapData existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -43,7 +43,7 @@ static string GetScriptFilename(AssetLoadContext context) return scriptPattern.Format(context.BuildAssetPath()); } - void Write(BaseMapData existing, ISerializer s, AssetLoadContext context) + void Write(BaseMapData existing, ISerdes s, AssetLoadContext context) { (byte[] bytes, string script) = existing switch { @@ -77,7 +77,7 @@ void Write(BaseMapData existing, ISerializer s, AssetLoadContext context) context.Disk.WriteAllText(Path.Combine(assetDir, scriptPath), script); } - BaseMapData Read(ISerializer s, AssetLoadContext context) + BaseMapData Read(ISerdes s, AssetLoadContext context) { var assetDir = GetAssetDir(context); var scriptPath = Path.Combine(assetDir, GetScriptFilename(context)); diff --git a/src/Formats/Exporters/Tiled/TiledTilesetLoader.cs b/src/Formats/Exporters/Tiled/TiledTilesetLoader.cs index 95c71f7c2..42a111cfd 100644 --- a/src/Formats/Exporters/Tiled/TiledTilesetLoader.cs +++ b/src/Formats/Exporters/Tiled/TiledTilesetLoader.cs @@ -12,10 +12,10 @@ public class TiledTilesetLoader : Component, IAssetLoader { public static readonly StringAssetProperty BlankTilePathProperty = new("BlankTilePath"); public static readonly PathPatternProperty GraphicsPattern = new("GraphicsPattern"); - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((TilesetData)existing, s, context); - public TilesetData Serdes(TilesetData existing, ISerializer s, AssetLoadContext context) + public TilesetData Serdes(TilesetData existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -36,15 +36,15 @@ public TilesetData Serdes(TilesetData existing, ISerializer s, AssetLoadContext : Load(context, properties, s); } - static TilesetData Load(AssetLoadContext context, Tilemap2DProperties properties, ISerializer serializer) + static TilesetData Load(AssetLoadContext context, Tilemap2DProperties properties, ISerdes serdes) { - var xmlBytes = serializer.Bytes(null, null, (int)serializer.BytesRemaining); + var xmlBytes = serdes.Bytes(null, null, (int)serdes.BytesRemaining); using var ms = new MemoryStream(xmlBytes); var tileset = Tileset.Parse(ms); return TilesetMapping.ToAlbion(tileset, context.AssetId, properties); } - static TilesetData Save(TilesetData tileset, Tilemap2DProperties properties, ISerializer s) + static TilesetData Save(TilesetData tileset, Tilemap2DProperties properties, ISerdes s) { ArgumentNullException.ThrowIfNull(tileset); var tiledTileset = TilesetMapping.FromAlbion(tileset, properties); diff --git a/src/Formats/FormatUtil.cs b/src/Formats/FormatUtil.cs index 1e1807be6..90e03abd5 100644 --- a/src/Formats/FormatUtil.cs +++ b/src/Formats/FormatUtil.cs @@ -151,7 +151,7 @@ public static byte[] BytesFromStream([InstantHandle] Action func) return stream.ToArray(); } - public static ISerializer SerializeWithSerdes([InstantHandle] Action serdes) + public static ISerdes SerializeWithSerdes([InstantHandle] Action serdes) { ArgumentNullException.ThrowIfNull(serdes); var ms = new MemoryStream(); @@ -169,7 +169,7 @@ public static ISerializer SerializeWithSerdes([InstantHandle] Action serdes) + public static byte[] SerializeToBytes([InstantHandle] Action serdes) { ArgumentNullException.ThrowIfNull(serdes); var ms = new MemoryStream(); @@ -181,7 +181,7 @@ public static byte[] SerializeToBytes([InstantHandle] Action serdes return ms.ToArray(); } - public static T DeserializeFromBytes(byte[] bytes, [InstantHandle] Func serdes) + public static T DeserializeFromBytes(byte[] bytes, [InstantHandle] Func serdes) { ArgumentNullException.ThrowIfNull(serdes); using var ms = new MemoryStream(bytes); diff --git a/src/Formats/GlobalSuppressions.cs b/src/Formats/GlobalSuppressions.cs index 1e0bc233f..46007f0b8 100644 --- a/src/Formats/GlobalSuppressions.cs +++ b/src/Formats/GlobalSuppressions.cs @@ -3,8 +3,8 @@ // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "member", Target = "~M:UAlbion.Formats.Assets.AutomapInfo.Serdes(System.Int32,UAlbion.Formats.Assets.AutomapInfo,SerdesNet.ISerializer)~UAlbion.Formats.Assets.AutomapInfo")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "member", Target = "~M:UAlbion.Formats.Assets.ColorRange.Serdes(System.Int32,UAlbion.Formats.Assets.ColorRange,SerdesNet.ISerializer)~UAlbion.Formats.Assets.ColorRange")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "member", Target = "~M:UAlbion.Formats.Assets.AutomapInfo.Serdes(System.Int32,UAlbion.Formats.Assets.AutomapInfo,SerdesNet.ISerdes)~UAlbion.Formats.Assets.AutomapInfo")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "member", Target = "~M:UAlbion.Formats.Assets.ColorRange.Serdes(System.Int32,UAlbion.Formats.Assets.ColorRange,SerdesNet.ISerdes)~UAlbion.Formats.Assets.ColorRange")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "", Scope = "member", Target = "~P:UAlbion.Formats.MapEvents.IEventNode.Event")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "", Scope = "member", Target = "~P:UAlbion.Formats.MapEvents.IEventNode.Next")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2227:Collection properties should be read only", Justification = "", Scope = "member", Target = "~P:UAlbion.Formats.Assets.CharacterSheet.UnknownBlock96")] diff --git a/src/Formats/Ids/AutomapId.g.cs b/src/Formats/Ids/AutomapId.g.cs index 551e17c80..46c7e5101 100644 --- a/src/Formats/Ids/AutomapId.g.cs +++ b/src/Formats/Ids/AutomapId.g.cs @@ -67,7 +67,7 @@ public static AutomapId FromDisk(int disk, AssetMapping mapping) return (AutomapId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static AutomapId SerdesU8(string name, AutomapId id, AssetMapping mapping, ISerializer s) + public static AutomapId SerdesU8(string name, AutomapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static AutomapId SerdesU8(string name, AutomapId id, AssetMapping mapping return id; } - public static AutomapId SerdesU16(string name, AutomapId id, AssetMapping mapping, ISerializer s) + public static AutomapId SerdesU16(string name, AutomapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static AutomapId SerdesU16(string name, AutomapId id, AssetMapping mappin return id; } - public static AutomapId SerdesU16BE(string name, AutomapId id, AssetMapping mapping, ISerializer s) + public static AutomapId SerdesU16BE(string name, AutomapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/BlockListId.g.cs b/src/Formats/Ids/BlockListId.g.cs index c76e9aaca..35333f225 100644 --- a/src/Formats/Ids/BlockListId.g.cs +++ b/src/Formats/Ids/BlockListId.g.cs @@ -67,7 +67,7 @@ public static BlockListId FromDisk(int disk, AssetMapping mapping) return (BlockListId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static BlockListId SerdesU8(string name, BlockListId id, AssetMapping mapping, ISerializer s) + public static BlockListId SerdesU8(string name, BlockListId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static BlockListId SerdesU8(string name, BlockListId id, AssetMapping map return id; } - public static BlockListId SerdesU16(string name, BlockListId id, AssetMapping mapping, ISerializer s) + public static BlockListId SerdesU16(string name, BlockListId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static BlockListId SerdesU16(string name, BlockListId id, AssetMapping ma return id; } - public static BlockListId SerdesU16BE(string name, BlockListId id, AssetMapping mapping, ISerializer s) + public static BlockListId SerdesU16BE(string name, BlockListId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/ChestId.g.cs b/src/Formats/Ids/ChestId.g.cs index 1569baa28..9d044f548 100644 --- a/src/Formats/Ids/ChestId.g.cs +++ b/src/Formats/Ids/ChestId.g.cs @@ -67,7 +67,7 @@ public static ChestId FromDisk(int disk, AssetMapping mapping) return (ChestId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static ChestId SerdesU8(string name, ChestId id, AssetMapping mapping, ISerializer s) + public static ChestId SerdesU8(string name, ChestId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static ChestId SerdesU8(string name, ChestId id, AssetMapping mapping, IS return id; } - public static ChestId SerdesU16(string name, ChestId id, AssetMapping mapping, ISerializer s) + public static ChestId SerdesU16(string name, ChestId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static ChestId SerdesU16(string name, ChestId id, AssetMapping mapping, I return id; } - public static ChestId SerdesU16BE(string name, ChestId id, AssetMapping mapping, ISerializer s) + public static ChestId SerdesU16BE(string name, ChestId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/CombatBackgroundId.g.cs b/src/Formats/Ids/CombatBackgroundId.g.cs index a714cd882..2b612ff94 100644 --- a/src/Formats/Ids/CombatBackgroundId.g.cs +++ b/src/Formats/Ids/CombatBackgroundId.g.cs @@ -67,7 +67,7 @@ public static CombatBackgroundId FromDisk(int disk, AssetMapping mapping) return (CombatBackgroundId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static CombatBackgroundId SerdesU8(string name, CombatBackgroundId id, AssetMapping mapping, ISerializer s) + public static CombatBackgroundId SerdesU8(string name, CombatBackgroundId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static CombatBackgroundId SerdesU8(string name, CombatBackgroundId id, As return id; } - public static CombatBackgroundId SerdesU16(string name, CombatBackgroundId id, AssetMapping mapping, ISerializer s) + public static CombatBackgroundId SerdesU16(string name, CombatBackgroundId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static CombatBackgroundId SerdesU16(string name, CombatBackgroundId id, A return id; } - public static CombatBackgroundId SerdesU16BE(string name, CombatBackgroundId id, AssetMapping mapping, ISerializer s) + public static CombatBackgroundId SerdesU16BE(string name, CombatBackgroundId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/DoorId.g.cs b/src/Formats/Ids/DoorId.g.cs index a65bb3349..caa81aa63 100644 --- a/src/Formats/Ids/DoorId.g.cs +++ b/src/Formats/Ids/DoorId.g.cs @@ -67,7 +67,7 @@ public static DoorId FromDisk(int disk, AssetMapping mapping) return (DoorId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static DoorId SerdesU8(string name, DoorId id, AssetMapping mapping, ISerializer s) + public static DoorId SerdesU8(string name, DoorId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static DoorId SerdesU8(string name, DoorId id, AssetMapping mapping, ISer return id; } - public static DoorId SerdesU16(string name, DoorId id, AssetMapping mapping, ISerializer s) + public static DoorId SerdesU16(string name, DoorId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static DoorId SerdesU16(string name, DoorId id, AssetMapping mapping, ISe return id; } - public static DoorId SerdesU16BE(string name, DoorId id, AssetMapping mapping, ISerializer s) + public static DoorId SerdesU16BE(string name, DoorId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/EventSetId.g.cs b/src/Formats/Ids/EventSetId.g.cs index 742aa5214..b56c4bc23 100644 --- a/src/Formats/Ids/EventSetId.g.cs +++ b/src/Formats/Ids/EventSetId.g.cs @@ -67,7 +67,7 @@ public static EventSetId FromDisk(int disk, AssetMapping mapping) return (EventSetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static EventSetId SerdesU8(string name, EventSetId id, AssetMapping mapping, ISerializer s) + public static EventSetId SerdesU8(string name, EventSetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static EventSetId SerdesU8(string name, EventSetId id, AssetMapping mappi return id; } - public static EventSetId SerdesU16(string name, EventSetId id, AssetMapping mapping, ISerializer s) + public static EventSetId SerdesU16(string name, EventSetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static EventSetId SerdesU16(string name, EventSetId id, AssetMapping mapp return id; } - public static EventSetId SerdesU16BE(string name, EventSetId id, AssetMapping mapping, ISerializer s) + public static EventSetId SerdesU16BE(string name, EventSetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/FontId.g.cs b/src/Formats/Ids/FontId.g.cs index 17b288b82..c5784f58e 100644 --- a/src/Formats/Ids/FontId.g.cs +++ b/src/Formats/Ids/FontId.g.cs @@ -67,7 +67,7 @@ public static FontId FromDisk(int disk, AssetMapping mapping) return (FontId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static FontId SerdesU8(string name, FontId id, AssetMapping mapping, ISerializer s) + public static FontId SerdesU8(string name, FontId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static FontId SerdesU8(string name, FontId id, AssetMapping mapping, ISer return id; } - public static FontId SerdesU16(string name, FontId id, AssetMapping mapping, ISerializer s) + public static FontId SerdesU16(string name, FontId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static FontId SerdesU16(string name, FontId id, AssetMapping mapping, ISe return id; } - public static FontId SerdesU16BE(string name, FontId id, AssetMapping mapping, ISerializer s) + public static FontId SerdesU16BE(string name, FontId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/InkId.g.cs b/src/Formats/Ids/InkId.g.cs index 839c204cf..e2cb7336f 100644 --- a/src/Formats/Ids/InkId.g.cs +++ b/src/Formats/Ids/InkId.g.cs @@ -67,7 +67,7 @@ public static InkId FromDisk(int disk, AssetMapping mapping) return (InkId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static InkId SerdesU8(string name, InkId id, AssetMapping mapping, ISerializer s) + public static InkId SerdesU8(string name, InkId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static InkId SerdesU8(string name, InkId id, AssetMapping mapping, ISeria return id; } - public static InkId SerdesU16(string name, InkId id, AssetMapping mapping, ISerializer s) + public static InkId SerdesU16(string name, InkId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static InkId SerdesU16(string name, InkId id, AssetMapping mapping, ISeri return id; } - public static InkId SerdesU16BE(string name, InkId id, AssetMapping mapping, ISerializer s) + public static InkId SerdesU16BE(string name, InkId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/ItemId.g.cs b/src/Formats/Ids/ItemId.g.cs index 693e9321a..8511c025a 100644 --- a/src/Formats/Ids/ItemId.g.cs +++ b/src/Formats/Ids/ItemId.g.cs @@ -61,7 +61,7 @@ public static ItemId FromDisk(AssetType type, int disk, AssetMapping mapping) return (ItemId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static ItemId SerdesU8(string name, ItemId id, AssetType type, AssetMapping mapping, ISerializer s) + public static ItemId SerdesU8(string name, ItemId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static ItemId SerdesU8(string name, ItemId id, AssetType type, AssetMappi return id; } - public static ItemId SerdesU16(string name, ItemId id, AssetType type, AssetMapping mapping, ISerializer s) + public static ItemId SerdesU16(string name, ItemId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static ItemId SerdesU16(string name, ItemId id, AssetType type, AssetMapp return id; } - public static ItemId SerdesU16BE(string name, ItemId id, AssetType type, AssetMapping mapping, ISerializer s) + public static ItemId SerdesU16BE(string name, ItemId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/LabyrinthId.g.cs b/src/Formats/Ids/LabyrinthId.g.cs index 213887cc1..8e22caae9 100644 --- a/src/Formats/Ids/LabyrinthId.g.cs +++ b/src/Formats/Ids/LabyrinthId.g.cs @@ -67,7 +67,7 @@ public static LabyrinthId FromDisk(int disk, AssetMapping mapping) return (LabyrinthId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static LabyrinthId SerdesU8(string name, LabyrinthId id, AssetMapping mapping, ISerializer s) + public static LabyrinthId SerdesU8(string name, LabyrinthId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static LabyrinthId SerdesU8(string name, LabyrinthId id, AssetMapping map return id; } - public static LabyrinthId SerdesU16(string name, LabyrinthId id, AssetMapping mapping, ISerializer s) + public static LabyrinthId SerdesU16(string name, LabyrinthId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static LabyrinthId SerdesU16(string name, LabyrinthId id, AssetMapping ma return id; } - public static LabyrinthId SerdesU16BE(string name, LabyrinthId id, AssetMapping mapping, ISerializer s) + public static LabyrinthId SerdesU16BE(string name, LabyrinthId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/MapId.g.cs b/src/Formats/Ids/MapId.g.cs index 97b195361..85a406dd9 100644 --- a/src/Formats/Ids/MapId.g.cs +++ b/src/Formats/Ids/MapId.g.cs @@ -67,7 +67,7 @@ public static MapId FromDisk(int disk, AssetMapping mapping) return (MapId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static MapId SerdesU8(string name, MapId id, AssetMapping mapping, ISerializer s) + public static MapId SerdesU8(string name, MapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static MapId SerdesU8(string name, MapId id, AssetMapping mapping, ISeria return id; } - public static MapId SerdesU16(string name, MapId id, AssetMapping mapping, ISerializer s) + public static MapId SerdesU16(string name, MapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static MapId SerdesU16(string name, MapId id, AssetMapping mapping, ISeri return id; } - public static MapId SerdesU16BE(string name, MapId id, AssetMapping mapping, ISerializer s) + public static MapId SerdesU16BE(string name, MapId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/MapObjectid.g.cs b/src/Formats/Ids/MapObjectid.g.cs index 10ddf9e17..ea4583ca3 100644 --- a/src/Formats/Ids/MapObjectid.g.cs +++ b/src/Formats/Ids/MapObjectid.g.cs @@ -67,7 +67,7 @@ public static MapObjectId FromDisk(int disk, AssetMapping mapping) return (MapObjectId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static MapObjectId SerdesU8(string name, MapObjectId id, AssetMapping mapping, ISerializer s) + public static MapObjectId SerdesU8(string name, MapObjectId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static MapObjectId SerdesU8(string name, MapObjectId id, AssetMapping map return id; } - public static MapObjectId SerdesU16(string name, MapObjectId id, AssetMapping mapping, ISerializer s) + public static MapObjectId SerdesU16(string name, MapObjectId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static MapObjectId SerdesU16(string name, MapObjectId id, AssetMapping ma return id; } - public static MapObjectId SerdesU16BE(string name, MapObjectId id, AssetMapping mapping, ISerializer s) + public static MapObjectId SerdesU16BE(string name, MapObjectId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/MerchantId.g.cs b/src/Formats/Ids/MerchantId.g.cs index 9910c7484..6613cd7d3 100644 --- a/src/Formats/Ids/MerchantId.g.cs +++ b/src/Formats/Ids/MerchantId.g.cs @@ -67,7 +67,7 @@ public static MerchantId FromDisk(int disk, AssetMapping mapping) return (MerchantId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static MerchantId SerdesU8(string name, MerchantId id, AssetMapping mapping, ISerializer s) + public static MerchantId SerdesU8(string name, MerchantId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static MerchantId SerdesU8(string name, MerchantId id, AssetMapping mappi return id; } - public static MerchantId SerdesU16(string name, MerchantId id, AssetMapping mapping, ISerializer s) + public static MerchantId SerdesU16(string name, MerchantId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static MerchantId SerdesU16(string name, MerchantId id, AssetMapping mapp return id; } - public static MerchantId SerdesU16BE(string name, MerchantId id, AssetMapping mapping, ISerializer s) + public static MerchantId SerdesU16BE(string name, MerchantId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/MonsterGroupId.g.cs b/src/Formats/Ids/MonsterGroupId.g.cs index ffffff989..79eedbbf1 100644 --- a/src/Formats/Ids/MonsterGroupId.g.cs +++ b/src/Formats/Ids/MonsterGroupId.g.cs @@ -67,7 +67,7 @@ public static MonsterGroupId FromDisk(int disk, AssetMapping mapping) return (MonsterGroupId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static MonsterGroupId SerdesU8(string name, MonsterGroupId id, AssetMapping mapping, ISerializer s) + public static MonsterGroupId SerdesU8(string name, MonsterGroupId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static MonsterGroupId SerdesU8(string name, MonsterGroupId id, AssetMappi return id; } - public static MonsterGroupId SerdesU16(string name, MonsterGroupId id, AssetMapping mapping, ISerializer s) + public static MonsterGroupId SerdesU16(string name, MonsterGroupId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static MonsterGroupId SerdesU16(string name, MonsterGroupId id, AssetMapp return id; } - public static MonsterGroupId SerdesU16BE(string name, MonsterGroupId id, AssetMapping mapping, ISerializer s) + public static MonsterGroupId SerdesU16BE(string name, MonsterGroupId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/MonsterId.g.cs b/src/Formats/Ids/MonsterId.g.cs index ac9776d21..4fd568ce4 100644 --- a/src/Formats/Ids/MonsterId.g.cs +++ b/src/Formats/Ids/MonsterId.g.cs @@ -67,7 +67,7 @@ public static MonsterId FromDisk(int disk, AssetMapping mapping) return (MonsterId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static MonsterId SerdesU8(string name, MonsterId id, AssetMapping mapping, ISerializer s) + public static MonsterId SerdesU8(string name, MonsterId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static MonsterId SerdesU8(string name, MonsterId id, AssetMapping mapping return id; } - public static MonsterId SerdesU16(string name, MonsterId id, AssetMapping mapping, ISerializer s) + public static MonsterId SerdesU16(string name, MonsterId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static MonsterId SerdesU16(string name, MonsterId id, AssetMapping mappin return id; } - public static MonsterId SerdesU16BE(string name, MonsterId id, AssetMapping mapping, ISerializer s) + public static MonsterId SerdesU16BE(string name, MonsterId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/NpcSheetId.g.cs b/src/Formats/Ids/NpcSheetId.g.cs index 48556cefb..348d08a60 100644 --- a/src/Formats/Ids/NpcSheetId.g.cs +++ b/src/Formats/Ids/NpcSheetId.g.cs @@ -67,7 +67,7 @@ public static NpcSheetId FromDisk(int disk, AssetMapping mapping) return (NpcSheetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static NpcSheetId SerdesU8(string name, NpcSheetId id, AssetMapping mapping, ISerializer s) + public static NpcSheetId SerdesU8(string name, NpcSheetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static NpcSheetId SerdesU8(string name, NpcSheetId id, AssetMapping mappi return id; } - public static NpcSheetId SerdesU16(string name, NpcSheetId id, AssetMapping mapping, ISerializer s) + public static NpcSheetId SerdesU16(string name, NpcSheetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static NpcSheetId SerdesU16(string name, NpcSheetId id, AssetMapping mapp return id; } - public static NpcSheetId SerdesU16BE(string name, NpcSheetId id, AssetMapping mapping, ISerializer s) + public static NpcSheetId SerdesU16BE(string name, NpcSheetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/PaletteId.g.cs b/src/Formats/Ids/PaletteId.g.cs index f730afa9e..4ea06132d 100644 --- a/src/Formats/Ids/PaletteId.g.cs +++ b/src/Formats/Ids/PaletteId.g.cs @@ -67,7 +67,7 @@ public static PaletteId FromDisk(int disk, AssetMapping mapping) return (PaletteId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static PaletteId SerdesU8(string name, PaletteId id, AssetMapping mapping, ISerializer s) + public static PaletteId SerdesU8(string name, PaletteId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static PaletteId SerdesU8(string name, PaletteId id, AssetMapping mapping return id; } - public static PaletteId SerdesU16(string name, PaletteId id, AssetMapping mapping, ISerializer s) + public static PaletteId SerdesU16(string name, PaletteId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static PaletteId SerdesU16(string name, PaletteId id, AssetMapping mappin return id; } - public static PaletteId SerdesU16BE(string name, PaletteId id, AssetMapping mapping, ISerializer s) + public static PaletteId SerdesU16BE(string name, PaletteId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/PartyMemberId.g.cs b/src/Formats/Ids/PartyMemberId.g.cs index 4945b480e..5ee064705 100644 --- a/src/Formats/Ids/PartyMemberId.g.cs +++ b/src/Formats/Ids/PartyMemberId.g.cs @@ -67,7 +67,7 @@ public static PartyMemberId FromDisk(int disk, AssetMapping mapping) return (PartyMemberId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static PartyMemberId SerdesU8(string name, PartyMemberId id, AssetMapping mapping, ISerializer s) + public static PartyMemberId SerdesU8(string name, PartyMemberId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static PartyMemberId SerdesU8(string name, PartyMemberId id, AssetMapping return id; } - public static PartyMemberId SerdesU16(string name, PartyMemberId id, AssetMapping mapping, ISerializer s) + public static PartyMemberId SerdesU16(string name, PartyMemberId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static PartyMemberId SerdesU16(string name, PartyMemberId id, AssetMappin return id; } - public static PartyMemberId SerdesU16BE(string name, PartyMemberId id, AssetMapping mapping, ISerializer s) + public static PartyMemberId SerdesU16BE(string name, PartyMemberId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/PictureId.g.cs b/src/Formats/Ids/PictureId.g.cs index 9c7c1bfd0..7a74ff87c 100644 --- a/src/Formats/Ids/PictureId.g.cs +++ b/src/Formats/Ids/PictureId.g.cs @@ -67,7 +67,7 @@ public static PictureId FromDisk(int disk, AssetMapping mapping) return (PictureId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static PictureId SerdesU8(string name, PictureId id, AssetMapping mapping, ISerializer s) + public static PictureId SerdesU8(string name, PictureId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static PictureId SerdesU8(string name, PictureId id, AssetMapping mapping return id; } - public static PictureId SerdesU16(string name, PictureId id, AssetMapping mapping, ISerializer s) + public static PictureId SerdesU16(string name, PictureId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static PictureId SerdesU16(string name, PictureId id, AssetMapping mappin return id; } - public static PictureId SerdesU16BE(string name, PictureId id, AssetMapping mapping, ISerializer s) + public static PictureId SerdesU16BE(string name, PictureId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/PortraitId.g.cs b/src/Formats/Ids/PortraitId.g.cs index e960c143e..0fa537b2a 100644 --- a/src/Formats/Ids/PortraitId.g.cs +++ b/src/Formats/Ids/PortraitId.g.cs @@ -67,7 +67,7 @@ public static PortraitId FromDisk(int disk, AssetMapping mapping) return (PortraitId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static PortraitId SerdesU8(string name, PortraitId id, AssetMapping mapping, ISerializer s) + public static PortraitId SerdesU8(string name, PortraitId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static PortraitId SerdesU8(string name, PortraitId id, AssetMapping mappi return id; } - public static PortraitId SerdesU16(string name, PortraitId id, AssetMapping mapping, ISerializer s) + public static PortraitId SerdesU16(string name, PortraitId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static PortraitId SerdesU16(string name, PortraitId id, AssetMapping mapp return id; } - public static PortraitId SerdesU16BE(string name, PortraitId id, AssetMapping mapping, ISerializer s) + public static PortraitId SerdesU16BE(string name, PortraitId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SampleId.g.cs b/src/Formats/Ids/SampleId.g.cs index 7b503134c..957aa625d 100644 --- a/src/Formats/Ids/SampleId.g.cs +++ b/src/Formats/Ids/SampleId.g.cs @@ -67,7 +67,7 @@ public static SampleId FromDisk(int disk, AssetMapping mapping) return (SampleId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SampleId SerdesU8(string name, SampleId id, AssetMapping mapping, ISerializer s) + public static SampleId SerdesU8(string name, SampleId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static SampleId SerdesU8(string name, SampleId id, AssetMapping mapping, return id; } - public static SampleId SerdesU16(string name, SampleId id, AssetMapping mapping, ISerializer s) + public static SampleId SerdesU16(string name, SampleId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static SampleId SerdesU16(string name, SampleId id, AssetMapping mapping, return id; } - public static SampleId SerdesU16BE(string name, SampleId id, AssetMapping mapping, ISerializer s) + public static SampleId SerdesU16BE(string name, SampleId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/ScriptId.g.cs b/src/Formats/Ids/ScriptId.g.cs index 4b61a530b..5d2983347 100644 --- a/src/Formats/Ids/ScriptId.g.cs +++ b/src/Formats/Ids/ScriptId.g.cs @@ -67,7 +67,7 @@ public static ScriptId FromDisk(int disk, AssetMapping mapping) return (ScriptId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static ScriptId SerdesU8(string name, ScriptId id, AssetMapping mapping, ISerializer s) + public static ScriptId SerdesU8(string name, ScriptId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static ScriptId SerdesU8(string name, ScriptId id, AssetMapping mapping, return id; } - public static ScriptId SerdesU16(string name, ScriptId id, AssetMapping mapping, ISerializer s) + public static ScriptId SerdesU16(string name, ScriptId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static ScriptId SerdesU16(string name, ScriptId id, AssetMapping mapping, return id; } - public static ScriptId SerdesU16BE(string name, ScriptId id, AssetMapping mapping, ISerializer s) + public static ScriptId SerdesU16BE(string name, ScriptId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SheetId.g.cs b/src/Formats/Ids/SheetId.g.cs index bdb8904b7..9d16f94a7 100644 --- a/src/Formats/Ids/SheetId.g.cs +++ b/src/Formats/Ids/SheetId.g.cs @@ -61,7 +61,7 @@ public static SheetId FromDisk(AssetType type, int disk, AssetMapping mapping) return (SheetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SheetId SerdesU8(string name, SheetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SheetId SerdesU8(string name, SheetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static SheetId SerdesU8(string name, SheetId id, AssetType type, AssetMap return id; } - public static SheetId SerdesU16(string name, SheetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SheetId SerdesU16(string name, SheetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static SheetId SerdesU16(string name, SheetId id, AssetType type, AssetMa return id; } - public static SheetId SerdesU16BE(string name, SheetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SheetId SerdesU16BE(string name, SheetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SongId.g.cs b/src/Formats/Ids/SongId.g.cs index 95ed9b7f6..653833c86 100644 --- a/src/Formats/Ids/SongId.g.cs +++ b/src/Formats/Ids/SongId.g.cs @@ -67,7 +67,7 @@ public static SongId FromDisk(int disk, AssetMapping mapping) return (SongId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SongId SerdesU8(string name, SongId id, AssetMapping mapping, ISerializer s) + public static SongId SerdesU8(string name, SongId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static SongId SerdesU8(string name, SongId id, AssetMapping mapping, ISer return id; } - public static SongId SerdesU16(string name, SongId id, AssetMapping mapping, ISerializer s) + public static SongId SerdesU16(string name, SongId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static SongId SerdesU16(string name, SongId id, AssetMapping mapping, ISe return id; } - public static SongId SerdesU16BE(string name, SongId id, AssetMapping mapping, ISerializer s) + public static SongId SerdesU16BE(string name, SongId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SpecialId.g.cs b/src/Formats/Ids/SpecialId.g.cs index 23295ffa4..3d924db05 100644 --- a/src/Formats/Ids/SpecialId.g.cs +++ b/src/Formats/Ids/SpecialId.g.cs @@ -67,7 +67,7 @@ public static SpecialId FromDisk(int disk, AssetMapping mapping) return (SpecialId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SpecialId SerdesU8(string name, SpecialId id, AssetMapping mapping, ISerializer s) + public static SpecialId SerdesU8(string name, SpecialId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static SpecialId SerdesU8(string name, SpecialId id, AssetMapping mapping return id; } - public static SpecialId SerdesU16(string name, SpecialId id, AssetMapping mapping, ISerializer s) + public static SpecialId SerdesU16(string name, SpecialId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static SpecialId SerdesU16(string name, SpecialId id, AssetMapping mappin return id; } - public static SpecialId SerdesU16BE(string name, SpecialId id, AssetMapping mapping, ISerializer s) + public static SpecialId SerdesU16BE(string name, SpecialId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SpellId.g.cs b/src/Formats/Ids/SpellId.g.cs index 52b6eb516..71499be86 100644 --- a/src/Formats/Ids/SpellId.g.cs +++ b/src/Formats/Ids/SpellId.g.cs @@ -67,7 +67,7 @@ public static SpellId FromDisk(int disk, AssetMapping mapping) return (SpellId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SpellId SerdesU8(string name, SpellId id, AssetMapping mapping, ISerializer s) + public static SpellId SerdesU8(string name, SpellId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static SpellId SerdesU8(string name, SpellId id, AssetMapping mapping, IS return id; } - public static SpellId SerdesU16(string name, SpellId id, AssetMapping mapping, ISerializer s) + public static SpellId SerdesU16(string name, SpellId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static SpellId SerdesU16(string name, SpellId id, AssetMapping mapping, I return id; } - public static SpellId SerdesU16BE(string name, SpellId id, AssetMapping mapping, ISerializer s) + public static SpellId SerdesU16BE(string name, SpellId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SpriteId.g.cs b/src/Formats/Ids/SpriteId.g.cs index 1d014b278..006967d01 100644 --- a/src/Formats/Ids/SpriteId.g.cs +++ b/src/Formats/Ids/SpriteId.g.cs @@ -61,7 +61,7 @@ public static SpriteId FromDisk(AssetType type, int disk, AssetMapping mapping) return (SpriteId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SpriteId SerdesU8(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SpriteId SerdesU8(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static SpriteId SerdesU8(string name, SpriteId id, AssetType type, AssetM return id; } - public static SpriteId SerdesU16(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SpriteId SerdesU16(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static SpriteId SerdesU16(string name, SpriteId id, AssetType type, Asset return id; } - public static SpriteId SerdesU16BE(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerializer s) + public static SpriteId SerdesU16BE(string name, SpriteId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/StringSetId.g.cs b/src/Formats/Ids/StringSetId.g.cs index 55b405f06..c96ce905a 100644 --- a/src/Formats/Ids/StringSetId.g.cs +++ b/src/Formats/Ids/StringSetId.g.cs @@ -61,7 +61,7 @@ public static StringSetId FromDisk(AssetType type, int disk, AssetMapping mappin return (StringSetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static StringSetId SerdesU8(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static StringSetId SerdesU8(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static StringSetId SerdesU8(string name, StringSetId id, AssetType type, return id; } - public static StringSetId SerdesU16(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static StringSetId SerdesU16(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static StringSetId SerdesU16(string name, StringSetId id, AssetType type, return id; } - public static StringSetId SerdesU16BE(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static StringSetId SerdesU16BE(string name, StringSetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/SwitchId.g.cs b/src/Formats/Ids/SwitchId.g.cs index 23485b45b..3887122d7 100644 --- a/src/Formats/Ids/SwitchId.g.cs +++ b/src/Formats/Ids/SwitchId.g.cs @@ -67,7 +67,7 @@ public static SwitchId FromDisk(int disk, AssetMapping mapping) return (SwitchId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static SwitchId SerdesU8(string name, SwitchId id, AssetMapping mapping, ISerializer s) + public static SwitchId SerdesU8(string name, SwitchId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static SwitchId SerdesU8(string name, SwitchId id, AssetMapping mapping, return id; } - public static SwitchId SerdesU16(string name, SwitchId id, AssetMapping mapping, ISerializer s) + public static SwitchId SerdesU16(string name, SwitchId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static SwitchId SerdesU16(string name, SwitchId id, AssetMapping mapping, return id; } - public static SwitchId SerdesU16BE(string name, SwitchId id, AssetMapping mapping, ISerializer s) + public static SwitchId SerdesU16BE(string name, SwitchId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/TargetId.g.cs b/src/Formats/Ids/TargetId.g.cs index ad9e202f2..d75cea31c 100644 --- a/src/Formats/Ids/TargetId.g.cs +++ b/src/Formats/Ids/TargetId.g.cs @@ -61,7 +61,7 @@ public static TargetId FromDisk(AssetType type, int disk, AssetMapping mapping) return (TargetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static TargetId SerdesU8(string name, TargetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TargetId SerdesU8(string name, TargetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static TargetId SerdesU8(string name, TargetId id, AssetType type, AssetM return id; } - public static TargetId SerdesU16(string name, TargetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TargetId SerdesU16(string name, TargetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static TargetId SerdesU16(string name, TargetId id, AssetType type, Asset return id; } - public static TargetId SerdesU16BE(string name, TargetId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TargetId SerdesU16BE(string name, TargetId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/TextId.g.cs b/src/Formats/Ids/TextId.g.cs index 79f6e6ce7..5708f3910 100644 --- a/src/Formats/Ids/TextId.g.cs +++ b/src/Formats/Ids/TextId.g.cs @@ -61,7 +61,7 @@ public static TextId FromDisk(AssetType type, int disk, AssetMapping mapping) return (TextId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static TextId SerdesU8(string name, TextId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TextId SerdesU8(string name, TextId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -72,7 +72,7 @@ public static TextId SerdesU8(string name, TextId id, AssetType type, AssetMappi return id; } - public static TextId SerdesU16(string name, TextId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TextId SerdesU16(string name, TextId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -83,7 +83,7 @@ public static TextId SerdesU16(string name, TextId id, AssetType type, AssetMapp return id; } - public static TextId SerdesU16BE(string name, TextId id, AssetType type, AssetMapping mapping, ISerializer s) + public static TextId SerdesU16BE(string name, TextId id, AssetType type, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/TickerId.g.cs b/src/Formats/Ids/TickerId.g.cs index 25906ad28..0bc3f166e 100644 --- a/src/Formats/Ids/TickerId.g.cs +++ b/src/Formats/Ids/TickerId.g.cs @@ -67,7 +67,7 @@ public static TickerId FromDisk(int disk, AssetMapping mapping) return (TickerId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static TickerId SerdesU8(string name, TickerId id, AssetMapping mapping, ISerializer s) + public static TickerId SerdesU8(string name, TickerId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static TickerId SerdesU8(string name, TickerId id, AssetMapping mapping, return id; } - public static TickerId SerdesU16(string name, TickerId id, AssetMapping mapping, ISerializer s) + public static TickerId SerdesU16(string name, TickerId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static TickerId SerdesU16(string name, TickerId id, AssetMapping mapping, return id; } - public static TickerId SerdesU16BE(string name, TickerId id, AssetMapping mapping, ISerializer s) + public static TickerId SerdesU16BE(string name, TickerId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/TilesetGfxId.g.cs b/src/Formats/Ids/TilesetGfxId.g.cs index 1232469d7..155a86043 100644 --- a/src/Formats/Ids/TilesetGfxId.g.cs +++ b/src/Formats/Ids/TilesetGfxId.g.cs @@ -67,7 +67,7 @@ public static TilesetGfxId FromDisk(int disk, AssetMapping mapping) return (TilesetGfxId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static TilesetGfxId SerdesU8(string name, TilesetGfxId id, AssetMapping mapping, ISerializer s) + public static TilesetGfxId SerdesU8(string name, TilesetGfxId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static TilesetGfxId SerdesU8(string name, TilesetGfxId id, AssetMapping m return id; } - public static TilesetGfxId SerdesU16(string name, TilesetGfxId id, AssetMapping mapping, ISerializer s) + public static TilesetGfxId SerdesU16(string name, TilesetGfxId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static TilesetGfxId SerdesU16(string name, TilesetGfxId id, AssetMapping return id; } - public static TilesetGfxId SerdesU16BE(string name, TilesetGfxId id, AssetMapping mapping, ISerializer s) + public static TilesetGfxId SerdesU16BE(string name, TilesetGfxId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/TilesetId.g.cs b/src/Formats/Ids/TilesetId.g.cs index 2a93e684f..5403a43a5 100644 --- a/src/Formats/Ids/TilesetId.g.cs +++ b/src/Formats/Ids/TilesetId.g.cs @@ -67,7 +67,7 @@ public static TilesetId FromDisk(int disk, AssetMapping mapping) return (TilesetId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static TilesetId SerdesU8(string name, TilesetId id, AssetMapping mapping, ISerializer s) + public static TilesetId SerdesU8(string name, TilesetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static TilesetId SerdesU8(string name, TilesetId id, AssetMapping mapping return id; } - public static TilesetId SerdesU16(string name, TilesetId id, AssetMapping mapping, ISerializer s) + public static TilesetId SerdesU16(string name, TilesetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static TilesetId SerdesU16(string name, TilesetId id, AssetMapping mappin return id; } - public static TilesetId SerdesU16BE(string name, TilesetId id, AssetMapping mapping, ISerializer s) + public static TilesetId SerdesU16BE(string name, TilesetId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/VideoId.g.cs b/src/Formats/Ids/VideoId.g.cs index 701701aae..4b81f9c09 100644 --- a/src/Formats/Ids/VideoId.g.cs +++ b/src/Formats/Ids/VideoId.g.cs @@ -67,7 +67,7 @@ public static VideoId FromDisk(int disk, AssetMapping mapping) return (VideoId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static VideoId SerdesU8(string name, VideoId id, AssetMapping mapping, ISerializer s) + public static VideoId SerdesU8(string name, VideoId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static VideoId SerdesU8(string name, VideoId id, AssetMapping mapping, IS return id; } - public static VideoId SerdesU16(string name, VideoId id, AssetMapping mapping, ISerializer s) + public static VideoId SerdesU16(string name, VideoId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static VideoId SerdesU16(string name, VideoId id, AssetMapping mapping, I return id; } - public static VideoId SerdesU16BE(string name, VideoId id, AssetMapping mapping, ISerializer s) + public static VideoId SerdesU16BE(string name, VideoId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/WaveLibraryId.g.cs b/src/Formats/Ids/WaveLibraryId.g.cs index a4e4e766b..ffa4217ca 100644 --- a/src/Formats/Ids/WaveLibraryId.g.cs +++ b/src/Formats/Ids/WaveLibraryId.g.cs @@ -67,7 +67,7 @@ public static WaveLibraryId FromDisk(int disk, AssetMapping mapping) return (WaveLibraryId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static WaveLibraryId SerdesU8(string name, WaveLibraryId id, AssetMapping mapping, ISerializer s) + public static WaveLibraryId SerdesU8(string name, WaveLibraryId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static WaveLibraryId SerdesU8(string name, WaveLibraryId id, AssetMapping return id; } - public static WaveLibraryId SerdesU16(string name, WaveLibraryId id, AssetMapping mapping, ISerializer s) + public static WaveLibraryId SerdesU16(string name, WaveLibraryId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static WaveLibraryId SerdesU16(string name, WaveLibraryId id, AssetMappin return id; } - public static WaveLibraryId SerdesU16BE(string name, WaveLibraryId id, AssetMapping mapping, ISerializer s) + public static WaveLibraryId SerdesU16BE(string name, WaveLibraryId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/Ids/WordId.g.cs b/src/Formats/Ids/WordId.g.cs index 392b75a6e..66cd2e50e 100644 --- a/src/Formats/Ids/WordId.g.cs +++ b/src/Formats/Ids/WordId.g.cs @@ -67,7 +67,7 @@ public static WordId FromDisk(int disk, AssetMapping mapping) return (WordId)AssetMapping.Global.EnumToId(enumType, enumValue); } - public static WordId SerdesU8(string name, WordId id, AssetMapping mapping, ISerializer s) + public static WordId SerdesU8(string name, WordId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -78,7 +78,7 @@ public static WordId SerdesU8(string name, WordId id, AssetMapping mapping, ISer return id; } - public static WordId SerdesU16(string name, WordId id, AssetMapping mapping, ISerializer s) + public static WordId SerdesU16(string name, WordId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); @@ -89,7 +89,7 @@ public static WordId SerdesU16(string name, WordId id, AssetMapping mapping, ISe return id; } - public static WordId SerdesU16BE(string name, WordId id, AssetMapping mapping, ISerializer s) + public static WordId SerdesU16BE(string name, WordId id, AssetMapping mapping, ISerdes s) { if (s == null) throw new ArgumentNullException(nameof(s)); diff --git a/src/Formats/MapEvents/ActionEvent.cs b/src/Formats/MapEvents/ActionEvent.cs index 902335a23..15a89ac84 100644 --- a/src/Formats/MapEvents/ActionEvent.cs +++ b/src/Formats/MapEvents/ActionEvent.cs @@ -23,7 +23,7 @@ public ActionEvent(ActionType actionType, byte block, AssetId arg, byte unk2) Argument = arg; } - public static ActionEvent Serdes(ActionEvent e, AssetMapping mapping, ISerializer s) + public static ActionEvent Serdes(ActionEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var actionType = s.EnumU8(nameof(ActionType), e?.ActionType ?? 0); diff --git a/src/Formats/MapEvents/AddPartyMemberEvent.cs b/src/Formats/MapEvents/AddPartyMemberEvent.cs index 7d10127ba..5807529f2 100644 --- a/src/Formats/MapEvents/AddPartyMemberEvent.cs +++ b/src/Formats/MapEvents/AddPartyMemberEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("add_party_member", "Add someone to the party", "apm")] public class AddPartyMemberEvent : ModifyEvent { - public static AddPartyMemberEvent Serdes(AddPartyMemberEvent e, AssetMapping mapping, ISerializer s) + public static AddPartyMemberEvent Serdes(AddPartyMemberEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new AddPartyMemberEvent(); diff --git a/src/Formats/MapEvents/AskSurrenderEvent.cs b/src/Formats/MapEvents/AskSurrenderEvent.cs index bae7364c1..a04ed591f 100644 --- a/src/Formats/MapEvents/AskSurrenderEvent.cs +++ b/src/Formats/MapEvents/AskSurrenderEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("ask_surrender")] public class AskSurrenderEvent : MapEvent { - public static AskSurrenderEvent Serdes(AskSurrenderEvent e, ISerializer s) + public static AskSurrenderEvent Serdes(AskSurrenderEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new AskSurrenderEvent(); diff --git a/src/Formats/MapEvents/ChangeAttributeEvent.cs b/src/Formats/MapEvents/ChangeAttributeEvent.cs index 0c08170ab..7a99d0aa2 100644 --- a/src/Formats/MapEvents/ChangeAttributeEvent.cs +++ b/src/Formats/MapEvents/ChangeAttributeEvent.cs @@ -27,7 +27,7 @@ public ChangeAttributeEvent(TargetId target, PhysicalAttribute attribute, Numeri IsRandom = isRandom; } - public static ChangeAttributeEvent Serdes(ChangeAttributeEvent e, ISerializer s) + public static ChangeAttributeEvent Serdes(ChangeAttributeEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeAttributeEvent(); diff --git a/src/Formats/MapEvents/ChangeEventSetEvent.cs b/src/Formats/MapEvents/ChangeEventSetEvent.cs index 96a5999e4..454423906 100644 --- a/src/Formats/MapEvents/ChangeEventSetEvent.cs +++ b/src/Formats/MapEvents/ChangeEventSetEvent.cs @@ -27,7 +27,7 @@ public ChangeEventSetEvent(TargetId target, EventSetId eventset, NumericOperatio IsRandom = isRandom; } - public static ChangeEventSetEvent Serdes(ChangeEventSetEvent e, AssetMapping mapping, ISerializer s) + public static ChangeEventSetEvent Serdes(ChangeEventSetEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeEventSetEvent(); diff --git a/src/Formats/MapEvents/ChangeIconEvent.cs b/src/Formats/MapEvents/ChangeIconEvent.cs index eaa7eec24..781ada09f 100644 --- a/src/Formats/MapEvents/ChangeIconEvent.cs +++ b/src/Formats/MapEvents/ChangeIconEvent.cs @@ -11,7 +11,7 @@ namespace UAlbion.Formats.MapEvents; public class ChangeIconEvent : MapEvent { // MapEvent as this method handles ChangeIconEvent, ChangeNpcSpriteEvent and ChangeNpcMovementEvent - public static MapEvent Serdes(MapEvent me, AssetMapping mapping, MapType mapType, ISerializer s) + public static MapEvent Serdes(MapEvent me, AssetMapping mapping, MapType mapType, ISerdes s) { ArgumentNullException.ThrowIfNull(s); if (me is ChangeNpcSpriteEvent cnse) diff --git a/src/Formats/MapEvents/ChangeItemEvent.cs b/src/Formats/MapEvents/ChangeItemEvent.cs index 8c6f87bde..01bd42456 100644 --- a/src/Formats/MapEvents/ChangeItemEvent.cs +++ b/src/Formats/MapEvents/ChangeItemEvent.cs @@ -28,7 +28,7 @@ public ChangeItemEvent(TargetId target, ItemId itemId, NumericOperation operatio IsRandom = isRandom; } - public static ChangeItemEvent Serdes(ChangeItemEvent e, AssetMapping mapping, ISerializer s) + public static ChangeItemEvent Serdes(ChangeItemEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeItemEvent(); diff --git a/src/Formats/MapEvents/ChangeLanguageEvent.cs b/src/Formats/MapEvents/ChangeLanguageEvent.cs index 5659801e2..687da1e3e 100644 --- a/src/Formats/MapEvents/ChangeLanguageEvent.cs +++ b/src/Formats/MapEvents/ChangeLanguageEvent.cs @@ -27,7 +27,7 @@ public ChangeLanguageEvent(TargetId target, PlayerLanguage language, NumericOper IsRandom = isRandom; } - public static ChangeLanguageEvent Serdes(ChangeLanguageEvent e, ISerializer s) + public static ChangeLanguageEvent Serdes(ChangeLanguageEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeLanguageEvent(); diff --git a/src/Formats/MapEvents/ChangeNpcMovementEvent.cs b/src/Formats/MapEvents/ChangeNpcMovementEvent.cs index 5403d1619..33eda349d 100644 --- a/src/Formats/MapEvents/ChangeNpcMovementEvent.cs +++ b/src/Formats/MapEvents/ChangeNpcMovementEvent.cs @@ -17,7 +17,7 @@ public class ChangeNpcMovementEvent( short y) : MapEvent, INpcEvent // Specialised variant of ChangeIconEvent { - public static ChangeNpcMovementEvent Serdes(ChangeNpcMovementEvent e, AssetMapping mapping, MapType mapType, ISerializer s) + public static ChangeNpcMovementEvent Serdes(ChangeNpcMovementEvent e, AssetMapping mapping, MapType mapType, ISerdes s) { if (s.IsReading()) // Should never be used return (ChangeNpcMovementEvent)ChangeIconEvent.Serdes(null, mapping, mapType, s); diff --git a/src/Formats/MapEvents/ChangeNpcSpriteEvent.cs b/src/Formats/MapEvents/ChangeNpcSpriteEvent.cs index 6620a1666..0629752bb 100644 --- a/src/Formats/MapEvents/ChangeNpcSpriteEvent.cs +++ b/src/Formats/MapEvents/ChangeNpcSpriteEvent.cs @@ -11,7 +11,7 @@ namespace UAlbion.Formats.MapEvents; public class ChangeNpcSpriteEvent(byte npcNum, AssetId id, EventScope scope, ChangeIconLayers layers, MapId mapId) : MapEvent, INpcEvent // Specialised variant of ChangeIconEvent { - public static ChangeNpcSpriteEvent Serdes(ChangeNpcSpriteEvent e, AssetMapping mapping, MapType mapType, ISerializer s) + public static ChangeNpcSpriteEvent Serdes(ChangeNpcSpriteEvent e, AssetMapping mapping, MapType mapType, ISerdes s) { if (s.IsReading()) // Should never be used return (ChangeNpcSpriteEvent)ChangeIconEvent.Serdes(null, mapping, mapType, s); diff --git a/src/Formats/MapEvents/ChangeSkillEvent.cs b/src/Formats/MapEvents/ChangeSkillEvent.cs index 8f275134b..715da45b9 100644 --- a/src/Formats/MapEvents/ChangeSkillEvent.cs +++ b/src/Formats/MapEvents/ChangeSkillEvent.cs @@ -28,7 +28,7 @@ public ChangeSkillEvent(TargetId target, Skill skill, NumericOperation operation IsRandom = isRandom; } - public static ChangeSkillEvent Serdes(ChangeSkillEvent e, AssetMapping mapping, ISerializer s) + public static ChangeSkillEvent Serdes(ChangeSkillEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeSkillEvent(); diff --git a/src/Formats/MapEvents/ChangeSpellsEvent.cs b/src/Formats/MapEvents/ChangeSpellsEvent.cs index 0f24f285d..c2c2e3295 100644 --- a/src/Formats/MapEvents/ChangeSpellsEvent.cs +++ b/src/Formats/MapEvents/ChangeSpellsEvent.cs @@ -26,7 +26,7 @@ public ChangeSpellsEvent(TargetId target, SpellClass school, ushort num, Numeric Operation = operation; } - public static ChangeSpellsEvent Serdes(ChangeSpellsEvent e, AssetMapping mapping, ISerializer s) + public static ChangeSpellsEvent Serdes(ChangeSpellsEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeSpellsEvent(); diff --git a/src/Formats/MapEvents/ChangeStatusEvent.cs b/src/Formats/MapEvents/ChangeStatusEvent.cs index dbba53087..c34243343 100644 --- a/src/Formats/MapEvents/ChangeStatusEvent.cs +++ b/src/Formats/MapEvents/ChangeStatusEvent.cs @@ -28,7 +28,7 @@ public ChangeStatusEvent(TargetId target, PlayerCondition status, NumericOperati IsRandom = isRandom; } - public static ChangeStatusEvent Serdes(ChangeStatusEvent e, AssetMapping mapping, ISerializer s) + public static ChangeStatusEvent Serdes(ChangeStatusEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeStatusEvent(); diff --git a/src/Formats/MapEvents/ChangeUsedItemEvent.cs b/src/Formats/MapEvents/ChangeUsedItemEvent.cs index 9c9d4a49d..2e81039ab 100644 --- a/src/Formats/MapEvents/ChangeUsedItemEvent.cs +++ b/src/Formats/MapEvents/ChangeUsedItemEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("change_used_item")] public class ChangeUsedItemEvent : MapEvent { - public static ChangeUsedItemEvent Serdes(ChangeUsedItemEvent e, AssetMapping mapping, ISerializer s) + public static ChangeUsedItemEvent Serdes(ChangeUsedItemEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeUsedItemEvent(); diff --git a/src/Formats/MapEvents/ChangeWordSetEvent.cs b/src/Formats/MapEvents/ChangeWordSetEvent.cs index 031c390d9..691ad6434 100644 --- a/src/Formats/MapEvents/ChangeWordSetEvent.cs +++ b/src/Formats/MapEvents/ChangeWordSetEvent.cs @@ -28,7 +28,7 @@ public ChangeWordSetEvent(TargetId target, EventSetId wordset, NumericOperation IsRandom = isRandom; } - public static ChangeWordSetEvent Serdes(ChangeWordSetEvent e, AssetMapping mapping, ISerializer s) + public static ChangeWordSetEvent Serdes(ChangeWordSetEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChangeWordSetEvent(); diff --git a/src/Formats/MapEvents/ChestEvent.cs b/src/Formats/MapEvents/ChestEvent.cs index 4558548c8..6e499be81 100644 --- a/src/Formats/MapEvents/ChestEvent.cs +++ b/src/Formats/MapEvents/ChestEvent.cs @@ -19,7 +19,7 @@ public ChestEvent(ChestId chestId, ItemId key, byte difficulty, byte openedText, UnlockedText = unlockedText; } - public static ChestEvent Serdes(ChestEvent e, AssetMapping mapping, ISerializer s) + public static ChestEvent Serdes(ChestEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ChestEvent(); diff --git a/src/Formats/MapEvents/CloneAutomapEvent.cs b/src/Formats/MapEvents/CloneAutomapEvent.cs index b171856b2..9b8a0c5be 100644 --- a/src/Formats/MapEvents/CloneAutomapEvent.cs +++ b/src/Formats/MapEvents/CloneAutomapEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("clone_automap", "Copy the automap discovery data from one map to another")] public class CloneAutomapEvent : MapEvent { - public static CloneAutomapEvent Serdes(CloneAutomapEvent e, AssetMapping mapping, ISerializer s) + public static CloneAutomapEvent Serdes(CloneAutomapEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new CloneAutomapEvent(); diff --git a/src/Formats/MapEvents/CreateTransportEvent.cs b/src/Formats/MapEvents/CreateTransportEvent.cs index 0ab72ecd3..f181405e5 100644 --- a/src/Formats/MapEvents/CreateTransportEvent.cs +++ b/src/Formats/MapEvents/CreateTransportEvent.cs @@ -19,7 +19,7 @@ public CreateTransportEvent(byte x, byte y, byte id, MapId mapId) CreateTransportEvent() { } - public static CreateTransportEvent Serdes(CreateTransportEvent e, AssetMapping mapping, ISerializer s) + public static CreateTransportEvent Serdes(CreateTransportEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new CreateTransportEvent(); diff --git a/src/Formats/MapEvents/DataChangeEvent.cs b/src/Formats/MapEvents/DataChangeEvent.cs index a354ed226..5a2eabf56 100644 --- a/src/Formats/MapEvents/DataChangeEvent.cs +++ b/src/Formats/MapEvents/DataChangeEvent.cs @@ -30,7 +30,7 @@ public DataChangeEvent(TargetId target, ChangeProperty property, NumericOperatio IsRandom = isRandom; } - public static IDataChangeEvent Serdes(IDataChangeEvent existing, AssetMapping mapping, ISerializer s) + public static IDataChangeEvent Serdes(IDataChangeEvent existing, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); if (s.IsWriting() && existing == null) throw new ArgumentNullException(nameof(existing)); diff --git a/src/Formats/MapEvents/DoScriptEvent.cs b/src/Formats/MapEvents/DoScriptEvent.cs index 4e565e5b6..b9efb06f0 100644 --- a/src/Formats/MapEvents/DoScriptEvent.cs +++ b/src/Formats/MapEvents/DoScriptEvent.cs @@ -13,7 +13,7 @@ public class DoScriptEvent : MapEvent DoScriptEvent() { } public DoScriptEvent(ScriptId scriptId) => ScriptId = scriptId; - public static DoScriptEvent Serdes(DoScriptEvent e, AssetMapping mapping, ISerializer s) + public static DoScriptEvent Serdes(DoScriptEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new DoScriptEvent(); diff --git a/src/Formats/MapEvents/DoorEvent.cs b/src/Formats/MapEvents/DoorEvent.cs index 1d3939144..fa381a96d 100644 --- a/src/Formats/MapEvents/DoorEvent.cs +++ b/src/Formats/MapEvents/DoorEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("door", "Opens the inventory screen for the given door")] public class DoorEvent : MapEvent, ILockedInventoryEvent { - public static DoorEvent Serdes(DoorEvent e, AssetMapping mapping, ISerializer s) + public static DoorEvent Serdes(DoorEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new DoorEvent(); diff --git a/src/Formats/MapEvents/DummyMapEvent.cs b/src/Formats/MapEvents/DummyMapEvent.cs index 81bfb8cc3..50efd71d5 100644 --- a/src/Formats/MapEvents/DummyMapEvent.cs +++ b/src/Formats/MapEvents/DummyMapEvent.cs @@ -28,7 +28,7 @@ public DummyMapEvent( Unk8 = unk8; } - public static DummyMapEvent Serdes(DummyMapEvent e, ISerializer s, MapEventType type) + public static DummyMapEvent Serdes(DummyMapEvent e, ISerdes s, MapEventType type) { ArgumentNullException.ThrowIfNull(s); e ??= new DummyMapEvent(); diff --git a/src/Formats/MapEvents/EncounterEvent.cs b/src/Formats/MapEvents/EncounterEvent.cs index c1c3641d8..601c301d6 100644 --- a/src/Formats/MapEvents/EncounterEvent.cs +++ b/src/Formats/MapEvents/EncounterEvent.cs @@ -16,7 +16,7 @@ public EncounterEvent(MonsterGroupId groupId, CombatBackgroundId backgroundId) BackgroundId = backgroundId; } - public static EncounterEvent Serdes(EncounterEvent e, AssetMapping mapping, ISerializer s) + public static EncounterEvent Serdes(EncounterEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new EncounterEvent(); diff --git a/src/Formats/MapEvents/EndDialogueEvent.cs b/src/Formats/MapEvents/EndDialogueEvent.cs index 898b4deee..07666e96b 100644 --- a/src/Formats/MapEvents/EndDialogueEvent.cs +++ b/src/Formats/MapEvents/EndDialogueEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("end_dialogue", null, "ed")] public class EndDialogueEvent : MapEvent { - public static EndDialogueEvent Serdes(EndDialogueEvent e, ISerializer s) + public static EndDialogueEvent Serdes(EndDialogueEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new EndDialogueEvent(); diff --git a/src/Formats/MapEvents/EventChainOffEvent.cs b/src/Formats/MapEvents/EventChainOffEvent.cs index c4b90c01b..bbef68072 100644 --- a/src/Formats/MapEvents/EventChainOffEvent.cs +++ b/src/Formats/MapEvents/EventChainOffEvent.cs @@ -18,7 +18,7 @@ public EventChainOffEvent(SwitchOperation operation, byte chainNumber, MapId map Map = map; } - public static EventChainOffEvent Serdes(EventChainOffEvent e, AssetMapping mapping, ISerializer s) + public static EventChainOffEvent Serdes(EventChainOffEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new EventChainOffEvent(); diff --git a/src/Formats/MapEvents/ExecuteEvent.cs b/src/Formats/MapEvents/ExecuteEvent.cs index 4d9268f3a..84729e5fc 100644 --- a/src/Formats/MapEvents/ExecuteEvent.cs +++ b/src/Formats/MapEvents/ExecuteEvent.cs @@ -14,7 +14,7 @@ public ExecuteEvent(byte unk1, ushort unk8) Unk8 = unk8; } - public static ExecuteEvent Serdes(ExecuteEvent e, ISerializer s) + public static ExecuteEvent Serdes(ExecuteEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ExecuteEvent(); diff --git a/src/Formats/MapEvents/MapEvent.cs b/src/Formats/MapEvents/MapEvent.cs index 411cc8058..2726ba1ca 100644 --- a/src/Formats/MapEvents/MapEvent.cs +++ b/src/Formats/MapEvents/MapEvent.cs @@ -11,7 +11,7 @@ public abstract class MapEvent : Event, IMapEvent { public abstract MapEventType EventType { get; } - public static EventNode SerdesNode(ushort id, EventNode node, ISerializer s, AssetMapping mapping, MapType mapType) + public static EventNode SerdesNode(ushort id, EventNode node, ISerdes s, AssetMapping mapping, MapType mapType) { ArgumentNullException.ThrowIfNull(s); var initialPosition = s.Offset; @@ -25,23 +25,22 @@ public static EventNode SerdesNode(ushort id, EventNode node, ISerializer s, Ass { node ??= new BranchNode(id, be); var branch = (BranchNode)node; - ushort? falseEventId = s.Transform( - nameof(branch.NextIfFalse), - branch.NextIfFalse?.Id, - S.UInt16, - MaxToNullConverter.Instance); + + ushort rawEventId = branch.NextIfFalse?.Id ?? 0xffff; + rawEventId = s.UInt16(nameof(branch.NextIfFalse), rawEventId); + ushort? falseEventId = rawEventId == 0xffff ? null : rawEventId; if (falseEventId != null && branch.NextIfFalse == null) branch.NextIfFalse = new DummyEventNode(falseEventId.Value); } else + { node ??= new EventNode(id, @event); + } - ushort? nextEventId = s.Transform( - nameof(node.Next), - node.Next?.Id, - S.UInt16, - MaxToNullConverter.Instance); + ushort rawNextEventId = node.Next?.Id ?? 0xffff; + rawNextEventId = s.UInt16(nameof(node.Next), rawNextEventId); + ushort? nextEventId = rawNextEventId == 0xffff ? null : rawNextEventId; if (nextEventId != null && node.Next == null) node.Next = new DummyEventNode(nextEventId.Value); @@ -54,7 +53,7 @@ public static EventNode SerdesNode(ushort id, EventNode node, ISerializer s, Ass return node; } - public static IMapEvent SerdesEvent(IMapEvent e, ISerializer s, AssetMapping mapping, MapType mapType) + public static IMapEvent SerdesEvent(IMapEvent e, ISerdes s, AssetMapping mapping, MapType mapType) { ArgumentNullException.ThrowIfNull(s); var initialPosition = s.Offset; @@ -101,128 +100,128 @@ public static IMapEvent SerdesEvent(IMapEvent e, ISerializer s, AssetMapping map return e; } -/* == Binary Serialisable Event types: == - 1 Teleport (teleport 300 32 75) - 2 Door (open_door ...) - 3 Chest (open_chest ...) - 4 Text (map_text 100) - 5 Spinner (spinner ...) - 6 Trap (trap ...) - 7 ChangeUsedItem (change_used_item ...) - 8 DataChange (further subdivided by operation: min,max,?,set,add,sub,add%,sub%) - 0 Unk0 (TODO) - 2 Health (party[Tom].health += 20%) - 3 Mana (party[Sira].mana -= 5) - 5 Status (party[Rainer].status[Poisoned] = max) - 7 Language (party[Tom].language[Iskai] = max) - 8 Experience (party[Drirr].experience += 2000) - B UnkB (TODO) - C UnkC (TODO) - 13 Item (party[Tom].items[LughsShield] = 1) - 14 Gold (party[Joe].gold += 12) - 15 Food (party[Siobhan].food -= 10%) - 9 ChangeIcon (scope: rel vs abs, temp vs perm) - 0 Underlay (map.tempUnderlay[23,12] = 47) - 1 Overlay (map.permOverlay[+0,-3] = 1231) - 2 Wall (map.tempWall[10, 10] = 7) - 3 Floor (map.permFloor[64, 64] = 1) - 4 Ceiling (map.permCeiling[12, 24] = 7) - 5 NpcMovement (npc[12].permMovement = 3) - 6 NpcSprite (npc[5].tempSprite = 14) - 7 Chain (map.tempChain[10, 10] = 15) - 8 BlockHard (block_hard ...) - 9 BlockSoft (block_soft ...) - A Trigger (map.tempTrigger[96, 7] = Normal) - A Encounter (encounter ...) - B PlaceAction - 0 LearnCloseCombat - 1 Heal - 2 Cure - 3 RemoveCurse - 4 AskOpinion - 5 RestoreItemEnergy - 6 SleepInRoom - 7 Merchant - 8 OrderFood - 9 ScrollMerchant - B LearnSpells - C RepairItem - C Query (further subdivided by operation: NZ, <=, !=, ==, >=, >, <) - 0 Switch (switch[100]), (!switch[203]), (switch[KhunagMentionedSecretPassage]) - 1 Unk1 - 4 Unk4 - 5 HasPartyMember (party[Tom].isPresent) - 6 HasItem (!party.hasItem[Axe]) - 7 UsedItem (context.usedItem == Pick) - 9 PreviousActionResult (context.result) - A ScriptDebugMode (context.isDebug) - C UnkC - E NpcActive (npc[16].isActive) - F Gold (party.gold > 100) - 11 RandomChance (random(50)) - 12 Unk12 - 14 ChosenVerb (context.verb == Examine) - 15 Conscious (party[Tom].isConscious) - 1A Leader (party[Rainer].isLeader) - 1C Ticker (ticker[50] > 12) - 1D Map (context.map == Drinno3) - 1E Unk1E - 1F PromptPlayer (askYesNo(100)) - 19 Unk19 - 20 TriggerType (context.trigger == UseItem) - 21 Unk21 - 22 EventUsed (context.event[108].hasRun) - 23 DemoVersion (context.isDemo) - 29 Unk29 - 2A Unk2A - 2B PromptPlayerNumeric (askNumeric() = 1042) - D Modify - 0 Switch (switch[125] = 1) - 1 DisableEventChain (map[CantosHouse].chain[120] = 0) - 2 Unk2 - 4 NpcActive (set_npc_active ...) - 5 AddPartyMember (add_party_member ...) - 6 InventoryItem (party.item[Knife] += 3) - B Lighting (map.lighting = 5) ?? - F PartyGold (party.gold = min) - 10 PartyRations (party.rations += 12) - 12 Time (context.time += 6) - 1A Leader (party.leader = Tom) - 1C Ticker (ticker[93] = 108) - E Action (action ...) - 0 Word - 1 AskAboutItem - 2 Unk2 // Pay money? See ES156 (Garris, Gratogel sailor) - 4 Unk4 - 5 Unk5 - 6 StartDialogue - 7 FinishDialogue - 8 DialogueLine - 9 Unk9 - E Unk14 - 17 Unk23 - 2D Unk45 - 2E UseItem - 2F EquipItem - 30 UnequipItem - 36 PickupItem - 39 Unk57 - 3D Unk61 - F Signal (signal ...) -10 CloneAutomap (clone_automap ...) -11 Sound (sound ...) -12 StartDialogue (start_dialogue ...) -13 CreateTransport (???) -14 Execute (execute) -15 RemovePartyMember (remove_party_member ...) -16 EndDialogue (end_dialogue) -17 Wipe (wipe ...) -18 PlayAnimation (play_anim ...) -19 Offset (offset 0 0) -1A Pause (pause 3) -1B SimpleChest (simple_chest ...) -1C AskSurrender (ask_surrender) -1D Script (script 15) -FF UnkFF -*/ + /* == Binary Serialisable Event types: == + 1 Teleport (teleport 300 32 75) + 2 Door (open_door ...) + 3 Chest (open_chest ...) + 4 Text (map_text 100) + 5 Spinner (spinner ...) + 6 Trap (trap ...) + 7 ChangeUsedItem (change_used_item ...) + 8 DataChange (further subdivided by operation: min,max,?,set,add,sub,add%,sub%) + 0 Unk0 (TODO) + 2 Health (party[Tom].health += 20%) + 3 Mana (party[Sira].mana -= 5) + 5 Status (party[Rainer].status[Poisoned] = max) + 7 Language (party[Tom].language[Iskai] = max) + 8 Experience (party[Drirr].experience += 2000) + B UnkB (TODO) + C UnkC (TODO) + 13 Item (party[Tom].items[LughsShield] = 1) + 14 Gold (party[Joe].gold += 12) + 15 Food (party[Siobhan].food -= 10%) + 9 ChangeIcon (scope: rel vs abs, temp vs perm) + 0 Underlay (map.tempUnderlay[23,12] = 47) + 1 Overlay (map.permOverlay[+0,-3] = 1231) + 2 Wall (map.tempWall[10, 10] = 7) + 3 Floor (map.permFloor[64, 64] = 1) + 4 Ceiling (map.permCeiling[12, 24] = 7) + 5 NpcMovement (npc[12].permMovement = 3) + 6 NpcSprite (npc[5].tempSprite = 14) + 7 Chain (map.tempChain[10, 10] = 15) + 8 BlockHard (block_hard ...) + 9 BlockSoft (block_soft ...) + A Trigger (map.tempTrigger[96, 7] = Normal) + A Encounter (encounter ...) + B PlaceAction + 0 LearnCloseCombat + 1 Heal + 2 Cure + 3 RemoveCurse + 4 AskOpinion + 5 RestoreItemEnergy + 6 SleepInRoom + 7 Merchant + 8 OrderFood + 9 ScrollMerchant + B LearnSpells + C RepairItem + C Query (further subdivided by operation: NZ, <=, !=, ==, >=, >, <) + 0 Switch (switch[100]), (!switch[203]), (switch[KhunagMentionedSecretPassage]) + 1 Unk1 + 4 Unk4 + 5 HasPartyMember (party[Tom].isPresent) + 6 HasItem (!party.hasItem[Axe]) + 7 UsedItem (context.usedItem == Pick) + 9 PreviousActionResult (context.result) + A ScriptDebugMode (context.isDebug) + C UnkC + E NpcActive (npc[16].isActive) + F Gold (party.gold > 100) + 11 RandomChance (random(50)) + 12 Unk12 + 14 ChosenVerb (context.verb == Examine) + 15 Conscious (party[Tom].isConscious) + 1A Leader (party[Rainer].isLeader) + 1C Ticker (ticker[50] > 12) + 1D Map (context.map == Drinno3) + 1E Unk1E + 1F PromptPlayer (askYesNo(100)) + 19 Unk19 + 20 TriggerType (context.trigger == UseItem) + 21 Unk21 + 22 EventUsed (context.event[108].hasRun) + 23 DemoVersion (context.isDemo) + 29 Unk29 + 2A Unk2A + 2B PromptPlayerNumeric (askNumeric() = 1042) + D Modify + 0 Switch (switch[125] = 1) + 1 DisableEventChain (map[CantosHouse].chain[120] = 0) + 2 Unk2 + 4 NpcActive (set_npc_active ...) + 5 AddPartyMember (add_party_member ...) + 6 InventoryItem (party.item[Knife] += 3) + B Lighting (map.lighting = 5) ?? + F PartyGold (party.gold = min) + 10 PartyRations (party.rations += 12) + 12 Time (context.time += 6) + 1A Leader (party.leader = Tom) + 1C Ticker (ticker[93] = 108) + E Action (action ...) + 0 Word + 1 AskAboutItem + 2 Unk2 // Pay money? See ES156 (Garris, Gratogel sailor) + 4 Unk4 + 5 Unk5 + 6 StartDialogue + 7 FinishDialogue + 8 DialogueLine + 9 Unk9 + E Unk14 + 17 Unk23 + 2D Unk45 + 2E UseItem + 2F EquipItem + 30 UnequipItem + 36 PickupItem + 39 Unk57 + 3D Unk61 + F Signal (signal ...) + 10 CloneAutomap (clone_automap ...) + 11 Sound (sound ...) + 12 StartDialogue (start_dialogue ...) + 13 CreateTransport (???) + 14 Execute (execute) + 15 RemovePartyMember (remove_party_member ...) + 16 EndDialogue (end_dialogue) + 17 Wipe (wipe ...) + 18 PlayAnimation (play_anim ...) + 19 Offset (offset 0 0) + 1A Pause (pause 3) + 1B SimpleChest (simple_chest ...) + 1C AskSurrender (ask_surrender) + 1D Script (script 15) + FF UnkFF + */ } \ No newline at end of file diff --git a/src/Formats/MapEvents/MapLightingEvent.cs b/src/Formats/MapEvents/MapLightingEvent.cs index 5525d9e3a..994980e64 100644 --- a/src/Formats/MapEvents/MapLightingEvent.cs +++ b/src/Formats/MapEvents/MapLightingEvent.cs @@ -14,7 +14,7 @@ public MapLightingEvent(LightingLevel level, byte unk3) Unk3 = unk3; } - public static MapLightingEvent Serdes(MapLightingEvent e, ISerializer s) + public static MapLightingEvent Serdes(MapLightingEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new MapLightingEvent(); diff --git a/src/Formats/MapEvents/ModifyDaysEvent.cs b/src/Formats/MapEvents/ModifyDaysEvent.cs index fab24cb82..7de56483e 100644 --- a/src/Formats/MapEvents/ModifyDaysEvent.cs +++ b/src/Formats/MapEvents/ModifyDaysEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_days")] public class ModifyDaysEvent : ModifyEvent { - public static ModifyDaysEvent Serdes(ModifyDaysEvent e, ISerializer s) + public static ModifyDaysEvent Serdes(ModifyDaysEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyDaysEvent(); diff --git a/src/Formats/MapEvents/ModifyEvent.cs b/src/Formats/MapEvents/ModifyEvent.cs index 11c710d76..c2a8fe90a 100644 --- a/src/Formats/MapEvents/ModifyEvent.cs +++ b/src/Formats/MapEvents/ModifyEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; public abstract class ModifyEvent : MapEvent { - public static ModifyEvent BaseSerdes(ModifyEvent genericEvent, AssetMapping mapping, ISerializer s) + public static ModifyEvent BaseSerdes(ModifyEvent genericEvent, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); var subType = s.EnumU8("SubType", genericEvent?.SubType ?? ModifyType.DoorOpen); diff --git a/src/Formats/MapEvents/ModifyGoldEvent.cs b/src/Formats/MapEvents/ModifyGoldEvent.cs index 120b4ff77..db7db2cf5 100644 --- a/src/Formats/MapEvents/ModifyGoldEvent.cs +++ b/src/Formats/MapEvents/ModifyGoldEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_gold")] public class ModifyGoldEvent : ModifyEvent { - public static ModifyGoldEvent Serdes(ModifyGoldEvent e, ISerializer s) + public static ModifyGoldEvent Serdes(ModifyGoldEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyGoldEvent(); diff --git a/src/Formats/MapEvents/ModifyHoursEvent.cs b/src/Formats/MapEvents/ModifyHoursEvent.cs index 388b5d607..cf2d70d08 100644 --- a/src/Formats/MapEvents/ModifyHoursEvent.cs +++ b/src/Formats/MapEvents/ModifyHoursEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_hours")] public class ModifyHoursEvent : ModifyEvent { - public static ModifyHoursEvent Serdes(ModifyHoursEvent e, ISerializer s) + public static ModifyHoursEvent Serdes(ModifyHoursEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyHoursEvent(); diff --git a/src/Formats/MapEvents/ModifyItemCountEvent.cs b/src/Formats/MapEvents/ModifyItemCountEvent.cs index 685edcfd0..ae066697b 100644 --- a/src/Formats/MapEvents/ModifyItemCountEvent.cs +++ b/src/Formats/MapEvents/ModifyItemCountEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_item_count")] public class ModifyItemCountEvent : ModifyEvent { - public static ModifyItemCountEvent Serdes(ModifyItemCountEvent e, AssetMapping mapping, ISerializer s) + public static ModifyItemCountEvent Serdes(ModifyItemCountEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyItemCountEvent(); diff --git a/src/Formats/MapEvents/ModifyMTicksEvent.cs b/src/Formats/MapEvents/ModifyMTicksEvent.cs index dcf281600..dacebdd19 100644 --- a/src/Formats/MapEvents/ModifyMTicksEvent.cs +++ b/src/Formats/MapEvents/ModifyMTicksEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_mticks")] public class ModifyMTicksEvent : ModifyEvent { - public static ModifyMTicksEvent Serdes(ModifyMTicksEvent e, ISerializer s) + public static ModifyMTicksEvent Serdes(ModifyMTicksEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyMTicksEvent(); diff --git a/src/Formats/MapEvents/ModifyNpcOffEvent.cs b/src/Formats/MapEvents/ModifyNpcOffEvent.cs index b9a9cb1ac..fc153ce2e 100644 --- a/src/Formats/MapEvents/ModifyNpcOffEvent.cs +++ b/src/Formats/MapEvents/ModifyNpcOffEvent.cs @@ -18,7 +18,7 @@ public ModifyNpcOffEvent(SwitchOperation operation, byte npcNum, MapId map) Map = map; } - public static ModifyNpcOffEvent Serdes(ModifyNpcOffEvent e, AssetMapping mapping, ISerializer s) + public static ModifyNpcOffEvent Serdes(ModifyNpcOffEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyNpcOffEvent(); diff --git a/src/Formats/MapEvents/ModifyRationsEvent.cs b/src/Formats/MapEvents/ModifyRationsEvent.cs index 06cbe01ec..afaba3a74 100644 --- a/src/Formats/MapEvents/ModifyRationsEvent.cs +++ b/src/Formats/MapEvents/ModifyRationsEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("modify_rations")] public class ModifyRationsEvent : ModifyEvent { - public static ModifyRationsEvent Serdes(ModifyRationsEvent e, ISerializer s) + public static ModifyRationsEvent Serdes(ModifyRationsEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new ModifyRationsEvent(); diff --git a/src/Formats/MapEvents/OffsetEvent.cs b/src/Formats/MapEvents/OffsetEvent.cs index 3c97503bb..1c53c6949 100644 --- a/src/Formats/MapEvents/OffsetEvent.cs +++ b/src/Formats/MapEvents/OffsetEvent.cs @@ -15,7 +15,7 @@ public OffsetEvent(sbyte x, sbyte y, byte unk3) Unk3 = unk3; } - public static OffsetEvent Serdes(OffsetEvent e, ISerializer s) + public static OffsetEvent Serdes(OffsetEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new OffsetEvent(); diff --git a/src/Formats/MapEvents/PauseEvent.cs b/src/Formats/MapEvents/PauseEvent.cs index ce05e79a3..5818203e4 100644 --- a/src/Formats/MapEvents/PauseEvent.cs +++ b/src/Formats/MapEvents/PauseEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("pause")] // USED IN SCRIPT public class PauseEvent : MapEvent { - public static PauseEvent Serdes(PauseEvent e, ISerializer s) + public static PauseEvent Serdes(PauseEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new PauseEvent(); diff --git a/src/Formats/MapEvents/PlaceActionEvent.cs b/src/Formats/MapEvents/PlaceActionEvent.cs index 7a3a417a4..7ad0fa8ba 100644 --- a/src/Formats/MapEvents/PlaceActionEvent.cs +++ b/src/Formats/MapEvents/PlaceActionEvent.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.MapEvents; [Event("place_action")] public class PlaceActionEvent : MapEvent { - public static PlaceActionEvent Serdes(PlaceActionEvent e, ISerializer s) + public static PlaceActionEvent Serdes(PlaceActionEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new PlaceActionEvent(); diff --git a/src/Formats/MapEvents/PlayAnimationEvent.cs b/src/Formats/MapEvents/PlayAnimationEvent.cs index 636b655ba..12a88eee4 100644 --- a/src/Formats/MapEvents/PlayAnimationEvent.cs +++ b/src/Formats/MapEvents/PlayAnimationEvent.cs @@ -21,7 +21,7 @@ public PlayAnimationEvent(VideoId videoId, byte x, byte y, byte unk4, byte unk5, OffsetY = offsetY; } - public static PlayAnimationEvent Serdes(PlayAnimationEvent e, AssetMapping mapping, ISerializer s) + public static PlayAnimationEvent Serdes(PlayAnimationEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new PlayAnimationEvent(); diff --git a/src/Formats/MapEvents/PromptPlayerEvent.cs b/src/Formats/MapEvents/PromptPlayerEvent.cs index bf4083030..4a31131f3 100644 --- a/src/Formats/MapEvents/PromptPlayerEvent.cs +++ b/src/Formats/MapEvents/PromptPlayerEvent.cs @@ -19,7 +19,7 @@ public PromptPlayerEvent(ushort argument, QueryOperation operation, byte immedia Immediate = immediate; } - public static PromptPlayerEvent Serdes(PromptPlayerEvent e, ISerializer s) + public static PromptPlayerEvent Serdes(PromptPlayerEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new PromptPlayerEvent(); diff --git a/src/Formats/MapEvents/PromptPlayerNumericEvent.cs b/src/Formats/MapEvents/PromptPlayerNumericEvent.cs index 1d4b8bcd6..fc6bcc13a 100644 --- a/src/Formats/MapEvents/PromptPlayerNumericEvent.cs +++ b/src/Formats/MapEvents/PromptPlayerNumericEvent.cs @@ -16,7 +16,7 @@ public PromptPlayerNumericEvent(QueryOperation operation, ushort argument) Operation = operation; Argument = argument; } - public static PromptPlayerNumericEvent Serdes(PromptPlayerNumericEvent e, ISerializer s) + public static PromptPlayerNumericEvent Serdes(PromptPlayerNumericEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new PromptPlayerNumericEvent(); diff --git a/src/Formats/MapEvents/QueryChainActiveEvent.cs b/src/Formats/MapEvents/QueryChainActiveEvent.cs index ecd1e21ab..4924c7aec 100644 --- a/src/Formats/MapEvents/QueryChainActiveEvent.cs +++ b/src/Formats/MapEvents/QueryChainActiveEvent.cs @@ -21,7 +21,7 @@ public QueryChainActiveEvent(byte chainNum, MapId mapId, QueryOperation operatio MapId = mapId; } - public static QueryChainActiveEvent Serdes(QueryChainActiveEvent e, AssetMapping mapping, ISerializer s) + public static QueryChainActiveEvent Serdes(QueryChainActiveEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryChainActiveEvent(); diff --git a/src/Formats/MapEvents/QueryConsciousEvent.cs b/src/Formats/MapEvents/QueryConsciousEvent.cs index 95a1fcad6..a32785329 100644 --- a/src/Formats/MapEvents/QueryConsciousEvent.cs +++ b/src/Formats/MapEvents/QueryConsciousEvent.cs @@ -20,7 +20,7 @@ public QueryConsciousEvent(PartyMemberId partyMemberId, QueryOperation operation Operation = operation; Immediate = immediate; } - public static QueryConsciousEvent Serdes(QueryConsciousEvent e, AssetMapping mapping, ISerializer s) + public static QueryConsciousEvent Serdes(QueryConsciousEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryConsciousEvent(); diff --git a/src/Formats/MapEvents/QueryDemoVersionEvent.cs b/src/Formats/MapEvents/QueryDemoVersionEvent.cs index eeecbf1cb..d5dc7666c 100644 --- a/src/Formats/MapEvents/QueryDemoVersionEvent.cs +++ b/src/Formats/MapEvents/QueryDemoVersionEvent.cs @@ -18,7 +18,7 @@ public QueryDemoVersionEvent(ushort argument, QueryOperation operation, byte imm Operation = operation; Immediate = immediate; } - public static QueryDemoVersionEvent Serdes(QueryDemoVersionEvent e, ISerializer s) + public static QueryDemoVersionEvent Serdes(QueryDemoVersionEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryDemoVersionEvent(); diff --git a/src/Formats/MapEvents/QueryEvent.cs b/src/Formats/MapEvents/QueryEvent.cs index f093889a2..8898bd6ab 100644 --- a/src/Formats/MapEvents/QueryEvent.cs +++ b/src/Formats/MapEvents/QueryEvent.cs @@ -9,7 +9,7 @@ public abstract class QueryEvent : MapEvent, IBranchingEvent { public override MapEventType EventType => MapEventType.Query; public abstract QueryType QueryType { get; } - public static QueryEvent Serdes(QueryEvent e, AssetMapping mapping, ISerializer s) + public static QueryEvent Serdes(QueryEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); if (s.IsWriting() && e == null) throw new ArgumentNullException(nameof(e)); diff --git a/src/Formats/MapEvents/QueryEventUsedEvent.cs b/src/Formats/MapEvents/QueryEventUsedEvent.cs index b6bf649c2..b28610f96 100644 --- a/src/Formats/MapEvents/QueryEventUsedEvent.cs +++ b/src/Formats/MapEvents/QueryEventUsedEvent.cs @@ -8,7 +8,7 @@ namespace UAlbion.Formats.MapEvents; public class QueryEventUsedEvent : QueryEvent { public override QueryType QueryType => QueryType.EventUsed; - public static QueryEventUsedEvent Serdes(QueryEventUsedEvent e, ISerializer s) + public static QueryEventUsedEvent Serdes(QueryEventUsedEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryEventUsedEvent(); diff --git a/src/Formats/MapEvents/QueryGoldEvent.cs b/src/Formats/MapEvents/QueryGoldEvent.cs index 9bc7e60fd..d1d7141f8 100644 --- a/src/Formats/MapEvents/QueryGoldEvent.cs +++ b/src/Formats/MapEvents/QueryGoldEvent.cs @@ -18,7 +18,7 @@ public QueryGoldEvent(QueryOperation operation, byte immediate, ushort argument) Immediate = immediate; Argument = argument; } - public static QueryGoldEvent Serdes(QueryGoldEvent e, ISerializer s) + public static QueryGoldEvent Serdes(QueryGoldEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryGoldEvent(); diff --git a/src/Formats/MapEvents/QueryHasItemEvent.cs b/src/Formats/MapEvents/QueryHasItemEvent.cs index bff8fb529..7b072075a 100644 --- a/src/Formats/MapEvents/QueryHasItemEvent.cs +++ b/src/Formats/MapEvents/QueryHasItemEvent.cs @@ -20,7 +20,7 @@ public QueryHasItemEvent(QueryOperation operation, byte immediate, ItemId itemId Immediate = immediate; ItemId = itemId; } - public static QueryHasItemEvent Serdes(QueryHasItemEvent e, AssetMapping mapping, ISerializer s) + public static QueryHasItemEvent Serdes(QueryHasItemEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryHasItemEvent(); diff --git a/src/Formats/MapEvents/QueryHasPartyMemberEvent.cs b/src/Formats/MapEvents/QueryHasPartyMemberEvent.cs index 61cd2ac03..80f081fa3 100644 --- a/src/Formats/MapEvents/QueryHasPartyMemberEvent.cs +++ b/src/Formats/MapEvents/QueryHasPartyMemberEvent.cs @@ -20,7 +20,7 @@ public QueryHasPartyMemberEvent(PartyMemberId partyMemberId, QueryOperation oper Operation = operation; Immediate = immediate; } - public static QueryHasPartyMemberEvent Serdes(QueryHasPartyMemberEvent e, AssetMapping mapping, ISerializer s) + public static QueryHasPartyMemberEvent Serdes(QueryHasPartyMemberEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryHasPartyMemberEvent(); diff --git a/src/Formats/MapEvents/QueryHourEvent.cs b/src/Formats/MapEvents/QueryHourEvent.cs index eb0fc884b..b91a7be81 100644 --- a/src/Formats/MapEvents/QueryHourEvent.cs +++ b/src/Formats/MapEvents/QueryHourEvent.cs @@ -18,7 +18,7 @@ public QueryHourEvent(QueryOperation operation, byte immediate, ushort argument) Immediate = immediate; Argument = argument; } - public static QueryHourEvent Serdes(QueryHourEvent e, ISerializer s) + public static QueryHourEvent Serdes(QueryHourEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryHourEvent(); diff --git a/src/Formats/MapEvents/QueryLeaderEvent.cs b/src/Formats/MapEvents/QueryLeaderEvent.cs index 6fa015c56..78d38b33e 100644 --- a/src/Formats/MapEvents/QueryLeaderEvent.cs +++ b/src/Formats/MapEvents/QueryLeaderEvent.cs @@ -20,7 +20,7 @@ public QueryLeaderEvent(PartyMemberId partyMemberId, QueryOperation operation, b Operation = operation; Immediate = immediate; } - public static QueryLeaderEvent Serdes(QueryLeaderEvent e, AssetMapping mapping, ISerializer s) + public static QueryLeaderEvent Serdes(QueryLeaderEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryLeaderEvent(); diff --git a/src/Formats/MapEvents/QueryMapEvent.cs b/src/Formats/MapEvents/QueryMapEvent.cs index 33c8bcd7a..ad41273b5 100644 --- a/src/Formats/MapEvents/QueryMapEvent.cs +++ b/src/Formats/MapEvents/QueryMapEvent.cs @@ -20,7 +20,7 @@ public QueryMapEvent(QueryOperation operation, byte immediate, MapId mapId) Immediate = immediate; MapId = mapId; } - public static QueryMapEvent Serdes(QueryMapEvent e, AssetMapping mapping, ISerializer s) + public static QueryMapEvent Serdes(QueryMapEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryMapEvent(); diff --git a/src/Formats/MapEvents/QueryNpcActiveEvent.cs b/src/Formats/MapEvents/QueryNpcActiveEvent.cs index fa287ff6c..52c3402fd 100644 --- a/src/Formats/MapEvents/QueryNpcActiveEvent.cs +++ b/src/Formats/MapEvents/QueryNpcActiveEvent.cs @@ -20,7 +20,7 @@ public QueryNpcActiveEvent(ushort npcNum, QueryOperation operation, byte immedia Operation = operation; } - public static QueryNpcActiveEvent Serdes(QueryNpcActiveEvent e, AssetMapping mapping, ISerializer s) + public static QueryNpcActiveEvent Serdes(QueryNpcActiveEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryNpcActiveEvent(); diff --git a/src/Formats/MapEvents/QueryNpcActiveOnMapEvent.cs b/src/Formats/MapEvents/QueryNpcActiveOnMapEvent.cs index aa5324adb..982ed445a 100644 --- a/src/Formats/MapEvents/QueryNpcActiveOnMapEvent.cs +++ b/src/Formats/MapEvents/QueryNpcActiveOnMapEvent.cs @@ -20,7 +20,7 @@ public QueryNpcActiveOnMapEvent(QueryOperation operation, byte npcNum, MapId map NpcNum = npcNum; MapId = mapId; } - public static QueryNpcActiveOnMapEvent Serdes(QueryNpcActiveOnMapEvent e, AssetMapping mapping, ISerializer s) + public static QueryNpcActiveOnMapEvent Serdes(QueryNpcActiveOnMapEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryNpcActiveOnMapEvent(); diff --git a/src/Formats/MapEvents/QueryNpcXEvent.cs b/src/Formats/MapEvents/QueryNpcXEvent.cs index cf8a34b06..d57043949 100644 --- a/src/Formats/MapEvents/QueryNpcXEvent.cs +++ b/src/Formats/MapEvents/QueryNpcXEvent.cs @@ -18,7 +18,7 @@ public QueryNpcXEvent(QueryOperation operation, byte immediate, ushort argument) Immediate = immediate; Argument = argument; } - public static QueryNpcXEvent Serdes(QueryNpcXEvent e, ISerializer s) + public static QueryNpcXEvent Serdes(QueryNpcXEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryNpcXEvent(); diff --git a/src/Formats/MapEvents/QueryNpcYEvent.cs b/src/Formats/MapEvents/QueryNpcYEvent.cs index a07997a94..af405c2ac 100644 --- a/src/Formats/MapEvents/QueryNpcYEvent.cs +++ b/src/Formats/MapEvents/QueryNpcYEvent.cs @@ -18,7 +18,7 @@ public QueryNpcYEvent(QueryOperation operation, byte immediate, ushort argument) Immediate = immediate; Argument = argument; } - public static QueryNpcYEvent Serdes(QueryNpcYEvent e, ISerializer s) + public static QueryNpcYEvent Serdes(QueryNpcYEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryNpcYEvent(); diff --git a/src/Formats/MapEvents/QueryPreviousActionResultEvent.cs b/src/Formats/MapEvents/QueryPreviousActionResultEvent.cs index d4a892b5b..133f95632 100644 --- a/src/Formats/MapEvents/QueryPreviousActionResultEvent.cs +++ b/src/Formats/MapEvents/QueryPreviousActionResultEvent.cs @@ -18,7 +18,7 @@ public QueryPreviousActionResultEvent(QueryOperation operation, byte immediate, Immediate = immediate; Argument = argument; } - public static QueryPreviousActionResultEvent Serdes(QueryPreviousActionResultEvent e, ISerializer s) + public static QueryPreviousActionResultEvent Serdes(QueryPreviousActionResultEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryPreviousActionResultEvent(); diff --git a/src/Formats/MapEvents/QueryRandomChanceEvent.cs b/src/Formats/MapEvents/QueryRandomChanceEvent.cs index 89bf36be8..56ebe74b2 100644 --- a/src/Formats/MapEvents/QueryRandomChanceEvent.cs +++ b/src/Formats/MapEvents/QueryRandomChanceEvent.cs @@ -19,7 +19,7 @@ public QueryRandomChanceEvent(ushort argument, QueryOperation operation, byte im Immediate = immediate; Argument = argument; } - public static QueryRandomChanceEvent Serdes(QueryRandomChanceEvent e, ISerializer s) + public static QueryRandomChanceEvent Serdes(QueryRandomChanceEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryRandomChanceEvent(); diff --git a/src/Formats/MapEvents/QueryScriptDebugModeEvent.cs b/src/Formats/MapEvents/QueryScriptDebugModeEvent.cs index fcb215940..de6694299 100644 --- a/src/Formats/MapEvents/QueryScriptDebugModeEvent.cs +++ b/src/Formats/MapEvents/QueryScriptDebugModeEvent.cs @@ -18,7 +18,7 @@ public QueryScriptDebugModeEvent(ushort argument, QueryOperation operation, byte Operation = operation; Immediate = immediate; } - public static QueryScriptDebugModeEvent Serdes(QueryScriptDebugModeEvent e, ISerializer s) + public static QueryScriptDebugModeEvent Serdes(QueryScriptDebugModeEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryScriptDebugModeEvent(); diff --git a/src/Formats/MapEvents/QuerySwitchEvent.cs b/src/Formats/MapEvents/QuerySwitchEvent.cs index a85708b6f..c2bf8969f 100644 --- a/src/Formats/MapEvents/QuerySwitchEvent.cs +++ b/src/Formats/MapEvents/QuerySwitchEvent.cs @@ -20,7 +20,7 @@ public QuerySwitchEvent(SwitchId switchId, QueryOperation operation, byte immedi Immediate = immediate; SwitchId = switchId; } - public static QuerySwitchEvent Serdes(QuerySwitchEvent e, AssetMapping mapping, ISerializer s) + public static QuerySwitchEvent Serdes(QuerySwitchEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QuerySwitchEvent(); diff --git a/src/Formats/MapEvents/QueryTickerEvent.cs b/src/Formats/MapEvents/QueryTickerEvent.cs index 9c9454072..70e0e73c0 100644 --- a/src/Formats/MapEvents/QueryTickerEvent.cs +++ b/src/Formats/MapEvents/QueryTickerEvent.cs @@ -20,7 +20,7 @@ public QueryTickerEvent(TickerId tickerId, QueryOperation operation, byte immedi Operation = operation; Immediate = immediate; } - public static QueryTickerEvent Serdes(QueryTickerEvent e, AssetMapping mapping, ISerializer s) + public static QueryTickerEvent Serdes(QueryTickerEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryTickerEvent(); diff --git a/src/Formats/MapEvents/QueryTriggerTypeEvent.cs b/src/Formats/MapEvents/QueryTriggerTypeEvent.cs index 56d21481f..cf7418f03 100644 --- a/src/Formats/MapEvents/QueryTriggerTypeEvent.cs +++ b/src/Formats/MapEvents/QueryTriggerTypeEvent.cs @@ -18,7 +18,7 @@ public QueryTriggerTypeEvent(QueryOperation operation, byte immediate, ushort ar Immediate = immediate; Argument = argument; } - public static QueryTriggerTypeEvent Serdes(QueryTriggerTypeEvent e, ISerializer s) + public static QueryTriggerTypeEvent Serdes(QueryTriggerTypeEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryTriggerTypeEvent(); diff --git a/src/Formats/MapEvents/QueryUnk19Event.cs b/src/Formats/MapEvents/QueryUnk19Event.cs index fc902997f..86a9e77f9 100644 --- a/src/Formats/MapEvents/QueryUnk19Event.cs +++ b/src/Formats/MapEvents/QueryUnk19Event.cs @@ -18,7 +18,7 @@ public QueryUnk19Event(QueryOperation operation, byte immediate, ushort argument Immediate = immediate; Argument = argument; } - public static QueryUnk19Event Serdes(QueryUnk19Event e, ISerializer s) + public static QueryUnk19Event Serdes(QueryUnk19Event e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryUnk19Event(); diff --git a/src/Formats/MapEvents/QueryUnk1EEvent.cs b/src/Formats/MapEvents/QueryUnk1EEvent.cs index 7ef260d8f..601cde263 100644 --- a/src/Formats/MapEvents/QueryUnk1EEvent.cs +++ b/src/Formats/MapEvents/QueryUnk1EEvent.cs @@ -18,7 +18,7 @@ public QueryUnk1EEvent(QueryOperation operation, byte immediate, ushort argument Immediate = immediate; Argument = argument; } - public static QueryUnk1EEvent Serdes(QueryUnk1EEvent e, ISerializer s) + public static QueryUnk1EEvent Serdes(QueryUnk1EEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryUnk1EEvent(); diff --git a/src/Formats/MapEvents/QueryUnk21Event.cs b/src/Formats/MapEvents/QueryUnk21Event.cs index 765090a86..b35113004 100644 --- a/src/Formats/MapEvents/QueryUnk21Event.cs +++ b/src/Formats/MapEvents/QueryUnk21Event.cs @@ -18,7 +18,7 @@ public QueryUnk21Event(QueryOperation operation, byte immediate, ushort argument Immediate = immediate; Argument = argument; } - public static QueryUnk21Event Serdes(QueryUnk21Event e, ISerializer s) + public static QueryUnk21Event Serdes(QueryUnk21Event e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryUnk21Event(); diff --git a/src/Formats/MapEvents/QueryUnkCEvent.cs b/src/Formats/MapEvents/QueryUnkCEvent.cs index c0b790229..70ce24927 100644 --- a/src/Formats/MapEvents/QueryUnkCEvent.cs +++ b/src/Formats/MapEvents/QueryUnkCEvent.cs @@ -18,7 +18,7 @@ public QueryUnkCEvent(QueryOperation operation, byte immediate, ushort argument) Immediate = immediate; Argument = argument; } - public static QueryUnkCEvent Serdes(QueryUnkCEvent e, ISerializer s) + public static QueryUnkCEvent Serdes(QueryUnkCEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryUnkCEvent(); diff --git a/src/Formats/MapEvents/QueryUsedItemEvent.cs b/src/Formats/MapEvents/QueryUsedItemEvent.cs index 2f383cb0c..07f8ad1fd 100644 --- a/src/Formats/MapEvents/QueryUsedItemEvent.cs +++ b/src/Formats/MapEvents/QueryUsedItemEvent.cs @@ -20,7 +20,7 @@ public QueryUsedItemEvent(ItemId itemId, QueryOperation operation, byte immediat Operation = operation; Immediate = immediate; } - public static QueryUsedItemEvent Serdes(QueryUsedItemEvent e, AssetMapping mapping, ISerializer s) + public static QueryUsedItemEvent Serdes(QueryUsedItemEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryUsedItemEvent(); diff --git a/src/Formats/MapEvents/QueryVerbEvent.cs b/src/Formats/MapEvents/QueryVerbEvent.cs index 2469ce7ac..845206963 100644 --- a/src/Formats/MapEvents/QueryVerbEvent.cs +++ b/src/Formats/MapEvents/QueryVerbEvent.cs @@ -19,7 +19,7 @@ public QueryVerbEvent(TriggerType triggerType, QueryOperation operation, byte im Operation = operation; Immediate = immediate; } - public static QueryVerbEvent Serdes(QueryVerbEvent e, ISerializer s) + public static QueryVerbEvent Serdes(QueryVerbEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new QueryVerbEvent(); diff --git a/src/Formats/MapEvents/RemovePartyMemberEvent.cs b/src/Formats/MapEvents/RemovePartyMemberEvent.cs index f6abf6a59..8c88412b5 100644 --- a/src/Formats/MapEvents/RemovePartyMemberEvent.cs +++ b/src/Formats/MapEvents/RemovePartyMemberEvent.cs @@ -9,7 +9,7 @@ namespace UAlbion.Formats.MapEvents; [Event("remove_party_member", "Remove someone from the party", "rpm")] public class RemovePartyMemberEvent : MapEvent { - public static RemovePartyMemberEvent Serdes(RemovePartyMemberEvent e, AssetMapping mapping, ISerializer s) + public static RemovePartyMemberEvent Serdes(RemovePartyMemberEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new RemovePartyMemberEvent(); diff --git a/src/Formats/MapEvents/SetChestOpenEvent.cs b/src/Formats/MapEvents/SetChestOpenEvent.cs index 224fa3525..6918981dd 100644 --- a/src/Formats/MapEvents/SetChestOpenEvent.cs +++ b/src/Formats/MapEvents/SetChestOpenEvent.cs @@ -10,7 +10,7 @@ namespace UAlbion.Formats.MapEvents; [Event("set_chest_open")] public class SetChestOpenEvent : ModifyEvent { - public static SetChestOpenEvent Serdes(SetChestOpenEvent e, AssetMapping mapping, ISerializer s) + public static SetChestOpenEvent Serdes(SetChestOpenEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SetChestOpenEvent(); diff --git a/src/Formats/MapEvents/SetDoorOpenEvent.cs b/src/Formats/MapEvents/SetDoorOpenEvent.cs index 66a8b61a4..e38c3411d 100644 --- a/src/Formats/MapEvents/SetDoorOpenEvent.cs +++ b/src/Formats/MapEvents/SetDoorOpenEvent.cs @@ -10,7 +10,7 @@ namespace UAlbion.Formats.MapEvents; [Event("set_door_open")] public class SetDoorOpenEvent : ModifyEvent { - public static SetDoorOpenEvent Serdes(SetDoorOpenEvent e, AssetMapping mapping, ISerializer s) + public static SetDoorOpenEvent Serdes(SetDoorOpenEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SetDoorOpenEvent(); diff --git a/src/Formats/MapEvents/SetPartyLeaderEvent.cs b/src/Formats/MapEvents/SetPartyLeaderEvent.cs index 0d3d89606..02f1e04ea 100644 --- a/src/Formats/MapEvents/SetPartyLeaderEvent.cs +++ b/src/Formats/MapEvents/SetPartyLeaderEvent.cs @@ -17,7 +17,7 @@ public SetPartyLeaderEvent(PartyMemberId id, byte unk2, byte unk3) Unk3 = unk3; } - public static SetPartyLeaderEvent Serdes(SetPartyLeaderEvent e, AssetMapping mapping, ISerializer s) + public static SetPartyLeaderEvent Serdes(SetPartyLeaderEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SetPartyLeaderEvent(); diff --git a/src/Formats/MapEvents/SignalEvent.cs b/src/Formats/MapEvents/SignalEvent.cs index 497d6f6fa..20baf48c8 100644 --- a/src/Formats/MapEvents/SignalEvent.cs +++ b/src/Formats/MapEvents/SignalEvent.cs @@ -10,7 +10,7 @@ public class SignalEvent : MapEvent SignalEvent() { } public SignalEvent(byte signalId) => SignalId = signalId; - public static SignalEvent Serdes(SignalEvent e, ISerializer s) + public static SignalEvent Serdes(SignalEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SignalEvent(); diff --git a/src/Formats/MapEvents/SimpleChestEvent.cs b/src/Formats/MapEvents/SimpleChestEvent.cs index 1ce0d57a5..cee2ceddd 100644 --- a/src/Formats/MapEvents/SimpleChestEvent.cs +++ b/src/Formats/MapEvents/SimpleChestEvent.cs @@ -24,7 +24,7 @@ public SimpleChestEvent(ushort amount, ItemId item) SimpleChestEvent() { } - public static SimpleChestEvent Serdes(SimpleChestEvent e, AssetMapping mapping, ISerializer s) + public static SimpleChestEvent Serdes(SimpleChestEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SimpleChestEvent(); diff --git a/src/Formats/MapEvents/SoundEvent.cs b/src/Formats/MapEvents/SoundEvent.cs index 9351903b1..01754f66e 100644 --- a/src/Formats/MapEvents/SoundEvent.cs +++ b/src/Formats/MapEvents/SoundEvent.cs @@ -26,7 +26,7 @@ public SoundEvent( Mode = mode; } - public static SoundEvent Serdes(SoundEvent e, AssetMapping mapping, ISerializer s) + public static SoundEvent Serdes(SoundEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SoundEvent(); diff --git a/src/Formats/MapEvents/SpinnerEvent.cs b/src/Formats/MapEvents/SpinnerEvent.cs index 4ed27e84d..f0a54e383 100644 --- a/src/Formats/MapEvents/SpinnerEvent.cs +++ b/src/Formats/MapEvents/SpinnerEvent.cs @@ -10,7 +10,7 @@ public class SpinnerEvent : MapEvent SpinnerEvent() { } public SpinnerEvent(byte unk1) => Unk1 = unk1; - public static SpinnerEvent Serdes(SpinnerEvent e, ISerializer s) + public static SpinnerEvent Serdes(SpinnerEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SpinnerEvent(); diff --git a/src/Formats/MapEvents/StartDialogueEvent.cs b/src/Formats/MapEvents/StartDialogueEvent.cs index 488fcdded..df1c1b8c6 100644 --- a/src/Formats/MapEvents/StartDialogueEvent.cs +++ b/src/Formats/MapEvents/StartDialogueEvent.cs @@ -36,7 +36,7 @@ 981 Tom - UnkE [EventPart("npc_id")] public NpcSheetId NpcId { get; private set; } - public static StartDialogueEvent Serdes(StartDialogueEvent e, AssetMapping mapping, ISerializer s) + public static StartDialogueEvent Serdes(StartDialogueEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new StartDialogueEvent(); diff --git a/src/Formats/MapEvents/SwitchEvent.cs b/src/Formats/MapEvents/SwitchEvent.cs index 5eae4a6c0..38f0d5b19 100644 --- a/src/Formats/MapEvents/SwitchEvent.cs +++ b/src/Formats/MapEvents/SwitchEvent.cs @@ -17,7 +17,7 @@ public SwitchEvent(SwitchOperation operation, SwitchId switchId, byte unk3) Unk3 = unk3; } - public static SwitchEvent Serdes(SwitchEvent e, AssetMapping mapping, ISerializer s) + public static SwitchEvent Serdes(SwitchEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new SwitchEvent(); diff --git a/src/Formats/MapEvents/TeleportEvent.cs b/src/Formats/MapEvents/TeleportEvent.cs index 2a0887dc6..cfb5c24cf 100644 --- a/src/Formats/MapEvents/TeleportEvent.cs +++ b/src/Formats/MapEvents/TeleportEvent.cs @@ -31,7 +31,7 @@ public TeleportEvent(MapId mapId, byte x, byte y, Direction direction, byte unk4 Unk5 = unk5; } - public static TeleportEvent Serdes(TeleportEvent e, AssetMapping mapping, ISerializer s) + public static TeleportEvent Serdes(TeleportEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new TeleportEvent(); diff --git a/src/Formats/MapEvents/TextEvent.cs b/src/Formats/MapEvents/TextEvent.cs index 621c30f83..3f33460f6 100644 --- a/src/Formats/MapEvents/TextEvent.cs +++ b/src/Formats/MapEvents/TextEvent.cs @@ -56,7 +56,7 @@ public static TextEvent Parse(string[] parts) return new TextEvent(subId, location, charId); } - public static TextEvent Serdes(TextEvent e, AssetMapping mapping, ISerializer s) + public static TextEvent Serdes(TextEvent e, AssetMapping mapping, ISerdes s) { e ??= new TextEvent(); diff --git a/src/Formats/MapEvents/TickerEvent.cs b/src/Formats/MapEvents/TickerEvent.cs index 24548be3a..464c29bbf 100644 --- a/src/Formats/MapEvents/TickerEvent.cs +++ b/src/Formats/MapEvents/TickerEvent.cs @@ -19,7 +19,7 @@ public TickerEvent(TickerId tickerId, NumericOperation operation, byte amount, b Unk4 = unk4; } - public static TickerEvent Serdes(TickerEvent e, AssetMapping mapping, ISerializer s) + public static TickerEvent Serdes(TickerEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); diff --git a/src/Formats/MapEvents/TrapEvent.cs b/src/Formats/MapEvents/TrapEvent.cs index 5c3938667..6a1ce447b 100644 --- a/src/Formats/MapEvents/TrapEvent.cs +++ b/src/Formats/MapEvents/TrapEvent.cs @@ -18,7 +18,7 @@ public TrapEvent(byte unk1, byte unk2, byte unk3, byte unk5, ushort unk6) Unk6 = unk6; } - public static TrapEvent Serdes(TrapEvent e, ISerializer s) + public static TrapEvent Serdes(TrapEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new TrapEvent(); diff --git a/src/Formats/MapEvents/WipeEvent.cs b/src/Formats/MapEvents/WipeEvent.cs index 5aaea33e3..0f3d92f5a 100644 --- a/src/Formats/MapEvents/WipeEvent.cs +++ b/src/Formats/MapEvents/WipeEvent.cs @@ -10,7 +10,7 @@ public class WipeEvent : MapEvent WipeEvent() { } public WipeEvent(byte value) => Value = value; - public static WipeEvent Serdes(WipeEvent e, ISerializer s) + public static WipeEvent Serdes(WipeEvent e, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new WipeEvent(); diff --git a/src/Formats/MapEvents/WordKnownEvent.cs b/src/Formats/MapEvents/WordKnownEvent.cs index 46378331f..bd2d7b454 100644 --- a/src/Formats/MapEvents/WordKnownEvent.cs +++ b/src/Formats/MapEvents/WordKnownEvent.cs @@ -10,7 +10,7 @@ namespace UAlbion.Formats.MapEvents; [Event("word_known")] public class WordKnownEvent : ModifyEvent { - public static WordKnownEvent Serdes(WordKnownEvent e, AssetMapping mapping, ISerializer s) + public static WordKnownEvent Serdes(WordKnownEvent e, AssetMapping mapping, ISerdes s) { ArgumentNullException.ThrowIfNull(s); e ??= new WordKnownEvent(); diff --git a/src/Formats/Parsers/AlbionStringTableLoader.cs b/src/Formats/Parsers/AlbionStringTableLoader.cs index 3bc60c7bc..ea236fb4e 100644 --- a/src/Formats/Parsers/AlbionStringTableLoader.cs +++ b/src/Formats/Parsers/AlbionStringTableLoader.cs @@ -8,7 +8,7 @@ namespace UAlbion.Formats.Parsers; public class AlbionStringTableLoader : IAssetLoader { - public ListStringSet Serdes(ListStringSet existing, ISerializer s, AssetLoadContext context) + public ListStringSet Serdes(ListStringSet existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); if (s.IsReading()) @@ -41,6 +41,6 @@ public ListStringSet Serdes(ListStringSet existing, ISerializer s, AssetLoadCont } } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as ListStringSet, s, context); } diff --git a/src/Formats/Parsers/AmorphousSpriteLoader.cs b/src/Formats/Parsers/AmorphousSpriteLoader.cs index 6dcb6a956..1ad4bc81b 100644 --- a/src/Formats/Parsers/AmorphousSpriteLoader.cs +++ b/src/Formats/Parsers/AmorphousSpriteLoader.cs @@ -42,10 +42,10 @@ public class AmorphousSpriteLoader : IAssetLoader> } } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((IReadOnlyTexture)existing, s, context); - public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerializer s, AssetLoadContext context) + public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -54,7 +54,7 @@ public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerialize : Read(context, s); } - static IReadOnlyTexture Write(IReadOnlyTexture existing, ISerializer s) + static IReadOnlyTexture Write(IReadOnlyTexture existing, ISerdes s) { ArgumentNullException.ThrowIfNull(existing); @@ -80,7 +80,7 @@ static IReadOnlyTexture Write(IReadOnlyTexture existing, ISerializer return existing; } - static SimpleTexture Read(AssetLoadContext context, ISerializer s) + static SimpleTexture Read(AssetLoadContext context, ISerdes s) { var sizes = ParseSpriteSizes(context.Node.GetProperty(SubSpritesProperty)); diff --git a/src/Formats/Parsers/AutomapLoader.cs b/src/Formats/Parsers/AutomapLoader.cs index 11dd54703..745bac408 100644 --- a/src/Formats/Parsers/AutomapLoader.cs +++ b/src/Formats/Parsers/AutomapLoader.cs @@ -6,8 +6,8 @@ namespace UAlbion.Formats.Parsers; public class AutomapLoader : IAssetLoader { - public Automap Serdes(Automap existing, ISerializer s, AssetLoadContext context) + public Automap Serdes(Automap existing, ISerdes s, AssetLoadContext context) => Automap.Serdes(existing, s); - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((Automap)existing, s, context); } diff --git a/src/Formats/Parsers/BlockListLoader.cs b/src/Formats/Parsers/BlockListLoader.cs index 79b1af4bf..d59d586ba 100644 --- a/src/Formats/Parsers/BlockListLoader.cs +++ b/src/Formats/Parsers/BlockListLoader.cs @@ -6,9 +6,9 @@ namespace UAlbion.Formats.Parsers; public class BlockListLoader : IAssetLoader { - public BlockList Serdes(BlockList existing, ISerializer s, AssetLoadContext context) + public BlockList Serdes(BlockList existing, ISerdes s, AssetLoadContext context) => BlockList.Serdes(context?.AssetId.Id ?? 0, existing, s); - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as BlockList, s, context); } diff --git a/src/Formats/Parsers/CharacterSheetLoader.cs b/src/Formats/Parsers/CharacterSheetLoader.cs index 5db73ece5..76f3f54c1 100644 --- a/src/Formats/Parsers/CharacterSheetLoader.cs +++ b/src/Formats/Parsers/CharacterSheetLoader.cs @@ -8,12 +8,12 @@ namespace UAlbion.Formats.Parsers; public class CharacterSheetLoader : Component, IAssetLoader { - public CharacterSheet Serdes(CharacterSheet existing, ISerializer s, AssetLoadContext context) + public CharacterSheet Serdes(CharacterSheet existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return CharacterSheet.Serdes(context.AssetId, existing, context.Mapping, s, Resolve()); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as CharacterSheet, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/ChestLoader.cs b/src/Formats/Parsers/ChestLoader.cs index d8e65f995..89a237cb8 100644 --- a/src/Formats/Parsers/ChestLoader.cs +++ b/src/Formats/Parsers/ChestLoader.cs @@ -7,12 +7,12 @@ namespace UAlbion.Formats.Parsers; public class ChestLoader : IAssetLoader { - public Inventory Serdes(Inventory existing, ISerializer s, AssetLoadContext context) + public Inventory Serdes(Inventory existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return Inventory.SerdesChest(context.AssetId.ToInt32(), existing, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as Inventory, s, context); } diff --git a/src/Formats/Parsers/DummyLoader.cs b/src/Formats/Parsers/DummyLoader.cs index f5a6c93bb..da9b595c6 100644 --- a/src/Formats/Parsers/DummyLoader.cs +++ b/src/Formats/Parsers/DummyLoader.cs @@ -5,6 +5,6 @@ namespace UAlbion.Formats.Parsers; public class DummyLoader : IAssetLoader { - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => existing ?? new object(); } diff --git a/src/Formats/Parsers/EventSetLoader.cs b/src/Formats/Parsers/EventSetLoader.cs index 8fee5793b..1f051a3aa 100644 --- a/src/Formats/Parsers/EventSetLoader.cs +++ b/src/Formats/Parsers/EventSetLoader.cs @@ -7,12 +7,12 @@ namespace UAlbion.Formats.Parsers; public class EventSetLoader : IAssetLoader { - public EventSet Serdes(EventSet existing, ISerializer s, AssetLoadContext context) + public EventSet Serdes(EventSet existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return EventSet.Serdes(context.AssetId, existing, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as EventSet, s, context); } diff --git a/src/Formats/Parsers/EventSetScriptLoader.cs b/src/Formats/Parsers/EventSetScriptLoader.cs index 69b3d1159..30aefc907 100644 --- a/src/Formats/Parsers/EventSetScriptLoader.cs +++ b/src/Formats/Parsers/EventSetScriptLoader.cs @@ -10,7 +10,7 @@ namespace UAlbion.Formats.Parsers; public class EventSetScriptLoader : Component, IAssetLoader { - public EventSet Serdes(EventSet existing, ISerializer s, AssetLoadContext context) + public EventSet Serdes(EventSet existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -41,6 +41,6 @@ static string Decompile(EventSetId id, EventSet set, IAssetManager assets) return eventFormatter.Decompile(set.Events, set.Chains, null).Script; } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((EventSet)existing, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/FixedSizeSpriteLoader.cs b/src/Formats/Parsers/FixedSizeSpriteLoader.cs index ad99a6e3d..8973bcb09 100644 --- a/src/Formats/Parsers/FixedSizeSpriteLoader.cs +++ b/src/Formats/Parsers/FixedSizeSpriteLoader.cs @@ -14,10 +14,10 @@ public class FixedSizeSpriteLoader : IAssetLoader> public static readonly BoolAssetProperty TransposedProperty = new("Transposed"); // For various textures in the 3D world that are stored with rows/columns flipped public static readonly IntAssetProperty ExtraBytesProperty = new("ExtraBytes"); // Used to suppress assertions when loading original assets that have incorrect sizes - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((IReadOnlyTexture) existing, s, context); - public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerializer s, AssetLoadContext context) + public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -26,7 +26,7 @@ public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerialize : Read(context, s); } - static SimpleTexture Read(AssetLoadContext context, ISerializer s) + static SimpleTexture Read(AssetLoadContext context, ISerdes s) { var streamLength = s.BytesRemaining; if (streamLength == 0) @@ -67,7 +67,7 @@ static SimpleTexture Read(AssetLoadContext context, ISerializer s) return info.GetProperty(TransposedProperty) ? Transpose(sprite) : sprite; } - static IReadOnlyTexture Write(IReadOnlyTexture existing, AssetLoadContext context, ISerializer s) + static IReadOnlyTexture Write(IReadOnlyTexture existing, AssetLoadContext context, ISerdes s) { ArgumentNullException.ThrowIfNull(existing); @@ -86,7 +86,7 @@ static IReadOnlyTexture Write(IReadOnlyTexture existing, AssetLoadCo return existing; } - static void InnerWrite(IReadOnlyTexture sprite, ISerializer s) + static void InnerWrite(IReadOnlyTexture sprite, ISerdes s) { var f = sprite.Regions[0]; int frameSize = f.Width * f.Height; diff --git a/src/Formats/Parsers/FlicLoader.cs b/src/Formats/Parsers/FlicLoader.cs index 4e5676772..0286d0708 100644 --- a/src/Formats/Parsers/FlicLoader.cs +++ b/src/Formats/Parsers/FlicLoader.cs @@ -6,5 +6,5 @@ namespace UAlbion.Formats.Parsers; public class FlicLoader : IAssetLoader { - public object Serdes(object existing, ISerializer s, AssetLoadContext context) => new FlicFile(s); + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => new FlicFile(s); } diff --git a/src/Formats/Parsers/InputConfigLoader.cs b/src/Formats/Parsers/InputConfigLoader.cs index 39a1a45ad..6b6e37d38 100644 --- a/src/Formats/Parsers/InputConfigLoader.cs +++ b/src/Formats/Parsers/InputConfigLoader.cs @@ -7,10 +7,10 @@ namespace UAlbion.Formats.Parsers; public class InputConfigLoader : IAssetLoader { - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((InputConfig)existing, s, context); - public InputConfig Serdes(InputConfig existing, ISerializer s, AssetLoadContext context) + public InputConfig Serdes(InputConfig existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); @@ -21,4 +21,4 @@ public InputConfig Serdes(InputConfig existing, ISerializer s, AssetLoadContext existing.Save(context.Filename, context.Disk, context.Json); return existing; } -} \ No newline at end of file +} diff --git a/src/Formats/Parsers/InterlacedBitmapLoader.cs b/src/Formats/Parsers/InterlacedBitmapLoader.cs index e94616a74..bf4ad1499 100644 --- a/src/Formats/Parsers/InterlacedBitmapLoader.cs +++ b/src/Formats/Parsers/InterlacedBitmapLoader.cs @@ -8,7 +8,7 @@ namespace UAlbion.Formats.Parsers; public class InterlacedBitmapLoader : IAssetLoader> { - public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerializer s, AssetLoadContext context) + public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); @@ -19,7 +19,7 @@ public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerialize return s.IsWriting() ? existing : ConvertIlbmToTexture(ilbm, context); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((IReadOnlyTexture)existing, s, context); static SimpleTexture ConvertIlbmToTexture(InterlacedBitmap bitmap, AssetLoadContext info) diff --git a/src/Formats/Parsers/ItemDataLoader.cs b/src/Formats/Parsers/ItemDataLoader.cs index 3f4430e1a..1d69f4afe 100644 --- a/src/Formats/Parsers/ItemDataLoader.cs +++ b/src/Formats/Parsers/ItemDataLoader.cs @@ -8,12 +8,12 @@ namespace UAlbion.Formats.Parsers; public class ItemDataLoader : Component, IAssetLoader { - public ItemData Serdes(ItemData existing, ISerializer s, AssetLoadContext context) + public ItemData Serdes(ItemData existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return ItemData.Serdes(context.AssetId, existing, s, Resolve()); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as ItemData, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/ItemNameCollectorLoader.cs b/src/Formats/Parsers/ItemNameCollectorLoader.cs index 8068f7901..a709959fa 100644 --- a/src/Formats/Parsers/ItemNameCollectorLoader.cs +++ b/src/Formats/Parsers/ItemNameCollectorLoader.cs @@ -13,12 +13,12 @@ public class ItemNameCollectorLoader : Component, IAssetLoader Serdes((Dictionary)existing, s, context); public Dictionary Serdes( Dictionary existing, - ISerializer s, + ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Parsers/ItemNameLoader.cs b/src/Formats/Parsers/ItemNameLoader.cs index 80346984d..d1ea80b63 100644 --- a/src/Formats/Parsers/ItemNameLoader.cs +++ b/src/Formats/Parsers/ItemNameLoader.cs @@ -11,12 +11,12 @@ namespace UAlbion.Formats.Parsers; public class ItemNameLoader : IAssetLoader> { const int StringSize = 20; - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((Dictionary)existing, s, context); public Dictionary Serdes( Dictionary existing, - ISerializer s, + ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); @@ -31,7 +31,7 @@ public Dictionary Serdes( return existing; } - static Dictionary Read(ISerializer s) + static Dictionary Read(ISerdes s) { var german = new ListStringSet(); var english = new ListStringSet(); @@ -58,7 +58,7 @@ static Dictionary Read(ISerializer s) return results; } - static void WriteAll(Dictionary existing, ISerializer s) + static void WriteAll(Dictionary existing, ISerdes s) { existing.TryGetValue(Base.Language.German, out var german); existing.TryGetValue(Base.Language.English, out var english); @@ -82,7 +82,7 @@ static void WriteAll(Dictionary existing, ISerializer s) } } - static void Write(ListStringSet set, ISerializer s, int i) + static void Write(ListStringSet set, ISerdes s, int i) { var text = set.Count <= i ? "" : set[i]; s.FixedLengthString(null, text, StringSize); diff --git a/src/Formats/Parsers/ItemNameMetaLoader.cs b/src/Formats/Parsers/ItemNameMetaLoader.cs index 9278c5094..df423a682 100644 --- a/src/Formats/Parsers/ItemNameMetaLoader.cs +++ b/src/Formats/Parsers/ItemNameMetaLoader.cs @@ -11,7 +11,7 @@ namespace UAlbion.Formats.Parsers; public class ItemNameMetaLoader : Component, IAssetLoader { public static readonly AssetIdAssetProperty TargetProperty = new("Target"); - public ListStringSet Serdes(ListStringSet existing, ISerializer s, AssetLoadContext context) + public ListStringSet Serdes(ListStringSet existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); var targetId = context.GetProperty(TargetProperty); @@ -30,6 +30,6 @@ public ListStringSet Serdes(ListStringSet existing, ISerializer s, AssetLoadCont return dict.GetValueOrDefault(context.Language); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((ListStringSet)existing, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/JsonLoader.cs b/src/Formats/Parsers/JsonLoader.cs index cb2a6f2dd..cfe4c275e 100644 --- a/src/Formats/Parsers/JsonLoader.cs +++ b/src/Formats/Parsers/JsonLoader.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.Parsers; public class JsonLoader : IAssetLoader where T : class { - public T Serdes(T existing, ISerializer s, AssetLoadContext context) + public T Serdes(T existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -28,6 +28,6 @@ public T Serdes(T existing, ISerializer s, AssetLoadContext context) } } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((T)existing, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/JsonStringLoader.cs b/src/Formats/Parsers/JsonStringLoader.cs index 10b54e47c..061b0e0c6 100644 --- a/src/Formats/Parsers/JsonStringLoader.cs +++ b/src/Formats/Parsers/JsonStringLoader.cs @@ -7,7 +7,7 @@ namespace UAlbion.Formats.Parsers; public class JsonStringLoader : IAssetLoader { - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); diff --git a/src/Formats/Parsers/LabyrinthDataLoader.cs b/src/Formats/Parsers/LabyrinthDataLoader.cs index 8a5b03e1f..2bbaf387f 100644 --- a/src/Formats/Parsers/LabyrinthDataLoader.cs +++ b/src/Formats/Parsers/LabyrinthDataLoader.cs @@ -7,12 +7,12 @@ namespace UAlbion.Formats.Parsers; public class LabyrinthDataLoader : IAssetLoader { - public LabyrinthData Serdes(LabyrinthData existing, ISerializer s, AssetLoadContext context) + public LabyrinthData Serdes(LabyrinthData existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return LabyrinthData.Serdes(existing, context.AssetId, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as LabyrinthData, s, context); } diff --git a/src/Formats/Parsers/MapLoader.cs b/src/Formats/Parsers/MapLoader.cs index 41a942aa3..d25f858a4 100644 --- a/src/Formats/Parsers/MapLoader.cs +++ b/src/Formats/Parsers/MapLoader.cs @@ -8,12 +8,12 @@ namespace UAlbion.Formats.Parsers; public class MapLoader : IAssetLoader { - public IMapData Serdes(IMapData existing, ISerializer s, AssetLoadContext context) + public IMapData Serdes(IMapData existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return BaseMapData.Serdes(context.AssetId, existing, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as IMapData, s, context); } \ No newline at end of file diff --git a/src/Formats/Parsers/MerchantLoader.cs b/src/Formats/Parsers/MerchantLoader.cs index 6f487bc39..4515fec3c 100644 --- a/src/Formats/Parsers/MerchantLoader.cs +++ b/src/Formats/Parsers/MerchantLoader.cs @@ -7,12 +7,12 @@ namespace UAlbion.Formats.Parsers; public class MerchantLoader : IAssetLoader { - public Inventory Serdes(Inventory existing, ISerializer s, AssetLoadContext context) + public Inventory Serdes(Inventory existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return Inventory.SerdesMerchant(context.AssetId.ToInt32(), existing, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as Inventory, s, context); } diff --git a/src/Formats/Parsers/MonsterGroupLoader.cs b/src/Formats/Parsers/MonsterGroupLoader.cs index e01594619..571c6d331 100644 --- a/src/Formats/Parsers/MonsterGroupLoader.cs +++ b/src/Formats/Parsers/MonsterGroupLoader.cs @@ -7,12 +7,12 @@ namespace UAlbion.Formats.Parsers; public class MonsterGroupLoader : IAssetLoader { - public MonsterGroup Serdes(MonsterGroup existing, ISerializer s, AssetLoadContext context) + public MonsterGroup Serdes(MonsterGroup existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(context); return MonsterGroup.Serdes(context.AssetId.Id, existing, context.Mapping, s); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes(existing as MonsterGroup, s, context); } diff --git a/src/Formats/Parsers/MultiHeaderSpriteLoader.cs b/src/Formats/Parsers/MultiHeaderSpriteLoader.cs index ef2ff48ce..e7a6c8756 100644 --- a/src/Formats/Parsers/MultiHeaderSpriteLoader.cs +++ b/src/Formats/Parsers/MultiHeaderSpriteLoader.cs @@ -11,10 +11,10 @@ namespace UAlbion.Formats.Parsers; public class MultiHeaderSpriteLoader : IAssetLoader> { - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((IReadOnlyTexture)existing, s, context); - public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerializer s, AssetLoadContext context) + public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(context); @@ -29,7 +29,7 @@ public IReadOnlyTexture Serdes(IReadOnlyTexture existing, ISerialize return Read(context, s); } - static IReadOnlyTexture Read(AssetLoadContext context, ISerializer s) + static IReadOnlyTexture Read(AssetLoadContext context, ISerdes s) { int width = s.UInt16("Width", 0); int height = s.UInt16("Height", 0); @@ -58,7 +58,7 @@ static IReadOnlyTexture Read(AssetLoadContext context, ISerializer s) return BlitUtil.CombineFramesVertically(context.AssetId, frames); } - static void Write(IReadOnlyTexture existing, ISerializer s) + static void Write(IReadOnlyTexture existing, ISerdes s) { if (existing.Regions.Count > 255) throw new ArgumentOutOfRangeException($"Tried to save an image with more than 255 frames as a multi-header sprite ({existing.Name} with {existing.Regions.Count} regions)"); diff --git a/src/Formats/Parsers/PackedChunks.cs b/src/Formats/Parsers/PackedChunks.cs index 22944ed54..7c5c6e9e1 100644 --- a/src/Formats/Parsers/PackedChunks.cs +++ b/src/Formats/Parsers/PackedChunks.cs @@ -9,7 +9,7 @@ public static class PackedChunks const string Magic = "CHUNKED_MAGIC"; // Format: u32 count; [ u32 size; byte[size] chunk ] - public static IEnumerable<(byte[], string)> Unpack(ISerializer s) + public static IEnumerable<(byte[], string)> Unpack(ISerdes s) { ArgumentNullException.ThrowIfNull(s); var initial = s.Offset; @@ -37,10 +37,10 @@ public static class PackedChunks } } - public static void Pack(ISerializer s, int count, Func buildChunk) + public static void Pack(ISerdes s, int count, Func buildChunk) => PackNamed(s, count, i => (buildChunk(i), null)); - public static void PackNamed(ISerializer s, int count, Func buildChunk) + public static void PackNamed(ISerdes s, int count, Func buildChunk) { ArgumentNullException.ThrowIfNull(s); ArgumentNullException.ThrowIfNull(buildChunk); @@ -62,4 +62,4 @@ public static void PackNamed(ISerializer s, int count, Func public static readonly StringAssetProperty AnimatedRanges = new("AnimatedRanges"); // string (e.g. "0x1-0xf, 0x12-0x1a") public static AssetIdAssetProperty NightPalette { get; }= new("NightPalette"); - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((AlbionPalette)existing, s, context); - public AlbionPalette Serdes(AlbionPalette existing, ISerializer s, AssetLoadContext context) + public AlbionPalette Serdes(AlbionPalette existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); return AlbionPalette.Serdes(existing, context, s); diff --git a/src/Formats/Parsers/RawLoader.cs b/src/Formats/Parsers/RawLoader.cs index bec2843c8..5f7be68a7 100644 --- a/src/Formats/Parsers/RawLoader.cs +++ b/src/Formats/Parsers/RawLoader.cs @@ -6,12 +6,12 @@ namespace UAlbion.Formats.Parsers; public class RawLoader : IAssetLoader { - public byte[] Serdes(byte[] existing, ISerializer s, AssetLoadContext context) + public byte[] Serdes(byte[] existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); return s.Bytes(null, existing, (int) (existing?.Length ?? s.BytesRemaining)); } - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((byte[]) existing, s, context); } diff --git a/src/Formats/Parsers/SampleLoader.cs b/src/Formats/Parsers/SampleLoader.cs index aef3ca0bb..b202f22fd 100644 --- a/src/Formats/Parsers/SampleLoader.cs +++ b/src/Formats/Parsers/SampleLoader.cs @@ -11,16 +11,16 @@ public class SampleLoader : IAssetLoader const int Channels = 1; const int BytesPerSample = 1; - public object Serdes(object existing, ISerializer s, AssetLoadContext context) + public object Serdes(object existing, ISerdes s, AssetLoadContext context) => Serdes((AlbionSample) existing, s, context); - public AlbionSample Serdes(AlbionSample existing, ISerializer s, AssetLoadContext context) + public AlbionSample Serdes(AlbionSample existing, ISerdes s, AssetLoadContext context) { ArgumentNullException.ThrowIfNull(s); return s.IsWriting() ? Write(existing, s) : Read(s); } - static AlbionSample Read(ISerializer s) + static AlbionSample Read(ISerdes s) { return new() { @@ -31,7 +31,7 @@ static AlbionSample Read(ISerializer s) }; } - static AlbionSample Write(AlbionSample sample, ISerializer s) + static AlbionSample Write(AlbionSample sample, ISerdes s) { ArgumentNullException.ThrowIfNull(sample); if(sample.SampleRate != SampleRate) diff --git a/src/Formats/Parsers/ScriptLoader.cs b/src/Formats/Parsers/ScriptLoader.cs index a298c9d4a..55fcd1911 100644 --- a/src/Formats/Parsers/ScriptLoader.cs +++ b/src/Formats/Parsers/ScriptLoader.cs @@ -13,10 +13,10 @@ namespace UAlbion.Formats.Parsers; public class ScriptLoader : IAssetLoader