-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainForm.cs
621 lines (574 loc) · 28.4 KB
/
MainForm.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
using System.Diagnostics;
using RimLangKit.Properties;
using RimLanguageCore.Activities;
using RimLanguageCore.Misc;
namespace RimLangKit
{
public partial class MainForm : Form
{
private static string DirectoryPath = string.Empty;
private static string GamePath = string.Empty;
private static string AdditionalFolder = string.Empty;
private readonly Color goodColor = Color.FromArgb(0, 130, 0);
private readonly Color badColor = Color.FromArgb(130, 0, 0);
public MainForm()
{
InitializeComponent();
FolderTextBox.Text = DirectoryPath;
// Обновление настроек
if (Settings.Default.firstLaunch)
{
Settings.Default.Upgrade();
Settings.Default.firstLaunch = false;
Settings.Default.Save();
SendToInfoTextBox("Первый запуск. Обновление настроек завершено");
}
// Установка версии программы
string? version = System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version?.ToString();
if (version is null || version.Length < 5)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Неправильная версия программы");
}
else
{
version = version[..5];
if (version.EndsWith(".0", StringComparison.OrdinalIgnoreCase))
{
version = version[..^2];
}
}
VersionLabel.Text = "Версия " + version;
// Восстановление последней вкладки
MainTabs.SelectTab(Settings.Default.lastTab);
// Установка размера вкладок
MainTabs.SizeMode = TabSizeMode.Fixed;
MainTabs.ItemSize = new Size((MainTabs.Width / MainTabs.TabPages.Count) - 2, MainTabs.ItemSize.Height);
// Восстановление пути к папке игры
if (Directory.Exists(Settings.Default.savedDirectory))
{
GamePath = Settings.Default.savedDirectory;
}
else
{
GamePath = string.Empty;
}
FolderTextBox2.Text = GamePath;
LanguageInput.Text = Settings.Default.language;
RepoInput.Text = Settings.Default.repo;
}
// Выбор папки и обработка изменения адреса папки
private void FolderButton_Click(object sender, EventArgs e)
{
using FolderBrowserDialog ofd = new();
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
DirectoryPath = ofd.SelectedPath;
FolderTextBox.Text = DirectoryPath;
}
}
private void FolderTextBox_TextChanged(object sender, EventArgs e)
{
DirectoryPath = FolderTextBox.Text;
// Кнопки доступны только, тогда, когда директория существует
if (Directory.Exists(FolderTextBox.Text) && !FolderTextBox.Text.Contains("294100"))
{
LabelCheck.ForeColor = goodColor;
LabelCheck.Text = "ОК";
CommentInserterButton.Enabled = true;
FileRenamerButton.Enabled = true;
NamesTranslatorButton.Enabled = true;
CaseCreatorButton.Enabled = true;
EncodingFixerButton.Enabled = true;
TagCollectorButton.Enabled = true;
FileFixerButton.Enabled = true;
FindChangesButton.Enabled = true;
PreTranslatorButton.Enabled = true;
AdditionalFolderButton.Enabled = true;
}
else
{
LabelCheck.ForeColor = badColor;
LabelCheck.Text = "Ошибка: некорректная папка";
CommentInserterButton.Enabled = false;
FileRenamerButton.Enabled = false;
NamesTranslatorButton.Enabled = false;
CaseCreatorButton.Enabled = false;
EncodingFixerButton.Enabled = false;
TagCollectorButton.Enabled = false;
FileFixerButton.Enabled = false;
FindChangesButton.Enabled = false;
PreTranslatorButton.Enabled = false;
AdditionalFolderButton.Enabled = false;
}
}
#region прочие объекты
private void UpdateButton_Click(object sender, EventArgs e)
{
Root? json = GitHubHttpClient.GetGithubJson();
if (json is null)
{
SendToInfoTextBox("Ошибка получения данных с GitHub");
UpdateButton.BackgroundImage = Properties.Resources.no_c;
LinkLabelGithub.Visible = true;
return;
}
string newVersion = json.TagName.ToString()[1..];
string? oldVersion = System.Reflection.Assembly.GetEntryAssembly()?.GetName().Version?.ToString();
if (oldVersion is null || oldVersion.Length < 5)
{
SendToInfoTextBox("Неправильная версия программы");
UpdateButton.BackgroundImage = Properties.Resources.warn_c;
LinkLabelGithub.Visible = true;
return;
}
else
{
oldVersion = oldVersion[..5];
}
if (oldVersion.EndsWith(".0", StringComparison.OrdinalIgnoreCase))
{
oldVersion = oldVersion[..^2];
}
SendToInfoTextBox($"Ваша версия - {oldVersion}, доступная версия - {newVersion}");
UpdateLabel.Text = $"Последняя {newVersion}";
if (oldVersion == newVersion)
{
SendToInfoTextBox("Обновление не требуется");
UpdateButton.BackgroundImage = Properties.Resources.yes_c;
LinkLabelGithub.Visible = false;
}
else
{
SendToInfoTextBox("Доступна новая версия программы. Её можно скачать на GitHub по ссылке справа");
SendToInfoTextBox($"{json.Name}. Что нового?{Environment.NewLine}{json.Body}");
UpdateButton.BackgroundImage = Properties.Resources.warn_c;
LinkLabelGithub.Visible = true;
}
}
private void LinkLabelGithub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
LinkLabelGithub.LinkVisited = true;
try
{
Process.Start(new ProcessStartInfo { FileName = @"https://github.com/OneCodeUnit/RimLangKit/releases/latest", UseShellExecute = true });
}
catch
{
MessageBox.Show("Сайт не открылся :(");
}
}
private void LinkLabelInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
LinkLabelGithub.LinkVisited = true;
try
{
Process.Start(new ProcessStartInfo { FileName = @"https://github.com/OneCodeUnit/RimLangKit/blob/master/README.md", UseShellExecute = true });
}
catch
{
MessageBox.Show("Сайт не открылся :(");
}
}
private void AdditionalFolderButton_Click(object sender, EventArgs e)
{
FolderBrowserDialog ofd = new();
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
AdditionalFolder = ofd.SelectedPath;
}
AdditionalFolderButton.BackColor = goodColor;
}
// Выбор текстового поля в зависимости от выбранной вкладки
private void SendToInfoTextBox(string text)
{
if (Settings.Default.lastTab == 0)
{
InfoTextBox.AppendText($"{Environment.NewLine}{text}");
}
else
{
InfoTextBox2.AppendText($"{Environment.NewLine}{text}");
}
}
private void MainTabs_IndexChange(object sender, EventArgs e)
{
Settings.Default["lastTab"] = MainTabs.SelectedIndex;
Settings.Default.Save();
}
#endregion
#region кнопки функций
// Обработчик нажатий кнопок
private void ActionHandler(string name, string mask, string code)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Запуск: {name}");
// Получение списка всех файлов в заданой папке и во всех вложенных подпапках за счёт SearchOption
string[] allFiles = Directory.GetFiles(DirectoryPath, mask, SearchOption.AllDirectories);
int count = 0;
int errCount = 0;
(bool, string) result = (false, string.Empty);
string message;
foreach (string currentFile in allFiles)
{
switch (code)
{
case "FileRenamer":
result = FileRenamer.FileRenamerActivity(currentFile);
break;
case "NamesTranslator":
result = NamesTranslator.NamesTranslatorActivity(currentFile);
break;
case "TagCollector":
result = TagCollector.TagCollectorActivity(currentFile);
break;
case "FileFixer":
result = FileFixer.FileFixerActivity(currentFile);
break;
case "EncodingFixer":
result = EncodingFixer.EncodingFixerActivity(currentFile);
break;
case "CommentInserter":
result = CommentInserter.InsertComments(currentFile);
break;
default:
break;
}
if (result.Item1)
count++;
else
{
errCount++;
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({currentFile})");
}
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Завершено. Обработано файлов - {count}");
if (errCount != 0)
{
InfoTextBox.AppendText($"{Environment.NewLine}Пропущено файлов - {errCount}");
}
// Постобработка
switch (code)
{
case "TagCollector":
message = TagCollector.TagWriterActivity();
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{message}");
message = TagCollector.DefsClassGeneratorActivity();
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{message}");
TagCollector.DataCleanerActivity();
break;
case "FileFixer":
message = FileFixer.BrokenFilesWriterActivity();
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{message}");
break;
default:
break;
}
}
// Работа без обработчика
private void FindChangesButton_Click(object sender, EventArgs e)
{
if (AdditionalFolder == string.Empty)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Ошибка. Не выбран источник данных");
return;
}
InfoTextBox.AppendText($"{Environment.NewLine}Файлы перевода - {DirectoryPath}.{Environment.NewLine}Исходные файлы мода - {AdditionalFolder}");
InfoTextBox.AppendText($"{TimeSetter.PlaceTime()}Поиск изменений в переводе");
string[] allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
int count = 0;
int errCount = 0;
(bool, string) result;
foreach (string tempFile in allFiles)
{
result = ChangesFinder.GetTranslationData(tempFile);
if (result.Item1)
{
count++;
}
else
{
errCount++;
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({tempFile})");
}
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Собраны данные перевода. Обработано файлов - {count}.{Environment.NewLine}Пропущено файлов - {errCount}.");
allFiles = Directory.GetFiles(AdditionalFolder, "*.xml", SearchOption.AllDirectories);
count = 0;
errCount = 0;
foreach (string tempFile in allFiles)
{
result = ChangesFinder.GetModData(tempFile);
if (result.Item1)
{
count++;
}
else
{
errCount++;
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({tempFile})");
}
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Собраны исходные данные. Обработано файлов - {count}.{Environment.NewLine}Пропущено файлов - {errCount}.");
ChangesFinder.FindChangesInFiles();
string writeResult = ChangesFinder.WriteChanges();
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{writeResult}");
}
private void CaseCreatorButton_Click(object sender, EventArgs e)
{
InfoTextBox.AppendText($"{TimeSetter.PlaceTime()}Создание вспомогательных файлов");
string[] defTypeList = ["AbilityDef", "BodyDef", "BodyPartDef", "BodyPartGroupDef", "ChemicalDef", "FactionDef", "HediffDef", "MemeDef", "MentalBreakDef", "MentalFitDef", "MentalStateDef", "OrderedTakeGroupDef", "PawnCapacityDef", "PawnKindDef", "ScenarioDef", "SitePartDef", "SkillDef", "StyleCategoryDef", "ThingDef", "ToolCapacityDef", "WorldObjectDef", "XenotypeDef"];
//Получение списка всех файлов в заданой директории и во всех вложенных подпапках за счёт SearchOption
string[] allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
Dictionary<string, string> words = [];
// Поиск подходящей директории
string directory = Directory.Exists(DirectoryPath + "\\Common") ? DirectoryPath + "\\Common" : DirectoryPath;
int typeCount = 0;
// Проверяется каждый подходящий DefType из списка
foreach (string defType in defTypeList)
{
int count = 0;
foreach (string tempFile in allFiles)
{
// Каждый файл проверяется на соотвествие этому типу. Если не соотвествует, возвращает пустой список
List<string> tempWords = CaseCreator.FindWordsProcessing(tempFile, defType);
foreach (string word in tempWords)
{
bool result = words.TryAdd(word, defType);
if (result) { count++; }
}
}
// Если нашлись слова в данном DefType, то создаются файлы
if (count > 0)
{
int? limit = MorpherHttpClient.GetMorpherRequestLimit();
if (!limit.HasValue)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Ошибка получения лимита слов для {defType}. Проблемы с интернетом?");
continue;
}
else if (limit < words.Count)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Превышен лимит. Доступно сегодня {limit}, требуется для {defType} - {words.Count}. Стоит убрать уже обработанные папки и попробовать завтра. Или сменить IP.");
continue;
}
else
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Доступно запросов - {limit}");
}
CaseCreator.CreateCase(directory, words, defType);
CaseCreator.CreateGender(directory, words, defType);
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Обработано {count} объектов типа {defType}");
typeCount++;
}
}
if (typeCount > 0)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Созданы файлы по адресу {directory}\\Languages\\Russian\\WordInfo");
}
else
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Файлы не созданы");
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Завершено");
}
private void PreTranslatorButton_Click(object sender, EventArgs e)
{
if (AdditionalFolder == string.Empty)
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Ошибка. Не выбран источник данных");
return;
}
InfoTextBox.AppendText($"{Environment.NewLine}Переводимые файлы - {DirectoryPath}.{Environment.NewLine}Исходные файлы для предварительного перевода - {AdditionalFolder}");
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Сбор данных для перевода");
string[] allFiles = Directory.GetFiles(AdditionalFolder, "*.xml", SearchOption.AllDirectories);
int count = 0;
int errCount = 0;
(bool, string) result = (false, string.Empty);
foreach (string tempFile in allFiles)
{
if (tempFile.StartsWith(DirectoryPath, StringComparison.OrdinalIgnoreCase))
{
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Включать переводимый мод в исходные файлы - плохая идея.");
return;
}
result = PreTranslator.BuildDatabase(tempFile);
if (result.Item1)
{
count++;
}
else
{
errCount++;
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({tempFile})");
}
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Собрано {result.Item2} пар перевода. Обработано файлов - {count}. Пропущено файлов - {errCount}.");
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Начат предварительный перевод");
allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
count = 0;
errCount = 0;
foreach (string tempFile in allFiles)
{
result = PreTranslator.Translation(tempFile);
if (result.Item1)
{
count++;
}
else
{
errCount++;
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({tempFile})");
}
}
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Обработано файлов - {count}. Пропущено файлов - {errCount}.");
}
// Вызов обработчика из кнопок
private void FileRenamerButton_Click(object sender, EventArgs e)
{
ActionHandler("Переименование файлов", "*.xml", "FileRenamer");
}
private void NamesTranslatorButton_Click(object sender, EventArgs e)
{
ActionHandler("Транскрипция имён", "*.txt", "NamesTranslator");
}
private void TagCollectorButton_Click(object sender, EventArgs e)
{
ActionHandler("Сбор статистики тегов", "*.xml", "TagCollector");
}
private void FileFixerButton_Click(object sender, EventArgs e)
{
ActionHandler("Поиск сломанных файлов", "*.xml", "FileFixer");
}
private void EncodingFixerButton_Click(object sender, EventArgs e)
{
ActionHandler("Исправление кодировки", "*.xml", "EncodingFixer");
}
private void CommentInserterButton_Click(object sender, EventArgs e)
{
ActionHandler("Добавление комментариев", "*.xml", "CommentInserter");
}
#endregion
#region LanguageUpdate
// Обновление локализации
private void ButtonLanguageUpdate_Click(object sender, EventArgs e)
{
InfoTextBox2.AppendText($"{TimeSetter.PlaceTime()}Запуск: обновление перевода игры");
(bool, string) result;
result = LanguageUpdater.TranslationVersionCheckActivity(Settings.Default.sha, Settings.Default.repo);
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2}");
if (result.Item1 == false)
return;
result = LanguageUpdater.LanguageUpdateDownload(Settings.Default.repo);
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2}");
if (result.Item1 == false)
return;
result = LanguageUpdater.LanguageUpdateActivity(GamePath, Settings.Default.language);
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2}");
if (result.Item1 == false)
return;
Settings.Default["sha"] = LanguageUpdater.GetSha();
Settings.Default.Save();
}
// Удаление скачанного перевода
private void ResetButton_Click(object sender, EventArgs e)
{
// Получения списка дополнений
string[] modules = Directory.GetDirectories($"{GamePath}\\Data");
if (modules.Length == 0)
{
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}В указанной папке не обнаружены модули");
return;
}
string resultString = "Будут удалены следующие папки:";
string language = Settings.Default.language;
for (int i = 0; i < modules.Length; i++)
{
modules[i] += $"\\Languages\\{language}";
resultString += $"{Environment.NewLine}{modules[i]}";
}
DialogResult res = MessageBox.Show(resultString, "Подтверждение", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (res == DialogResult.OK)
{
Settings.Default["sha"] = "00000000";
Settings.Default.Save();
for (int i = 0; i < modules.Length; i++)
{
if (Directory.Exists(modules[i]))
{
Directory.Delete(modules[i], true);
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Папка {modules[i]} удалена");
}
else
{
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Папка {modules[i]} не найдена");
}
}
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Удаление перевода завершено");
}
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Удаление перевода отменено");
}
// Сброс настроек к значеним по умолчанию
private void DefaultButton_Click(object sender, EventArgs e)
{
Settings.Default["sha"] = "00000000";
Settings.Default["repo"] = "Ludeon/RimWorld-ru";
Settings.Default["language"] = "Russian (GitHub)";
Settings.Default["savedDirectory"] = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\RimWorld";
Settings.Default.Save();
if (Directory.Exists("C:\\Program Files (x86)\\Steam\\steamapps\\common\\RimWorld"))
{
GamePath = Settings.Default.savedDirectory;
}
else
{
GamePath = string.Empty;
}
RepoInput.Text = Settings.Default.repo;
LanguageInput.Text = Settings.Default.language;
FolderTextBox2.Text = GamePath;
InfoTextBox2.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Настройки программы (перевода) сброшены к значениям по умолчанию");
}
private void RepoInput_TextChanged(object sender, EventArgs e)
{
Settings.Default["repo"] = "Ludeon/RimWorld-ru";
Settings.Default.Save();
}
private void LanguageInput_TextChanged(object sender, EventArgs e)
{
Settings.Default["language"] = "Russian (GitHub)";
Settings.Default.Save();
}
private void FolderButton2_Click(object sender, EventArgs e)
{
FolderBrowserDialog ofd = new();
DialogResult dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
GamePath = ofd.SelectedPath;
FolderTextBox2.Text = GamePath;
}
}
private void FolderTextBox2_TextChanged(object sender, EventArgs e)
{
string tempPath = FolderTextBox2.Text;
string path = $"{tempPath}\\Version.txt";
if (File.Exists(path))
{
ButtonLanguageUpdate.Enabled = true;
ResetButton.Enabled = true;
GamePath = tempPath;
Settings.Default["savedDirectory"] = tempPath;
Settings.Default.Save();
FolderButton2.BackColor = goodColor;
}
else
{
ButtonLanguageUpdate.Enabled = false;
ResetButton.Enabled = false;
FolderButton2.BackColor = badColor;
}
}
#endregion
}
}