wabbajack/Wabbajack.DTOs/JsonConverters/Generated.cs

2708 lines
111 KiB
C#
Raw Normal View History

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