Skip to content

Commit 9fb8c3c

Browse files
committed
Переход на Net 9 и версия 3.6.2
1 parent 4bf8967 commit 9fb8c3c

15 files changed

Lines changed: 127 additions & 60 deletions

!publish.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
dotnet publish RimLangKit.csproj -p:PublishProfile=Properties\PublishProfiles\WinNet8.pubxml
2-
dotnet publish RimLangKit.csproj -p:PublishProfile=Properties\PublishProfiles\WinNet8Standalone.pubxml
1+
dotnet publish RimLangKit.csproj -p:PublishProfile=Properties\PublishProfiles\WinNet9.pubxml
2+
dotnet publish RimLangKit.csproj -p:PublishProfile=Properties\PublishProfiles\WinNet9Standalone.pubxml
33
pause

MainForm.cs

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public MainForm()
3737
// Обновление настроек
3838
if (Settings.Default.firstLaunch)
3939
{
40-
SendToInfoTextBox("Обновление настроек при первом запуске");
4140
Settings.Default.Upgrade();
4241
Settings.Default.firstLaunch = false;
4342
Settings.Default.Save();
43+
SendToInfoTextBox("Первый запуск. Обновление настроек завершено");
4444
}
4545

4646
// Установка версии программы
@@ -53,7 +53,9 @@ public MainForm()
5353
{
5454
version = version[..5];
5555
if (version.EndsWith(".0", StringComparison.OrdinalIgnoreCase))
56+
{
5657
version = version[..^2];
58+
}
5759
}
5860
VersionLabel.Text = "Версия " + version;
5961

@@ -167,6 +169,7 @@ private void UpdateButton_Click(object sender, EventArgs e)
167169
else
168170
{
169171
SendToInfoTextBox("Доступна новая версия программы. Её можно скачать на GitHub по ссылке справа");
172+
SendToInfoTextBox($"{json.name}. Что нового?{Environment.NewLine}{json.body}");
170173
UpdateButton.BackgroundImage = Properties.Resources.warn_c;
171174
LinkLabelGithub.Visible = true;
172175
}
@@ -200,7 +203,7 @@ private void LinkLabelInfo_LinkClicked(object sender, LinkLabelLinkClickedEventA
200203

201204
private void ButtonDarkMode_Click(object sender, EventArgs e)
202205
{
203-
if (Settings.Default.darkTheme == true)
206+
if (Settings.Default.darkTheme)
204207
{
205208
Settings.Default["darkTheme"] = false;
206209
SendToInfoTextBox("Хе-хе бой. Это светлая тема. Чтобы развидеть тёмную тему, перезапусти приложение.");
@@ -228,10 +231,13 @@ private void AdditionalFolderButton_Click(object sender, EventArgs e)
228231
private void SendToInfoTextBox(string text)
229232
{
230233
if (Settings.Default.lastTab == 0)
234+
{
231235
InfoTextBox.AppendText($"{Environment.NewLine}{text}");
236+
}
232237
else
238+
{
233239
InfoTextBox2.AppendText($"{Environment.NewLine}{text}");
234-
240+
}
235241
}
236242

237243
private void MainTabs_IndexChange(object sender, EventArgs e)
@@ -288,7 +294,9 @@ private void ActionHandler(string name, string mask, string code)
288294

289295
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Завершено. Обработано файлов - {count}");
290296
if (errCount != 0)
297+
{
291298
InfoTextBox.AppendText($"{Environment.NewLine}Пропущено файлов - {errCount}");
299+
}
292300

293301
// Постобработка
294302
switch (code)
@@ -324,12 +332,14 @@ private void FindChangesButton_Click(object sender, EventArgs e)
324332
string[] allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
325333
int count = 0;
326334
int errCount = 0;
327-
(bool, string) result = (false, string.Empty);
335+
(bool, string) result;
328336
foreach (string tempFile in allFiles)
329337
{
330338
result = ChangesFinder.GetTranslationData(tempFile);
331339
if (result.Item1)
340+
{
332341
count++;
342+
}
333343
else
334344
{
335345
errCount++;
@@ -345,7 +355,9 @@ private void FindChangesButton_Click(object sender, EventArgs e)
345355
{
346356
result = ChangesFinder.GetModData(tempFile);
347357
if (result.Item1)
358+
{
348359
count++;
360+
}
349361
else
350362
{
351363
errCount++;
@@ -365,19 +377,10 @@ private void CaseCreatorButton_Click(object sender, EventArgs e)
365377
string[] defTypeList = ["AbilityDef", "BodyDef", "BodyPartDef", "BodyPartGroupDef", "ChemicalDef", "FactionDef", "HediffDef", "MemeDef", "MentalBreakDef", "MentalFitDef", "MentalStateDef", "OrderedTakeGroupDef", "PawnCapacityDef", "PawnKindDef", "ScenarioDef", "SitePartDef", "SkillDef", "StyleCategoryDef", "ThingDef", "ToolCapacityDef", "WorldObjectDef", "XenotypeDef"];
366378
//Получение списка всех файлов в заданой директории и во всех вложенных подпапках за счёт SearchOption
367379
string[] allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
368-
Dictionary<string, string> words = new();
380+
Dictionary<string, string> words = [];
369381

370382
// Поиск подходящей директории
371-
string directory;
372-
if (Directory.Exists(DirectoryPath + "\\Common"))
373-
{
374-
directory = DirectoryPath + "\\Common";
375-
}
376-
else
377-
{
378-
directory = DirectoryPath;
379-
}
380-
383+
string directory = Directory.Exists(DirectoryPath + "\\Common") ? DirectoryPath + "\\Common" : DirectoryPath;
381384
int typeCount = 0;
382385
// Проверяется каждый подходящий DefType из списка
383386
foreach (string defType in defTypeList)
@@ -451,16 +454,18 @@ private void PreTranslatorButton_Click(object sender, EventArgs e)
451454
}
452455
result = PreTranslator.BuildDatabase(tempFile);
453456
if (result.Item1)
457+
{
454458
count++;
459+
}
455460
else
456461
{
457462
errCount++;
458463
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}{result.Item2} ({tempFile})");
459464
}
460465
}
461466
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Собрано {result.Item2} пар перевода. Обработано файлов - {count}. Пропущено файлов - {errCount}.");
462-
463-
467+
468+
464469
InfoTextBox.AppendText($"{Environment.NewLine}{TimeSetter.PlaceTime()}Начат предварительный перевод");
465470
allFiles = Directory.GetFiles(DirectoryPath, "*.xml", SearchOption.AllDirectories);
466471
count = 0;
@@ -469,7 +474,9 @@ private void PreTranslatorButton_Click(object sender, EventArgs e)
469474
{
470475
result = PreTranslator.Translation(tempFile);
471476
if (result.Item1)
477+
{
472478
count++;
479+
}
473480
else
474481
{
475482
errCount++;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<Configuration>Release</Configuration>
8+
<Platform>x64</Platform>
9+
<PublishDir>bin\Upload\Net8</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<_TargetId>Folder</_TargetId>
12+
<TargetFramework>net9.0-windows7.0</TargetFramework>
13+
<SelfContained>false</SelfContained>
14+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
15+
<PublishSingleFile>true</PublishSingleFile>
16+
<PublishReadyToRun>false</PublishReadyToRun>
17+
<DebugType>embedded</DebugType>
18+
</PropertyGroup>
19+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project>
6+
<PropertyGroup>
7+
<Configuration>Release</Configuration>
8+
<Platform>x64</Platform>
9+
<PublishDir>bin\Upload\RimLangKit</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<_TargetId>Folder</_TargetId>
12+
<TargetFramework>net9.0-windows7.0</TargetFramework>
13+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14+
<SelfContained>true</SelfContained>
15+
<PublishSingleFile>true</PublishSingleFile>
16+
<PublishReadyToRun>false</PublishReadyToRun>
17+
</PropertyGroup>
18+
</Project>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
## Системные требования
77
| Файл | ОС | .NET | ПЗУ |
88
| ------------- | ------------- | ------------- | ------------- |
9-
| RimLangKit.exe | Windows 10 x64 1607 и новее | [.NET 8](https://dotnet.microsoft.com/ru-ru/download) (любой вариант) | < 1 Мб |
10-
| RimLangKit.7z | Windows 10 x64 1607 и новее | - | ~ 150 Мб |
9+
| RimLangKit.exe | Windows 10 x64 1607 и новее | [.NET 9](https://dotnet.microsoft.com/ru-ru/download) (любой вариант) | < 0.5 Мб |
10+
| RimLangKit.7z | Windows 10 x64 1607 и новее | - | ~ 120 Мб |
1111

1212
Фактически программе ничто не мешает работать на x86 системах и (с минимальными правками кода) на более старых версиях Windows.
1313
Я не публикую для них сборки из-за их непопулярности, но вы можете собрать себе желаемую версию из исходников.

RimLangKit.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
5+
<TargetFramework>net9.0-windows7.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UseWindowsForms>true</UseWindowsForms>
88
<ImplicitUsings>enable</ImplicitUsings>
@@ -11,7 +11,7 @@
1111
<Platforms>x64</Platforms>
1212
<ApplicationIcon>images\icon.ico</ApplicationIcon>
1313
<PlatformTarget>x64</PlatformTarget>
14-
<Version>$(VersionPrefix)3.6.1</Version>
14+
<Version>$(VersionPrefix)3.6.2</Version>
1515
<RepositoryUrl>https://github.com/OneCodeUnit/RimLangKit</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
1717
<NeutralLanguage>ru</NeutralLanguage>

RimLanguageCore/Activities/CaseCreator.cs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ private static List<string> WordsExtract(string file)
2121
string nodeName = node.Name.ToString();
2222
StringComparison nodeComparison = StringComparison.OrdinalIgnoreCase;
2323
if ((nodeName.EndsWith(".label", nodeComparison) && !nodeName.Contains(".stages.") && !nodeName.Contains(".verbs.")) || nodeName.EndsWith(".chargeNoun", nodeComparison))
24+
{
2425
words.Add(node.Value);
26+
}
2527
}
2628
return words;
2729
}
@@ -49,35 +51,22 @@ public static void CreateCase(string directoryPath, Dictionary<string, string> w
4951
foreach (var word in words)
5052
{
5153
if (word.Value != defType)
54+
{
5255
continue;
56+
}
5357

5458
string tempWord = word.Key;
5559
Words result = MorpherHttpClient.GetMorpherWords(tempWord);
5660
// Case.txt
57-
string tempStringCase;
58-
if (result is null)
59-
{
60-
tempStringCase = $"{tempWord}; {tempWord}; {tempWord}; {tempWord}; {tempWord}; {tempWord}";
61-
}
62-
else
63-
{
64-
tempStringCase = $"{tempWord}; {result.Р}; {result.Д}; {result.В}; {result.Т}; {result.П}";
65-
}
61+
string tempStringCase = result is null
62+
? $"{tempWord}; {tempWord}; {tempWord}; {tempWord}; {tempWord}; {tempWord}"
63+
: $"{tempWord}; {result.Р}; {result.Д}; {result.В}; {result.Т}; {result.П}";
6664
writerCase.WriteLine(tempStringCase);
6765

6866
// Plural.txt
69-
if (result is null)
70-
{
71-
tempStringCase = $"{tempWord}; {tempWord}";
72-
}
73-
else if (result.множественное is null)
74-
{
75-
tempStringCase = string.Empty;
76-
}
77-
else
78-
{
79-
tempStringCase = $"{tempWord}; {result.множественное.И}";
80-
}
67+
tempStringCase = result is null
68+
? $"{tempWord}; {tempWord}"
69+
: result.множественное is null ? string.Empty : $"{tempWord}; {result.множественное.И}";
8170
writerPlural.WriteLine(tempStringCase);
8271
}
8372
writerCase.WriteLine();
@@ -121,7 +110,9 @@ public static void CreateGender(string directoryPath, Dictionary<string, string>
121110
foreach (var word in words)
122111
{
123112
if (word.Value != defType)
113+
{
124114
continue;
115+
}
125116

126117
writerUndefined.WriteLine(word.Key);
127118
}

RimLanguageCore/Activities/ChangesFinder.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public static (bool, string) GetTranslationData(string currentFile)
1818
{
1919
(bool, string) result = XmlErrorChecker.XmlErrorCheck(currentFile);
2020
if (!result.Item1)
21+
{
2122
return result;
23+
}
2224

2325
XmlReaderSettings settings = new() { DtdProcessing = DtdProcessing.Parse };
2426
XmlReader reader = XmlReader.Create(currentFile, settings);
@@ -56,7 +58,9 @@ public static (bool, string) GetModData(string currentFile)
5658
{
5759
(bool, string) result = XmlErrorChecker.XmlErrorCheck(currentFile);
5860
if (!result.Item1)
61+
{
5962
return result;
63+
}
6064

6165
XDocument xDoc = XDocument.Load(currentFile, LoadOptions.PreserveWhitespace);
6266
XElement root = xDoc.Element("LanguageData");

RimLanguageCore/Activities/CommentInserter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ public static (bool, string) CommentInserterActivity(string currentFile)
1010
{
1111
(bool, string) result = XmlErrorChecker.XmlErrorCheck(currentFile);
1212
if (!result.Item1)
13+
{
1314
return result;
15+
}
1416

1517
XDocument xDoc = XDocument.Load(currentFile, LoadOptions.PreserveWhitespace);
1618
XElement root = xDoc.Element("LanguageData");

RimLanguageCore/Activities/FileFixer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public static (bool, string) FileFixerActivity(string currentFile)
4747
public static string BrokenFilesWriterActivity()
4848
{
4949
if (BrokenFiles.Count == 0)
50-
return ("Не найдено сломанных файлов");
50+
{
51+
return "Не найдено сломанных файлов";
52+
}
5153

5254
string currentDirectory = Directory.GetCurrentDirectory();
5355
StreamWriter sw = new(Path.Combine(currentDirectory + "\\BrokenFiles.txt"), false);

0 commit comments

Comments
 (0)