コード例 #1
0
 virtual public void Restart()
 {
     Stop(); // stop miner first
     if (this is sgminer)
     {
         StartingUpDelay = true;
     }
     if (AlgoNameIs("ethereum"))
     {
         StartingUpDelay = true;
         Ethereum.StartProxy(false, "", "");
     }
     ProcessHandle = _Start(); // start with old command line
 }
コード例 #2
0
        virtual public void Stop()
        {
            if (ProcessHandle != null)
            {
                Helpers.ConsolePrint(MinerDeviceName, "Shutting down miner");
                try { ProcessHandle.Kill(); }
                catch { }
                ProcessHandle.Close();
                ProcessHandle   = null;
                StartingUpDelay = false;
                PreviousTotalMH = 0.0;

                if (AlgoNameIs("ethereum"))
                {
                    Ethereum.StopProxy();
                }
                else if (MinerDeviceName == "AMD_OpenCL")
                {
                    KillSGMiner();
                }
            }
        }
コード例 #3
0
ファイル: ccminer.cs プロジェクト: cduncan41/NiceHashMiner
        public override void Start(int nhalgo, string url, string username)
        {
            if (ProcessHandle != null)
            {
                return;                        // ignore, already running
            }
            Algorithm Algo = GetMinerAlgorithm(nhalgo);

            if (Algo == null)
            {
                return;
            }

            if (Algo.NiceHashName.Equals("ethereum"))
            {
                StartingUpDelay = true;

                // Create DAG file ahead of time
                if (!Ethereum.CreateDAGFile(MinerDeviceName))
                {
                    return;
                }

                // Starts up ether-proxy
                if (!Ethereum.StartProxy(true, url, username))
                {
                    return;
                }

                LastCommandLine = " --cuda -F http://127.0.0.1:" + Config.ConfigData.APIBindPortEthereumProxy + "/miner/10/" + MinerDeviceName + " " +
                                  " --erase-dags old" +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                                  " --cuda-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled)
                    {
                        LastCommandLine += EtherDevices[i] + " ";
                    }
                }
            }
            else
            {
                LastCommandLine = "--algo=" + Algo.MinerName +
                                  " --url=" + url +
                                  " --userpass="******":" + GetPassword(Algo) +
                                  " --api-bind=" + APIPort.ToString() +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " --devices ";

                foreach (ComputeDevice G in CDevs)
                {
                    if (G.Enabled)
                    {
                        LastCommandLine += G.ID.ToString() + ",";
                    }
                }

                if (LastCommandLine.EndsWith(","))
                {
                    LastCommandLine = LastCommandLine.Remove(LastCommandLine.Length - 1);
                }
                else
                {
                    LastCommandLine = "";
                    return; // no GPUs to start mining on
                }

                if (this is ccminer_sp && Algo.NiceHashName.Equals("neoscrypt"))
                {
                    Path = "bin\\ccminer_neoscrypt.exe";
                }
                else if (this is ccminer_sp)
                {
                    Path = "bin\\ccminer_sp.exe";
                }
            }

            ProcessHandle = _Start();
        }
コード例 #4
0
ファイル: ccminer.cs プロジェクト: cduncan41/NiceHashMiner
        protected override string BenchmarkCreateCommandLine(int index, int time)
        {
            string CommandLine = "";

            if (SupportedAlgorithms[index].NiceHashName.Equals("ethereum"))
            {
                CommandLine = " --benchmark-warmup 10 --benchmark-trial 20" +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                              " --cuda --cuda-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled)
                    {
                        CommandLine += i + " ";
                    }
                }

                CommandLine += " --benchmark ";
                if (Ethereum.GetCurrentBlock(MinerDeviceName))
                {
                    CommandLine += Ethereum.CurrentBlockNum;
                }

                // Check if dag-dir exist to avoid ethminer from crashing
                if (!Ethereum.CreateDAGDirectory(MinerDeviceName))
                {
                    return("");
                }
            }
            else
            {
                CommandLine = " --algo=" + SupportedAlgorithms[index].MinerName +
                              " --benchmark" +
                              " --time-limit " + time.ToString() +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --devices ";

                foreach (ComputeDevice G in CDevs)
                {
                    if (G.Enabled)
                    {
                        CommandLine += G.ID.ToString() + ",";
                    }
                }

                CommandLine = CommandLine.Remove(CommandLine.Length - 1);

                if (this is ccminer_sp && SupportedAlgorithms[index].NiceHashName.Equals("neoscrypt"))
                {
                    Path = "bin\\ccminer_neoscrypt.exe";
                }
                else if (this is ccminer_sp)
                {
                    Path = "bin\\ccminer_sp.exe";
                }
            }

            return(CommandLine);
        }
コード例 #5
0
ファイル: sgminer.cs プロジェクト: cduncan41/NiceHashMiner
        public override void Start(int nhalgo, string url, string username)
        {
            if (ProcessHandle != null)
            {
                return;                        // ignore, already running
            }
            Algorithm Algo = GetMinerAlgorithm(nhalgo);

            if (Algo == null)
            {
                Helpers.ConsolePrint(MinerDeviceName, "GetMinerAlgorithm(" + nhalgo + "): Algo equals to null");
                return;
            }

            if (Algo.NiceHashName.Equals("ethereum"))
            {
                StartingUpDelay = true;

                // Check if dag-dir exist to avoid ethminer from crashing
                if (!Directory.Exists(Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName))
                {
                    Directory.CreateDirectory(Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName);
                }

                // Create DAG file ahead of time
                if (!Ethereum.CreateDAGFile(MinerDeviceName))
                {
                    return;
                }

                // Starts up ether-proxy
                if (!Ethereum.StartProxy(true, url, username))
                {
                    return;
                }

                WorkingDirectory = "";
                LastCommandLine  = " --opencl --opencl-platform " + GPUPlatformNumber +
                                   " --erase-dags old" +
                                   " " + ExtraLaunchParameters +
                                   " " + Algo.ExtraLaunchParameters +
                                   " -F http://127.0.0.1:" + Config.ConfigData.APIBindPortEthereumProxy + "/miner/10/" + MinerDeviceName +
                                   " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                                   " --opencl-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled)
                    {
                        LastCommandLine += i + " ";
                    }
                }
            }
            else
            {
                StartingUpDelay = true;

                Path             = "sgminer.exe";
                WorkingDirectory = GetMinerDirectory(Algo.NiceHashName);

                LastCommandLine = " --gpu-platform " + GPUPlatformNumber +
                                  " -k " + Algo.MinerName +
                                  " --url=" + url +
                                  " --userpass="******":" + GetPassword(Algo) +
                                  " --api-listen" +
                                  " --api-port=" + APIPort.ToString() +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " --device ";

                foreach (ComputeDevice G in CDevs)
                {
                    if (G.Enabled)
                    {
                        LastCommandLine += G.ID.ToString() + ",";
                    }
                }

                if (LastCommandLine.EndsWith(","))
                {
                    LastCommandLine = LastCommandLine.Remove(LastCommandLine.Length - 1);
                }
                else
                {
                    LastCommandLine = "";
                    return; // no GPUs to start mining on
                }

                if (Config.ConfigData.DisableAMDTempControl == false)
                {
                    LastCommandLine += TemperatureParam;
                }

                if (Config.ConfigData.HideMiningWindows)
                {
                    LastCommandLine = " /C \"cd /d " + WorkingDirectory +
                                      " && " + Path + LastCommandLine + "\"";
                    Path = "cmd";
                }
            }

            ProcessHandle = _Start();
        }
コード例 #6
0
ファイル: sgminer.cs プロジェクト: cduncan41/NiceHashMiner
        protected override string BenchmarkCreateCommandLine(int index, int time)
        {
            Algorithm Algo = GetMinerAlgorithm(SupportedAlgorithms[index].NiceHashID);

            if (Algo == null)
            {
                Helpers.ConsolePrint(MinerDeviceName, "GetMinerAlgorithm(" + index + "): Algo equals to null");
                return("");
            }

            string CommandLine;

            if (Algo.NiceHashName.Equals("ethereum"))
            {
                CommandLine = " --opencl --opencl-platform " + GPUPlatformNumber +
                              " " + ExtraLaunchParameters +
                              " " + Algo.ExtraLaunchParameters +
                              " --benchmark-warmup 10 --benchmark-trial 20" +
                              " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                              " --opencl-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled)
                    {
                        CommandLine += i + " ";
                    }
                }

                CommandLine += " --benchmark ";
                if (Ethereum.GetCurrentBlock(MinerDeviceName))
                {
                    CommandLine += Ethereum.CurrentBlockNum;
                }

                // Check if dag-dir exist to avoid ethminer from crashing
                if (!Ethereum.CreateDAGDirectory(MinerDeviceName))
                {
                    return("");
                }
            }
            else
            {
                Path = "cmd";
                string DirName = GetMinerDirectory(Algo.NiceHashName);

                string url = "stratum+tcp://" + Form1.NiceHashData[SupportedAlgorithms[index].NiceHashID].name + "." +
                             Form1.MiningLocation[Config.ConfigData.Location] + ".nicehash.com:" +
                             Form1.NiceHashData[SupportedAlgorithms[index].NiceHashID].port;

                string username = Config.ConfigData.BitcoinAddress.Trim();
                if (Config.ConfigData.WorkerName.Length > 0)
                {
                    username += "." + Config.ConfigData.WorkerName.Trim();
                }

                CommandLine = " /C \"cd /d " + DirName + " && sgminer.exe " +
                              " --gpu-platform " + GPUPlatformNumber +
                              " -k " + SupportedAlgorithms[index].MinerName +
                              " --url=" + url +
                              " --userpass="******":" + GetPassword(Algo) +
                              " --sched-stop " + DateTime.Now.AddMinutes(time).ToString("HH:mm") +
                              " -T --log 10 --log-file dump.txt" +
                              " --api-listen" +
                              " --api-port=" + APIPort.ToString() +
                              " --api-allow W:127.0.0.1" +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --device ";

                foreach (ComputeDevice G in CDevs)
                {
                    if (G.Enabled)
                    {
                        CommandLine += G.ID.ToString() + ",";
                    }
                }

                CommandLine = CommandLine.Remove(CommandLine.Length - 1);
                if (Config.ConfigData.DisableAMDTempControl == false)
                {
                    CommandLine += TemperatureParam;
                }
                CommandLine += " && del dump.txt\"";
            }

            return(CommandLine);
        }
コード例 #7
0
        public override void Start(int nhalgo, string url, string username)
        {
            if (ProcessHandle != null)
            {
                return;                        // ignore, already running
            }
            Algorithm Algo = GetMinerAlgorithm(nhalgo);

            if (Algo == null)
            {
                Helpers.ConsolePrint(MinerDeviceName, "GetMinerAlgorithm(" + nhalgo + "): Algo equals to null");
                return;
            }

            if (Algo.NiceHashName.Equals("daggerhashimoto"))
            {
                // Check if dag-dir exist to avoid ethminer from crashing
                if (!Ethereum.CreateDAGDirectory(MinerDeviceName))
                {
                    return;
                }

                WorkingDirectory = "";
                LastCommandLine  = " --opencl --opencl-platform " + GPUPlatformNumber +
                                   " --erase-dags old" +
                                   " " + ExtraLaunchParameters +
                                   " " + Algo.ExtraLaunchParameters +
                                   " -S " + url.Substring(14) +
                                   " -O " + username + ":" + GetPassword(Algo) +
                                   " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                                   " --report-port " + APIPort.ToString() +
                                   " --opencl-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        LastCommandLine += i + " ";
                    }
                }
            }
            else
            {
                StartingUpDelay = true;

                Path             = "sgminer.exe";
                WorkingDirectory = GetMinerDirectory(Algo.NiceHashName);

                LastCommandLine = " --gpu-platform " + GPUPlatformNumber +
                                  " -k " + Algo.MinerName +
                                  " --url=" + url +
                                  " --userpass="******":" + GetPassword(Algo) +
                                  " --api-listen" +
                                  " --api-port=" + APIPort.ToString() +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " --device ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        LastCommandLine += CDevs[i].ID.ToString() + ",";
                    }
                }

                if (LastCommandLine.EndsWith(","))
                {
                    LastCommandLine = LastCommandLine.Remove(LastCommandLine.Length - 1);
                }
                else
                {
                    LastCommandLine = "";
                    return; // no GPUs to start mining on
                }

                if (Config.ConfigData.DisableAMDTempControl == false)
                {
                    LastCommandLine += TemperatureParam;
                }

                if (Config.ConfigData.HideMiningWindows)
                {
                    LastCommandLine = " /C \"cd /d " + WorkingDirectory +
                                      " && " + Path + LastCommandLine + "\"";
                    Path = "cmd";
                }
            }

            ProcessHandle = _Start();
        }
コード例 #8
0
        protected override string BenchmarkCreateCommandLine(int index, int time)
        {
            string CommandLine = "";

            if (SupportedAlgorithms[index].NiceHashName.Equals("daggerhashimoto"))
            {
                CommandLine = " --benchmark-warmup 40 --benchmark-trial 20" +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --cuda --cuda-devices ";

                int dagdev = -1;
                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled && !SupportedAlgorithms[index].DisabledDevice[i])
                    {
                        CommandLine += i.ToString() + " ";
                        if (i == DaggerHashimotoGenerateDevice)
                        {
                            dagdev = DaggerHashimotoGenerateDevice;
                        }
                        else if (dagdev == -1)
                        {
                            dagdev = i;
                        }
                    }
                }

                CommandLine += " --dag-load-mode single " + dagdev.ToString();

                Ethereum.GetCurrentBlock(MinerDeviceName);
                CommandLine += " --benchmark " + Ethereum.CurrentBlockNum;
            }
            else
            {
                CommandLine = " --algo=" + SupportedAlgorithms[index].MinerName +
                              " --benchmark" +
                              " --time-limit " + time.ToString() +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (CDevs[i].Enabled && !SupportedAlgorithms[index].DisabledDevice[i])
                    {
                        CommandLine += CDevs[i].ID.ToString() + ",";
                    }
                }

                CommandLine = CommandLine.Remove(CommandLine.Length - 1);

                if (SupportedAlgorithms[index].NiceHashName.Equals("decred"))
                {
                    Path = "bin\\ccminer_decred.exe";
                }
                else if (SupportedAlgorithms[index].NiceHashName.Equals("lyra2re") || SupportedAlgorithms[index].NiceHashName.Equals("lyra2rev2"))
                {
                    Path = "bin\\ccminer_nanashi.exe";
                }
                else if (this is ccminer_sp && SupportedAlgorithms[index].NiceHashName.Equals("neoscrypt"))
                {
                    Path = "bin\\ccminer_neoscrypt.exe";
                }
                else if (this is ccminer_sp)
                {
                    Path = "bin\\ccminer_sp.exe";
                }
                else
                {
                    Path = "bin\\ccminer_tpruvot.exe";
                }
            }

            return(CommandLine);
        }
コード例 #9
0
        private void InitiateBenchmark()
        {
            if (listView1.Items.Count > index)
            {
                ListViewItem lvi = listView1.Items[index];
                index++;

                if (!lvi.Checked)
                {
                    InitiateBenchmark();
                    return;
                }

                Miner m = lvi.Tag as Miner;
                int   i = (int)lvi.SubItems[2].Tag;
                lvi.SubItems[3].Text  = "Please wait...";
                inBenchmark           = true;
                CurrentlyBenchmarking = m;

                if (m is cpuminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsCPU[TimeIndex];
                    lvi.SubItems[3].Text = "Please wait about " + Time + " seconds...";
                }
                else if (m is ccminer)
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsNVIDIA[TimeIndex];

                    if (lvi.SubItems[2].Text.Equals("ethereum"))
                    {
                        lvi.SubItems[3].Text = "Creating DAG file (10-20 minutes)..";
                        if (Ethereum.CreateDAGFile(true, m.MinerDeviceName) == false)
                        {
                            return;
                        }
                        lvi.SubItems[3].Text = "Benchmarking (2-4 minutes)...";
                    }
                    else
                    {
                        lvi.SubItems[3].Text = "Please wait about " + Time + " seconds...";
                    }
                }
                else
                {
                    Time = Config.ConfigData.BenchmarkTimeLimitsAMD[TimeIndex] / 60;

                    // add an aditional minute if second is not 0
                    if (DateTime.Now.Second != 0)
                    {
                        Time += 1;
                    }

                    if (lvi.SubItems[2].Text.Equals("ethereum"))
                    {
                        lvi.SubItems[3].Text = "Creating DAG file (10-20 minutes)..";
                        if (Ethereum.CreateDAGFile(true, m.MinerDeviceName) == false)
                        {
                            return;
                        }
                        lvi.SubItems[3].Text = "Benchmarking (2-4 minutes)...";
                    }
                    else
                    {
                        lvi.SubItems[3].Text = "Please wait about " + Time + " minutes...";
                    }
                }

                m.BenchmarkStart(i, Time, BenchmarkCompleted, lvi);
            }
            else
            {
                // average all cpu benchmarks
                if (Form1.Miners[0] is cpuminer)
                {
                    Helpers.ConsolePrint("BENCHMARK", "Calculating average CPU speeds:");

                    double[] Speeds = new double[Form1.Miners[0].SupportedAlgorithms.Length];
                    int[]    MTaken = new int[Form1.Miners[0].SupportedAlgorithms.Length];

                    foreach (ListViewItem lvi in listView1.Items)
                    {
                        if (lvi.Tag is cpuminer)
                        {
                            Miner m = lvi.Tag as Miner;
                            int   i = (int)lvi.SubItems[2].Tag;
                            if (m.SupportedAlgorithms[i].BenchmarkSpeed > 0)
                            {
                                Speeds[i] += m.SupportedAlgorithms[i].BenchmarkSpeed;
                                MTaken[i]++;
                            }
                        }
                    }

                    for (int i = 0; i < Speeds.Length; i++)
                    {
                        if (MTaken[i] > 0)
                        {
                            Speeds[i] /= MTaken[i];
                        }
                        Helpers.ConsolePrint("BENCHMARK", Form1.Miners[0].SupportedAlgorithms[i].NiceHashName + " average speed: " + Form1.Miners[0].PrintSpeed(Speeds[i]));

                        foreach (Miner m in Form1.Miners)
                        {
                            if (m is cpuminer)
                            {
                                m.SupportedAlgorithms[i].BenchmarkSpeed = Speeds[i];
                            }
                        }
                    }
                }

                foreach (ListViewItem lvi in listView1.Items)
                {
                    Miner m = lvi.Tag as Miner;
                    int   i = (int)lvi.SubItems[2].Tag;
                    lvi.SubItems[3].Text = m.PrintSpeed(m.SupportedAlgorithms[i].BenchmarkSpeed);
                }

                Config.RebuildGroups();

                button1.Enabled = true;
                button2.Enabled = false;
                button3.Enabled = true;
                button4.Enabled = true;
            }
        }
コード例 #10
0
        protected override string BenchmarkCreateCommandLine(int index, int time)
        {
            Algorithm Algo = GetMinerAlgorithm(SupportedAlgorithms[index].NiceHashID);

            if (Algo == null)
            {
                Helpers.ConsolePrint(MinerDeviceName, "GetMinerAlgorithm(" + index + "): Algo equals to null");
                return("");
            }

            string CommandLine;

            if (Algo.NiceHashName.Equals("daggerhashimoto"))
            {
                CommandLine = " --opencl --opencl-platform " + GPUPlatformNumber +
                              " " + ExtraLaunchParameters +
                              " " + Algo.ExtraLaunchParameters +
                              " --benchmark-warmup 40 --benchmark-trial 20" +
                              " --opencl-devices ";

                int dagdev = -1;
                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        CommandLine += i + " ";
                        if (i == DaggerHashimotoGenerateDevice)
                        {
                            dagdev = DaggerHashimotoGenerateDevice;
                        }
                        else if (dagdev == -1)
                        {
                            dagdev = i;
                        }
                    }
                }

                CommandLine += " --dag-load-mode single " + dagdev.ToString();

                Ethereum.GetCurrentBlock(MinerDeviceName);
                CommandLine += " --benchmark " + Ethereum.CurrentBlockNum;
            }
            else
            {
                Path = "cmd";
                string DirName = GetMinerDirectory(Algo.NiceHashName);

                string url = "stratum+tcp://" + Globals.NiceHashData[SupportedAlgorithms[index].NiceHashID].name + "." +
                             Globals.MiningLocation[Config.ConfigData.ServiceLocation] + ".nicehash.com:" +
                             Globals.NiceHashData[SupportedAlgorithms[index].NiceHashID].port;

                string username = Config.ConfigData.BitcoinAddress.Trim();
                if (Config.ConfigData.WorkerName.Length > 0)
                {
                    username += "." + Config.ConfigData.WorkerName.Trim();
                }

                CommandLine = " /C \"cd /d " + DirName + " && sgminer.exe " +
                              " --gpu-platform " + GPUPlatformNumber +
                              " -k " + SupportedAlgorithms[index].MinerName +
                              " --url=" + url +
                              " --userpass="******":" + GetPassword(Algo) +
                              " --sched-stop " + DateTime.Now.AddMinutes(time).ToString("HH:mm") +
                              " -T --log 10 --log-file dump.txt" +
                              " " + ExtraLaunchParameters +
                              " " + SupportedAlgorithms[index].ExtraLaunchParameters +
                              " --device ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        CommandLine += CDevs[i].ID.ToString() + ",";
                    }
                }

                CommandLine = CommandLine.Remove(CommandLine.Length - 1);
                if (Config.ConfigData.DisableAMDTempControl == false)
                {
                    CommandLine += TemperatureParam;
                }
                CommandLine += " && del dump.txt\"";
            }

            return(CommandLine);
        }
コード例 #11
0
ファイル: ccminer.cs プロジェクト: theLosers106/NiceHashMiner
        public override void Start(int nhalgo, string url, string username)
        {
            if (ProcessHandle != null)
            {
                return;                        // ignore, already running
            }
            Algorithm Algo = GetMinerAlgorithm(nhalgo);

            if (Algo == null)
            {
                return;
            }

            if (Algo.NiceHashName.Equals("daggerhashimoto"))
            {
                // Check if dag-dir exist to avoid ethminer from crashing
                if (!Ethereum.CreateDAGDirectory(MinerDeviceName))
                {
                    return;
                }

                LastCommandLine = " --cuda" +
                                  " --erase-dags old" +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " -S " + url.Substring(14) +
                                  " -O " + username + ":" + GetPassword(Algo) +
                                  " --dag-dir " + Config.ConfigData.DAGDirectory + "\\" + MinerDeviceName +
                                  " --report-port " + APIPort.ToString() +
                                  " --cuda-devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (EtherDevices[i] != -1 && CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        LastCommandLine += i + " ";
                    }
                }
            }
            else
            {
                LastCommandLine = "--algo=" + Algo.MinerName +
                                  " --url=" + url +
                                  " --userpass="******":" + GetPassword(Algo) +
                                  " --api-bind=" + APIPort.ToString() +
                                  " " + ExtraLaunchParameters +
                                  " " + Algo.ExtraLaunchParameters +
                                  " --devices ";

                for (int i = 0; i < CDevs.Count; i++)
                {
                    if (CDevs[i].Enabled && !Algo.DisabledDevice[i])
                    {
                        LastCommandLine += CDevs[i].ID.ToString() + ",";
                    }
                }

                if (LastCommandLine.EndsWith(","))
                {
                    LastCommandLine = LastCommandLine.Remove(LastCommandLine.Length - 1);
                }
                else
                {
                    LastCommandLine = "";
                    return; // no GPUs to start mining on
                }

                if (Algo.NiceHashName.Equals("decred"))
                {
                    Path = "bin\\ccminer_decred.exe";
                }
                else if (this is ccminer_sp && Algo.NiceHashName.Equals("neoscrypt"))
                {
                    Path = "bin\\ccminer_neoscrypt.exe";
                }
                else if (this is ccminer_sp && Algo.NiceHashName.Equals("lyra2rev2"))
                {
                    Path = "bin\\ccminer_sp_lyra2v2.exe";
                }
                else if (this is ccminer_sp)
                {
                    Path = "bin\\ccminer_sp.exe";
                }
                else
                {
                    Path = "bin\\ccminer_tpruvot.exe";
                }
            }

            ProcessHandle = _Start();
        }