From 13b258b1422ae0fcaaced98dbd9869fb3a401b62 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Thu, 18 Apr 2024 12:54:52 +0200 Subject: [PATCH] Added a new public property AdvancedFeaturesSupported to CurrentPlatform class. --- src/corelib/CurrentPlatform.cs | 5 +++++ src/corelib/IPlatform.cs | 5 +++++ src/corelib/PlatformWindows.cs | 5 +++++ src/srcrepair/FrmMainW.cs | 4 ++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/corelib/CurrentPlatform.cs b/src/corelib/CurrentPlatform.cs index 609b332e..5b1edf43 100644 --- a/src/corelib/CurrentPlatform.cs +++ b/src/corelib/CurrentPlatform.cs @@ -81,6 +81,11 @@ protected static string AddQuotesToPath(string Source) /// public virtual bool AutoUpdateSupported => false; + /// + /// Return whether advanced features are supported on this platform. + /// + public virtual bool AdvancedFeaturesSupported => false; + /// /// Immediately shut down application and return exit code. /// diff --git a/src/corelib/IPlatform.cs b/src/corelib/IPlatform.cs index 7514df47..a4c3b581 100644 --- a/src/corelib/IPlatform.cs +++ b/src/corelib/IPlatform.cs @@ -31,6 +31,11 @@ public interface IPlatform /// bool AutoUpdateSupported { get; } + /// + /// Return whether advanced features are supported on this platform. + /// + bool AdvancedFeaturesSupported { get; } + /// /// Immediately shut down application and return exit code. /// diff --git a/src/corelib/PlatformWindows.cs b/src/corelib/PlatformWindows.cs index 87cb68da..4a483edf 100644 --- a/src/corelib/PlatformWindows.cs +++ b/src/corelib/PlatformWindows.cs @@ -78,6 +78,11 @@ public override int StartElevatedProcess(string FileName) /// public override bool AutoUpdateSupported => true; + /// + /// Return whether advanced features are supported on this platform. + /// + public override bool AdvancedFeaturesSupported => true; + /// /// Get platform-dependent Steam installation folder (directory) name. /// diff --git a/src/srcrepair/FrmMainW.cs b/src/srcrepair/FrmMainW.cs index d8788255..47669212 100644 --- a/src/srcrepair/FrmMainW.cs +++ b/src/srcrepair/FrmMainW.cs @@ -678,7 +678,7 @@ private void RegisterPlugins() { try { - if (App.Platform.OS == CurrentPlatform.OSType.Windows) + if (App.Platform.AdvancedFeaturesSupported) { MNUWinMnuDisabler.Enabled = App.Plugins["kbhelper"].Installed; } @@ -708,7 +708,7 @@ private void SetAppStrings() private void ChangePrvControlState() { // Checking platform... - if (App.Platform.OS != CurrentPlatform.OSType.Windows) + if (!App.Platform.AdvancedFeaturesSupported) { // On Linux and MacOS we will disable some modules and features... MNUReportBuilder.Enabled = false;