private void SetSpeed(object sender, Miner.SpeedChangedArgs e) { tabControl1.BeginInvoke((MethodInvoker)delegate { tabControl1.TabPages[e.TabIndex].Controls["l8"].Text = e.CurrentSpeed; }); int speed; bool b = int.TryParse(e.CurrentSpeed, out speed); if (b) minerspeed[e.TabIndex] = speed; tabControl1.BeginInvoke((MethodInvoker)delegate { tabControl1.TabPages[1].Controls["groupBox5"].Controls["label23"].Text = totalspeed.ToString(); }); }
private void SetSShares(object sender, Miner.StaleShareArgs e) { tabControl1.BeginInvoke((MethodInvoker)delegate { tabControl1.TabPages[e.TabIndex].Controls["l7"].Text = e.Stale.ToString(); }); minersshares[e.TabIndex] += e.Stale; }
private void SetBlock(object sender, Miner.NewBlockArgs e) { tabControl1.BeginInvoke((MethodInvoker)delegate { tabControl1.TabPages[e.TabIndex].Controls["l5"].Text = e.BlockID.ToString(); tabControl1.TabPages["Stats"].Controls["groupBox8"].Controls["label33"].Text = e.BlockID.ToString(); }); }
private void SetAShares(object sender, Miner.AcceptedShareArgs e) { tabControl1.BeginInvoke((MethodInvoker)delegate { tabControl1.TabPages[e.TabIndex].Controls["l6"].Text = e.Accepted.ToString(); }); minersshares[e.TabIndex] = 0; minerashares[e.TabIndex] = e.Accepted; }
int newMiner(string nick, int failover) { Miner miner; miners++; bool vectors = false; if (checkBox3.Checked) { vectors = true; } StreamReader sr = new StreamReader("accounts/" + listBox2.SelectedItem.ToString() + ".txt"); int counter = 0; string line; string pUser = "******"; string pPass = "******"; string pPool = "DeepBit"; string pHost = "nil"; while ((line = sr.ReadLine()) != null) { if (counter == 0) { pUser = line; } if (counter == 1) { pPass = line; } if (counter == 2) { pPool = line; } if (counter == 3) { if (line != string.Empty) { pHost = line; } } counter++; } int d, f; d = (int)numericUpDown2.Value; f = (int)numericUpDown3.Value; Pool p = Pool.DeepBit; MinerProgram mp = MinerProgram.poclbm; if (pPool == "DeepBit") { p = Pool.DeepBit; } else if (pPool == "Slush's Pool") { p = Pool.Slush; } else if (pPool == "BTC Guild") { p = Pool.BTCGuild; } else if (pPool == "BTC Mine") { p = Pool.BTCMine; } else if (pPool == "Eligius") { p = Pool.Eligius; } else if (pPool == "Custom") { p = Pool.Custom; } else if (pPool == "Ozco.in") { p = Pool.Ozco; } miner = new Miner(d, f, vectors, hScrollBar1.Value, nick + " - Miner " + miners, p, mp, pUser, pPass, pHost); m[miners] = miner; miner.SpeedChanged += new Miner.SpeedChangedHandler(SetSpeed); miner.StaleShare += new Miner.StaleShareHandler(SetSShares); miner.AcceptedShare += new Miner.AcceptedShareHandler(SetAShares); miner.NewBlock += new Miner.NewBlockHandler(SetBlock); miner.Error += new Miner.ErrorHandler(Error); miner.FailOver += new Miner.FailOverHandler(FailOver); tabControl1.TabPages.Add(miner.newMinerPage(nick)); miner.Tab = tabControl1.TabPages[5]; miner.TabIndex = 4 + miners; miner.Initialize(); miner.Start(); return 1; }
private void FailOver(object sender, Miner.FailOverArgs e) { failovercount[e.TabPage]++; if (failovercount[e.TabPage] > FailOverMax) { Miner miner = new Miner(e.device, e.framerate, e.vectors, e.worksize, e.nick, e.pool, e.mp, e.pooluser, e.poolpass, e.phost); } }
private void Error(object sender, Miner.ErrorArgs e) { MessageBox.Show(e.ErrorMessage); }