Exemplo n.º 1
0
 private string ProcessTag(MinerPID_Data pidData)
 {
     return String.Format("[pid({0})|bin({1})]", pidData.PID, pidData.minerBinPath);
 }
Exemplo n.º 2
0
        protected virtual 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.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;
            }
        }
Exemplo n.º 3
0
 private string ProcessTag(MinerPID_Data pidData)
 {
     return(String.Format("[pid({0})|bin({1})]", pidData.PID, pidData.minerBinPath));
 }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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 (IsNeverHideMiningWindow)
            {
                P.StartInfo.CreateNoWindow = false;
                ////not working
                //if (ConfigManager.GeneralConfig.HideMiningWindows) {
                //    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();
                    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);
            }
        }