void stopMiner() { MiningStartButton.Text = "Start Mining"; miner?.Stop(); StringMiner?.StopRandomStringMiner(); incremental?.StopRandomStringMiner(); MinerInfoUpdateTimer.Stop(); MiningProgressBar.Value = 0; ProgressLabel.Text = ""; stopWatch.Reset(); //If the job was done by miner thread minerStillRunning bool should be false this will be skipped //If the cancellation was requested by user this should be true while (MinerInfo.minerStillRunning) { //Cancellation was already requested in miner thread, waiting a few milliseconds to completing Thread.Sleep(10); } ProgressRichTextBox.AppendText(MinerInfo.minerThreadResults); MinerInfo.defaultingValues(); }
private void MiningStartButton_Click(object sender, EventArgs e) { if (ToolChoosingTabcontrol.SelectedIndex == 1) { if (InputisValid()) { if (MiningStartButton.Text == "Start Mining") { MiningStartButton.Text = "Stop Mining"; bool increment = IncrementRadio.Checked ? true : false; incremental = new KeyRangeMiner(AddressOpenFileDialog.FileName, LookupCompressedCheckbox.Checked, Hexbox.Checked, FromTextbox.Text, UntilTextbox.Text, increment, this, ProgressRichTextBox); incremental.StartIncrementalSearch(); MinerInfoUpdateTimer.Start(); stopWatch.Start(); } else { stopMiner(); } return; } else { return; } } if (UseRandomCheckBox.Checked) { if (InputisValid()) { if (MiningStartButton.Text == "Start Mining") { MiningStartButton.Text = "Stop Mining"; if (CharSetTextBox.Text.Length > 0) { StringMiner = new RandomStringMiner((int)CountOfCharsUpDown.Value, AddressOpenFileDialog.FileName, CompressedCheckBox.Checked, (int)Sha256NumericUpDown.Value, CharSetTextBox.Text); } else { StringMiner = new RandomStringMiner((int)CountOfCharsUpDown.Value, AddressOpenFileDialog.FileName, CompressedCheckBox.Checked, (int)Sha256NumericUpDown.Value); } StringMiner.StartRandomStringMiner(); MinerInfoUpdateTimer.Start(); stopWatch.Start(); } else { stopMiner(); } return; } } else { if (InputisValid()) { char separator = '\0'; if (SeparatorEnterCheckBox.Checked) { separator = '\r'; } else { separator = Convert.ToChar(SeparatorTextBox.Text); } if (MiningStartButton.Text == "Start Mining") { MiningStartButton.Text = "Stop Mining"; miner = new BrainwalletMiner(PasswordListOpenFileDialog.FileName, AddressOpenFileDialog.FileName, CompressedCheckBox.Checked, separator, (int)Sha256NumericUpDown.Value); miner.Start(); MinerInfoUpdateTimer.Start(); stopWatch.Start(); } else { stopMiner(); } } } }