Example #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());
            }
        }
Example #2
0
 /// <summary>
 /// 多线程访问控件委托,在RickTextBox中显示数据
 /// </summary>
 public static void showDataInRichTextBox(ref UIRichTextBox textBox, string data)
 {
     if (textBox.InvokeRequired)
     {
         showDataInRichTextBoxDelegate d = showDataInRichTextBox;
         textBox.Invoke(d, textBox, data);
     }
     else
     {
         textBox.Text = data;
     }
 }
Example #3
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");
         }
     }
 }
Example #4
0
 private void InvokeClearTextBox(UIRichTextBox box)
 {
     if (box.InvokeRequired)
     {
         InvokeClearTextBoxDelegate d = InvokeClearTextBox;
         box.Invoke(d, box);
     }
     else
     {
         box.ClearUndo();
     }
 }
Example #5
0
 private void InvokeAppendTextAction(UIRichTextBox txtBox, string message)
 {
     if (txtBox.InvokeRequired)
     {
         InvokeAppendTextActionDelegate d = InvokeAppendTextAction;
         txtBox.Invoke(d, txtBox, message);
     }
     else
     {
         txtBox.AppendText(message);
     }
 }
Example #6
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());
     }
 }
Example #7
0
 private void button5_Click(object sender, EventArgs e)
 {
     UIRichTextBox.AppendText(richTextBox1, DateTime.Now.ToString() + "\n", Color.Blue);
     UIRichTextBox.ScrollToEnd(richTextBox1);
 }