virtual protected NiceHashProcess _Start() { PreviousTotalMH = 0.0; if (LastCommandLine.Length == 0) { return(null); } NiceHashProcess P = new NiceHashProcess(); if (WorkingDirectory.Length > 1) { P.StartInfo.WorkingDirectory = WorkingDirectory; } P.StartInfo.FileName = Path; P.ExitEvent = Miner_Exited; P.StartInfo.Arguments = LastCommandLine; if (Path != MinerPaths.eqm) { P.StartInfo.CreateNoWindow = ConfigManager.Instance.GeneralConfig.HideMiningWindows; } else { P.StartInfo.CreateNoWindow = false; } P.StartInfo.UseShellExecute = false; try { if (P.Start()) { IsRunning = true; _currentPidData = new MinerPID_Data(); _currentPidData.minerBinPath = P.StartInfo.FileName; _currentPidData.PID = P.Id; _allPidData.Add(_currentPidData); Helpers.ConsolePrint(MinerTAG(), "Starting miner " + ProcessTag() + " " + LastCommandLine); StartCoolDownTimerChecker(); isEnded = false; return(P); } else { Helpers.ConsolePrint(MinerTAG(), "NOT STARTED " + ProcessTag() + " " + LastCommandLine); return(null); } } catch (Exception ex) { Helpers.ConsolePrint(MinerTAG(), ProcessTag() + " _Start: " + ex.Message); return(null); } }
virtual protected NiceHashProcess _Start() { PreviousTotalMH = 0.0; if (LastCommandLine.Length == 0 || EnabledDeviceCount() == 0) { return(null); } Helpers.ConsolePrint(MinerDeviceName, "Starting miner: " + LastCommandLine); NiceHashProcess P = new NiceHashProcess(); if (WorkingDirectory.Length > 1) { P.StartInfo.WorkingDirectory = WorkingDirectory; } NumRetries = Config.ConfigData.MinerAPIGraceMinutes * 60 / Config.ConfigData.MinerAPIQueryInterval; if (AlgoNameIs("daggerhashimoto")) { NumRetries = Config.ConfigData.EthMinerAPIGraceMinutes * 60 / Config.ConfigData.MinerAPIQueryInterval; ER.Start(); P.StartInfo.FileName = Ethereum.EtherMinerPath; } else { P.StartInfo.FileName = Path; } P.StartInfo.Arguments = LastCommandLine; P.StartInfo.CreateNoWindow = Config.ConfigData.HideMiningWindows; //P.StartInfo.UseShellExecute = !Config.ConfigData.HideMiningWindows; P.StartInfo.UseShellExecute = false; //P.EnableRaisingEvents = true; //P.Exited += Miner_Exited; P.ExitEvent = Miner_Exited; try { if (P.Start()) { return(P); } else { return(null); } } catch (Exception ex) { Helpers.ConsolePrint(MinerDeviceName, "_Start: " + ex.Message); return(null); } }
virtual protected NiceHashProcess _Start() { // never start when ended if (isEnded) { return(null); } PreviousTotalMH = 0.0; if (LastCommandLine.Length == 0) { return(null); } NiceHashProcess P = new NiceHashProcess(); if (WorkingDirectory.Length > 1) { P.StartInfo.WorkingDirectory = WorkingDirectory; } if (MinersSettingsManager.MinerSystemVariables.ContainsKey(Path)) { foreach (var kvp in MinersSettingsManager.MinerSystemVariables[Path]) { string envName = kvp.Key; string envValue = kvp.Value; P.StartInfo.EnvironmentVariables[envName] = envValue; } } P.StartInfo.FileName = Path; P.ExitEvent = Miner_Exited; P.StartInfo.Arguments = LastCommandLine; if (IsNeverHideMiningWindow) { P.StartInfo.CreateNoWindow = false; if (ConfigManager.GeneralConfig.HideMiningWindows || ConfigManager.GeneralConfig.MinimizeMiningWindows) { P.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; P.StartInfo.UseShellExecute = true; } } else { P.StartInfo.CreateNoWindow = ConfigManager.GeneralConfig.HideMiningWindows; } P.StartInfo.UseShellExecute = false; try { if (P.Start()) { IsRunning = true; _currentPidData = new MinerPID_Data(); _currentPidData.minerBinPath = P.StartInfo.FileName; _currentPidData.PID = P.Id; _allPidData.Add(_currentPidData); Helpers.ConsolePrint(MinerTAG(), "Starting miner " + ProcessTag() + " " + LastCommandLine); StartCoolDownTimerChecker(); return(P); } else { Helpers.ConsolePrint(MinerTAG(), "NOT STARTED " + ProcessTag() + " " + LastCommandLine); return(null); } } catch (Exception ex) { Helpers.ConsolePrint(MinerTAG(), ProcessTag() + " _Start: " + ex.Message); return(null); } }
virtual protected NiceHashProcess _Start() { // check if dagger already running if (AlgoNameIs("daggerhashimoto") && ethminerProcess != null) { Helpers.ConsolePrint(MinerDeviceName, "Resuming ethminer.."); ethminerLink.StartMining(); IsRunning = true; return(null); } PreviousTotalMH = 0.0; if (LastCommandLine.Length == 0 || EnabledDeviceCount() == 0) { return(null); } NiceHashProcess P = new NiceHashProcess(); if (WorkingDirectory.Length > 1) { P.StartInfo.WorkingDirectory = WorkingDirectory; } NumRetries = Config.ConfigData.MinerAPIGraceSeconds / Config.ConfigData.MinerAPIQueryInterval; if (this is sgminer && !AlgoNameIs("daggerhashimoto")) { NumRetries = (Config.ConfigData.MinerAPIGraceSeconds + Config.ConfigData.MinerAPIGraceSecondsAMD) / Config.ConfigData.MinerAPIQueryInterval; } if (AlgoNameIs("daggerhashimoto")) { ethminerLink = new ethminerAPI((this is sgminer) ? Config.ConfigData.ethminerAPIPortAMD : Config.ConfigData.ethminerAPIPortNvidia); P.StartInfo.FileName = Ethereum.EtherMinerPath; P.ExitEvent = ethMiner_Exited; } else { P.StartInfo.FileName = Path; P.ExitEvent = Miner_Exited; } P.StartInfo.Arguments = LastCommandLine; P.StartInfo.CreateNoWindow = Config.ConfigData.HideMiningWindows; P.StartInfo.UseShellExecute = false; Helpers.ConsolePrint(MinerDeviceName, "Starting miner (" + P.StartInfo.FileName + "): " + LastCommandLine); try { if (P.Start()) { IsRunning = true; if (AlgoNameIs("daggerhashimoto")) { ethminerProcess = P; return(null); } return(P); } else { return(null); } } catch (Exception ex) { Helpers.ConsolePrint(MinerDeviceName, "_Start: " + ex.Message); return(null); } }