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