-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
128 lines (108 loc) · 3.97 KB
/
Copy pathProgram.cs
File metadata and controls
128 lines (108 loc) · 3.97 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using Newtonsoft.Json.Linq;
using System.Configuration;
using System.IO;
namespace DK2_Utils
{
internal class Program
{
static SharedFuncs shared = new SharedFuncs();
static void Main(string[] args)
{
SupplyEditor supplyEditor = null;
TracerBugFix tracerBugFix = null;
string firstLaunch = ConfigurationManager.AppSettings["firstLaunch"];
bool IsfirstLaunch = Convert.ToBoolean(firstLaunch);
//Init some values and method instances if its first launch
if (IsfirstLaunch == true)
{
//its the first launch
GetSetUserLanguage();
GetUserModsFolder();
supplyEditor = new SupplyEditor(shared);
tracerBugFix = new TracerBugFix(shared);
shared.SetAppSetting("firstLaunch", "false");
}
else
{
//its not the first launch
SharedFuncs.culture = ConfigurationManager.AppSettings["culture_string"];
supplyEditor = new SupplyEditor(shared);
tracerBugFix = new TracerBugFix(shared);
}
Console.CursorVisible = true;
string[] options = new string[]
{
//get the culture specific strings
shared.GetLocalString("menuItem_supply"),
shared.GetLocalString("menuItem_iov"),
shared.GetLocalString("menuItem_exit")
};
//Create menu instance and use it in an infinite loops
Menu menu = new Menu(options);
while (true)
{
int userChoice = menu.GetMenu();
Console.CursorVisible = true;
switch (userChoice)
{
case 0:
supplyEditor.EditSupply();
break;
case 1:
tracerBugFix.EditTracerBug();
Console.ReadLine();
break;
case 2:
Environment.Exit(0);
return;
}
}
}
static void GetSetUserLanguage()
{
//Ask the User what language he wants and set the culture string in shared based on that
string culture;
string[] languages = new string[]
{
"English (GB)",
"Deutsch (GER)"
};
Menu langMenu = new Menu(languages);
int userChoice = langMenu.GetMenu();
//check user choice to appropriatly set the culture string
switch (userChoice)
{
case 0:
Console.WriteLine("Language set to: English (GB|US)");
culture = "en-GB";
break;
case 1:
Console.WriteLine("Sprache ausgewählt: Deutsch (GER)");
culture = "de-GER";
break;
default:
Console.WriteLine("How did we get here ?");
Console.WriteLine("Language set to: English (GB|US)");
culture = "en-GB";
break;
}
SharedFuncs.culture = culture;
shared.SetAppSetting("culture_string", culture);
}
public static void GetUserModsFolder()
{
while (true)
{
//ask for path to modsfolder and loop till its valid
Console.WriteLine(shared.GetLocalString("question_modsFolder"));
string path = Console.ReadLine();
if (Directory.Exists(path))
{
shared.SetAppSetting("costumModsFolder", path);
return;
}
Console.WriteLine(shared.GetLocalString("invalid_path"));
}
}
}
}