Skip to content

Commit

Permalink
Only prompt for WASM update if it changed (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilenns authored and DocMoebiuz committed Feb 5, 2024
1 parent 5659645 commit 9b31a71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions SimConnectMSFS/WasmModuleUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,19 @@ public bool WasmModulesAreDifferent()

string installedWASM;
string mobiflightWASM;
string installedEvents;
string mobiflightEvents;

if (CommunityFolder == null) return true;


if (!File.Exists(CommunityFolder + $@"\mobiflight-event-module\modules\{WasmModuleName}"))
string wasmModulePath = Path.Combine(CommunityFolder, @"mobiflight-event-module\modules\", WasmModuleName);
if (!File.Exists(wasmModulePath))
{
return true;
}

installedWASM = CalculateMD5(CommunityFolder + $@"\mobiflight-event-module\modules\{WasmModuleName}");
mobiflightWASM = CalculateMD5($@".\MSFS2020-module\mobiflight-event-module\modules\{WasmModuleName}");

installedEvents = CalculateMD5(CommunityFolder + $@"\mobiflight-event-module\modules\{WasmEventsTxtFile}");
mobiflightEvents = CalculateMD5($@".\MSFS2020-module\mobiflight-event-module\modules\{WasmEventsTxtFile}");

return (installedWASM != mobiflightWASM || installedEvents != mobiflightEvents);
return installedWASM != mobiflightWASM;
}

public bool InstallWasmEvents()
Expand Down
2 changes: 1 addition & 1 deletion UI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private void OnFirstStart()

// MSFS2020
WasmModuleUpdater updater = new WasmModuleUpdater();
if (updater.AutoDetectCommunityFolder())
if (updater.AutoDetectCommunityFolder() && updater.WasmModulesAreDifferent())
{
// MSFS2020 installed
Msfs2020StartupForm msfsForm = new Msfs2020StartupForm();
Expand Down

0 comments on commit 9b31a71

Please sign in to comment.