using Dpz.Core.Backup;
using Dpz.Core.Infrastructure;
using Dpz.Core.Service.ObjectStorage;
using Dpz.Core.Service.ObjectStorage.Services;
using Dpz.Core.Service.ObjectStorage.Services.Impl;
using Dpz.Core.Service.RepositoryService;
using Dpz.Core.Service.RepositoryServiceImpl;
using Dpz.Core.Service.V4.Implements;
using Dpz.Core.Service.V4.Services;
using Dpz.Core.Web.Jobs.Hangfire;
using Dpz.Core.Web.Jobs.Services;
using Dpz.Core.Web.Jobs.Services.Implements;
namespace Dpz.Core.Web.Jobs;
public static class RegisterDependencyInjectionExtensions
{
public static IServiceCollection AddInject(this IServiceCollection services)
{
services.AddScoped<IArticleService, ArticleService>();
services.AddScoped<IObjectStorageOperation, ObjectStorageService>();
services.AddScoped<IAccountService, AccountService>();
services.AddScoped<IAppLogEntryService, AppLogEntryService>();
services.AddScoped<IWaitExecutionService, WaitExecutionService>();
services.AddScoped<IPictureReadService, PictureReadService>();
services.AddSingleton<IPushMessage, PushMessage>();
//services.AddSingleton<TaskService,ItHomeActivator>();
services.AddScoped<IBackupRestore, BackupRestore>();
services.AddScoped<IBackupRecordService, BackupRecordService>();
services.AddHttpClient("edge",
httpClient =>
{
httpClient.DefaultRequestHeaders.Add("User-Agent", EnvironmentInfo.UserAgent);
})
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
});
services.AddHttpClient<ISteamGameService, SteamGameService>((sp, client) =>
{
ActivatorUtilities.CreateInstance<SteamGameService>(sp);
client.BaseAddress = new Uri("https://api.steampowered.com");
}).ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
});
services.AddUpyunObjectStorage();
return services;
}
}