From abd010ac6567ee7e98dd3c7461f43266ac5e9758 Mon Sep 17 00:00:00 2001 From: Stanko Date: Fri, 12 Jul 2019 13:51:40 +0200 Subject: [PATCH] disable FirewallRules by default --- .../ApplicationStateManager.Init.cs | 20 +++++++++++-------- .../Configs/Data/GeneralConfig.cs | 7 +++++++ src/NiceHashMiner/Utils/FirewallRules.cs | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/NiceHashMiner/ApplicationStateManager/ApplicationStateManager.Init.cs b/src/NiceHashMiner/ApplicationStateManager/ApplicationStateManager.Init.cs index 50635db51..e2b4c971c 100644 --- a/src/NiceHashMiner/ApplicationStateManager/ApplicationStateManager.Init.cs +++ b/src/NiceHashMiner/ApplicationStateManager/ApplicationStateManager.Init.cs @@ -2,7 +2,6 @@ using NiceHashMiner.Configs; using NiceHashMiner.Devices; using NiceHashMiner.Forms.Components; -using NiceHashMiner.Miners; using NiceHashMiner.Miners.IntegratedPlugins; using NiceHashMiner.Plugin; using NiceHashMiner.Stats; @@ -10,10 +9,8 @@ using NHM.Common; using NHM.Common.Enums; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using NHM.DeviceDetection; @@ -194,12 +191,19 @@ public static async Task InitializeManagersAndMiners(StartupLoadingControl loadi VC_REDIST_x64_2015_DEPENDENCY_PLUGIN.Instance.InstallVcRedist(); // STEP - progress?.Report((Tr("Checking Firewall Rules..."), nextProgPerc())); - if (FirewallRules.IsFirewallRulesOutdated()) + if (FirewallRules.RunFirewallRulesOnStartup) { - // requires UAC - // TODO show message box - FirewallRules.UpdateFirewallRules(); + progress?.Report((Tr("Checking Firewall Rules..."), nextProgPerc())); + if (FirewallRules.IsFirewallRulesOutdated()) + { + // requires UAC + // TODO show message box + FirewallRules.UpdateFirewallRules(); + } + } + else + { + progress?.Report((Tr("Skipping Firewall Rules..."), nextProgPerc())); } // STEP diff --git a/src/NiceHashMiner/Configs/Data/GeneralConfig.cs b/src/NiceHashMiner/Configs/Data/GeneralConfig.cs index afcaa1a92..ebede0263 100644 --- a/src/NiceHashMiner/Configs/Data/GeneralConfig.cs +++ b/src/NiceHashMiner/Configs/Data/GeneralConfig.cs @@ -4,6 +4,7 @@ using NiceHashMiner.Miners; using NiceHashMiner.Switching; using NHM.Common.Enums; +using NiceHashMiner.Utils; namespace NiceHashMiner.Configs.Data { @@ -190,6 +191,12 @@ public bool CoolDownCheckEnabled public Point MainFormSize = new Point(1000, 400); + public bool RunFirewallRulesOnStartup + { + get => FirewallRules.RunFirewallRulesOnStartup; + set => FirewallRules.RunFirewallRulesOnStartup = value; + } + public bool UseEthlargement { get => NiceHashMiner.Configs.ThirdPartyMinerSettings.Instance.UseEthlargement; diff --git a/src/NiceHashMiner/Utils/FirewallRules.cs b/src/NiceHashMiner/Utils/FirewallRules.cs index 37cae32a5..73ca87dd1 100644 --- a/src/NiceHashMiner/Utils/FirewallRules.cs +++ b/src/NiceHashMiner/Utils/FirewallRules.cs @@ -10,6 +10,7 @@ namespace NiceHashMiner.Utils { public static class FirewallRules { + public static bool RunFirewallRulesOnStartup { get; set; } = false; static string _firewallRulesAddedFilePath => Path.Combine("internals", "firewall_rules_added.json"); private static List _pluginsUUIDsWithVersions = new List();