示例#1
0
        private void ButtonSettings_Click(object sender, EventArgs e)
        {
            using (var settings = new Form_Settings())
            {
                SetChildFormCenter(settings);
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Settings;
                settings.ShowDialog();
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Main;

                if (settings.IsRestartNeeded)
                {
                    if (!settings.SetDefaults)
                    {
                        MessageBox.Show(
                            Tr("Settings change requires {0} to restart.", NHMProductInfo.Name),
                            Tr("Restart Notice"),
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    ApplicationStateManager.RestartProgram();
                    return;
                }
            }
            InitMainConfigGuiData();
            // TODO check this later
            IdleCheckManager.StartIdleCheck(ConfigManager.GeneralConfig.IdleCheckType, IdleCheck);
        }
示例#2
0
        // TODO this has nothing to do with Mian_Form
        private async void IdleCheck(object sender, IdleChangedEventArgs e)
        {
            if (!ConfigManager.GeneralConfig.StartMiningWhenIdle || _isManuallyStarted)
            {
                return;
            }

            // TODO set is mining here
            if (MiningState.Instance.IsCurrentlyMining)
            {
                if (!e.IsIdle)
                {
                    await ApplicationStateManager.StopAllDevice();

                    Logger.Info("NICEHASH", "Resumed from idling");
                }
            }
            else if (ApplicationStateManager.CurrentForm == ApplicationStateManager.CurrentFormState.Main && e.IsIdle)
            {
                Logger.Info("NICEHASH", "Entering idling state");
                if (StartMining(false) != StartMiningReturnType.StartMining)
                {
                    await ApplicationStateManager.StopAllDevice();
                }
            }
        }
示例#3
0
        private async void Form_Main_Shown(object sender, EventArgs e)
        {
            //// TODO temporary hooks
            ApplicationStateManager._ratesComunication = devicesListViewEnableControl1;
            // handle these callbacks differently
            //NiceHashStats.OnConnectionLost += ConnectionLostCallback;
            ApplicationStateManager.OnExchangeUpdate += UpdateExchange;

            foreach (Control c in Controls)
            {
                c.Enabled = false;
            }

            using (var loadingControl = new StartupLoadingControl(Tr("Loading, please wait...")))
            {
                Controls.Add(loadingControl);
                var location = new Point((Width - loadingControl.Width) / 2, (int)((Height - loadingControl.Height) * 0.3));
                loadingControl.Location = location;
                loadingControl.BringToFront();

                var progress = new Progress <(string loadMessageText, int perc)>(p =>
                {
                    loadingControl.Progress        = (int)p.perc;
                    loadingControl.LoadMessageText = p.loadMessageText;
                });

                var progressDownload = new Progress <(string loadMessageText, int perc)>(p =>
                {
                    loadingControl.ProgressSecond        = (int)p.perc;
                    loadingControl.LoadMessageTextSecond = p.loadMessageText;
                });
                await ApplicationStateManager.InitializeManagersAndMiners(loadingControl);
            }
            devicesListViewEnableControl1.SetComputeDevices(AvailableDevices.Devices.ToList());

            foreach (Control c in Controls)
            {
                c.Enabled = true;
            }

            // Data bindings
            InitDataBindings();
            textBoxBTCAddress_Validate();
            textBoxWorkerName_Validate();

            if (ConfigManager.GeneralConfig.AutoStartMining)
            {
                // well this is started manually as we want it to start at runtime
                _isManuallyStarted = true;
                if (StartMining(false) != StartMiningReturnType.StartMining)
                {
                    _isManuallyStarted = false;
                    ApplicationStateManager.StopAllDevice();
                }
            }
#if SHOW_TDP_SETTINGS
            var form_TDP = new Form_TDPSettings();
            form_TDP.Show();
#endif
        }
示例#4
0
        private void LinkLabelNewVersion_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // check if the NHM was installed
            var root        = new DirectoryInfo(Paths.Root);
            var isInstalled = false;

            foreach (var file in root.GetFiles("*.exe"))
            {
                if (file.Name == "Uninstall NiceHashMiner.exe")
                {
                    isInstalled = true;
                }
            }
            // end of installation checking
            if (!isInstalled)
            {
                ApplicationStateManager.VisitNewVersionUrl();
                return;
            }
            using (var updaterForm = new Form_ChooseUpdate())
            {
                SetChildFormCenter(updaterForm);
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Settings;
                updaterForm.ShowDialog();
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Main;
            }
        }
示例#5
0
 private void LinkLabelCheckStats_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (ConfigManager.CredentialsSettings.IsCredentialsValid == false)
     {
         return;
     }
     ApplicationStateManager.VisitMiningStatsPage();
 }
示例#6
0
 private void ButtonStartMining_Click(object sender, EventArgs e)
 {
     _isManuallyStarted = true;
     if (StartMining(true) == StartMiningReturnType.ShowNoMining)
     {
         _isManuallyStarted = false;
         ApplicationStateManager.StopAllDevice();
         MessageBox.Show(Tr("NiceHash Miner Legacy cannot start mining. Make sure you have at least one enabled device that has at least one enabled and benchmarked algorithm."),
                         Tr("Warning!"),
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
示例#7
0
        private async void textBoxWorkerName_Validate()
        {
            var trimmedWorkerNameText = textBoxWorkerName.Text.Trim();
            var result = await ApplicationStateManager.SetWorkerIfValidOrDifferent(trimmedWorkerNameText);

            if (ApplicationStateManager.SetResult.INVALID == result)
            {
                errorProvider1.SetError(textBoxWorkerName, Tr("Invalid workername!\n\nPlease enter a valid workername (Aa-Zz, 0-9, up to 15 character long)."));
            }
            else
            {
                errorProvider1.SetError(textBoxWorkerName, "");
            }
        }
示例#8
0
        private async void textBoxBTCAddress_Validate()
        {
            var trimmedBtcText = textBoxBTCAddress.Text.Trim();
            var result         = await ApplicationStateManager.SetBTCIfValidOrDifferent(trimmedBtcText);

            if (ApplicationStateManager.SetResult.INVALID == result)
            {
                errorProvider1.SetError(textBoxBTCAddress, Tr("Invalid Bitcoin address! {0} will start mining in DEMO mode. In the DEMO mode, you can test run the miner and be able see how much you can earn using your computer. Would you like to continue in DEMO mode?\n\nDISCLAIMER: YOU WILL NOT EARN ANYTHING DURING DEMO MODE!", NHMProductInfo.Name));
            }
            else
            {
                errorProvider1.SetError(textBoxBTCAddress, "");
            }
        }
示例#9
0
        private void LinkLabelNewVersion_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var isInstalled = UpdateHelpers.IsNHMInstalled();

            if (!isInstalled)
            {
                ApplicationStateManager.VisitNewVersionUrl();
                return;
            }
            using (var updaterForm = new Form_ChooseUpdate())
            {
                SetChildFormCenter(updaterForm);
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Update;
                updaterForm.ShowDialog();
                ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Main;
            }
        }
示例#10
0
        static void Main(string[] argv)
        {
            // Set working directory to exe
            var pathSet = false;
            var path    = Path.GetDirectoryName(Application.ExecutablePath);

            if (path != null)
            {
                Paths.SetRoot(path);
                Environment.CurrentDirectory = path;
                pathSet = true;
            }

            // Add common folder to path for launched processes
            var pathVar = Environment.GetEnvironmentVariable("PATH");

            pathVar += ";" + Path.Combine(Environment.CurrentDirectory, "common");
            Environment.SetEnvironmentVariable("PATH", pathVar);


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            // set security protocols
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls
                                                    | SecurityProtocolType.Tls11
                                                    | SecurityProtocolType.Tls12
                                                    | SecurityProtocolType.Ssl3;

            // #1 first initialize config
            ConfigManager.InitializeConfig();

#warning "TODO Ensure that there is only a single instance running at time. Currenly the restart is broken if we close on multiple instances"
            // #2 check if multiple instances are allowed
            if (ConfigManager.GeneralConfig.AllowMultipleInstances == false)
            {
                try
                {
                    var current = Process.GetCurrentProcess();
                    foreach (var process in Process.GetProcessesByName(current.ProcessName))
                    {
                        if (process.Id != current.Id)
                        {
                            // already running instance, return from Main
                            return;
                        }
                    }
                }
                catch { }
            }


            // TODO set logging level
            Logger.ConfigureWithFile(ConfigManager.GeneralConfig.LogToFile, Level.Info, ConfigManager.GeneralConfig.LogMaxFileSize);

            if (ConfigManager.GeneralConfig.DebugConsole)
            {
                PInvokeHelpers.AllocConsole();
                Logger.ConfigureConsoleLogging(Level.Info);
            }

            // init active display currency after config load
            ExchangeRateApi.ActiveDisplayCurrency = ConfigManager.GeneralConfig.DisplayCurrency;

            Logger.Info("NICEHASH", $"Starting up {ApplicationStateManager.Title}");

            if (!pathSet)
            {
                Logger.Info("NICEHASH", "Path not set to executable");
            }

            // check TOS
            if (ConfigManager.GeneralConfig.agreedWithTOS != ApplicationStateManager.CurrentTosVer)
            {
                Logger.Info("NICEHASH", $"TOS differs! agreed: {ConfigManager.GeneralConfig.agreedWithTOS} != Current {ApplicationStateManager.CurrentTosVer}. Showing TOS Form.");

                Application.Run(new FormEula());
                // check TOS after
                if (ConfigManager.GeneralConfig.agreedWithTOS != ApplicationStateManager.CurrentTosVer)
                {
                    Logger.Info("NICEHASH", "TOS differs AFTER TOS confirmation FORM");
                    // TOS not confirmed return from Main
                    return;
                }
            }

            // if config created show language select
            if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.Language))
            {
                if (Translations.GetAvailableLanguagesNames().Count > 1)
                {
                    Application.Run(new Form_ChooseLanguage());
                }
                else
                {
                    ConfigManager.GeneralConfig.Language = "en";
                    ConfigManager.GeneralConfigFileCommit();
                }
            }
            Translations.LanguageChanged += (s, e) => FormHelpers.TranslateAllOpenForms();
            Translations.SelectedLanguage = ConfigManager.GeneralConfig.Language;

            // if system requirements are not ensured it will fail the program
            var canRun = ApplicationStateManager.SystemRequirementsEnsured();
            if (!canRun)
            {
                return;
            }

            // 3rdparty miners TOS check if setting set
            if (ConfigManager.GeneralConfig.Use3rdPartyMinersTOS != ApplicationStateManager.CurrentTosVer)
            {
                using (var secondTOS = new Form_3rdParty_TOS())
                {
                    Application.Run(secondTOS);
                    if (!secondTOS.Accepted)
                    {
                        return;
                    }
                }
                ConfigManager.GeneralConfigFileCommit();
            }

#warning "Login form feature is missing (only discontinued old platform supports it)"
#if false
            // if no BTC address show login/register form
            if (ConfigManager.GeneralConfig.BitcoinAddress.Trim() == "")
            {
                Application.Run(new EnterBTCDialogSwitch());
            }
#endif

            Application.Run(new Form_Main());
        }
示例#11
0
        // TODO this thing needs to be completely removed
        // TODO this will be moved outside of GUI code, replace textBoxBTCAddress.Text with ConfigManager.GeneralConfig.BitcoinAddress
        private StartMiningReturnType StartMining(bool showWarnings)
        {
            //if (ConfigManager.GeneralConfig.BitcoinAddress.Equals(""))
            //{
            //    if (showWarnings)
            //    {
            //        var result = MessageBox.Show(Tr("You have not entered a bitcoin address. {0} will start mining in DEMO mode. In the DEMO mode, you can test run the miner and be able see how much you can earn using your computer. Would you like to continue in DEMO mode?\n\nDISCLAIMER: YOU WILL NOT EARN ANYTHING DURING DEMO MODE!"),
            //            Tr("Start mining in DEMO mode?"),
            //            MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            //        if (result == DialogResult.Yes)
            //        {
            //            _demoMode = true;
            //            //labelDemoMode.Visible = true;
            //        }
            //        else
            //        {
            //            return StartMiningReturnType.IgnoreMsg;
            //        }
            //    }
            //    else
            //    {
            //        return StartMiningReturnType.IgnoreMsg;
            //    }
            //}
            ////else if (!VerifyMiningAddress(true)) return StartMiningReturnType.IgnoreMsg; // TODO this whole shitty thing

            var hasData = NHSmaData.HasData;

            if (!showWarnings)
            {
                for (var i = 0; i < 10; i++)
                {
                    if (hasData)
                    {
                        break;
                    }
                    Thread.Sleep(1000);
                    hasData = NHSmaData.HasData;
                    Logger.Info("NICEHASH", $"After {i}s has data: {hasData}");
                }
            }

            if (!hasData)
            {
                Logger.Debug("NICEHASH", "No data received within timeout");
                if (showWarnings)
                {
                    MessageBox.Show(Tr("Unable to get NiceHash profitability data. If you are connected to internet, try again later."),
                                    Tr("Error!"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(StartMiningReturnType.IgnoreMsg);
            }

            var isMining = true;

            ApplicationStateManager.StartAllAvailableDevices();

            return(isMining ? StartMiningReturnType.StartMining : StartMiningReturnType.ShowNoMining);
        }
示例#12
0
 private async void ButtonStopMining_Click(object sender, EventArgs e)
 {
     _isManuallyStarted = false;
     await ApplicationStateManager.StopAllDevice();
 }
示例#13
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
#if __DESIGN_DEVELOP
            var designWindow = new __DESIGN_DEVELOP();
            designWindow.ShowDialog();
            return;
#endif
            RenderOptions.ProcessRenderMode         = RenderMode.SoftwareOnly;
            ApplicationStateManager.App             = this;
            ApplicationStateManager.ApplicationExit = () =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    this.Shutdown();
                });
            };
            var isLauncher  = Environment.GetCommandLineArgs().Contains("-lc");
            var launcherPID = ParseLauncherPID();
            Launcher.SetIsUpdated(Environment.GetCommandLineArgs().Contains("-updated"));
            Launcher.SetIsUpdatedFailed(Environment.GetCommandLineArgs().Contains("-updateFailed"));
            Launcher.SetIsLauncher(isLauncher);
            // Set working directory to exe
            var pathSet = false;
            var path    = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            if (path != null)
            {
                if (isLauncher)
                {
                    var oneUpPath = new Uri(Path.Combine(path, @"..\")).LocalPath;
                    Paths.SetRoot(oneUpPath);
                    Paths.SetAppRoot(path);
                    // TODO this might be problematic
                    Environment.CurrentDirectory = oneUpPath;
                }
                else
                {
                    Paths.SetRoot(path);
                    Paths.SetAppRoot(path);
                    Environment.CurrentDirectory = path;
                }
                pathSet = true;
            }

            // Add common folder to path for launched processes
            const string pathKey = "PATH";
            var          pathVar = Environment.GetEnvironmentVariable(pathKey);
            pathVar += $";{Path.Combine(Paths.AppRoot, "common")}";
            Environment.SetEnvironmentVariable(pathKey, pathVar);

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // Set security protocols
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls |
                                                    SecurityProtocolType.Tls11 |
                                                    SecurityProtocolType.Tls12 |
                                                    SecurityProtocolType.Ssl3;

            // Initialize config
            ConfigManager.InitializeConfig();

            ThemeSetterManager.SetTheme(GUISettings.Instance.DisplayTheme);

            // Check multiple instances
            if (!MiscSettings.Instance.AllowMultipleInstances)
            {
                try
                {
                    var current      = Process.GetCurrentProcess();
                    var processesIds = Process.GetProcessesByName(current.ProcessName).Select(p => p.Id);
                    if (processesIds.Any(pid => pid != current.Id && pid != launcherPID))
                    {
                        var singleInstanceNotice = new SingleInstanceNotice {
                        };
                        singleInstanceNotice.ShowDialog();
                        // Shutdown to exit
                        Shutdown();
                        return;
                    }
                }
                catch
                { }
            }

            // Init logger
            Logger.ConfigureWithFile(LoggingDebugConsoleSettings.Instance.LogToFile, Level.Info, LoggingDebugConsoleSettings.Instance.LogMaxFileSize);

            if (LoggingDebugConsoleSettings.Instance.DebugConsole)
            {
                PInvokeHelpers.AllocConsole();
                Logger.ConfigureConsoleLogging(Level.Info);
            }

            if (!pathSet)
            {
                Logger.Warn(Tag, "Path not set to executable");
            }

            // Set to explicit shutdown or else these intro windows will cause shutdown
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            Logger.Info(Tag, $"Starting up {ApplicationStateManager.Title}");
            if (ToSSetings.Instance.AgreedWithTOS != ApplicationStateManager.CurrentTosVer)
            {
                Logger.Info(Tag, $"TOS differs! agreed: {ToSSetings.Instance.AgreedWithTOS} != Current {ApplicationStateManager.CurrentTosVer}");

                var eula     = new EulaWindowFirstLong {
                };
                var accepted = eula.ShowDialog();
                if (accepted.HasValue && eula.AcceptedTos)
                {
                    ToSSetings.Instance.AgreedWithTOS = ApplicationStateManager.CurrentTosVer;
                }
                else
                {
                    Logger.Error(Tag, "TOS differs AFTER TOS confirmation window");
                    Shutdown();
                    return;
                }
            }

            // Check 3rd party miners TOS
            if (ToSSetings.Instance.Use3rdPartyMinersTOS != ApplicationStateManager.CurrentTosVer)
            {
                var thirdPty = new EulaWindowSecondShort {
                };
                thirdPty.ShowDialog();
                if (!thirdPty.Accepted)
                {
                    Logger.Error(Tag, "3rd party TOS not accepted");
                    Shutdown();
                    return;
                }
                ToSSetings.Instance.Use3rdPartyMinersTOS = ApplicationStateManager.CurrentTosVer;
                ConfigManager.GeneralConfigFileCommit();
            }

            // Chose lang
            if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language) && AppRuntimeSettings.ShowLanguage)
            {
                if (Translations.GetAvailableLanguagesNames().Count > 1)
                {
                    var lang = new ChooseLanguageWindow {
                    };
                    lang.ShowDialog();
                }
                // check if user didn't choose anything
                if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language))
                {
                    TranslationsSettings.Instance.Language = "en";
                }
                ConfigManager.GeneralConfigFileCommit();
            }
            else if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language) && !AppRuntimeSettings.ShowLanguage)
            {
                // while we have locale disabled set english
                TranslationsSettings.Instance.Language = "en";
                ConfigManager.GeneralConfigFileCommit();
            }

            Translations.SelectedLanguage = TranslationsSettings.Instance.Language;

            // Check sys requirements
            var canRun = ApplicationStateManager.SystemRequirementsEnsured();
            if (!canRun)
            {
                Shutdown();
                return;
            }

#if ENABLE_LOGIN
            FilterOSSpecific.GetWindowsVersion();
            // show login if no BTC
            if (!CredentialsSettings.Instance.IsBitcoinAddressValid && AppRuntimeSettings.ShowLoginWindow && SystemVersion.BuildNumber >= 17110)
            {
                var login = new LoginWindow {
                };
                var nek   = login.ShowDialog();
            }
#endif
            if (!CredentialsSettings.Instance.IsBitcoinAddressValid)
            {
                var btcNotice = new DemoBTCNotice {
                };
                btcNotice.ShowDialog();
            }

            var main = new MainWindow();
            main.Show();

            //// Set shutdown mode back to default
            //ShutdownMode = ShutdownMode.OnLastWindowClose;
        }
示例#14
0
 private void LinkLabelNewVersion_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ApplicationStateManager.VisitNewVersionUrl();
 }
示例#15
0
        static void Main(string[] argv)
        {
            BUILD_TAG.ASSERT_COMPATIBLE_BUILDS();
            // Set working directory to exe
            var pathSet = false;
            var path    = Path.GetDirectoryName(Application.ExecutablePath);

            if (path != null)
            {
                Paths.SetRoot(path);
                Environment.CurrentDirectory = path;
                pathSet = true;
            }

            // Add common folder to path for launched processes
            var pathVar = Environment.GetEnvironmentVariable("PATH");

            pathVar += ";" + Path.Combine(Environment.CurrentDirectory, "common");
            Environment.SetEnvironmentVariable("PATH", pathVar);


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            // set security protocols
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls
                                                    | SecurityProtocolType.Tls11
                                                    | SecurityProtocolType.Tls12
                                                    | SecurityProtocolType.Ssl3;

            // #1 first initialize config
            ConfigManager.InitializeConfig();

//            // PRODUCTION NEW
//#if (TESTNET || TESTNETDEV || PRODUCTION_NEW)
//            // TODO disable this as it breaks restart functionality
//            //// on new production we allow only one instance
//            //try
//            //{
//            //    var current = Process.GetCurrentProcess();
//            //    foreach (var process in Process.GetProcessesByName(current.ProcessName))
//            //    {
//            //        if (process.Id != current.Id)
//            //        {
//            //            // already running instance, return from Main
//            //            MessageBox.Show(Tr("{0} can run only one instance at a time.", NHMProductInfo.Name),
//            //            Tr("{0} Already Running", NHMProductInfo.Name),
//            //            MessageBoxButtons.OK, MessageBoxIcon.Error);
//            //            return;
//            //        }
//            //    }
//            //}
//            //catch { }
//#else
//            // PRODUCTION OLD
            // #2 check if multiple instances are allowed
            if (ConfigManager.GeneralConfig.AllowMultipleInstances == false)
            {
                try
                {
                    var current = Process.GetCurrentProcess();
                    foreach (var process in Process.GetProcessesByName(current.ProcessName))
                    {
                        if (process.Id != current.Id)
                        {
                            // already running instance, return from Main
                            return;
                        }
                    }
                }
                catch { }
            }
//#endif


            // TODO set logging level
            Logger.ConfigureWithFile(ConfigManager.GeneralConfig.LogToFile, Level.Info, ConfigManager.GeneralConfig.LogMaxFileSize);

            if (ConfigManager.GeneralConfig.DebugConsole)
            {
                PInvokeHelpers.AllocConsole();
            }

            // init active display currency after config load
            ExchangeRateApi.ActiveDisplayCurrency = ConfigManager.GeneralConfig.DisplayCurrency;

            Logger.Info("NICEHASH", $"Starting up {ApplicationStateManager.Title}");

            if (!pathSet)
            {
                Logger.Info("NICEHASH", "Path not set to executable");
            }

            // check TOS
            if (ConfigManager.GeneralConfig.agreedWithTOS != ApplicationStateManager.CurrentTosVer)
            {
                Logger.Info("NICEHASH", $"TOS differs! agreed: {ConfigManager.GeneralConfig.agreedWithTOS} != Current {ApplicationStateManager.CurrentTosVer}. Showing TOS Form.");

                Application.Run(new FormEula());
                // check TOS after
                if (ConfigManager.GeneralConfig.agreedWithTOS != ApplicationStateManager.CurrentTosVer)
                {
                    Logger.Info("NICEHASH", "TOS differs AFTER TOS confirmation FORM");
                    // TOS not confirmed return from Main
                    return;
                }
            }

            // if config created show language select
            if (string.IsNullOrEmpty(ConfigManager.GeneralConfig.Language))
            {
                if (Translations.GetAvailableLanguagesNames().Count > 1)
                {
                    Application.Run(new Form_ChooseLanguage());
                }
                else
                {
                    ConfigManager.GeneralConfig.Language = "en";
                    ConfigManager.GeneralConfigFileCommit();
                }
            }
            Translations.SetLanguage(ConfigManager.GeneralConfig.Language);

            // if system requirements are not ensured it will fail the program
            var canRun = ApplicationStateManager.SystemRequirementsEnsured();

            if (!canRun)
            {
                return;
            }

            // 3rdparty miners TOS check if setting set
            if (ConfigManager.GeneralConfig.Use3rdPartyMiners == Use3rdPartyMiners.NOT_SET)
            {
                Application.Run(new Form_3rdParty_TOS());
                ConfigManager.GeneralConfigFileCommit();
            }

            // PRODUCTION
#if !(TESTNET || TESTNETDEV || PRODUCTION_NEW)
            // if no BTC address show login/register form
            if (ConfigManager.GeneralConfig.BitcoinAddress.Trim() == "")
            {
                Application.Run(new EnterBTCDialogSwitch());
            }
#endif
            Application.Run(new Form_Main());
        }