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