private void computeParameter(Coin coin, Server server, Algo algo) { if (coin != null && server != null) { int mode = modeComboBox.SelectedIndex; string port = ""; string host = ""; string serverLocation = ""; string sgminerAlgo = ""; string nameCoinAlgo = ""; int serverSelection = serverComboBox.SelectedIndex; if (mode == 0) { port = coin.port.ToString(); host = coin.host; if (serverSelection == 0) { serverLocation = "us-east1"; } else if (serverSelection == 1) { serverLocation = "europe1"; } else { serverLocation = "asia1"; } sgminerAlgo = coin.algorithm; nameCoinAlgo = coin.name; } else if (mode == 1) { port = algo.port.ToString(); host = algo.host; if (serverSelection == 0) { serverLocation = "us-east"; } else if (serverSelection == 1) { serverLocation = "europe"; } else { serverLocation = "asia"; } sgminerAlgo = algo.algorithm; nameCoinAlgo = algo.name; } else { port = algo.port.ToString().Replace("170", "120"); host = algo.host; if (serverSelection == 0) { serverLocation = "us-east"; } else if (serverSelection == 1) { serverLocation = "europe"; } else { serverLocation = "asia"; } sgminerAlgo = algo.algorithm; nameCoinAlgo = algo.name; } resultLabel.Text = "Coin/Algo: " + nameCoinAlgo + "\nServer: " + serverLocation + "." + host + "\nPort: " + port + "\nLogin: "******":x"; string name = ""; if (mode == 0) { name = coin.name; } else { name = algo.name; } switch (name) { case "Zcash": case "Zclassic": case "Equihash": cpuRadioButton.Enabled = true; gpuNVIDIARadioButton.Enabled = true; gpuAMDRadioButton.Enabled = true; sgminerRadioButton.Enabled = false; if (!cpuRadioButton.Checked && !gpuAMDRadioButton.Checked && !gpuNVIDIARadioButton.Checked) { gpuNVIDIARadioButton.Checked = true; } if (cpuRadioButton.Checked) { paramText = "-l " + serverLocation + "." + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; } else if (gpuNVIDIARadioButton.Checked) { paramText = "--server " + serverLocation + "." + host + " --port " + port + " --user " + loginTextField.Text + " --pass " + passwordTextField.Text; } else if (gpuAMDRadioButton.Checked) { paramText = "-zpool " + serverLocation + "." + host + ":" + port + " -zwal " + loginTextField.Text + " -zpsw " + passwordTextField.Text + " -allpools 1"; } break; case "Ethereum": case "Ethereum-Classic": case "Expanse": case "Ethash": cpuRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = true; gpuAMDRadioButton.Enabled = true; sgminerRadioButton.Enabled = false; if (!gpuAMDRadioButton.Checked && !gpuNVIDIARadioButton.Checked) { gpuAMDRadioButton.Checked = true; } if (gpuNVIDIARadioButton.Checked) { paramText = "-epool " + serverLocation + "." + host + ":" + port + " -ewal " + loginTextField.Text + " -epsw " + passwordTextField.Text + " -allpools 1"; } else if (gpuAMDRadioButton.Checked) { paramText = "-epool " + serverLocation + "." + host + ":" + port + " -ewal " + loginTextField.Text + " -epsw " + passwordTextField.Text + " -allpools 1"; } break; case "Monero": case "Cryptonight": cpuRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = false; gpuAMDRadioButton.Enabled = true; sgminerRadioButton.Enabled = false; if (!cpuRadioButton.Checked && !gpuAMDRadioButton.Checked && !gpuNVIDIARadioButton.Checked) { gpuAMDRadioButton.Checked = true; } if (gpuNVIDIARadioButton.Checked) { // TODO: nvidia miner should be added here paramText = "-epool " + serverLocation + "." + host + ":" + port + " -ewal " + loginTextField.Text + " -epsw " + passwordTextField.Text + " -allpools 1"; } else if (gpuAMDRadioButton.Checked) { paramText = "-o ssl://" + serverLocation + "." + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; } break; case "Siacoin": case "Sia": cpuRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = true; gpuAMDRadioButton.Enabled = true; sgminerRadioButton.Enabled = false; Coin ethCoin = new Coin("Ethereum", 20535, "ethereum.miningpoolhub.com", "Ethash", "20"); if (!gpuAMDRadioButton.Checked && !gpuNVIDIARadioButton.Checked) { gpuAMDRadioButton.Checked = true; } if (gpuNVIDIARadioButton.Checked) { paramText = "-epool " + serverLocation + ".ethereum.miningpoolhub.com:20535 -ewal " + loginTextField.Text + " -epsw " + passwordTextField.Text + " -allpools 1 -dpool stratum+tcp://" + host + ":" + port + " -dwal " + loginTextField.Text + " -dpsw " + passwordTextField.Text + " -dcoin sia"; } else if (gpuAMDRadioButton.Checked) { paramText = "-epool " + serverLocation + ".ethereum.miningpoolhub.com:20535 -ewal " + loginTextField.Text + " -epsw " + passwordTextField.Text + " -allpools 1 -dpool stratum+tcp://" + host + ":" + port + " -dwal " + loginTextField.Text + " -dpsw " + passwordTextField.Text + " -dcoin sia"; } break; case "Dash": sgminerRadioButton.Enabled = true; cpuRadioButton.Enabled = false; gpuAMDRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = false; if (!sgminerRadioButton.Checked) { sgminerRadioButton.Checked = true; } paramText = "--no-retry -k " + sgminerAlgo + " -o stratum+tcp://" + serverLocation + "." + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; resultLabel.Text = "Coin/Algo: " + nameCoinAlgo + "\nServer: stratum+tcp://" + serverLocation + "." + host + "\nPort: " + port + "\nLogin: "******":x"; break; case "Maxcoin": sgminerRadioButton.Enabled = true; cpuRadioButton.Enabled = false; gpuAMDRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = false; if (!sgminerRadioButton.Checked) { sgminerRadioButton.Checked = true; } paramText = "--no-retry -k " + sgminerAlgo + " -o stratum+tcp://" + serverLocation + "." + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; resultLabel.Text = "Coin/Algo: " + nameCoinAlgo + "\nServer: stratum+tcp://" + serverLocation + "." + host + "\nPort: " + port + "\nLogin: "******":x"; break; case "Myriadcoin (Groestl)": sgminerRadioButton.Enabled = true; cpuRadioButton.Enabled = false; gpuAMDRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = false; if (!sgminerRadioButton.Checked) { sgminerRadioButton.Checked = true; } paramText = "--no-retry -k " + sgminerAlgo + " -o stratum+tcp://" + serverLocation + "." + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; resultLabel.Text = "Coin/Algo: " + nameCoinAlgo + "\nServer: stratum+tcp://" + serverLocation + "." + host + "\nPort: " + port + "\nLogin: "******":x"; break; default: sgminerRadioButton.Enabled = true; cpuRadioButton.Enabled = false; gpuAMDRadioButton.Enabled = false; gpuNVIDIARadioButton.Enabled = false; if (!sgminerRadioButton.Checked) { sgminerRadioButton.Checked = true; } paramText = "--no-retry -k " + sgminerAlgo + " -o stratum+tcp://" + host + ":" + port + " -u " + loginTextField.Text + " -p " + passwordTextField.Text + ""; resultLabel.Text = "Coin/Algo: " + nameCoinAlgo + "\nServer: stratum+tcp://" + host + "\nPort: " + port + "\nLogin: "******":x"; break; } } configTextBox.Text = paramText; startButton.Enabled = true; }
private void startButton_Click(object sender, EventArgs e) { Coin coin = (Coin)coinComboBox.SelectedItem; Algo algo = (Algo)algoComboBox.SelectedItem; Process miner = new Process(); String fileName = null; String workingDirectory = null; int mode = modeComboBox.SelectedIndex; string name = ""; if (mode == 0) { name = coin.name; } else { name = algo.name; } switch (name) { case "Zcash": case "Zclassic": case "Equihash": if (cpuRadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\nheqminer_zec\\"; fileName = "nheqminer.exe"; } else if (gpuAMDRadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\claymore_zec\\"; fileName = "ZecMiner64.exe"; } else if (gpuNVIDIARadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\zecminer\\"; fileName = "miner.exe"; } break; case "Ethereum": case "Ethereum-Classic": case "Expanse": case "Siacoin": case "Ethash": if (gpuAMDRadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\claymore_eth\\"; fileName = "EthDcrMiner64.exe"; } else if (gpuNVIDIARadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\claymore_eth\\"; fileName = "EthDcrMiner64.exe"; } break; case "Monero": case "Cryptonight": if (gpuAMDRadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\claymore_monero\\"; fileName = "NsGpuCNMiner.exe"; } else if (gpuNVIDIARadioButton.Checked) { workingDirectory = Environment.CurrentDirectory + "\\ccminer_monero\\"; fileName = "ccminer.exe"; } break; default: workingDirectory = Environment.CurrentDirectory + "\\sgminer\\"; fileName = "sgminer.exe"; break; } if (fileName != null) { try { miner.StartInfo.WorkingDirectory = Path.GetDirectoryName(workingDirectory); miner.StartInfo.FileName = fileName; miner.StartInfo.Arguments = paramText; miner.Start(); } catch (Exception) { resultLabel.Text = "Could not start " + fileName + " miner! Make sure it is placed in the directory: \n " + workingDirectory + ""; } } }