From b86adad490713a7dd73100e905c4df4b664c1707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sat, 29 Jan 2022 23:24:10 +0100 Subject: [PATCH] feat(data): add nostale data files service collection extensions --- .../Extensions/ServiceCollectionExtensions.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Data/NosSmooth.Data.NOSFiles/Extensions/ServiceCollectionExtensions.cs b/Data/NosSmooth.Data.NOSFiles/Extensions/ServiceCollectionExtensions.cs index c4583cb..c819341 100644 --- a/Data/NosSmooth.Data.NOSFiles/Extensions/ServiceCollectionExtensions.cs +++ b/Data/NosSmooth.Data.NOSFiles/Extensions/ServiceCollectionExtensions.cs @@ -5,6 +5,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.Extensions.DependencyInjection; +using NosSmooth.Data.Abstractions; +using NosSmooth.Data.Abstractions.Language; using NosSmooth.Data.NOSFiles.Readers; using NosSmooth.Data.NOSFiles.Readers.Types; @@ -15,6 +17,32 @@ namespace NosSmooth.Data.NOSFiles.Extensions; /// public static class ServiceCollectionExtensions { + /// + /// Adds the nostale file data info and language service. + /// + /// The service collection. + /// The collection. + public static IServiceCollection AddNostaleDataFiles(this IServiceCollection serviceCollection) + { + return serviceCollection + .AddNostaleDataParsing() + .AddSingleton() + .AddSingleton(p => p.GetRequiredService().InfoService) + .AddSingleton(p => p.GetRequiredService().LanguageService); + } + + /// + /// Adds the . + /// + /// The service collection. + /// The collection. + public static IServiceCollection AddNostaleDataParsing(this IServiceCollection serviceCollection) + { + return serviceCollection + .AddFileReader() + .AddSingleton(); + } + /// /// Add the file reader and NosTale type readers. /// -- 2.48.1