diff --git a/CHANGELOG.md b/CHANGELOG.md index e470b430..078a066f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ### Changelog +#### Version - 3.0.6.0 - ?? +* Add support for Cubemaps in BA2 files, if you have problems with BA2 recompression, be sure to delete your `GlobalVFSCache3.sqlite` from your AppData before the next compile +* Fixed slides not being shown during installation for lists compile with the 3.0 compiler +* Set the "While loading slide" debug message to be `Trace` level, set the default minimum log level to `Information` + #### Version - 3.0.5.0 - 12/22/2022 * Add support for https://www.nexusmods.com/site hosted mods. * Fix Website Links diff --git a/Wabbajack.App.Wpf/App.xaml.cs b/Wabbajack.App.Wpf/App.xaml.cs index a224e5d6..e855d5af 100644 --- a/Wabbajack.App.Wpf/App.xaml.cs +++ b/Wabbajack.App.Wpf/App.xaml.cs @@ -145,7 +145,7 @@ namespace Wabbajack config.AddRuleForAllLevels(uiTarget); loggingBuilder.ClearProviders(); - loggingBuilder.SetMinimumLevel(LogLevel.Trace); + loggingBuilder.SetMinimumLevel(LogLevel.Information); loggingBuilder.AddNLog(config); } diff --git a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs index bd48ad1b..507d463a 100644 --- a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs @@ -505,7 +505,7 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM } catch (Exception ex) { - _logger.LogWarning(ex, "While loading slide"); + _logger.LogTrace(ex, "While loading slide"); } } diff --git a/Wabbajack.Compression.BSA/DDS.cs b/Wabbajack.Compression.BSA/DDS.cs index 57366883..8a7a4334 100644 --- a/Wabbajack.Compression.BSA/DDS.cs +++ b/Wabbajack.Compression.BSA/DDS.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using System.Runtime.InteropServices; using Wabbajack.DTOs.Texture; @@ -66,6 +67,19 @@ public enum DXT10_RESOURCE_DIMENSION DIMENSION_TEXTURE3D = 4 } +[Flags] +public enum DDSCAPS2 : uint +{ + CUBEMAP = 0x200, + CUBEMAP_POSITIVEX = 0x400, + CUBEMAP_NEGATIVEX = 0x800, + CUBEMAP_POSITIVEY = 0x1000, + CUBEMAP_NEGATIVEY = 0x2000, + CUBEMAP_POSITIVEZ = 0x4000, + CUBEMAP_NEGATIVEZ = 0x8000, + CUBEMAP_ALLFACES = 0xFC00 +} + [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct DDS_HEADER { diff --git a/Wabbajack.Compression.BSA/FO4Archive/DX10Entry.cs b/Wabbajack.Compression.BSA/FO4Archive/DX10Entry.cs index 41ac7988..a793f4f4 100644 --- a/Wabbajack.Compression.BSA/FO4Archive/DX10Entry.cs +++ b/Wabbajack.Compression.BSA/FO4Archive/DX10Entry.cs @@ -18,19 +18,21 @@ namespace Wabbajack.Compression.BSA.FO4Archive; public class DX10Entry : IBA2FileEntry { private readonly Reader _bsa; - internal ushort _chunkHdrLen; - internal List _chunks; - internal uint _dirHash; - internal string _extension; - internal byte _format; - internal ushort _height; - internal int _index; - internal uint _nameHash; - internal byte _numChunks; - internal byte _numMips; - internal ushort _unk16; - internal byte _unk8; - internal ushort _width; + private ushort _chunkHdrLen; + private List _chunks; + private uint _dirHash; + private string _extension; + private byte _format; + private ushort _height; + private int _index; + private uint _nameHash; + private byte _numChunks; + private byte _numMips; + private ushort _unk16; + private byte _unk8; + private ushort _width; + private readonly byte _isCubemap; + private readonly byte _tileMode; public DX10Entry(Reader ba2Reader, int idx) { @@ -47,7 +49,8 @@ public class DX10Entry : IBA2FileEntry _width = _rdr.ReadUInt16(); _numMips = _rdr.ReadByte(); _format = _rdr.ReadByte(); - _unk16 = _rdr.ReadUInt16(); + _isCubemap = _rdr.ReadByte(); + _tileMode = _rdr.ReadByte(); _index = idx; _chunks = Enumerable.Range(0, _numChunks) @@ -74,7 +77,8 @@ public class DX10Entry : IBA2FileEntry Width = _width, NumMips = _numMips, PixelFormat = _format, - Unk16 = _unk16, + IsCubeMap = _isCubemap, + TileMode = _tileMode, Index = _index, Chunks = _chunks.Select(ch => new BA2Chunk { @@ -139,6 +143,12 @@ public class DX10Entry : IBA2FileEntry ddsHeader.PixelFormat.dwSize = ddsHeader.PixelFormat.GetSize(); ddsHeader.dwDepth = 1; ddsHeader.dwSurfaceFlags = DDS.DDS_SURFACE_FLAGS_TEXTURE | DDS.DDS_SURFACE_FLAGS_MIPMAP; + ddsHeader.dwCubemapFlags = _isCubemap == 1 ? (uint)(DDSCAPS2.CUBEMAP + | DDSCAPS2.CUBEMAP_NEGATIVEX | DDSCAPS2.CUBEMAP_POSITIVEX + | DDSCAPS2.CUBEMAP_NEGATIVEY | DDSCAPS2.CUBEMAP_POSITIVEY + | DDSCAPS2.CUBEMAP_NEGATIVEZ | DDSCAPS2.CUBEMAP_POSITIVEZ + | DDSCAPS2.CUBEMAP_ALLFACES) : 0u; + switch ((DXGI_FORMAT) _format) { diff --git a/Wabbajack.Compression.BSA/FO4Archive/DX10FileEntryBuilder.cs b/Wabbajack.Compression.BSA/FO4Archive/DX10FileEntryBuilder.cs index b12d1046..86045356 100644 --- a/Wabbajack.Compression.BSA/FO4Archive/DX10FileEntryBuilder.cs +++ b/Wabbajack.Compression.BSA/FO4Archive/DX10FileEntryBuilder.cs @@ -31,7 +31,8 @@ public class DX10FileEntryBuilder : IFileBuilder bw.Write(_state.Width); bw.Write(_state.NumMips); bw.Write(_state.PixelFormat); - bw.Write(_state.Unk16); + bw.Write((byte)_state.IsCubeMap); + bw.Write((byte)_state.TileMode); foreach (var chunk in _chunks) chunk.WriteHeader(bw); diff --git a/Wabbajack.DTOs/JsonConverters/Generated.cs b/Wabbajack.DTOs/JsonConverters/Generated.cs index ff90f3eb..644a59c9 100644 --- a/Wabbajack.DTOs/JsonConverters/Generated.cs +++ b/Wabbajack.DTOs/JsonConverters/Generated.cs @@ -3,17 +3,11 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; -using Microsoft.Extensions.DependencyInjection; -using Wabbajack.DTOs; -using Wabbajack.DTOs.BSA.ArchiveStates; -using Wabbajack.DTOs.BSA.FileStates; -using Wabbajack.DTOs.Directives; -using Wabbajack.DTOs.DownloadStates; -using Wabbajack.DTOs.Texture; using Wabbajack.Hashing.xxHash64; -using Wabbajack.Paths; +using Microsoft.Extensions.DependencyInjection; -public class Wabbajack_DTOs_DownloadStates_IDownloadStateConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_IDownloadStateConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { @@ -34,7 +28,8 @@ public class Wabbajack_DTOs_DownloadStates_IDownloadStateConverter : JsonConvert services.AddSingleton(); } - public override IDownloadState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.IDownloadState Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) @@ -47,130 +42,133 @@ public class Wabbajack_DTOs_DownloadStates_IDownloadStateConverter : JsonConvert switch (type) { case "Bethesda": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLabDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, + options)!; case "GameFileSourceDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "GameFileSource": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "GoogleDriveDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "GoogleDrive": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "HttpDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "Http": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "HttpDownloader": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLabOAuthDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLab": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "ManualDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "Manual": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFireDownloader+State, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFire": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFireDownloader": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MegaDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "Mega": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "ModDBDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "ModDB": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "ModDBDownloader": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "NexusDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "Nexus": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TESAllianceDownloader, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TESAlliance": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "VectorPlexusOAuthDownloader+State, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "VectorPlexus": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "WabbajackCDNDownloader+State, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "WabbajackCDN": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } - public override void Write(Utf8JsonWriter writer, IDownloadState value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.IDownloadState value, + JsonSerializerOptions options) { switch (value) { - case LoversLab v0: + case Wabbajack.DTOs.DownloadStates.LoversLab v0: JsonSerializer.Serialize(writer, v0, options); return; - case VectorPlexus v1: + case Wabbajack.DTOs.DownloadStates.VectorPlexus v1: JsonSerializer.Serialize(writer, v1, options); return; - case Bethesda v2: + case Wabbajack.DTOs.DownloadStates.Bethesda v2: JsonSerializer.Serialize(writer, v2, options); return; - case DeprecatedLoversLab v3: + case Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab v3: JsonSerializer.Serialize(writer, v3, options); return; - case GameFileSource v4: + case Wabbajack.DTOs.DownloadStates.GameFileSource v4: JsonSerializer.Serialize(writer, v4, options); return; - case GoogleDrive v5: + case Wabbajack.DTOs.DownloadStates.GoogleDrive v5: JsonSerializer.Serialize(writer, v5, options); return; - case Http v6: + case Wabbajack.DTOs.DownloadStates.Http v6: JsonSerializer.Serialize(writer, v6, options); return; - case Manual v7: + case Wabbajack.DTOs.DownloadStates.Manual v7: JsonSerializer.Serialize(writer, v7, options); return; - case MediaFire v8: + case Wabbajack.DTOs.DownloadStates.MediaFire v8: JsonSerializer.Serialize(writer, v8, options); return; - case Mega v9: + case Wabbajack.DTOs.DownloadStates.Mega v9: JsonSerializer.Serialize(writer, v9, options); return; - case ModDB v10: + case Wabbajack.DTOs.DownloadStates.ModDB v10: JsonSerializer.Serialize(writer, v10, options); return; - case Nexus v11: + case Wabbajack.DTOs.DownloadStates.Nexus v11: JsonSerializer.Serialize(writer, v11, options); return; - case TESAlliance v12: + case Wabbajack.DTOs.DownloadStates.TESAlliance v12: JsonSerializer.Serialize(writer, v12, options); return; - case WabbajackCDN v13: + case Wabbajack.DTOs.DownloadStates.WabbajackCDN v13: JsonSerializer.Serialize(writer, v13, options); return; } } } -public class Wabbajack_DTOs_DownloadStates_BethesdaConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_BethesdaConverter : JsonConverter { - public override Bethesda Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.Bethesda Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - long branchidProp = default; - string contentidProp = default; - Game gameProp = default; - bool isccmodProp = default; - string nameProp = default; - long productidProp = default; + System.Int64 branchidProp = default; + System.String contentidProp = default; + Wabbajack.DTOs.Game gameProp = default; + System.Boolean isccmodProp = default; + System.String nameProp = default; + System.Int64 productidProp = default; while (true) { reader.Read(); @@ -185,22 +183,22 @@ public class Wabbajack_DTOs_DownloadStates_BethesdaConverter : JsonConverter(ref reader, options); + branchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "ContentId": - contentidProp = JsonSerializer.Deserialize(ref reader, options); + contentidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Game": - gameProp = JsonSerializer.Deserialize(ref reader, options); + gameProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsCCMod": - isccmodProp = JsonSerializer.Deserialize(ref reader, options); + isccmodProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": - nameProp = JsonSerializer.Deserialize(ref reader, options); + nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "ProductId": - productidProp = JsonSerializer.Deserialize(ref reader, options); + productidProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -208,41 +206,44 @@ public class Wabbajack_DTOs_DownloadStates_BethesdaConverter : JsonConverter(writer, value.BranchId, options); writer.WritePropertyName("ContentId"); - JsonSerializer.Serialize(writer, value.ContentId, options); + JsonSerializer.Serialize(writer, value.ContentId, options); writer.WritePropertyName("Game"); - JsonSerializer.Serialize(writer, value.Game, options); + JsonSerializer.Serialize(writer, value.Game, options); writer.WritePropertyName("IsCCMod"); - JsonSerializer.Serialize(writer, value.IsCCMod, options); + JsonSerializer.Serialize(writer, value.IsCCMod, options); writer.WritePropertyName("Name"); - JsonSerializer.Serialize(writer, value.Name, options); + JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("ProductId"); - JsonSerializer.Serialize(writer, value.ProductId, options); + JsonSerializer.Serialize(writer, value.ProductId, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_DeprecatedLoversLabConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_DeprecatedLoversLabConverter : JsonConverter< + Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab> { - public override DeprecatedLoversLab Read(ref Utf8JsonReader reader, Type typeToConvert, - JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab Read(ref Utf8JsonReader reader, + Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); @@ -265,10 +266,13 @@ public class Wabbajack_DTOs_DownloadStates_DeprecatedLoversLabConverter : JsonCo } } - return new DeprecatedLoversLab(); + return new Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab + { + }; } - public override void Write(Utf8JsonWriter writer, DeprecatedLoversLab value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "LoversLabDownloader, Wabbajack.Lib"); @@ -276,16 +280,18 @@ public class Wabbajack_DTOs_DownloadStates_DeprecatedLoversLabConverter : JsonCo } } -public class Wabbajack_DTOs_DownloadStates_GameFileSourceConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_GameFileSourceConverter : JsonConverter { - public override GameFileSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.GameFileSource Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Game gameProp = default; - RelativePath gamefileProp = default; - string gameversionProp = default; - Hash hashProp = default; + Wabbajack.DTOs.Game gameProp = default; + Wabbajack.Paths.RelativePath gamefileProp = default; + System.String gameversionProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; while (true) { reader.Read(); @@ -300,16 +306,16 @@ public class Wabbajack_DTOs_DownloadStates_GameFileSourceConverter : JsonConvert switch (prop) { case "Game": - gameProp = JsonSerializer.Deserialize(ref reader, options); + gameProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameFile": - gamefileProp = JsonSerializer.Deserialize(ref reader, options); + gamefileProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameVersion": - gameversionProp = JsonSerializer.Deserialize(ref reader, options); + gameversionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -317,38 +323,41 @@ public class Wabbajack_DTOs_DownloadStates_GameFileSourceConverter : JsonConvert } } - return new GameFileSource + return new Wabbajack.DTOs.DownloadStates.GameFileSource { Game = gameProp, GameFile = gamefileProp, GameVersion = gameversionProp, - Hash = hashProp + Hash = hashProp, }; } - public override void Write(Utf8JsonWriter writer, GameFileSource value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.GameFileSource value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "GameFileSourceDownloader, Wabbajack.Lib"); writer.WritePropertyName("Game"); - JsonSerializer.Serialize(writer, value.Game, options); + JsonSerializer.Serialize(writer, value.Game, options); writer.WritePropertyName("GameFile"); - JsonSerializer.Serialize(writer, value.GameFile, options); + JsonSerializer.Serialize(writer, value.GameFile, options); writer.WritePropertyName("GameVersion"); - JsonSerializer.Serialize(writer, value.GameVersion, options); + JsonSerializer.Serialize(writer, value.GameVersion, options); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_GoogleDriveConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_GoogleDriveConverter : JsonConverter { - public override GoogleDrive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.GoogleDrive Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string idProp = default; + System.String idProp = default; while (true) { reader.Read(); @@ -363,7 +372,7 @@ public class Wabbajack_DTOs_DownloadStates_GoogleDriveConverter : JsonConverter< switch (prop) { case "Id": - idProp = JsonSerializer.Deserialize(ref reader, options); + idProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -371,30 +380,32 @@ public class Wabbajack_DTOs_DownloadStates_GoogleDriveConverter : JsonConverter< } } - return new GoogleDrive + return new Wabbajack.DTOs.DownloadStates.GoogleDrive { - Id = idProp + Id = idProp, }; } - public override void Write(Utf8JsonWriter writer, GoogleDrive value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.GoogleDrive value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "GoogleDriveDownloader, Wabbajack.Lib"); writer.WritePropertyName("Id"); - JsonSerializer.Serialize(writer, value.Id, options); + JsonSerializer.Serialize(writer, value.Id, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_HttpConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_HttpConverter : JsonConverter { - public override Http Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.Http Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string[] headersProp = default; - Uri urlProp = default; + System.String[] headersProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -409,10 +420,10 @@ public class Wabbajack_DTOs_DownloadStates_HttpConverter : JsonConverter switch (prop) { case "Headers": - headersProp = JsonSerializer.Deserialize(ref reader, options); + headersProp = JsonSerializer.Deserialize(ref reader, options); break; case "Url": - urlProp = JsonSerializer.Deserialize(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -420,41 +431,43 @@ public class Wabbajack_DTOs_DownloadStates_HttpConverter : JsonConverter } } - return new Http + return new Wabbajack.DTOs.DownloadStates.Http { Headers = headersProp, - Url = urlProp + Url = urlProp, }; } - public override void Write(Utf8JsonWriter writer, Http value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.Http value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "HttpDownloader, Wabbajack.Lib"); writer.WritePropertyName("Headers"); - JsonSerializer.Serialize(writer, value.Headers, options); + JsonSerializer.Serialize(writer, value.Headers, options); writer.WritePropertyName("Url"); - JsonSerializer.Serialize(writer, value.Url, options); + JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_LoversLabConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_LoversLabConverter : JsonConverter { - public override LoversLab Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.LoversLab Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string authorProp = default; - string descriptionProp = default; - Uri imageurlProp = default; - string ips4fileProp = default; - long ips4modProp = default; - string ips4urlProp = default; - bool isattachmentProp = default; - bool isnsfwProp = default; - string nameProp = default; - string versionProp = default; + System.String authorProp = default; + System.String descriptionProp = default; + System.Uri imageurlProp = default; + System.String ips4fileProp = default; + System.Int64 ips4modProp = default; + System.String ips4urlProp = default; + System.Boolean isattachmentProp = default; + System.Boolean isnsfwProp = default; + System.String nameProp = default; + System.String versionProp = default; while (true) { reader.Read(); @@ -469,34 +482,34 @@ public class Wabbajack_DTOs_DownloadStates_LoversLabConverter : JsonConverter(ref reader, options); + authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": - descriptionProp = JsonSerializer.Deserialize(ref reader, options); + descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": - imageurlProp = JsonSerializer.Deserialize(ref reader, options); + imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4File": - ips4fileProp = JsonSerializer.Deserialize(ref reader, options); + ips4fileProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Mod": - ips4modProp = JsonSerializer.Deserialize(ref reader, options); + ips4modProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Url": - ips4urlProp = JsonSerializer.Deserialize(ref reader, options); + ips4urlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": - isattachmentProp = JsonSerializer.Deserialize(ref reader, options); + isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": - isnsfwProp = JsonSerializer.Deserialize(ref reader, options); + isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": - nameProp = JsonSerializer.Deserialize(ref reader, options); + nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": - versionProp = JsonSerializer.Deserialize(ref reader, options); + versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -504,7 +517,7 @@ public class Wabbajack_DTOs_DownloadStates_LoversLabConverter : JsonConverter(writer, value.Author, options); + JsonSerializer.Serialize(writer, value.Author, options); writer.WritePropertyName("Description"); - JsonSerializer.Serialize(writer, value.Description, options); + JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("ImageURL"); - JsonSerializer.Serialize(writer, value.ImageURL, options); + JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IPS4File"); - JsonSerializer.Serialize(writer, value.IPS4File, options); + JsonSerializer.Serialize(writer, value.IPS4File, options); writer.WritePropertyName("IPS4Mod"); - JsonSerializer.Serialize(writer, value.IPS4Mod, options); + JsonSerializer.Serialize(writer, value.IPS4Mod, options); writer.WritePropertyName("IPS4Url"); - JsonSerializer.Serialize(writer, value.IPS4Url, options); + JsonSerializer.Serialize(writer, value.IPS4Url, options); writer.WritePropertyName("IsAttachment"); - JsonSerializer.Serialize(writer, value.IsAttachment, options); + JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WritePropertyName("IsNSFW"); - JsonSerializer.Serialize(writer, value.IsNSFW, options); + JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("Name"); - JsonSerializer.Serialize(writer, value.Name, options); + JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); - JsonSerializer.Serialize(writer, value.Version, options); + JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_ManualConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_ManualConverter : JsonConverter { - public override Manual Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.Manual Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string promptProp = default; - Uri urlProp = default; + System.String promptProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -569,10 +584,10 @@ public class Wabbajack_DTOs_DownloadStates_ManualConverter : JsonConverter(ref reader, options); + promptProp = JsonSerializer.Deserialize(ref reader, options); break; case "Url": - urlProp = JsonSerializer.Deserialize(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -580,32 +595,34 @@ public class Wabbajack_DTOs_DownloadStates_ManualConverter : JsonConverter(writer, value.Prompt, options); writer.WritePropertyName("Url"); - JsonSerializer.Serialize(writer, value.Url, options); + JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_MediaFireConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_MediaFireConverter : JsonConverter { - public override MediaFire Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.MediaFire Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Uri urlProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -620,7 +637,7 @@ public class Wabbajack_DTOs_DownloadStates_MediaFireConverter : JsonConverter(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -628,29 +645,31 @@ public class Wabbajack_DTOs_DownloadStates_MediaFireConverter : JsonConverter(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_MegaConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_MegaConverter : JsonConverter { - public override Mega Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.Mega Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Uri urlProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -665,7 +684,7 @@ public class Wabbajack_DTOs_DownloadStates_MegaConverter : JsonConverter switch (prop) { case "Url": - urlProp = JsonSerializer.Deserialize(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -673,29 +692,31 @@ public class Wabbajack_DTOs_DownloadStates_MegaConverter : JsonConverter } } - return new Mega + return new Wabbajack.DTOs.DownloadStates.Mega { - Url = urlProp + Url = urlProp, }; } - public override void Write(Utf8JsonWriter writer, Mega value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.Mega value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "MegaDownloader, Wabbajack.Lib"); writer.WritePropertyName("Url"); - JsonSerializer.Serialize(writer, value.Url, options); + JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_ModDBConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_ModDBConverter : JsonConverter { - public override ModDB Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.ModDB Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Uri urlProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -710,7 +731,7 @@ public class Wabbajack_DTOs_DownloadStates_ModDBConverter : JsonConverter switch (prop) { case "Url": - urlProp = JsonSerializer.Deserialize(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -718,37 +739,39 @@ public class Wabbajack_DTOs_DownloadStates_ModDBConverter : JsonConverter } } - return new ModDB + return new Wabbajack.DTOs.DownloadStates.ModDB { - Url = urlProp + Url = urlProp, }; } - public override void Write(Utf8JsonWriter writer, ModDB value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.ModDB value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "ModDBDownloader, Wabbajack.Lib"); writer.WritePropertyName("Url"); - JsonSerializer.Serialize(writer, value.Url, options); + JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter +public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter { - public override Nexus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.Nexus Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string authorProp = default; - string descriptionProp = default; - long fileidProp = default; - Game gamenameProp = default; - Uri imageurlProp = default; - bool isnsfwProp = default; - long modidProp = default; - string nameProp = default; - string versionProp = default; + System.String authorProp = default; + System.String descriptionProp = default; + System.Int64 fileidProp = default; + Wabbajack.DTOs.Game gamenameProp = default; + System.Uri imageurlProp = default; + System.Boolean isnsfwProp = default; + System.Int64 modidProp = default; + System.String nameProp = default; + System.String versionProp = default; while (true) { reader.Read(); @@ -763,31 +786,31 @@ public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter switch (prop) { case "Author": - authorProp = JsonSerializer.Deserialize(ref reader, options); + authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": - descriptionProp = JsonSerializer.Deserialize(ref reader, options); + descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileID": - fileidProp = JsonSerializer.Deserialize(ref reader, options); + fileidProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameName": - gamenameProp = JsonSerializer.Deserialize(ref reader, options); + gamenameProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": - imageurlProp = JsonSerializer.Deserialize(ref reader, options); + imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": - isnsfwProp = JsonSerializer.Deserialize(ref reader, options); + isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "ModID": - modidProp = JsonSerializer.Deserialize(ref reader, options); + modidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": - nameProp = JsonSerializer.Deserialize(ref reader, options); + nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": - versionProp = JsonSerializer.Deserialize(ref reader, options); + versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -795,7 +818,7 @@ public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter } } - return new Nexus + return new Wabbajack.DTOs.DownloadStates.Nexus { Author = authorProp, Description = descriptionProp, @@ -805,46 +828,49 @@ public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter IsNSFW = isnsfwProp, ModID = modidProp, Name = nameProp, - Version = versionProp + Version = versionProp, }; } - public override void Write(Utf8JsonWriter writer, Nexus value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.Nexus value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "NexusDownloader, Wabbajack.Lib"); writer.WritePropertyName("Author"); - JsonSerializer.Serialize(writer, value.Author, options); + JsonSerializer.Serialize(writer, value.Author, options); writer.WritePropertyName("Description"); - JsonSerializer.Serialize(writer, value.Description, options); + JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("FileID"); - JsonSerializer.Serialize(writer, value.FileID, options); + JsonSerializer.Serialize(writer, value.FileID, options); writer.WritePropertyName("GameName"); - JsonSerializer.Serialize(writer, value.Game, options); + JsonSerializer.Serialize(writer, value.Game, options); writer.WritePropertyName("ImageURL"); - JsonSerializer.Serialize(writer, value.ImageURL, options); + JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IsNSFW"); - JsonSerializer.Serialize(writer, value.IsNSFW, options); + JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("ModID"); - JsonSerializer.Serialize(writer, value.ModID, options); + JsonSerializer.Serialize(writer, value.ModID, options); writer.WritePropertyName("Name"); - JsonSerializer.Serialize(writer, value.Name, options); + JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); - JsonSerializer.Serialize(writer, value.Version, options); + JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_TESAllianceConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_TESAllianceConverter : JsonConverter { - public override TESAlliance Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.TESAlliance Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string fileidProp = default; - string filenameProp = default; - Uri fullurlProp = default; - bool isattachmentProp = default; + System.String fileidProp = default; + System.String filenameProp = default; + System.Uri fullurlProp = default; + System.Boolean isattachmentProp = default; while (true) { reader.Read(); @@ -859,16 +885,16 @@ public class Wabbajack_DTOs_DownloadStates_TESAllianceConverter : JsonConverter< switch (prop) { case "FileID": - fileidProp = JsonSerializer.Deserialize(ref reader, options); + fileidProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileName": - filenameProp = JsonSerializer.Deserialize(ref reader, options); + filenameProp = JsonSerializer.Deserialize(ref reader, options); break; case "FullURL": - fullurlProp = JsonSerializer.Deserialize(ref reader, options); + fullurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": - isattachmentProp = JsonSerializer.Deserialize(ref reader, options); + isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -876,47 +902,50 @@ public class Wabbajack_DTOs_DownloadStates_TESAllianceConverter : JsonConverter< } } - return new TESAlliance + return new Wabbajack.DTOs.DownloadStates.TESAlliance { FileID = fileidProp, FileName = filenameProp, FullURL = fullurlProp, - IsAttachment = isattachmentProp + IsAttachment = isattachmentProp, }; } - public override void Write(Utf8JsonWriter writer, TESAlliance value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.TESAlliance value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "TESAllianceDownloader, Wabbajack.Lib"); writer.WritePropertyName("FileID"); - JsonSerializer.Serialize(writer, value.FileID, options); + JsonSerializer.Serialize(writer, value.FileID, options); writer.WritePropertyName("FileName"); - JsonSerializer.Serialize(writer, value.FileName, options); + JsonSerializer.Serialize(writer, value.FileName, options); writer.WritePropertyName("FullURL"); - JsonSerializer.Serialize(writer, value.FullURL, options); + JsonSerializer.Serialize(writer, value.FullURL, options); writer.WritePropertyName("IsAttachment"); - JsonSerializer.Serialize(writer, value.IsAttachment, options); + JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter { - public override VectorPlexus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.VectorPlexus Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - string authorProp = default; - string descriptionProp = default; - Uri imageurlProp = default; - string ips4fileProp = default; - long ips4modProp = default; - string ips4urlProp = default; - bool isattachmentProp = default; - bool isnsfwProp = default; - string nameProp = default; - string versionProp = default; + System.String authorProp = default; + System.String descriptionProp = default; + System.Uri imageurlProp = default; + System.String ips4fileProp = default; + System.Int64 ips4modProp = default; + System.String ips4urlProp = default; + System.Boolean isattachmentProp = default; + System.Boolean isnsfwProp = default; + System.String nameProp = default; + System.String versionProp = default; while (true) { reader.Read(); @@ -931,34 +960,34 @@ public class Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter switch (prop) { case "Author": - authorProp = JsonSerializer.Deserialize(ref reader, options); + authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": - descriptionProp = JsonSerializer.Deserialize(ref reader, options); + descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": - imageurlProp = JsonSerializer.Deserialize(ref reader, options); + imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4File": - ips4fileProp = JsonSerializer.Deserialize(ref reader, options); + ips4fileProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Mod": - ips4modProp = JsonSerializer.Deserialize(ref reader, options); + ips4modProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Url": - ips4urlProp = JsonSerializer.Deserialize(ref reader, options); + ips4urlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": - isattachmentProp = JsonSerializer.Deserialize(ref reader, options); + isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": - isnsfwProp = JsonSerializer.Deserialize(ref reader, options); + isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": - nameProp = JsonSerializer.Deserialize(ref reader, options); + nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": - versionProp = JsonSerializer.Deserialize(ref reader, options); + versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -966,7 +995,7 @@ public class Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter } } - return new VectorPlexus + return new Wabbajack.DTOs.DownloadStates.VectorPlexus { Author = authorProp, Description = descriptionProp, @@ -977,45 +1006,48 @@ public class Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter IsAttachment = isattachmentProp, IsNSFW = isnsfwProp, Name = nameProp, - Version = versionProp + Version = versionProp, }; } - public override void Write(Utf8JsonWriter writer, VectorPlexus value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.VectorPlexus value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "VectorPlexusOAuthDownloader+State, Wabbajack.Lib"); writer.WritePropertyName("Author"); - JsonSerializer.Serialize(writer, value.Author, options); + JsonSerializer.Serialize(writer, value.Author, options); writer.WritePropertyName("Description"); - JsonSerializer.Serialize(writer, value.Description, options); + JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("ImageURL"); - JsonSerializer.Serialize(writer, value.ImageURL, options); + JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IPS4File"); - JsonSerializer.Serialize(writer, value.IPS4File, options); + JsonSerializer.Serialize(writer, value.IPS4File, options); writer.WritePropertyName("IPS4Mod"); - JsonSerializer.Serialize(writer, value.IPS4Mod, options); + JsonSerializer.Serialize(writer, value.IPS4Mod, options); writer.WritePropertyName("IPS4Url"); - JsonSerializer.Serialize(writer, value.IPS4Url, options); + JsonSerializer.Serialize(writer, value.IPS4Url, options); writer.WritePropertyName("IsAttachment"); - JsonSerializer.Serialize(writer, value.IsAttachment, options); + JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WritePropertyName("IsNSFW"); - JsonSerializer.Serialize(writer, value.IsNSFW, options); + JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("Name"); - JsonSerializer.Serialize(writer, value.Name, options); + JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); - JsonSerializer.Serialize(writer, value.Version, options); + JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DownloadStates_WabbajackCDNConverter : JsonConverter +public class + Wabbajack_DTOs_DownloadStates_WabbajackCDNConverter : JsonConverter { - public override WabbajackCDN Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.DownloadStates.WabbajackCDN Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Uri urlProp = default; + System.Uri urlProp = default; while (true) { reader.Read(); @@ -1030,7 +1062,7 @@ public class Wabbajack_DTOs_DownloadStates_WabbajackCDNConverter : JsonConverter switch (prop) { case "Url": - urlProp = JsonSerializer.Deserialize(ref reader, options); + urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1038,23 +1070,25 @@ public class Wabbajack_DTOs_DownloadStates_WabbajackCDNConverter : JsonConverter } } - return new WabbajackCDN + return new Wabbajack.DTOs.DownloadStates.WabbajackCDN { - Url = urlProp + Url = urlProp, }; } - public override void Write(Utf8JsonWriter writer, WabbajackCDN value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.WabbajackCDN value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "WabbajackCDNDownloader+State, Wabbajack.Lib"); writer.WritePropertyName("Url"); - JsonSerializer.Serialize(writer, value.Url, options); + JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter : JsonConverter +public class + Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { @@ -1064,7 +1098,8 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter : JsonConverter< services.AddSingleton(); } - public override IArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.ArchiveStates.IArchive Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) @@ -1077,49 +1112,52 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter : JsonConverter< switch (type) { case "BA2State, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BA2State": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BSAState, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BSAState": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TES3State": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TES3State, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } - public override void Write(Utf8JsonWriter writer, IArchive value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.ArchiveStates.IArchive value, + JsonSerializerOptions options) { switch (value) { - case BA2State v0: + case Wabbajack.DTOs.BSA.ArchiveStates.BA2State v0: JsonSerializer.Serialize(writer, v0, options); return; - case BSAState v1: + case Wabbajack.DTOs.BSA.ArchiveStates.BSAState v1: JsonSerializer.Serialize(writer, v1, options); return; - case TES3State v2: + case Wabbajack.DTOs.BSA.ArchiveStates.TES3State v2: JsonSerializer.Serialize(writer, v2, options); return; } } } -public class Wabbajack_DTOs_BSA_ArchiveStates_BA2StateConverter : JsonConverter +public class + Wabbajack_DTOs_BSA_ArchiveStates_BA2StateConverter : JsonConverter { - public override BA2State Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.ArchiveStates.BA2State Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - bool hasnametableProp = default; - string headermagicProp = default; - BA2EntryType typeProp = default; - uint versionProp = default; + System.Boolean hasnametableProp = default; + System.String headermagicProp = default; + Wabbajack.DTOs.BSA.ArchiveStates.BA2EntryType typeProp = default; + System.UInt32 versionProp = default; while (true) { reader.Read(); @@ -1134,16 +1172,17 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_BA2StateConverter : JsonConverter< switch (prop) { case "HasNameTable": - hasnametableProp = JsonSerializer.Deserialize(ref reader, options); + hasnametableProp = JsonSerializer.Deserialize(ref reader, options); break; case "HeaderMagic": - headermagicProp = JsonSerializer.Deserialize(ref reader, options); + headermagicProp = JsonSerializer.Deserialize(ref reader, options); break; case "Type": - typeProp = JsonSerializer.Deserialize(ref reader, options); + typeProp = JsonSerializer.Deserialize(ref reader, + options); break; case "Version": - versionProp = JsonSerializer.Deserialize(ref reader, options); + versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1151,41 +1190,44 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_BA2StateConverter : JsonConverter< } } - return new BA2State + return new Wabbajack.DTOs.BSA.ArchiveStates.BA2State { HasNameTable = hasnametableProp, HeaderMagic = headermagicProp, Type = typeProp, - Version = versionProp + Version = versionProp, }; } - public override void Write(Utf8JsonWriter writer, BA2State value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.ArchiveStates.BA2State value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "BA2State, Compression.BSA"); writer.WritePropertyName("HasNameTable"); - JsonSerializer.Serialize(writer, value.HasNameTable, options); + JsonSerializer.Serialize(writer, value.HasNameTable, options); writer.WritePropertyName("HeaderMagic"); - JsonSerializer.Serialize(writer, value.HeaderMagic, options); + JsonSerializer.Serialize(writer, value.HeaderMagic, options); writer.WritePropertyName("Type"); - JsonSerializer.Serialize(writer, value.Type, options); + JsonSerializer.Serialize(writer, value.Type, options); writer.WritePropertyName("Version"); - JsonSerializer.Serialize(writer, value.Version, options); + JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_ArchiveStates_BSAStateConverter : JsonConverter +public class + Wabbajack_DTOs_BSA_ArchiveStates_BSAStateConverter : JsonConverter { - public override BSAState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.ArchiveStates.BSAState Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - uint archiveflagsProp = default; - uint fileflagsProp = default; - string magicProp = default; - uint versionProp = default; + System.UInt32 archiveflagsProp = default; + System.UInt32 fileflagsProp = default; + System.String magicProp = default; + System.UInt32 versionProp = default; while (true) { reader.Read(); @@ -1200,16 +1242,16 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_BSAStateConverter : JsonConverter< switch (prop) { case "ArchiveFlags": - archiveflagsProp = JsonSerializer.Deserialize(ref reader, options); + archiveflagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileFlags": - fileflagsProp = JsonSerializer.Deserialize(ref reader, options); + fileflagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Magic": - magicProp = JsonSerializer.Deserialize(ref reader, options); + magicProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": - versionProp = JsonSerializer.Deserialize(ref reader, options); + versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1217,41 +1259,44 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_BSAStateConverter : JsonConverter< } } - return new BSAState + return new Wabbajack.DTOs.BSA.ArchiveStates.BSAState { ArchiveFlags = archiveflagsProp, FileFlags = fileflagsProp, Magic = magicProp, - Version = versionProp + Version = versionProp, }; } - public override void Write(Utf8JsonWriter writer, BSAState value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.ArchiveStates.BSAState value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "BSAState, Compression.BSA"); writer.WritePropertyName("ArchiveFlags"); - JsonSerializer.Serialize(writer, value.ArchiveFlags, options); + JsonSerializer.Serialize(writer, value.ArchiveFlags, options); writer.WritePropertyName("FileFlags"); - JsonSerializer.Serialize(writer, value.FileFlags, options); + JsonSerializer.Serialize(writer, value.FileFlags, options); writer.WritePropertyName("Magic"); - JsonSerializer.Serialize(writer, value.Magic, options); + JsonSerializer.Serialize(writer, value.Magic, options); writer.WritePropertyName("Version"); - JsonSerializer.Serialize(writer, value.Version, options); + JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_ArchiveStates_TES3StateConverter : JsonConverter +public class + Wabbajack_DTOs_BSA_ArchiveStates_TES3StateConverter : JsonConverter { - public override TES3State Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.ArchiveStates.TES3State Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - long dataoffsetProp = default; - uint filecountProp = default; - uint hashoffsetProp = default; - uint versionnumberProp = default; + System.Int64 dataoffsetProp = default; + System.UInt32 filecountProp = default; + System.UInt32 hashoffsetProp = default; + System.UInt32 versionnumberProp = default; while (true) { reader.Read(); @@ -1266,16 +1311,16 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_TES3StateConverter : JsonConverter switch (prop) { case "DataOffset": - dataoffsetProp = JsonSerializer.Deserialize(ref reader, options); + dataoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileCount": - filecountProp = JsonSerializer.Deserialize(ref reader, options); + filecountProp = JsonSerializer.Deserialize(ref reader, options); break; case "HashOffset": - hashoffsetProp = JsonSerializer.Deserialize(ref reader, options); + hashoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "VersionNumber": - versionnumberProp = JsonSerializer.Deserialize(ref reader, options); + versionnumberProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1283,32 +1328,33 @@ public class Wabbajack_DTOs_BSA_ArchiveStates_TES3StateConverter : JsonConverter } } - return new TES3State + return new Wabbajack.DTOs.BSA.ArchiveStates.TES3State { DataOffset = dataoffsetProp, FileCount = filecountProp, HashOffset = hashoffsetProp, - VersionNumber = versionnumberProp + VersionNumber = versionnumberProp, }; } - public override void Write(Utf8JsonWriter writer, TES3State value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.ArchiveStates.TES3State value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "TES3State"); writer.WritePropertyName("DataOffset"); - JsonSerializer.Serialize(writer, value.DataOffset, options); + JsonSerializer.Serialize(writer, value.DataOffset, options); writer.WritePropertyName("FileCount"); - JsonSerializer.Serialize(writer, value.FileCount, options); + JsonSerializer.Serialize(writer, value.FileCount, options); writer.WritePropertyName("HashOffset"); - JsonSerializer.Serialize(writer, value.HashOffset, options); + JsonSerializer.Serialize(writer, value.HashOffset, options); writer.WritePropertyName("VersionNumber"); - JsonSerializer.Serialize(writer, value.VersionNumber, options); + JsonSerializer.Serialize(writer, value.VersionNumber, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_DirectiveConverter : JsonConverter +public class Wabbajack_DTOs_DirectiveConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { @@ -1326,7 +1372,8 @@ public class Wabbajack_DTOs_DirectiveConverter : JsonConverter services.AddSingleton(); } - public override Directive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directive Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) @@ -1339,101 +1386,102 @@ public class Wabbajack_DTOs_DirectiveConverter : JsonConverter switch (type) { case "ArchiveMeta": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "ArchiveMeta, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "CreateBSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "CreateBSA, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "FromArchive": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "FromArchive, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "IgnoredDirectly": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "InlineFile": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "InlineFile, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MergedPatch, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "MergedPatch": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "NoMatch": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "PatchedFromArchive": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "PatchedFromArchive, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "PropertyFile": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "PropertyFile, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "RemappedInlineFile": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "RemappedInlineFile, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TransformedTexture": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TransformedTexture, Wabbajack.Lib": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } - public override void Write(Utf8JsonWriter writer, Directive value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directive value, JsonSerializerOptions options) { switch (value) { - case NoMatch v0: + case Wabbajack.DTOs.Directives.NoMatch v0: JsonSerializer.Serialize(writer, v0, options); return; - case PatchedFromArchive v1: + case Wabbajack.DTOs.Directives.PatchedFromArchive v1: JsonSerializer.Serialize(writer, v1, options); return; - case PropertyFile v2: + case Wabbajack.DTOs.Directives.PropertyFile v2: JsonSerializer.Serialize(writer, v2, options); return; - case RemappedInlineFile v3: + case Wabbajack.DTOs.Directives.RemappedInlineFile v3: JsonSerializer.Serialize(writer, v3, options); return; - case TransformedTexture v4: + case Wabbajack.DTOs.Directives.TransformedTexture v4: JsonSerializer.Serialize(writer, v4, options); return; - case ArchiveMeta v5: + case Wabbajack.DTOs.Directives.ArchiveMeta v5: JsonSerializer.Serialize(writer, v5, options); return; - case CreateBSA v6: + case Wabbajack.DTOs.Directives.CreateBSA v6: JsonSerializer.Serialize(writer, v6, options); return; - case FromArchive v7: + case Wabbajack.DTOs.Directives.FromArchive v7: JsonSerializer.Serialize(writer, v7, options); return; - case IgnoredDirectly v8: + case Wabbajack.DTOs.Directives.IgnoredDirectly v8: JsonSerializer.Serialize(writer, v8, options); return; - case InlineFile v9: + case Wabbajack.DTOs.Directives.InlineFile v9: JsonSerializer.Serialize(writer, v9, options); return; - case MergedPatch v10: + case Wabbajack.DTOs.Directives.MergedPatch v10: JsonSerializer.Serialize(writer, v10, options); return; } } } -public class Wabbajack_DTOs_Directives_ArchiveMetaConverter : JsonConverter +public class Wabbajack_DTOs_Directives_ArchiveMetaConverter : JsonConverter { - public override ArchiveMeta Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.ArchiveMeta Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath sourcedataidProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath sourcedataidProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1448,16 +1496,16 @@ public class Wabbajack_DTOs_Directives_ArchiveMetaConverter : JsonConverter(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": - sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); + sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1465,43 +1513,45 @@ public class Wabbajack_DTOs_Directives_ArchiveMetaConverter : JsonConverter(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); - JsonSerializer.Serialize(writer, value.SourceDataID, options); + JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_CreateBSAConverter : JsonConverter +public class Wabbajack_DTOs_Directives_CreateBSAConverter : JsonConverter { - public override CreateBSA Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.CreateBSA Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - AFile[] filestatesProp = default; - Hash hashProp = default; - long sizeProp = default; - IArchive stateProp = default; - RelativePath tempidProp = default; - RelativePath toProp = default; + Wabbajack.DTOs.BSA.FileStates.AFile[] filestatesProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.DTOs.BSA.ArchiveStates.IArchive stateProp = default; + Wabbajack.Paths.RelativePath tempidProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1516,22 +1566,24 @@ public class Wabbajack_DTOs_Directives_CreateBSAConverter : JsonConverter(ref reader, options); + filestatesProp = + JsonSerializer.Deserialize(ref reader, options); break; case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "State": - stateProp = JsonSerializer.Deserialize(ref reader, options); + stateProp = JsonSerializer.Deserialize(ref reader, + options); break; case "TempID": - tempidProp = JsonSerializer.Deserialize(ref reader, options); + tempidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1539,47 +1591,49 @@ public class Wabbajack_DTOs_Directives_CreateBSAConverter : JsonConverter(writer, value.FileStates, options); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("State"); - JsonSerializer.Serialize(writer, value.State, options); + JsonSerializer.Serialize(writer, value.State, options); writer.WritePropertyName("TempID"); - JsonSerializer.Serialize(writer, value.TempID, options); + JsonSerializer.Serialize(writer, value.TempID, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_FromArchiveConverter : JsonConverter +public class Wabbajack_DTOs_Directives_FromArchiveConverter : JsonConverter { - public override FromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.FromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - HashRelativePath archivehashpathProp = default; - Hash hashProp = default; - long sizeProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.HashRelativePath archivehashpathProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1594,16 +1648,17 @@ public class Wabbajack_DTOs_Directives_FromArchiveConverter : JsonConverter(ref reader, options); + archivehashpathProp = + JsonSerializer.Deserialize(ref reader, options); break; case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1611,40 +1666,43 @@ public class Wabbajack_DTOs_Directives_FromArchiveConverter : JsonConverter(writer, value.ArchiveHashPath, options); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_IgnoredDirectlyConverter : JsonConverter +public class + Wabbajack_DTOs_Directives_IgnoredDirectlyConverter : JsonConverter { - public override IgnoredDirectly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.IgnoredDirectly Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1659,13 +1717,13 @@ public class Wabbajack_DTOs_Directives_IgnoredDirectlyConverter : JsonConverter< switch (prop) { case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1673,38 +1731,40 @@ public class Wabbajack_DTOs_Directives_IgnoredDirectlyConverter : JsonConverter< } } - return new IgnoredDirectly + return new Wabbajack.DTOs.Directives.IgnoredDirectly { Hash = hashProp, Size = sizeProp, - To = toProp + To = toProp, }; } - public override void Write(Utf8JsonWriter writer, IgnoredDirectly value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.IgnoredDirectly value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "IgnoredDirectly"); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_InlineFileConverter : JsonConverter +public class Wabbajack_DTOs_Directives_InlineFileConverter : JsonConverter { - public override InlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.InlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath sourcedataidProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath sourcedataidProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1719,16 +1779,16 @@ public class Wabbajack_DTOs_Directives_InlineFileConverter : JsonConverter(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": - sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); + sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1736,42 +1796,44 @@ public class Wabbajack_DTOs_Directives_InlineFileConverter : JsonConverter(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); - JsonSerializer.Serialize(writer, value.SourceDataID, options); + JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_MergedPatchConverter : JsonConverter +public class Wabbajack_DTOs_Directives_MergedPatchConverter : JsonConverter { - public override MergedPatch Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.MergedPatch Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - RelativePath patchidProp = default; - long sizeProp = default; - SourcePatch[] sourcesProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + Wabbajack.Paths.RelativePath patchidProp = default; + System.Int64 sizeProp = default; + Wabbajack.DTOs.Directives.SourcePatch[] sourcesProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1786,19 +1848,20 @@ public class Wabbajack_DTOs_Directives_MergedPatchConverter : JsonConverter(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "PatchID": - patchidProp = JsonSerializer.Deserialize(ref reader, options); + patchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "Sources": - sourcesProp = JsonSerializer.Deserialize(ref reader, options); + sourcesProp = + JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1806,43 +1869,45 @@ public class Wabbajack_DTOs_Directives_MergedPatchConverter : JsonConverter(writer, value.Hash, options); writer.WritePropertyName("PatchID"); - JsonSerializer.Serialize(writer, value.PatchID, options); + JsonSerializer.Serialize(writer, value.PatchID, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("Sources"); - JsonSerializer.Serialize(writer, value.Sources, options); + JsonSerializer.Serialize(writer, value.Sources, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_NoMatchConverter : JsonConverter +public class Wabbajack_DTOs_Directives_NoMatchConverter : JsonConverter { - public override NoMatch Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.NoMatch Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1857,13 +1922,13 @@ public class Wabbajack_DTOs_Directives_NoMatchConverter : JsonConverter switch (prop) { case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1871,41 +1936,43 @@ public class Wabbajack_DTOs_Directives_NoMatchConverter : JsonConverter } } - return new NoMatch + return new Wabbajack.DTOs.Directives.NoMatch { Hash = hashProp, Size = sizeProp, - To = toProp + To = toProp, }; } - public override void Write(Utf8JsonWriter writer, NoMatch value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.NoMatch value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "NoMatch"); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_PatchedFromArchiveConverter : JsonConverter +public class + Wabbajack_DTOs_Directives_PatchedFromArchiveConverter : JsonConverter { - public override PatchedFromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, + public override Wabbajack.DTOs.Directives.PatchedFromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - HashRelativePath archivehashpathProp = default; - Hash fromhashProp = default; - Hash hashProp = default; - RelativePath patchidProp = default; - long sizeProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.HashRelativePath archivehashpathProp = default; + Wabbajack.Hashing.xxHash64.Hash fromhashProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + Wabbajack.Paths.RelativePath patchidProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1920,22 +1987,23 @@ public class Wabbajack_DTOs_Directives_PatchedFromArchiveConverter : JsonConvert switch (prop) { case "ArchiveHashPath": - archivehashpathProp = JsonSerializer.Deserialize(ref reader, options); + archivehashpathProp = + JsonSerializer.Deserialize(ref reader, options); break; case "FromHash": - fromhashProp = JsonSerializer.Deserialize(ref reader, options); + fromhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "PatchID": - patchidProp = JsonSerializer.Deserialize(ref reader, options); + patchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -1943,47 +2011,49 @@ public class Wabbajack_DTOs_Directives_PatchedFromArchiveConverter : JsonConvert } } - return new PatchedFromArchive + return new Wabbajack.DTOs.Directives.PatchedFromArchive { ArchiveHashPath = archivehashpathProp, FromHash = fromhashProp, Hash = hashProp, PatchID = patchidProp, Size = sizeProp, - To = toProp + To = toProp, }; } - public override void Write(Utf8JsonWriter writer, PatchedFromArchive value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.PatchedFromArchive value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "PatchedFromArchive"); writer.WritePropertyName("ArchiveHashPath"); - JsonSerializer.Serialize(writer, value.ArchiveHashPath, options); + JsonSerializer.Serialize(writer, value.ArchiveHashPath, options); writer.WritePropertyName("FromHash"); - JsonSerializer.Serialize(writer, value.FromHash, options); + JsonSerializer.Serialize(writer, value.FromHash, options); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("PatchID"); - JsonSerializer.Serialize(writer, value.PatchID, options); + JsonSerializer.Serialize(writer, value.PatchID, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_PropertyFileConverter : JsonConverter +public class Wabbajack_DTOs_Directives_PropertyFileConverter : JsonConverter { - public override PropertyFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.Directives.PropertyFile Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath sourcedataidProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath sourcedataidProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -1998,16 +2068,16 @@ public class Wabbajack_DTOs_Directives_PropertyFileConverter : JsonConverter(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": - sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); + sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2015,42 +2085,44 @@ public class Wabbajack_DTOs_Directives_PropertyFileConverter : JsonConverter(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); - JsonSerializer.Serialize(writer, value.SourceDataID, options); + JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_RemappedInlineFileConverter : JsonConverter +public class + Wabbajack_DTOs_Directives_RemappedInlineFileConverter : JsonConverter { - public override RemappedInlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, + public override Wabbajack.DTOs.Directives.RemappedInlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - Hash hashProp = default; - long sizeProp = default; - RelativePath sourcedataidProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath sourcedataidProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -2065,16 +2137,16 @@ public class Wabbajack_DTOs_Directives_RemappedInlineFileConverter : JsonConvert switch (prop) { case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": - sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); + sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2082,43 +2154,45 @@ public class Wabbajack_DTOs_Directives_RemappedInlineFileConverter : JsonConvert } } - return new RemappedInlineFile + return new Wabbajack.DTOs.Directives.RemappedInlineFile { Hash = hashProp, Size = sizeProp, SourceDataID = sourcedataidProp, - To = toProp + To = toProp, }; } - public override void Write(Utf8JsonWriter writer, RemappedInlineFile value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.RemappedInlineFile value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "RemappedInlineFile"); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); - JsonSerializer.Serialize(writer, value.SourceDataID, options); + JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_Directives_TransformedTextureConverter : JsonConverter +public class + Wabbajack_DTOs_Directives_TransformedTextureConverter : JsonConverter { - public override TransformedTexture Read(ref Utf8JsonReader reader, Type typeToConvert, + public override Wabbajack.DTOs.Directives.TransformedTexture Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - HashRelativePath archivehashpathProp = default; - Hash hashProp = default; - ImageState imagestateProp = default; - long sizeProp = default; - RelativePath toProp = default; + Wabbajack.Hashing.xxHash64.HashRelativePath archivehashpathProp = default; + Wabbajack.Hashing.xxHash64.Hash hashProp = default; + Wabbajack.DTOs.Texture.ImageState imagestateProp = default; + System.Int64 sizeProp = default; + Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); @@ -2133,19 +2207,20 @@ public class Wabbajack_DTOs_Directives_TransformedTextureConverter : JsonConvert switch (prop) { case "ArchiveHashPath": - archivehashpathProp = JsonSerializer.Deserialize(ref reader, options); + archivehashpathProp = + JsonSerializer.Deserialize(ref reader, options); break; case "Hash": - hashProp = JsonSerializer.Deserialize(ref reader, options); + hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageState": - imagestateProp = JsonSerializer.Deserialize(ref reader, options); + imagestateProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": - toProp = JsonSerializer.Deserialize(ref reader, options); + toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2153,35 +2228,36 @@ public class Wabbajack_DTOs_Directives_TransformedTextureConverter : JsonConvert } } - return new TransformedTexture + return new Wabbajack.DTOs.Directives.TransformedTexture { ArchiveHashPath = archivehashpathProp, Hash = hashProp, ImageState = imagestateProp, Size = sizeProp, - To = toProp + To = toProp, }; } - public override void Write(Utf8JsonWriter writer, TransformedTexture value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.TransformedTexture value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "TransformedTexture"); writer.WritePropertyName("ArchiveHashPath"); - JsonSerializer.Serialize(writer, value.ArchiveHashPath, options); + JsonSerializer.Serialize(writer, value.ArchiveHashPath, options); writer.WritePropertyName("Hash"); - JsonSerializer.Serialize(writer, value.Hash, options); + JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("ImageState"); - JsonSerializer.Serialize(writer, value.ImageState, options); + JsonSerializer.Serialize(writer, value.ImageState, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); - JsonSerializer.Serialize(writer, value.To, options); + JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_FileStates_AFileConverter : JsonConverter +public class Wabbajack_DTOs_BSA_FileStates_AFileConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { @@ -2192,7 +2268,8 @@ public class Wabbajack_DTOs_BSA_FileStates_AFileConverter : JsonConverter services.AddSingleton(); } - public override AFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.FileStates.AFile Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) @@ -2205,63 +2282,67 @@ public class Wabbajack_DTOs_BSA_FileStates_AFileConverter : JsonConverter switch (type) { case "BA2DX10Entry": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BA2DX10Entry, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BA2File": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BA2FileEntryState, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BSAFileState, Compression.BSA": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "BSAFile": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; case "TES3File": - return JsonSerializer.Deserialize(ref reader, options)!; + return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } - public override void Write(Utf8JsonWriter writer, AFile value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.AFile value, + JsonSerializerOptions options) { switch (value) { - case BA2DX10File v0: + case Wabbajack.DTOs.BSA.FileStates.BA2DX10File v0: JsonSerializer.Serialize(writer, v0, options); return; - case BA2File v1: + case Wabbajack.DTOs.BSA.FileStates.BA2File v1: JsonSerializer.Serialize(writer, v1, options); return; - case BSAFile v2: + case Wabbajack.DTOs.BSA.FileStates.BSAFile v2: JsonSerializer.Serialize(writer, v2, options); return; - case TES3File v3: + case Wabbajack.DTOs.BSA.FileStates.TES3File v3: JsonSerializer.Serialize(writer, v3, options); return; } } } -public class Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter +public class + Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter { - public override BA2DX10File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.FileStates.BA2DX10File Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - ushort chunkhdrlenProp = default; - BA2Chunk[] chunksProp = default; - uint dirhashProp = default; - string extensionProp = default; - ushort heightProp = default; - int indexProp = default; - uint namehashProp = default; - byte nummipsProp = default; - RelativePath pathProp = default; - byte pixelformatProp = default; - ushort unk16Prop = default; - byte unk8Prop = default; - ushort widthProp = default; + System.UInt16 chunkhdrlenProp = default; + Wabbajack.DTOs.BSA.FileStates.BA2Chunk[] chunksProp = default; + System.UInt32 dirhashProp = default; + System.String extensionProp = default; + System.UInt16 heightProp = default; + System.Int32 indexProp = default; + System.Byte iscubemapProp = default; + System.UInt32 namehashProp = default; + System.Byte nummipsProp = default; + Wabbajack.Paths.RelativePath pathProp = default; + System.Byte pixelformatProp = default; + System.Byte tilemodeProp = default; + System.Byte unk8Prop = default; + System.UInt16 widthProp = default; while (true) { reader.Read(); @@ -2276,43 +2357,47 @@ public class Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter< switch (prop) { case "ChunkHdrLen": - chunkhdrlenProp = JsonSerializer.Deserialize(ref reader, options); + chunkhdrlenProp = JsonSerializer.Deserialize(ref reader, options); break; case "Chunks": - chunksProp = JsonSerializer.Deserialize(ref reader, options); + chunksProp = + JsonSerializer.Deserialize(ref reader, options); break; case "DirHash": - dirhashProp = JsonSerializer.Deserialize(ref reader, options); + dirhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Extension": - extensionProp = JsonSerializer.Deserialize(ref reader, options); + extensionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Height": - heightProp = JsonSerializer.Deserialize(ref reader, options); + heightProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": - indexProp = JsonSerializer.Deserialize(ref reader, options); + indexProp = JsonSerializer.Deserialize(ref reader, options); + break; + case "IsCubeMap": + iscubemapProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameHash": - namehashProp = JsonSerializer.Deserialize(ref reader, options); + namehashProp = JsonSerializer.Deserialize(ref reader, options); break; case "NumMips": - nummipsProp = JsonSerializer.Deserialize(ref reader, options); + nummipsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": - pathProp = JsonSerializer.Deserialize(ref reader, options); + pathProp = JsonSerializer.Deserialize(ref reader, options); break; case "PixelFormat": - pixelformatProp = JsonSerializer.Deserialize(ref reader, options); + pixelformatProp = JsonSerializer.Deserialize(ref reader, options); break; - case "Unk16": - unk16Prop = JsonSerializer.Deserialize(ref reader, options); + case "TileMode": + tilemodeProp = JsonSerializer.Deserialize(ref reader, options); break; case "Unk8": - unk8Prop = JsonSerializer.Deserialize(ref reader, options); + unk8Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Width": - widthProp = JsonSerializer.Deserialize(ref reader, options); + widthProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2320,7 +2405,7 @@ public class Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter< } } - return new BA2DX10File + return new Wabbajack.DTOs.BSA.FileStates.BA2DX10File { ChunkHdrLen = chunkhdrlenProp, Chunks = chunksProp, @@ -2328,64 +2413,69 @@ public class Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter< Extension = extensionProp, Height = heightProp, Index = indexProp, + IsCubeMap = iscubemapProp, NameHash = namehashProp, NumMips = nummipsProp, Path = pathProp, PixelFormat = pixelformatProp, - Unk16 = unk16Prop, + TileMode = tilemodeProp, Unk8 = unk8Prop, - Width = widthProp + Width = widthProp, }; } - public override void Write(Utf8JsonWriter writer, BA2DX10File value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.BA2DX10File value, + JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "BA2DX10Entry"); writer.WritePropertyName("ChunkHdrLen"); - JsonSerializer.Serialize(writer, value.ChunkHdrLen, options); + JsonSerializer.Serialize(writer, value.ChunkHdrLen, options); writer.WritePropertyName("Chunks"); - JsonSerializer.Serialize(writer, value.Chunks, options); + JsonSerializer.Serialize(writer, value.Chunks, options); writer.WritePropertyName("DirHash"); - JsonSerializer.Serialize(writer, value.DirHash, options); + JsonSerializer.Serialize(writer, value.DirHash, options); writer.WritePropertyName("Extension"); - JsonSerializer.Serialize(writer, value.Extension, options); + JsonSerializer.Serialize(writer, value.Extension, options); writer.WritePropertyName("Height"); - JsonSerializer.Serialize(writer, value.Height, options); + JsonSerializer.Serialize(writer, value.Height, options); writer.WritePropertyName("Index"); - JsonSerializer.Serialize(writer, value.Index, options); + JsonSerializer.Serialize(writer, value.Index, options); + writer.WritePropertyName("IsCubeMap"); + JsonSerializer.Serialize(writer, value.IsCubeMap, options); writer.WritePropertyName("NameHash"); - JsonSerializer.Serialize(writer, value.NameHash, options); + JsonSerializer.Serialize(writer, value.NameHash, options); writer.WritePropertyName("NumMips"); - JsonSerializer.Serialize(writer, value.NumMips, options); + JsonSerializer.Serialize(writer, value.NumMips, options); writer.WritePropertyName("Path"); - JsonSerializer.Serialize(writer, value.Path, options); + JsonSerializer.Serialize(writer, value.Path, options); writer.WritePropertyName("PixelFormat"); - JsonSerializer.Serialize(writer, value.PixelFormat, options); - writer.WritePropertyName("Unk16"); - JsonSerializer.Serialize(writer, value.Unk16, options); + JsonSerializer.Serialize(writer, value.PixelFormat, options); + writer.WritePropertyName("TileMode"); + JsonSerializer.Serialize(writer, value.TileMode, options); writer.WritePropertyName("Unk8"); - JsonSerializer.Serialize(writer, value.Unk8, options); + JsonSerializer.Serialize(writer, value.Unk8, options); writer.WritePropertyName("Width"); - JsonSerializer.Serialize(writer, value.Width, options); + JsonSerializer.Serialize(writer, value.Width, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_FileStates_BA2FileConverter : JsonConverter +public class Wabbajack_DTOs_BSA_FileStates_BA2FileConverter : JsonConverter { - public override BA2File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.FileStates.BA2File Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - uint alignProp = default; - bool compressedProp = default; - uint dirhashProp = default; - string extensionProp = default; - uint flagsProp = default; - int indexProp = default; - uint namehashProp = default; - RelativePath pathProp = default; + System.UInt32 alignProp = default; + System.Boolean compressedProp = default; + System.UInt32 dirhashProp = default; + System.String extensionProp = default; + System.UInt32 flagsProp = default; + System.Int32 indexProp = default; + System.UInt32 namehashProp = default; + Wabbajack.Paths.RelativePath pathProp = default; while (true) { reader.Read(); @@ -2400,28 +2490,28 @@ public class Wabbajack_DTOs_BSA_FileStates_BA2FileConverter : JsonConverter(ref reader, options); + alignProp = JsonSerializer.Deserialize(ref reader, options); break; case "Compressed": - compressedProp = JsonSerializer.Deserialize(ref reader, options); + compressedProp = JsonSerializer.Deserialize(ref reader, options); break; case "DirHash": - dirhashProp = JsonSerializer.Deserialize(ref reader, options); + dirhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Extension": - extensionProp = JsonSerializer.Deserialize(ref reader, options); + extensionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Flags": - flagsProp = JsonSerializer.Deserialize(ref reader, options); + flagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": - indexProp = JsonSerializer.Deserialize(ref reader, options); + indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameHash": - namehashProp = JsonSerializer.Deserialize(ref reader, options); + namehashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": - pathProp = JsonSerializer.Deserialize(ref reader, options); + pathProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2429,7 +2519,7 @@ public class Wabbajack_DTOs_BSA_FileStates_BA2FileConverter : JsonConverter(writer, value.Align, options); writer.WritePropertyName("Compressed"); - JsonSerializer.Serialize(writer, value.Compressed, options); + JsonSerializer.Serialize(writer, value.Compressed, options); writer.WritePropertyName("DirHash"); - JsonSerializer.Serialize(writer, value.DirHash, options); + JsonSerializer.Serialize(writer, value.DirHash, options); writer.WritePropertyName("Extension"); - JsonSerializer.Serialize(writer, value.Extension, options); + JsonSerializer.Serialize(writer, value.Extension, options); writer.WritePropertyName("Flags"); - JsonSerializer.Serialize(writer, value.Flags, options); + JsonSerializer.Serialize(writer, value.Flags, options); writer.WritePropertyName("Index"); - JsonSerializer.Serialize(writer, value.Index, options); + JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("NameHash"); - JsonSerializer.Serialize(writer, value.NameHash, options); + JsonSerializer.Serialize(writer, value.NameHash, options); writer.WritePropertyName("Path"); - JsonSerializer.Serialize(writer, value.Path, options); + JsonSerializer.Serialize(writer, value.Path, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_FileStates_BSAFileConverter : JsonConverter +public class Wabbajack_DTOs_BSA_FileStates_BSAFileConverter : JsonConverter { - public override BSAFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.FileStates.BSAFile Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - bool flipcompressionProp = default; - int indexProp = default; - RelativePath pathProp = default; + System.Boolean flipcompressionProp = default; + System.Int32 indexProp = default; + Wabbajack.Paths.RelativePath pathProp = default; while (true) { reader.Read(); @@ -2489,13 +2581,13 @@ public class Wabbajack_DTOs_BSA_FileStates_BSAFileConverter : JsonConverter(ref reader, options); + flipcompressionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": - indexProp = JsonSerializer.Deserialize(ref reader, options); + indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": - pathProp = JsonSerializer.Deserialize(ref reader, options); + pathProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2503,41 +2595,43 @@ public class Wabbajack_DTOs_BSA_FileStates_BSAFileConverter : JsonConverter(writer, value.FlipCompression, options); writer.WritePropertyName("Index"); - JsonSerializer.Serialize(writer, value.Index, options); + JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("Path"); - JsonSerializer.Serialize(writer, value.Path, options); + JsonSerializer.Serialize(writer, value.Path, options); writer.WriteEndObject(); } } -public class Wabbajack_DTOs_BSA_FileStates_TES3FileConverter : JsonConverter +public class Wabbajack_DTOs_BSA_FileStates_TES3FileConverter : JsonConverter { - public override TES3File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override Wabbajack.DTOs.BSA.FileStates.TES3File Read(ref Utf8JsonReader reader, Type typeToConvert, + JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); - uint hash1Prop = default; - uint hash2Prop = default; - int indexProp = default; - uint nameoffsetProp = default; - uint offsetProp = default; - RelativePath pathProp = default; - uint sizeProp = default; + System.UInt32 hash1Prop = default; + System.UInt32 hash2Prop = default; + System.Int32 indexProp = default; + System.UInt32 nameoffsetProp = default; + System.UInt32 offsetProp = default; + Wabbajack.Paths.RelativePath pathProp = default; + System.UInt32 sizeProp = default; while (true) { reader.Read(); @@ -2552,25 +2646,25 @@ public class Wabbajack_DTOs_BSA_FileStates_TES3FileConverter : JsonConverter(ref reader, options); + hash1Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Hash2": - hash2Prop = JsonSerializer.Deserialize(ref reader, options); + hash2Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Index": - indexProp = JsonSerializer.Deserialize(ref reader, options); + indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameOffset": - nameoffsetProp = JsonSerializer.Deserialize(ref reader, options); + nameoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "Offset": - offsetProp = JsonSerializer.Deserialize(ref reader, options); + offsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": - pathProp = JsonSerializer.Deserialize(ref reader, options); + pathProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": - sizeProp = JsonSerializer.Deserialize(ref reader, options); + sizeProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); @@ -2578,7 +2672,7 @@ public class Wabbajack_DTOs_BSA_FileStates_TES3FileConverter : JsonConverter(writer, value.Hash1, options); writer.WritePropertyName("Hash2"); - JsonSerializer.Serialize(writer, value.Hash2, options); + JsonSerializer.Serialize(writer, value.Hash2, options); writer.WritePropertyName("Index"); - JsonSerializer.Serialize(writer, value.Index, options); + JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("NameOffset"); - JsonSerializer.Serialize(writer, value.NameOffset, options); + JsonSerializer.Serialize(writer, value.NameOffset, options); writer.WritePropertyName("Offset"); - JsonSerializer.Serialize(writer, value.Offset, options); + JsonSerializer.Serialize(writer, value.Offset, options); writer.WritePropertyName("Path"); - JsonSerializer.Serialize(writer, value.Path, options); + JsonSerializer.Serialize(writer, value.Path, options); writer.WritePropertyName("Size"); - JsonSerializer.Serialize(writer, value.Size, options); + JsonSerializer.Serialize(writer, value.Size, options); writer.WriteEndObject(); } } \ No newline at end of file diff --git a/Wabbajack.DTOs/ModList/BSA/FileStates/BA2DX10File.cs b/Wabbajack.DTOs/ModList/BSA/FileStates/BA2DX10File.cs index 7126e8e5..12cd24dc 100644 --- a/Wabbajack.DTOs/ModList/BSA/FileStates/BA2DX10File.cs +++ b/Wabbajack.DTOs/ModList/BSA/FileStates/BA2DX10File.cs @@ -8,8 +8,6 @@ public class BA2DX10File : AFile { public BA2Chunk[] Chunks { get; set; } - public ushort Unk16 { get; set; } - public byte PixelFormat { get; set; } public byte NumMips { get; set; } @@ -27,4 +25,6 @@ public class BA2DX10File : AFile public string Extension { get; set; } public uint NameHash { get; set; } + public byte IsCubeMap { get; set; } + public byte TileMode { get; set; } } \ No newline at end of file diff --git a/Wabbajack.Downloaders.Dispatcher.Test/VerificationCacheTests.cs b/Wabbajack.Downloaders.Dispatcher.Test/VerificationCacheTests.cs index 9627f268..37cb5bad 100644 --- a/Wabbajack.Downloaders.Dispatcher.Test/VerificationCacheTests.cs +++ b/Wabbajack.Downloaders.Dispatcher.Test/VerificationCacheTests.cs @@ -1,6 +1,8 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Wabbajack.Downloaders.VerificationCache; +using Wabbajack.DTOs.JsonConverters; using Wabbajack.Paths.IO; using Xunit; @@ -10,32 +12,41 @@ namespace Wabbajack.Downloaders.Dispatcher.Test; public class VerificationCacheTests { private readonly ILogger _logger; + private readonly DTOSerializer _dtos; - public VerificationCacheTests(ILogger logger) + public VerificationCacheTests(ILogger logger, DTOSerializer dtos) { _logger = logger; + _dtos = dtos; } [Fact] public async Task BasicCacheTests() { - using var cache = new VerificationCache.VerificationCache(_logger, KnownFolders.EntryPoint.Combine(Guid.NewGuid().ToString()), TimeSpan.FromSeconds(1)); + using var cacheBase = new VerificationCache.VerificationCache(_logger, + KnownFolders.EntryPoint.Combine(Guid.NewGuid().ToString()), + TimeSpan.FromSeconds(1), + _dtos); + + var cache = (IVerificationCache)cacheBase; var goodState = new DTOs.DownloadStates.Http { Url = new Uri($"https://some.com/{Guid.NewGuid()}/path") }; var badState = new DTOs.DownloadStates.Http { Url = new Uri($"https://some.com/{Guid.NewGuid()}/path") }; - Assert.True(await cache.Get(goodState) == null); + Assert.True((await cache.Get(goodState)).IsValid == null); await cache.Put(goodState, true); - Assert.True(await cache.Get(goodState)); + var result = await cache.Get(goodState); + Assert.True(result.IsValid); + Assert.IsType(result.State); await Task.Delay(TimeSpan.FromSeconds(2)); - Assert.False(await cache.Get(goodState)); + Assert.False((await cache.Get(goodState)).IsValid); await cache.Put(badState, true); - Assert.True(await cache.Get(badState)); + Assert.True((await cache.Get(badState)).IsValid); await cache.Put(badState, false); - Assert.Null(await cache.Get(badState)); + Assert.Null((await cache.Get(badState)).IsValid); } } diff --git a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs index 72958db2..70ade51d 100644 --- a/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs +++ b/Wabbajack.Downloaders.Dispatcher/DownloadDispatcher.cs @@ -112,9 +112,13 @@ public class DownloadDispatcher { try { - if (await _verificationCache.Get(a.State) == true) + var (valid, newState) = await _verificationCache.Get(a.State); + if (valid == true) + { + a.State = newState; return true; - + } + a = await MaybeProxy(a, token); var downloader = Downloader(a); using var job = await _limiter.Begin($"Verifying {a.State.PrimaryKeyString}", -1, token); diff --git a/Wabbajack.Downloaders.VerificationCache/IVerificationCache.cs b/Wabbajack.Downloaders.VerificationCache/IVerificationCache.cs index be151572..e4f6f705 100644 --- a/Wabbajack.Downloaders.VerificationCache/IVerificationCache.cs +++ b/Wabbajack.Downloaders.VerificationCache/IVerificationCache.cs @@ -5,6 +5,6 @@ namespace Wabbajack.Downloaders.VerificationCache; public interface IVerificationCache { - Task Get(IDownloadState archive); + Task<(bool? IsValid, IDownloadState State)> Get(IDownloadState archive); Task Put(IDownloadState archive, bool valid); } \ No newline at end of file diff --git a/Wabbajack.Downloaders.VerificationCache/VerificationCache.cs b/Wabbajack.Downloaders.VerificationCache/VerificationCache.cs index c6d149d0..b0f73e72 100644 --- a/Wabbajack.Downloaders.VerificationCache/VerificationCache.cs +++ b/Wabbajack.Downloaders.VerificationCache/VerificationCache.cs @@ -1,7 +1,9 @@ using System.Data.SQLite; +using System.Text.Json; using Microsoft.Extensions.Logging; using Wabbajack.DTOs; using Wabbajack.DTOs.DownloadStates; +using Wabbajack.DTOs.JsonConverters; using Wabbajack.Hashing.xxHash64; using Wabbajack.Paths; using Wabbajack.Paths.IO; @@ -15,12 +17,14 @@ public class VerificationCache : IVerificationCache, IDisposable private readonly SQLiteConnection _conn; private readonly TimeSpan _expiry; private readonly ILogger _logger; + private readonly DTOSerializer _dtos; - public VerificationCache(ILogger logger, AbsolutePath location, TimeSpan expiry) + public VerificationCache(ILogger logger, AbsolutePath location, TimeSpan expiry, DTOSerializer dtos) { _logger = logger; _location = location; _expiry = expiry; + _dtos = dtos; if (!_location.Parent.DirectoryExists()) _location.Parent.CreateDirectory(); @@ -34,17 +38,18 @@ public class VerificationCache : IVerificationCache, IDisposable using var cmd = new SQLiteCommand(_conn); cmd.CommandText = @"CREATE TABLE IF NOT EXISTS VerficationCache ( PKS TEXT PRIMARY KEY, - LastModified BIGINT) + LastModified BIGINT, + State TEXT) WITHOUT ROWID"; cmd.ExecuteNonQuery(); } - public async Task Get(IDownloadState archive) + public async Task<(bool?, IDownloadState?)> Get(IDownloadState archive) { var key = archive.PrimaryKeyString; await using var cmd = new SQLiteCommand(_conn); - cmd.CommandText = "SELECT LastModified FROM VerficationCache WHERE PKS = @pks"; + cmd.CommandText = "SELECT LastModified, State FROM VerficationCache WHERE PKS = @pks"; cmd.Parameters.AddWithValue("@pks", key); await cmd.PrepareAsync(); @@ -52,10 +57,12 @@ public class VerificationCache : IVerificationCache, IDisposable while (await reader.ReadAsync()) { var ts = DateTime.FromFileTimeUtc(reader.GetInt64(0)); - return DateTime.UtcNow - ts <= _expiry; + var state = JsonSerializer.Deserialize(reader.GetString(1), _dtos.Options); + + return (DateTime.UtcNow - ts <= _expiry, state); } - return null; + return (null, null); } public async Task Put(IDownloadState state, bool valid) @@ -64,10 +71,11 @@ public class VerificationCache : IVerificationCache, IDisposable if (valid) { await using var cmd = new SQLiteCommand(_conn); - cmd.CommandText = @"INSERT INTO VerficationCache (PKS, LastModified) VALUES (@pks, @lastModified) - ON CONFLICT(PKS) DO UPDATE SET LastModified = @lastModified"; + cmd.CommandText = @"INSERT INTO VerficationCache (PKS, LastModified, State) VALUES (@pks, @lastModified, @state) + ON CONFLICT(PKS) DO UPDATE SET LastModified = @lastModified, State = @state"; cmd.Parameters.AddWithValue("@pks", key); cmd.Parameters.AddWithValue("@lastModified", DateTime.UtcNow.ToFileTimeUtc()); + cmd.Parameters.AddWithValue("@state", JsonSerializer.Serialize(state, _dtos.Options)); await cmd.PrepareAsync(); await cmd.ExecuteNonQueryAsync(); diff --git a/Wabbajack.Hashing.PHash.Test/FileLoadingTests.cs b/Wabbajack.Hashing.PHash.Test/FileLoadingTests.cs index 96001e2a..dd8b76ef 100644 --- a/Wabbajack.Hashing.PHash.Test/FileLoadingTests.cs +++ b/Wabbajack.Hashing.PHash.Test/FileLoadingTests.cs @@ -1,4 +1,7 @@ +using System.IO; +using System.Threading; using System.Threading.Tasks; +using FluentAssertions; using Shipwreck.Phash; using Wabbajack.DTOs.Texture; using Wabbajack.Paths; @@ -29,4 +32,27 @@ public class FileLoadingTests new Digest {Coefficients = state.PerceptualHash.Data}), 1.0); } + + [Fact] + public async Task CanConvertCubeMaps() + { + // File used here via re-upload permissions found on the mod's Nexus page: + // https://www.nexusmods.com/fallout4/mods/43458?tab=description + // Used for testing purposes only + var path = "TestData/WindowDisabled_CGPlayerHouseCube.dds".ToRelativePath().RelativeTo(KnownFolders.EntryPoint); + + var baseState = await ImageLoader.Load(path); + baseState.Height.Should().Be(128); + baseState.Width.Should().Be(128); + //baseState.Frames.Should().Be(6); + + using var ms = new MemoryStream(); + await using var ins = path.Open(FileMode.Open, FileAccess.Read, FileShare.Read); + await ImageLoader.Recompress(ins, 128, 128, DXGI_FORMAT.BC1_UNORM, ms, CancellationToken.None, leaveOpen:true); + ms.Length.Should().Be(ins.Length); + + + + } + } \ No newline at end of file diff --git a/Wabbajack.Hashing.PHash.Test/TestData/WindowDisabled_CGPlayerHouseCube.dds b/Wabbajack.Hashing.PHash.Test/TestData/WindowDisabled_CGPlayerHouseCube.dds new file mode 100644 index 00000000..c9636b87 Binary files /dev/null and b/Wabbajack.Hashing.PHash.Test/TestData/WindowDisabled_CGPlayerHouseCube.dds differ diff --git a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj index 3c1093eb..2f5f8283 100644 --- a/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj +++ b/Wabbajack.Hashing.PHash.Test/Wabbajack.Hashing.PHash.Test.csproj @@ -11,6 +11,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + @@ -38,6 +39,9 @@ PreserveNewest + + PreserveNewest + diff --git a/Wabbajack.Hashing.PHash/Image.cs b/Wabbajack.Hashing.PHash/Image.cs index 3b55e5f1..75d22e02 100644 --- a/Wabbajack.Hashing.PHash/Image.cs +++ b/Wabbajack.Hashing.PHash/Image.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; @@ -71,12 +72,24 @@ public class ImageLoader { var decoder = new BcDecoder(); var ddsFile = DdsFile.Load(input); - + if (!leaveOpen) await input.DisposeAsync(); - var data = await decoder.DecodeToImageRgba32Async(ddsFile, token); + var faces = new List>(); + + var origFormat = ddsFile.dx10Header.dxgiFormat == DxgiFormat.DxgiFormatUnknown + ? ddsFile.header.ddsPixelFormat.DxgiFormat + : ddsFile.dx10Header.dxgiFormat; - data.Mutate(x => x.Resize(width, height, KnownResamplers.Welch)); + foreach (var face in ddsFile.Faces) + { + + var data = await decoder.DecodeRawToImageRgba32Async(face.MipMaps[0].Data, + (int)face.Width, (int)face.Height, ToCompressionFormat((DXGI_FORMAT)origFormat), token); + + data.Mutate(x => x.Resize(width, height, KnownResamplers.Welch)); + faces.Add(data); + } var encoder = new BcEncoder { @@ -88,9 +101,20 @@ public class ImageLoader FileFormat = OutputFileFormat.Dds } }; - var file = await encoder.EncodeToDdsAsync(data, token); - file.Write(output); - + + switch (faces.Count) + { + case 1: + (await encoder.EncodeToDdsAsync(faces[0], token)).Write(output); + break; + case 6: + (await encoder.EncodeCubeMapToDdsAsync(faces[0], faces[1], faces[2], faces[3], faces[4], faces[5], token)) + .Write(output); + break; + default: + throw new NotImplementedException($"Can't encode dds with {faces.Count} faces"); + } + if (!leaveOpen) await output.DisposeAsync(); } diff --git a/Wabbajack.Paths.IO/KnownFolders.cs b/Wabbajack.Paths.IO/KnownFolders.cs index c944e1e4..6a3f06fa 100644 --- a/Wabbajack.Paths.IO/KnownFolders.cs +++ b/Wabbajack.Paths.IO/KnownFolders.cs @@ -12,6 +12,7 @@ public static class KnownFolders { get { + return AppDomain.CurrentDomain.BaseDirectory.ToAbsolutePath(); var result = Process.GetCurrentProcess().MainModule?.FileName?.ToAbsolutePath() ?? default; if (result != default && diff --git a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs index 46887373..4d9fd1dc 100644 --- a/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs +++ b/Wabbajack.Services.OSIntegrated/ServiceExtensions.cs @@ -13,6 +13,7 @@ using Wabbajack.Downloaders.GameFile; using Wabbajack.Downloaders.VerificationCache; using Wabbajack.DTOs; using Wabbajack.DTOs.Interventions; +using Wabbajack.DTOs.JsonConverters; using Wabbajack.DTOs.Logins; using Wabbajack.Installer; using Wabbajack.Networking.BethesdaNet; @@ -73,9 +74,19 @@ public static class ServiceExtensions : new BinaryPatchCache(s.GetRequiredService>(),KnownFolders.WabbajackAppLocal.Combine("PatchCache"))); - service.AddSingleton(s => options.UseLocalCache - ? new VerificationCache(s.GetRequiredService>(), s.GetService()!.CreateFile().Path, TimeSpan.FromDays(1)) - : new VerificationCache(s.GetRequiredService>(),KnownFolders.WabbajackAppLocal.Combine("VerificationCache.sqlite"), TimeSpan.FromDays(1))); + service.AddSingleton(s => + { + var dtos = s.GetRequiredService(); + return options.UseLocalCache + ? new VerificationCache(s.GetRequiredService>(), + s.GetService()!.CreateFile().Path, + TimeSpan.FromDays(1), + dtos) + : new VerificationCache(s.GetRequiredService>(), + KnownFolders.WabbajackAppLocal.Combine("VerificationCacheV2.sqlite"), + TimeSpan.FromDays(1), + dtos); + }); service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = Environment.ProcessorCount});