// // Startup.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NosSmooth.Core.Client; using NosSmooth.LocalClient; using NosSmooth.LocalClient.Extensions; using WalkCommands.Commands; namespace WalkCommands; /// /// Startup class of WalkCommands. /// public class Startup { private IServiceProvider BuildServices() { return new ServiceCollection() .AddLocalClient() .AddScoped() .AddScoped() .AddSingleton() .Configure(o => o.AllowIntercept = true) .AddSingleton() .AddLogging(b => { b.ClearProviders(); b.AddConsole(); b.SetMinimumLevel(LogLevel.Debug); }) .BuildServiceProvider(); } /// /// Run the MoveToMiniland. /// /// A task that may or may not have succeeded. public async Task RunAsync() { var provider = BuildServices(); var mainCancellation = provider.GetRequiredService(); var client = provider.GetRequiredService(); await client.RunAsync(mainCancellation.Token); } }