2021-09-27 12:42:46 +00:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2022-06-20 23:21:04 +00:00
|
|
|
using Wabbajack.Paths;
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
namespace Wabbajack.DTOs.JsonConverters;
|
|
|
|
|
|
|
|
public static class DIExtensions
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
public static IServiceCollection AddDTOConverters(this IServiceCollection services)
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
Wabbajack_DTOs_DownloadStates_IDownloadStateConverter.ConfigureServices(services);
|
|
|
|
Wabbajack_DTOs_DirectiveConverter.ConfigureServices(services);
|
|
|
|
Wabbajack_DTOs_BSA_ArchiveStates_IArchiveConverter.ConfigureServices(services);
|
|
|
|
Wabbajack_DTOs_BSA_FileStates_AFileConverter.ConfigureServices(services);
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
services.AddSingleton<JsonConverter, HashJsonConverter>();
|
|
|
|
services.AddSingleton<JsonConverter, HashRelativePathConverter>();
|
|
|
|
services.AddSingleton<JsonConverter, PHashConverter>();
|
|
|
|
services.AddSingleton<JsonConverter, RelativePathConverter>();
|
|
|
|
services.AddSingleton<JsonConverter, AbsolutePathConverter>();
|
|
|
|
services.AddSingleton<JsonConverter, VersionConverter>();
|
2022-06-20 23:21:04 +00:00
|
|
|
services.AddSingleton<JsonConverter, IPathConverter>();
|
2021-10-23 16:51:17 +00:00
|
|
|
return services;
|
|
|
|
}
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
public static IServiceCollection AddDTOSerializer(this IServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddSingleton<DTOSerializer>();
|
|
|
|
services.AddSingleton(s => s.GetService<DTOSerializer>()!.Options);
|
|
|
|
return services;
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|
|
|
|
}
|