Skip to content

Commit

Permalink
Protection against bad conversion output
Browse files Browse the repository at this point in the history
Added a little more relisience to the conversion process.
  • Loading branch information
coldino committed Jan 22, 2018
1 parent 8da8bda commit 22ff9f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 11 additions & 3 deletions LarkatorGUI/ArkReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public async Task PerformConversion(bool force = false)
if (force || IsConversionRequired())
{
await RunArkTools();
ClassMapping.Clear();
}

if (ClassMapping.Count == 0)
Expand Down Expand Up @@ -76,8 +75,14 @@ private async Task RunArkTools()
}

executing = true;
await ExecuteArkTools(Tamed ? "tamed" : "wild", Properties.Settings.Default.SaveFile, outputDir);
executing = false;
try
{
await ExecuteArkTools(Tamed ? "tamed" : "wild", Properties.Settings.Default.SaveFile, outputDir);
}
finally
{
executing = false;
}

// Clear previously loaded data
ClassMapping.Clear();
Expand Down Expand Up @@ -110,6 +115,9 @@ private async Task LoadClassesJson()
.Select(mapping => new { Cls = mapping["cls"].Value<string>(), Name = mapping["name"].Value<string>() })
.Where(m => !m.Cls.Contains("BP_Ocean_C"))
.ToDictionary(m => m.Name, m => m.Cls);

if (ClassMapping.Count <= 0)
throw new ExternalToolsException("ARK Tools produced no classes output");
}

private async Task LoadSpecies(string speciesName)
Expand Down
2 changes: 2 additions & 0 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ private async Task UpdateArkToolsData()

private async Task ReReadArk(bool force = false)
{
if (IsLoading) return;

await PerformConversion(force);
await LoadSearchSpecies();

Expand Down

0 comments on commit 22ff9f5

Please sign in to comment.