Ejemplo n.º 1
0
        public static void startMiner(UIRichTextBox LogOutput, ref UIPanel panel)
        {
            try
            {
                Process minerProcess = new Process();
                minerProcess.StartInfo.FileName  = Application.StartupPath + "\\miner\\" + minerBigName + "\\" + minerSmallName + ".exe";
                minerProcess.StartInfo.Arguments = string.Format(getArguments(), miningPool, wallet, worker, argu);
                LogOutput.AppendText("[" + DateTime.Now.ToLocalTime().ToString() + "] 开始挖矿,启动参数:" + minerProcess.StartInfo.Arguments + ",若长时间无反应,请勾选显示原版内核查看错误提示\n");
                minerProcess.StartInfo.CreateNoWindow  = false;
                minerProcess.StartInfo.UseShellExecute = false;
                if (minerSmallName.ToLower().Contains("nb"))
                {
#if DEBUG
                    LogOutput.AppendText("nbminer");
#endif
                    minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                    minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@TSAmlU3LTYLdf9NFpnQbkIpKVFex7gJvUmzC01xGSyw=");
                }
                minerProcess.Start();
                fr = new showMinerWindow(panel, "");
                IntPtr NbminerHandle = fr.Start(minerProcess);
                fr.Application_Idle(null, null);
                StringBuilder 参数 = new StringBuilder();
                参数.Append("\"");
                参数.Append(minerProcess.StartInfo.FileName);
                参数.Append("\" ");
                参数.Append(minerProcess.StartInfo.Arguments);
                生成原版bat(参数.ToString());
            }
            catch (Exception ex)
            {
                UIMessageBox.ShowError("错误:" + ex.ToString());
            }
        }
Ejemplo n.º 2
0
 public static void stopMiner(ref UIRichTextBox LogOutput)
 {
     Process[] myProcesses = System.Diagnostics.Process.GetProcesses();
     foreach (System.Diagnostics.Process myProcess in myProcesses)
     {
         if (myProcess.ProcessName.ToLower().Contains(minerSmallName.ToLower()))
         {
             myProcess.Kill();//强制关闭该程序
             LogOutput.AppendText("[" + DateTime.Now.ToLocalTime().ToString() + "] 停止挖矿,结束进程:" + myProcess.ProcessName + ".exe\n");
         }
     }
 }
Ejemplo n.º 3
0
 private void InvokeAppendTextAction(UIRichTextBox txtBox, string message)
 {
     if (txtBox.InvokeRequired)
     {
         InvokeAppendTextActionDelegate d = InvokeAppendTextAction;
         txtBox.Invoke(d, txtBox, message);
     }
     else
     {
         txtBox.AppendText(message);
     }
 }
Ejemplo n.º 4
0
 public static void startMiner(UIRichTextBox LogOutput, ref UIPanel panel)
 {
     try
     {
         Process minerProcess = new Process();
         minerProcess.StartInfo.FileName  = Application.StartupPath + "\\miner\\" + minerBigName + "\\" + minerSmallName + ".exe";
         minerProcess.StartInfo.Arguments = string.Format(getArguments(), miningPool, wallet, worker, argu);
         LogOutput.AppendText("[" + DateTime.Now.ToLocalTime().ToString() + "] 开始挖矿,启动参数:" + minerProcess.StartInfo.Arguments + ",若长时间无反应,请勾选显示原版内核查看错误提示\n");
         minerProcess.StartInfo.CreateNoWindow  = false;
         minerProcess.StartInfo.UseShellExecute = false;
         if (minerSmallName.ToLower().Contains("nb"))
         {
             if (coin.Equals("ETH"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@TSAmlU3LTYLdf9NFpnQbkIpKVFex7gJvUmzC01xGSyw=");
             }
             if (coin.Equals("ETC"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@TSAtlU3LTYLdf9NFpnQbkGXI8NYwwv9K39JOGRbo/RU=");
             }
             if (coin.Equals("AE"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@STFjyFLLTsCReNNQuXQY0iGT7NnVIoQK0GAPsdTwsCU=");
             }
             if (coin.Equals("BEAM"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@SjEv1RDUTYGfM9RFs2sbk7hK2knvnUW+afv656cGCX6/O/p9QQmYcntenqmomxBN");
             }
             if (coin.Equals("CFX"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@SzI2lU3LTYLdf9NFpnQbkBgd/uKbMRiN2PsTm7ckcbA=");
             }
             if (coin.Equals("RVN"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@WiIglU3LTYLdf9NFpnQbkJCffAngld/5vYaNTabhHTA=");
             }
             if (coin.Equals("SERO"))
             {
                 minerProcess.StartInfo.EnvironmentVariables.Remove("NBDEV");
                 minerProcess.StartInfo.EnvironmentVariables.Add("NBDEV", "#@@@WzE81xDUTYGfM9RFs2sbk6sZO54XoS23hJRe6+2t9ZdSuebWrG9T5PGOCZVCU58Z");
             }
         }
         minerProcess.Start();
         fr = new showMinerWindow(panel, "");
         IntPtr NbminerHandle = fr.Start(minerProcess);
         fr.Application_Idle(null, null);
         StringBuilder 参数 = new StringBuilder();
         参数.Append("\"");
         参数.Append(minerProcess.StartInfo.FileName);
         参数.Append("\" ");
         参数.Append(minerProcess.StartInfo.Arguments);
         生成原版bat(参数.ToString());
     }
     catch (Exception ex)
     {
         UIMessageBox.ShowError("错误:" + ex.ToString());
     }
 }
Ejemplo n.º 5
0
 private void button5_Click(object sender, EventArgs e)
 {
     UIRichTextBox.AppendText(richTextBox1, DateTime.Now.ToString() + "\n", Color.Blue);
     UIRichTextBox.ScrollToEnd(richTextBox1);
 }