-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installer improvement, Installer checks for SimHub plugin
Issue #134
- Loading branch information
1 parent
6b7e342
commit e16fd63
Showing
7 changed files
with
155 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System.Diagnostics; | ||
using System.IO; | ||
using Microsoft.Win32; | ||
using StreamDeckSimHub.Installer.Tools; | ||
|
||
namespace StreamDeckSimHub.Installer.Actions; | ||
|
||
public class VerifySimHubPlugin : AbstractInstallerAction | ||
{ | ||
public override string Name => "Verify SimHub installation and SimHub Property Server plugin"; | ||
|
||
protected override Task<ActionResult> ExecuteInternal() | ||
{ | ||
var installFolder = GetSimHubInstallFolder(); | ||
if (!File.Exists(Path.Combine(installFolder, "SimHubWPF.exe"))) | ||
{ | ||
SetAndLogInfo("Could not find SimHub installation. SimHub is required for this plugin."); | ||
return Task.FromResult(ActionResult.Warning); | ||
} | ||
|
||
if (!File.Exists(Path.Combine(installFolder, "PropertyServer.dll"))) | ||
{ | ||
SetAndLogInfo($"Could not find SimHub Property Server plugin. Is is required for this plugin. Please install it from {Configuration.SimHubPluginUrl}"); | ||
return Task.FromResult(ActionResult.Warning); | ||
} | ||
|
||
var pluginVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(installFolder, "PropertyServer.dll")); | ||
Version pluginVersion = new(pluginVersionInfo.ProductMajorPart, pluginVersionInfo.ProductMinorPart, pluginVersionInfo.ProductBuildPart); | ||
if (pluginVersion < Configuration.RequiredSimHubPluginVersion) | ||
{ | ||
SetAndLogInfo($"SimHub Property Server plugin is too old. Found version {pluginVersion}, required version is {Configuration.RequiredSimHubPluginVersion}. Please update the SimHub Property Server plugin by visiting {Configuration.SimHubPluginUrl}"); | ||
return Task.FromResult(ActionResult.Warning); | ||
} | ||
|
||
SetAndLogInfo("Found SimHub and the SimHub Property Server plugin."); | ||
return Task.FromResult(ActionResult.Success); | ||
} | ||
|
||
private string GetSimHubInstallFolder() | ||
{ | ||
var installPath = (string?) Registry.GetValue(Configuration.SimHubRegistryFolder, Configuration.SimHubRegistryInstallFolder, null); | ||
if (!string.IsNullOrEmpty(installPath)) | ||
{ | ||
SetAndLogInfo($"Found SimHub directory in registry: {installPath}"); | ||
return installPath; | ||
} | ||
|
||
SetAndLogInfo($"Could not find SimHub directory in registry. Using default."); | ||
return Configuration.StreamDeckDefaultInstallFolder; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters