Пример #1
0
        //This one accepts a MinerList as the passed argument, and uses the Executable and Arguments of that particular miner.
        public static int LaunchProcess(MinerList miner)
        {
            if (miner.minerDisabled)
            {
                return(0);
            }

            miner.launchAttempts++;

            string arguments = Config.isUserIdle ? miner.idleArguments : miner.activeArguments;

            miner.isMiningIdleSpeed = Config.isUserIdle;
            Utilities.ChangeAfterburnerProfile();

            if (arguments.Length == 0)
            {
                return(0);
            }

            if (Config.settings.runInUserSession && Config.isPipeConnected)
            {
                Config.client.PushMessage(new IdleMessage
                {
                    packetId  = (int)Config.PacketID.RunProgram,
                    isIdle    = false,
                    requestId = (int)Config.PacketID.None,
                    data      = miner.executable,
                    data2     = arguments
                });

                return(1);
            }
            else
            {
                ProcessStartInfo psi = new ProcessStartInfo();
                psi.RedirectStandardOutput = false;
                psi.RedirectStandardError  = false;
                psi.UseShellExecute        = false;
                psi.WorkingDirectory       = Path.GetDirectoryName(miner.executable);

                Process proc = new Process();
                proc.StartInfo = psi;

                Debug("Starting Process " + miner.executable + " " + arguments);

                miner.isMiningIdleSpeed = Config.isUserIdle;

                try
                {
                    proc = Process.Start(miner.executable, arguments);
                }
                catch (Exception ex)
                {
                    Log("launchProcess miner: " + ex.ToString());
                }

                return(proc.Id);
            }
            return(-1);
        }
Пример #2
0
 private void UpdateMiner(MinerList miner)
 {
     miner.executable       = textExecutable.Text;
     miner.activeArguments  = textActive.Text;
     miner.idleArguments    = textIdleArgs.Text;
     miner.mineWhileNotIdle = checkMineNotIdle.Checked;
     miner.minerDisabled    = checkMinerDisabled.Checked;
 }
Пример #3
0
 private void PopulateMiner(MinerList miner)
 {
     textExecutable.Text        = miner.executable;
     textActive.Text            = miner.activeArguments;
     textIdleArgs.Text          = miner.idleArguments;
     checkMineNotIdle.Checked   = miner.mineWhileNotIdle;
     checkMinerDisabled.Checked = miner.minerDisabled;
 }
Пример #4
0
        public static bool IsProcessRunning(MinerList miner)
        {
            Process[] proc = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(miner.executable));

            if (proc.Length == 0)
            {
                return(false);
            }

            return(true);
        }
Пример #5
0
        //This one accepts a MinerList as the passed argument, and uses the Executable and Arguments of that particular miner.
        public static int LaunchProcess(MinerList miner)
        {
            if (miner.minerDisabled)
            {
                return(0);
            }

            miner.launchAttempts++;

            string arguments = Config.isUserIdle ? miner.idleArguments : miner.activeArguments;

            miner.isMiningIdleSpeed = Config.isUserIdle;

            if (arguments.Length == 0)
            {
                return(0);
            }

            ProcessStartInfo psi = new ProcessStartInfo();

            psi.RedirectStandardOutput = false;
            psi.RedirectStandardError  = false;
            psi.UseShellExecute        = false;
            psi.WorkingDirectory       = Path.GetDirectoryName(miner.executable);

            Process proc = new Process();

            proc.StartInfo = psi;

            Debug("Starting Process " + miner.executable + " " + arguments);

            miner.isMiningIdleSpeed = Config.isUserIdle;

            try
            {
                proc = Process.Start(miner.executable, arguments);
            }
            catch (Exception ex)
            {
                Log("launchProcess miner: " + ex.ToString());
            }
            return(proc.Id);
        }