Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation system config reading fix #476

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ClientCore/ClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,21 @@ private List<TranslationGameFile> ParseTranslationGameFiles()
{
List<TranslationGameFile> gameFiles = new();

for (int i = 0; clientDefinitionsIni.KeyExists(TRANSLATIONS, $"GameFile{i}"); i++)
foreach (string key in clientDefinitionsIni.GetSectionKeys(TRANSLATIONS))
{
// the syntax is GameFileX=path/to/source.file,path/to/destination.file[,checked]
string value = clientDefinitionsIni.GetStringValue(TRANSLATIONS, $"GameFile{i}", string.Empty);

if (!key.StartsWith("GameFile", System.StringComparison.Ordinal))
continue;

string value = clientDefinitionsIni.GetStringValue(TRANSLATIONS, key, string.Empty);
string[] parts = value.Split(',', StringSplitOptions.TrimEntries);

// fail explicitly if the syntax is wrong
if (parts.Length is < 2 or > 3
|| (parts.Length == 3 && parts[2].ToUpperInvariant() != "CHECKED"))
{
throw new IniParseException($"Invalid syntax for value of GameFile{i}! " +
throw new IniParseException($"Invalid syntax for value of {key}! " +
$"Expected path/to/source.file,path/to/destination.file[,checked], read {value}.");
}

Expand Down