forked from wabbajack-tools/wabbajack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
54 lines (49 loc) · 1.81 KB
/
Startup.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
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Wabbajack.DTOs.Interventions;
using Wabbajack.Networking.Steam.UserInterventions;
using Wabbajack.Networking.WabbajackClientApi;
using Wabbajack.Services.OSIntegrated;
using Xunit.DependencyInjection;
using Xunit.DependencyInjection.Logging;
using Configuration = Wabbajack.Services.OSIntegrated.Configuration;
namespace Wabbajack.Compiler.Test;
public class Startup
{
public void ConfigureServices(IServiceCollection service)
{
service.AddOSIntegrated(o =>
{
o.UseLocalCache = true;
o.UseStubbedGameFolders = true;
});
service.AddScoped<ModListHarness>();
service.AddSingleton<IUserInterventionHandler, UserInterventionHandler>();
}
public void Configure(ILoggerFactory loggerFactory, ITestOutputHelperAccessor accessor)
{
loggerFactory.AddProvider(new XunitTestOutputLoggerProvider(accessor, delegate { return true; }));
}
public class UserInterventionHandler : IUserInterventionHandler
{
public void Raise(IUserIntervention intervention)
{
if (intervention is GetAuthCode gac)
{
switch (gac.Type)
{
case GetAuthCode.AuthType.EmailCode:
Console.WriteLine("Please enter the Steam code that was just emailed to you");
break;
case GetAuthCode.AuthType.TwoFactorAuth:
Console.WriteLine("Please enter your 2FA code for Steam");
break;
default:
throw new ArgumentOutOfRangeException();
}
gac.Finish(Console.ReadLine()!.Trim());
}
}
}
}