// THIS FILE IS AUTOGENERATED DO NOT EDIT BY HAND using System; using System.Text.Json; using System.Text.Json.Serialization; using Wabbajack.Hashing.xxHash64; using Microsoft.Extensions.DependencyInjection; public class Wabbajack_DTOs_DownloadStates_IDownloadStateConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } public override Wabbajack.DTOs.DownloadStates.IDownloadState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); cReader.Read(); if (cReader.GetString() != "$type") throw new JsonException(); cReader.Read(); var type = cReader.GetString(); switch(type) { case "Bethesda": return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLabDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "GameFileSourceDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "GameFileSource": return JsonSerializer.Deserialize(ref reader, options)!; case "GoogleDriveDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "GoogleDrive": return JsonSerializer.Deserialize(ref reader, options)!; case "HttpDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "Http": return JsonSerializer.Deserialize(ref reader, options)!; case "HttpDownloader": return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLabOAuthDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "LoversLab": return JsonSerializer.Deserialize(ref reader, options)!; case "ManualDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "Manual": return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFireDownloader+State, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFire": return JsonSerializer.Deserialize(ref reader, options)!; case "MediaFireDownloader": return JsonSerializer.Deserialize(ref reader, options)!; case "MegaDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "Mega": return JsonSerializer.Deserialize(ref reader, options)!; case "ModDBDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "ModDB": return JsonSerializer.Deserialize(ref reader, options)!; case "ModDBDownloader": return JsonSerializer.Deserialize(ref reader, options)!; case "NexusDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "Nexus": return JsonSerializer.Deserialize(ref reader, options)!; case "TESAllianceDownloader, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "TESAlliance": return JsonSerializer.Deserialize(ref reader, options)!; case "VectorPlexusOAuthDownloader+State, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "VectorPlexus": return JsonSerializer.Deserialize(ref reader, options)!; case "WabbajackCDNDownloader+State, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "WabbajackCDN": return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.IDownloadState value, JsonSerializerOptions options) { switch (value) { case Wabbajack.DTOs.DownloadStates.LoversLab v0: JsonSerializer.Serialize(writer, v0, options); return; case Wabbajack.DTOs.DownloadStates.VectorPlexus v1: JsonSerializer.Serialize(writer, v1, options); return; case Wabbajack.DTOs.DownloadStates.Bethesda v2: JsonSerializer.Serialize(writer, v2, options); return; case Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab v3: JsonSerializer.Serialize(writer, v3, options); return; case Wabbajack.DTOs.DownloadStates.GameFileSource v4: JsonSerializer.Serialize(writer, v4, options); return; case Wabbajack.DTOs.DownloadStates.GoogleDrive v5: JsonSerializer.Serialize(writer, v5, options); return; case Wabbajack.DTOs.DownloadStates.Http v6: JsonSerializer.Serialize(writer, v6, options); return; case Wabbajack.DTOs.DownloadStates.Manual v7: JsonSerializer.Serialize(writer, v7, options); return; case Wabbajack.DTOs.DownloadStates.MediaFire v8: JsonSerializer.Serialize(writer, v8, options); return; case Wabbajack.DTOs.DownloadStates.Mega v9: JsonSerializer.Serialize(writer, v9, options); return; case Wabbajack.DTOs.DownloadStates.ModDB v10: JsonSerializer.Serialize(writer, v10, options); return; case Wabbajack.DTOs.DownloadStates.Nexus v11: JsonSerializer.Serialize(writer, v11, options); return; case Wabbajack.DTOs.DownloadStates.TESAlliance v12: JsonSerializer.Serialize(writer, v12, options); return; case Wabbajack.DTOs.DownloadStates.WabbajackCDN v13: JsonSerializer.Serialize(writer, v13, options); return; } } } public class Wabbajack_DTOs_DownloadStates_BethesdaConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.Bethesda Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "BranchId": branchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "ContentId": contentidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Game": gameProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsCCMod": isccmodProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "ProductId": productidProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.Bethesda { BranchId = branchidProp, ContentId = contentidProp, Game = gameProp, IsCCMod = isccmodProp, Name = nameProp, ProductId = productidProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.Bethesda value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "Bethesda"); writer.WritePropertyName("BranchId"); JsonSerializer.Serialize(writer, value.BranchId, options); writer.WritePropertyName("ContentId"); JsonSerializer.Serialize(writer, value.ContentId, options); writer.WritePropertyName("Game"); JsonSerializer.Serialize(writer, value.Game, options); writer.WritePropertyName("IsCCMod"); JsonSerializer.Serialize(writer, value.IsCCMod, options); writer.WritePropertyName("Name"); JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("ProductId"); JsonSerializer.Serialize(writer, value.ProductId, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_DeprecatedLoversLabConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab { }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.DeprecatedLoversLab value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "LoversLabDownloader, Wabbajack.Lib"); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_GameFileSourceConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.GameFileSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.DTOs.Game gameProp = default; Wabbajack.Paths.RelativePath gamefileProp = default; System.String gameversionProp = default; Wabbajack.Hashing.xxHash64.Hash hashProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Game": gameProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameFile": gamefileProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameVersion": gameversionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.GameFileSource { Game = gameProp, GameFile = gamefileProp, GameVersion = gameversionProp, Hash = hashProp, }; } 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); writer.WritePropertyName("GameFile"); JsonSerializer.Serialize(writer, value.GameFile, options); writer.WritePropertyName("GameVersion"); JsonSerializer.Serialize(writer, value.GameVersion, options); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_GoogleDriveConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.GoogleDrive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.String idProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Id": idProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.GoogleDrive { Id = idProp, }; } 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); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_HttpConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.Http Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.String[] headersProp = default; System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Headers": headersProp = JsonSerializer.Deserialize(ref reader, options); break; case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.Http { Headers = headersProp, Url = urlProp, }; } 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); writer.WritePropertyName("Url"); JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_LoversLabConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.LoversLab Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Author": authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4File": ips4fileProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Mod": ips4modProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Url": ips4urlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.LoversLab { Author = authorProp, Description = descriptionProp, ImageURL = imageurlProp, IPS4File = ips4fileProp, IPS4Mod = ips4modProp, IPS4Url = ips4urlProp, IsAttachment = isattachmentProp, IsNSFW = isnsfwProp, Name = nameProp, Version = versionProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.LoversLab value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "LoversLabOAuthDownloader, Wabbajack.Lib"); writer.WritePropertyName("Author"); JsonSerializer.Serialize(writer, value.Author, options); writer.WritePropertyName("Description"); JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("ImageURL"); JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IPS4File"); JsonSerializer.Serialize(writer, value.IPS4File, options); writer.WritePropertyName("IPS4Mod"); JsonSerializer.Serialize(writer, value.IPS4Mod, options); writer.WritePropertyName("IPS4Url"); JsonSerializer.Serialize(writer, value.IPS4Url, options); writer.WritePropertyName("IsAttachment"); JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WritePropertyName("IsNSFW"); JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("Name"); JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_ManualConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.Manual Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.String promptProp = default; System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Prompt": promptProp = JsonSerializer.Deserialize(ref reader, options); break; case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.Manual { Prompt = promptProp, Url = urlProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.Manual value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "ManualDownloader, Wabbajack.Lib"); writer.WritePropertyName("Prompt"); JsonSerializer.Serialize(writer, value.Prompt, options); writer.WritePropertyName("Url"); JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_MediaFireConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.MediaFire Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.MediaFire { Url = urlProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.DownloadStates.MediaFire value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "MediaFireDownloader+State, Wabbajack.Lib"); writer.WritePropertyName("Url"); JsonSerializer.Serialize(writer, value.Url, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_MegaConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.Mega Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.Mega { Url = urlProp, }; } 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); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_ModDBConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.ModDB Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.ModDB { Url = urlProp, }; } 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); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_NexusConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.Nexus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Author": authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileID": fileidProp = JsonSerializer.Deserialize(ref reader, options); break; case "GameName": gamenameProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "ModID": modidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.Nexus { Author = authorProp, Description = descriptionProp, FileID = fileidProp, Game = gamenameProp, ImageURL = imageurlProp, IsNSFW = isnsfwProp, ModID = modidProp, Name = nameProp, Version = versionProp, }; } 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); writer.WritePropertyName("Description"); JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("FileID"); JsonSerializer.Serialize(writer, value.FileID, options); writer.WritePropertyName("GameName"); JsonSerializer.Serialize(writer, value.Game, options); writer.WritePropertyName("ImageURL"); JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IsNSFW"); JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("ModID"); JsonSerializer.Serialize(writer, value.ModID, options); writer.WritePropertyName("Name"); JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_TESAllianceConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.TESAlliance Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.String fileidProp = default; System.String filenameProp = default; System.Uri fullurlProp = default; System.Boolean isattachmentProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "FileID": fileidProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileName": filenameProp = JsonSerializer.Deserialize(ref reader, options); break; case "FullURL": fullurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.TESAlliance { FileID = fileidProp, FileName = filenameProp, FullURL = fullurlProp, IsAttachment = isattachmentProp, }; } 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); writer.WritePropertyName("FileName"); JsonSerializer.Serialize(writer, value.FileName, options); writer.WritePropertyName("FullURL"); JsonSerializer.Serialize(writer, value.FullURL, options); writer.WritePropertyName("IsAttachment"); JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_VectorPlexusConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.VectorPlexus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Author": authorProp = JsonSerializer.Deserialize(ref reader, options); break; case "Description": descriptionProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageURL": imageurlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4File": ips4fileProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Mod": ips4modProp = JsonSerializer.Deserialize(ref reader, options); break; case "IPS4Url": ips4urlProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsAttachment": isattachmentProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsNSFW": isnsfwProp = JsonSerializer.Deserialize(ref reader, options); break; case "Name": nameProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.VectorPlexus { Author = authorProp, Description = descriptionProp, ImageURL = imageurlProp, IPS4File = ips4fileProp, IPS4Mod = ips4modProp, IPS4Url = ips4urlProp, IsAttachment = isattachmentProp, IsNSFW = isnsfwProp, Name = nameProp, Version = versionProp, }; } 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); writer.WritePropertyName("Description"); JsonSerializer.Serialize(writer, value.Description, options); writer.WritePropertyName("ImageURL"); JsonSerializer.Serialize(writer, value.ImageURL, options); writer.WritePropertyName("IPS4File"); JsonSerializer.Serialize(writer, value.IPS4File, options); writer.WritePropertyName("IPS4Mod"); JsonSerializer.Serialize(writer, value.IPS4Mod, options); writer.WritePropertyName("IPS4Url"); JsonSerializer.Serialize(writer, value.IPS4Url, options); writer.WritePropertyName("IsAttachment"); JsonSerializer.Serialize(writer, value.IsAttachment, options); writer.WritePropertyName("IsNSFW"); JsonSerializer.Serialize(writer, value.IsNSFW, options); writer.WritePropertyName("Name"); JsonSerializer.Serialize(writer, value.Name, options); writer.WritePropertyName("Version"); JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DownloadStates_WabbajackCDNConverter : JsonConverter { public override Wabbajack.DTOs.DownloadStates.WabbajackCDN Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Uri urlProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Url": urlProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.DownloadStates.WabbajackCDN { Url = urlProp, }; } 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); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } public override Wabbajack.DTOs.BSA.ArchiveStates.IArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); cReader.Read(); if (cReader.GetString() != "$type") throw new JsonException(); cReader.Read(); var type = cReader.GetString(); switch(type) { case "BA2State, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; case "BA2State": return JsonSerializer.Deserialize(ref reader, options)!; case "BSAState, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; case "BSAState": return JsonSerializer.Deserialize(ref reader, options)!; case "TES3State": return JsonSerializer.Deserialize(ref reader, options)!; case "TES3State, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.ArchiveStates.IArchive value, JsonSerializerOptions options) { switch (value) { case Wabbajack.DTOs.BSA.ArchiveStates.BA2State v0: JsonSerializer.Serialize(writer, v0, options); return; case Wabbajack.DTOs.BSA.ArchiveStates.BSAState v1: JsonSerializer.Serialize(writer, v1, options); return; case Wabbajack.DTOs.BSA.ArchiveStates.TES3State v2: JsonSerializer.Serialize(writer, v2, options); return; } } } public class Wabbajack_DTOs_BSA_ArchiveStates_BA2StateConverter : JsonConverter { public override Wabbajack.DTOs.BSA.ArchiveStates.BA2State Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Boolean hasnametableProp = default; System.String headermagicProp = default; Wabbajack.DTOs.BSA.ArchiveStates.BA2EntryType typeProp = default; System.UInt32 versionProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "HasNameTable": hasnametableProp = JsonSerializer.Deserialize(ref reader, options); break; case "HeaderMagic": headermagicProp = JsonSerializer.Deserialize(ref reader, options); break; case "Type": typeProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.ArchiveStates.BA2State { HasNameTable = hasnametableProp, HeaderMagic = headermagicProp, Type = typeProp, Version = versionProp, }; } 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); writer.WritePropertyName("HeaderMagic"); JsonSerializer.Serialize(writer, value.HeaderMagic, options); writer.WritePropertyName("Type"); JsonSerializer.Serialize(writer, value.Type, options); writer.WritePropertyName("Version"); JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_ArchiveStates_BSAStateConverter : JsonConverter { public override Wabbajack.DTOs.BSA.ArchiveStates.BSAState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.UInt32 archiveflagsProp = default; System.UInt32 fileflagsProp = default; System.String magicProp = default; System.UInt32 versionProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "ArchiveFlags": archiveflagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileFlags": fileflagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Magic": magicProp = JsonSerializer.Deserialize(ref reader, options); break; case "Version": versionProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.ArchiveStates.BSAState { ArchiveFlags = archiveflagsProp, FileFlags = fileflagsProp, Magic = magicProp, Version = versionProp, }; } 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); writer.WritePropertyName("FileFlags"); JsonSerializer.Serialize(writer, value.FileFlags, options); writer.WritePropertyName("Magic"); JsonSerializer.Serialize(writer, value.Magic, options); writer.WritePropertyName("Version"); JsonSerializer.Serialize(writer, value.Version, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_ArchiveStates_TES3StateConverter : JsonConverter { public override Wabbajack.DTOs.BSA.ArchiveStates.TES3State Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Int64 dataoffsetProp = default; System.UInt32 filecountProp = default; System.UInt32 hashoffsetProp = default; System.UInt32 versionnumberProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "DataOffset": dataoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "FileCount": filecountProp = JsonSerializer.Deserialize(ref reader, options); break; case "HashOffset": hashoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "VersionNumber": versionnumberProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.ArchiveStates.TES3State { DataOffset = dataoffsetProp, FileCount = filecountProp, HashOffset = hashoffsetProp, VersionNumber = versionnumberProp, }; } 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); writer.WritePropertyName("FileCount"); JsonSerializer.Serialize(writer, value.FileCount, options); writer.WritePropertyName("HashOffset"); JsonSerializer.Serialize(writer, value.HashOffset, options); writer.WritePropertyName("VersionNumber"); JsonSerializer.Serialize(writer, value.VersionNumber, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_DirectiveConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } public override Wabbajack.DTOs.Directive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); cReader.Read(); if (cReader.GetString() != "$type") throw new JsonException(); cReader.Read(); var type = cReader.GetString(); switch(type) { case "ArchiveMeta": return JsonSerializer.Deserialize(ref reader, options)!; case "ArchiveMeta, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "CreateBSA": return JsonSerializer.Deserialize(ref reader, options)!; case "CreateBSA, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "FromArchive": return JsonSerializer.Deserialize(ref reader, options)!; case "FromArchive, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "IgnoredDirectly": return JsonSerializer.Deserialize(ref reader, options)!; case "InlineFile": return JsonSerializer.Deserialize(ref reader, options)!; case "InlineFile, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "MergedPatch, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "MergedPatch": return JsonSerializer.Deserialize(ref reader, options)!; case "NoMatch": return JsonSerializer.Deserialize(ref reader, options)!; case "PatchedFromArchive": return JsonSerializer.Deserialize(ref reader, options)!; case "PatchedFromArchive, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "PropertyFile": return JsonSerializer.Deserialize(ref reader, options)!; case "PropertyFile, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "RemappedInlineFile": return JsonSerializer.Deserialize(ref reader, options)!; case "RemappedInlineFile, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; case "TransformedTexture": return JsonSerializer.Deserialize(ref reader, options)!; case "TransformedTexture, Wabbajack.Lib": return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directive value, JsonSerializerOptions options) { switch (value) { case Wabbajack.DTOs.Directives.NoMatch v0: JsonSerializer.Serialize(writer, v0, options); return; case Wabbajack.DTOs.Directives.PatchedFromArchive v1: JsonSerializer.Serialize(writer, v1, options); return; case Wabbajack.DTOs.Directives.PropertyFile v2: JsonSerializer.Serialize(writer, v2, options); return; case Wabbajack.DTOs.Directives.RemappedInlineFile v3: JsonSerializer.Serialize(writer, v3, options); return; case Wabbajack.DTOs.Directives.TransformedTexture v4: JsonSerializer.Serialize(writer, v4, options); return; case Wabbajack.DTOs.Directives.ArchiveMeta v5: JsonSerializer.Serialize(writer, v5, options); return; case Wabbajack.DTOs.Directives.CreateBSA v6: JsonSerializer.Serialize(writer, v6, options); return; case Wabbajack.DTOs.Directives.FromArchive v7: JsonSerializer.Serialize(writer, v7, options); return; case Wabbajack.DTOs.Directives.IgnoredDirectly v8: JsonSerializer.Serialize(writer, v8, options); return; case Wabbajack.DTOs.Directives.InlineFile v9: JsonSerializer.Serialize(writer, v9, options); return; case Wabbajack.DTOs.Directives.MergedPatch v10: JsonSerializer.Serialize(writer, v10, options); return; } } } public class Wabbajack_DTOs_Directives_ArchiveMetaConverter : JsonConverter { public override Wabbajack.DTOs.Directives.ArchiveMeta Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath sourcedataidProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.ArchiveMeta { Hash = hashProp, Size = sizeProp, SourceDataID = sourcedataidProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.ArchiveMeta value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "ArchiveMeta"); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_CreateBSAConverter : JsonConverter { public override Wabbajack.DTOs.Directives.CreateBSA Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "FileStates": filestatesProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "State": stateProp = JsonSerializer.Deserialize(ref reader, options); break; case "TempID": tempidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.CreateBSA { FileStates = filestatesProp, Hash = hashProp, Size = sizeProp, State = stateProp, TempID = tempidProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.CreateBSA value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "CreateBSA"); writer.WritePropertyName("FileStates"); JsonSerializer.Serialize(writer, value.FileStates, options); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("State"); JsonSerializer.Serialize(writer, value.State, options); writer.WritePropertyName("TempID"); JsonSerializer.Serialize(writer, value.TempID, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_FromArchiveConverter : JsonConverter { public override Wabbajack.DTOs.Directives.FromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "ArchiveHashPath": archivehashpathProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.FromArchive { ArchiveHashPath = archivehashpathProp, Hash = hashProp, Size = sizeProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.FromArchive value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "FromArchive"); writer.WritePropertyName("ArchiveHashPath"); JsonSerializer.Serialize(writer, value.ArchiveHashPath, options); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_IgnoredDirectlyConverter : JsonConverter { public override Wabbajack.DTOs.Directives.IgnoredDirectly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.IgnoredDirectly { Hash = hashProp, Size = sizeProp, To = toProp, }; } 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); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_InlineFileConverter : JsonConverter { public override Wabbajack.DTOs.Directives.InlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath sourcedataidProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.InlineFile { Hash = hashProp, Size = sizeProp, SourceDataID = sourcedataidProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.InlineFile value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "InlineFile"); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_MergedPatchConverter : JsonConverter { public override Wabbajack.DTOs.Directives.MergedPatch Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "PatchID": patchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "Sources": sourcesProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.MergedPatch { Hash = hashProp, PatchID = patchidProp, Size = sizeProp, Sources = sourcesProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.MergedPatch value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "MergedPatch, Wabbajack.Lib"); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("PatchID"); JsonSerializer.Serialize(writer, value.PatchID, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("Sources"); JsonSerializer.Serialize(writer, value.Sources, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_NoMatchConverter : JsonConverter { public override Wabbajack.DTOs.Directives.NoMatch Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.NoMatch { Hash = hashProp, Size = sizeProp, To = toProp, }; } 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); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_PatchedFromArchiveConverter : JsonConverter { public override Wabbajack.DTOs.Directives.PatchedFromArchive Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "ArchiveHashPath": archivehashpathProp = JsonSerializer.Deserialize(ref reader, options); break; case "FromHash": fromhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "PatchID": patchidProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.PatchedFromArchive { ArchiveHashPath = archivehashpathProp, FromHash = fromhashProp, Hash = hashProp, PatchID = patchidProp, Size = sizeProp, To = toProp, }; } 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); writer.WritePropertyName("FromHash"); JsonSerializer.Serialize(writer, value.FromHash, options); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("PatchID"); JsonSerializer.Serialize(writer, value.PatchID, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_PropertyFileConverter : JsonConverter { public override Wabbajack.DTOs.Directives.PropertyFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath sourcedataidProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.PropertyFile { Hash = hashProp, Size = sizeProp, SourceDataID = sourcedataidProp, To = toProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.Directives.PropertyFile value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "PropertyFile"); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_RemappedInlineFileConverter : JsonConverter { public override Wabbajack.DTOs.Directives.RemappedInlineFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); Wabbajack.Hashing.xxHash64.Hash hashProp = default; System.Int64 sizeProp = default; Wabbajack.Paths.RelativePath sourcedataidProp = default; Wabbajack.Paths.RelativePath toProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "SourceDataID": sourcedataidProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.RemappedInlineFile { Hash = hashProp, Size = sizeProp, SourceDataID = sourcedataidProp, To = toProp, }; } 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); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("SourceDataID"); JsonSerializer.Serialize(writer, value.SourceDataID, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_Directives_TransformedTextureConverter : JsonConverter { public override Wabbajack.DTOs.Directives.TransformedTexture Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "ArchiveHashPath": archivehashpathProp = JsonSerializer.Deserialize(ref reader, options); break; case "Hash": hashProp = JsonSerializer.Deserialize(ref reader, options); break; case "ImageState": imagestateProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; case "To": toProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.Directives.TransformedTexture { ArchiveHashPath = archivehashpathProp, Hash = hashProp, ImageState = imagestateProp, Size = sizeProp, To = toProp, }; } 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); writer.WritePropertyName("Hash"); JsonSerializer.Serialize(writer, value.Hash, options); writer.WritePropertyName("ImageState"); JsonSerializer.Serialize(writer, value.ImageState, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WritePropertyName("To"); JsonSerializer.Serialize(writer, value.To, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_FileStates_AFileConverter : JsonConverter { public static void ConfigureServices(IServiceCollection services) { services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); } public override Wabbajack.DTOs.BSA.FileStates.AFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var cReader = reader; if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); cReader.Read(); if (cReader.GetString() != "$type") throw new JsonException(); cReader.Read(); var type = cReader.GetString(); switch(type) { case "BA2DX10Entry": return JsonSerializer.Deserialize(ref reader, options)!; case "BA2DX10Entry, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; case "BA2File": return JsonSerializer.Deserialize(ref reader, options)!; case "BA2FileEntryState, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; case "BSAFileState, Compression.BSA": return JsonSerializer.Deserialize(ref reader, options)!; case "BSAFile": return JsonSerializer.Deserialize(ref reader, options)!; case "TES3File": return JsonSerializer.Deserialize(ref reader, options)!; default: throw new JsonException($"No Type dispatch for {type}"); } } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.AFile value, JsonSerializerOptions options) { switch (value) { case Wabbajack.DTOs.BSA.FileStates.BA2DX10File v0: JsonSerializer.Serialize(writer, v0, options); return; case Wabbajack.DTOs.BSA.FileStates.BA2File v1: JsonSerializer.Serialize(writer, v1, options); return; case Wabbajack.DTOs.BSA.FileStates.BSAFile v2: JsonSerializer.Serialize(writer, v2, options); return; case Wabbajack.DTOs.BSA.FileStates.TES3File v3: JsonSerializer.Serialize(writer, v3, options); return; } } } public class Wabbajack_DTOs_BSA_FileStates_BA2DX10FileConverter : JsonConverter { public override Wabbajack.DTOs.BSA.FileStates.BA2DX10File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "ChunkHdrLen": chunkhdrlenProp = JsonSerializer.Deserialize(ref reader, options); break; case "Chunks": chunksProp = JsonSerializer.Deserialize(ref reader, options); break; case "DirHash": dirhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Extension": extensionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Height": heightProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "IsCubeMap": iscubemapProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameHash": namehashProp = JsonSerializer.Deserialize(ref reader, options); break; case "NumMips": nummipsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": pathProp = JsonSerializer.Deserialize(ref reader, options); break; case "PixelFormat": pixelformatProp = JsonSerializer.Deserialize(ref reader, options); break; case "TileMode": tilemodeProp = JsonSerializer.Deserialize(ref reader, options); break; case "Unk8": unk8Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Width": widthProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.FileStates.BA2DX10File { ChunkHdrLen = chunkhdrlenProp, Chunks = chunksProp, DirHash = dirhashProp, Extension = extensionProp, Height = heightProp, Index = indexProp, IsCubeMap = iscubemapProp, NameHash = namehashProp, NumMips = nummipsProp, Path = pathProp, PixelFormat = pixelformatProp, TileMode = tilemodeProp, Unk8 = unk8Prop, Width = widthProp, }; } 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); writer.WritePropertyName("Chunks"); JsonSerializer.Serialize(writer, value.Chunks, options); writer.WritePropertyName("DirHash"); JsonSerializer.Serialize(writer, value.DirHash, options); writer.WritePropertyName("Extension"); JsonSerializer.Serialize(writer, value.Extension, options); writer.WritePropertyName("Height"); JsonSerializer.Serialize(writer, value.Height, options); writer.WritePropertyName("Index"); JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("IsCubeMap"); JsonSerializer.Serialize(writer, value.IsCubeMap, options); writer.WritePropertyName("NameHash"); JsonSerializer.Serialize(writer, value.NameHash, options); writer.WritePropertyName("NumMips"); JsonSerializer.Serialize(writer, value.NumMips, options); writer.WritePropertyName("Path"); JsonSerializer.Serialize(writer, value.Path, options); writer.WritePropertyName("PixelFormat"); JsonSerializer.Serialize(writer, value.PixelFormat, options); writer.WritePropertyName("TileMode"); JsonSerializer.Serialize(writer, value.TileMode, options); writer.WritePropertyName("Unk8"); JsonSerializer.Serialize(writer, value.Unk8, options); writer.WritePropertyName("Width"); JsonSerializer.Serialize(writer, value.Width, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_FileStates_BA2FileConverter : JsonConverter { public override Wabbajack.DTOs.BSA.FileStates.BA2File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Align": alignProp = JsonSerializer.Deserialize(ref reader, options); break; case "Compressed": compressedProp = JsonSerializer.Deserialize(ref reader, options); break; case "DirHash": dirhashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Extension": extensionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Flags": flagsProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameHash": namehashProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": pathProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.FileStates.BA2File { Align = alignProp, Compressed = compressedProp, DirHash = dirhashProp, Extension = extensionProp, Flags = flagsProp, Index = indexProp, NameHash = namehashProp, Path = pathProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.BA2File value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "BA2File"); writer.WritePropertyName("Align"); JsonSerializer.Serialize(writer, value.Align, options); writer.WritePropertyName("Compressed"); JsonSerializer.Serialize(writer, value.Compressed, options); writer.WritePropertyName("DirHash"); JsonSerializer.Serialize(writer, value.DirHash, options); writer.WritePropertyName("Extension"); JsonSerializer.Serialize(writer, value.Extension, options); writer.WritePropertyName("Flags"); JsonSerializer.Serialize(writer, value.Flags, options); writer.WritePropertyName("Index"); JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("NameHash"); JsonSerializer.Serialize(writer, value.NameHash, options); writer.WritePropertyName("Path"); JsonSerializer.Serialize(writer, value.Path, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_FileStates_BSAFileConverter : JsonConverter { public override Wabbajack.DTOs.BSA.FileStates.BSAFile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); System.Boolean flipcompressionProp = default; System.Int32 indexProp = default; Wabbajack.Paths.RelativePath pathProp = default; while (true) { reader.Read(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "FlipCompression": flipcompressionProp = JsonSerializer.Deserialize(ref reader, options); break; case "Index": indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": pathProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.FileStates.BSAFile { FlipCompression = flipcompressionProp, Index = indexProp, Path = pathProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.BSAFile value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "BSAFileState, Compression.BSA"); writer.WritePropertyName("FlipCompression"); JsonSerializer.Serialize(writer, value.FlipCompression, options); writer.WritePropertyName("Index"); JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("Path"); JsonSerializer.Serialize(writer, value.Path, options); writer.WriteEndObject(); } } public class Wabbajack_DTOs_BSA_FileStates_TES3FileConverter : JsonConverter { public override Wabbajack.DTOs.BSA.FileStates.TES3File Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType != JsonTokenType.StartObject) throw new JsonException(); 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(); if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); break; } var prop = reader.GetString(); reader.Read(); switch (prop) { case "Hash1": hash1Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Hash2": hash2Prop = JsonSerializer.Deserialize(ref reader, options); break; case "Index": indexProp = JsonSerializer.Deserialize(ref reader, options); break; case "NameOffset": nameoffsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "Offset": offsetProp = JsonSerializer.Deserialize(ref reader, options); break; case "Path": pathProp = JsonSerializer.Deserialize(ref reader, options); break; case "Size": sizeProp = JsonSerializer.Deserialize(ref reader, options); break; default: reader.Skip(); break; } } return new Wabbajack.DTOs.BSA.FileStates.TES3File { Hash1 = hash1Prop, Hash2 = hash2Prop, Index = indexProp, NameOffset = nameoffsetProp, Offset = offsetProp, Path = pathProp, Size = sizeProp, }; } public override void Write(Utf8JsonWriter writer, Wabbajack.DTOs.BSA.FileStates.TES3File value, JsonSerializerOptions options) { writer.WriteStartObject(); writer.WriteString("$type", "TES3File"); writer.WritePropertyName("Hash1"); JsonSerializer.Serialize(writer, value.Hash1, options); writer.WritePropertyName("Hash2"); JsonSerializer.Serialize(writer, value.Hash2, options); writer.WritePropertyName("Index"); JsonSerializer.Serialize(writer, value.Index, options); writer.WritePropertyName("NameOffset"); JsonSerializer.Serialize(writer, value.NameOffset, options); writer.WritePropertyName("Offset"); JsonSerializer.Serialize(writer, value.Offset, options); writer.WritePropertyName("Path"); JsonSerializer.Serialize(writer, value.Path, options); writer.WritePropertyName("Size"); JsonSerializer.Serialize(writer, value.Size, options); writer.WriteEndObject(); } }