-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.cs
More file actions
69 lines (58 loc) · 2.27 KB
/
Copy pathApp.cs
File metadata and controls
69 lines (58 loc) · 2.27 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.Net;
using LocalAssemblyDebugger.Scenarios;
using LocalAssemblyDebugger.UI;
using Spectre.Console;
namespace LocalAssemblyDebugger
{
public class App
{
public void Run()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var scenarioService = new ScenarioService();
OfferAppConfigImport(scenarioService);
var mainMenu = new MainMenu();
var pluginMenu = new PluginMenu(scenarioService);
var caMenu = new CodeActivityMenu(scenarioService);
var scenarioMenu = new ScenarioMenu(scenarioService);
while (true)
{
MainMenuChoice choice = mainMenu.Show();
switch (choice)
{
case MainMenuChoice.Plugin:
pluginMenu.Run();
break;
case MainMenuChoice.CodeActivity:
caMenu.Run();
break;
case MainMenuChoice.LoadScenario:
ScenarioRunResult result = scenarioMenu.Show();
if (result != null)
{
if (result.IsPlugin)
pluginMenu.Run(result.PluginScenario);
else
caMenu.Run(result.CodeActivityScenario);
}
break;
case MainMenuChoice.Exit:
AnsiConsole.MarkupLine("[grey]Exiting...[/]");
return;
}
AnsiConsole.MarkupLine("\n[grey]Press any key to continue...[/]");
System.Console.ReadKey(true);
}
}
private void OfferAppConfigImport(ScenarioService service)
{
if (!service.ShouldOfferAppConfigImport()) return;
AnsiConsole.MarkupLine("[yellow]Legacy settings detected in App.config.[/]");
if (AnsiConsole.Confirm("Import legacy settings as a scenario?", true))
{
service.ImportFromAppConfig();
AnsiConsole.MarkupLine("[green]Settings imported.[/]");
}
}
}
}