-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
42 lines (35 loc) · 1.34 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (C) 2024 Martin Renner
// LGPL-3.0-or-later (see file COPYING and COPYING.LESSER)
using System.IO.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using SharpDeck.Extensions.Hosting;
using StreamDeckSimHub.Plugin.PropertyLogic;
using StreamDeckSimHub.Plugin.SimHub;
using StreamDeckSimHub.Plugin.Tools;
// Main entry. Started by Stream Deck with appropriate arguments.
var host = Host.CreateDefaultBuilder()
.ConfigureLogging((context, loggingBuilder) =>
{
loggingBuilder
.ClearProviders()
.AddNLog();
})
.UseStreamDeck()
.ConfigureServices(ConfigureServices)
.Build();
host.Services.GetRequiredService<SimHubConnection>().Run();
host.Run();
void ConfigureServices(IServiceCollection serviceCollection)
{
serviceCollection.AddSingleton<PropertyParser>();
serviceCollection.AddSingleton<SimHubConnection>();
serviceCollection.AddSingleton<ShakeItStructureFetcher>();
serviceCollection.AddSingleton<PropertyComparer>();
serviceCollection.AddSingleton<ImageUtils>();
serviceCollection.AddSingleton<ImageManager>();
serviceCollection.AddSingleton<IFileSystem>(new FileSystem());
serviceCollection.AddHostedService<PeriodicBackgroundService>();
}