private void ShowMainWindow() { //Set defaults for GPUs if (Settings.Default.FirstLaunch) { if (MiningOperations.HasNVidia) { Settings.Default.GPUMining = (byte)MiningOperations.GpuMiningSettings.NVidia; } else if (MiningOperations.HasAmd) { Settings.Default.GPUMining = (byte)MiningOperations.GpuMiningSettings.Amd; } else { Settings.Default.CPUMining = true; Settings.Default.GPUMining = (byte)MiningOperations.GpuMiningSettings.None; } Settings.Default.GrsWalletAddress = MiningOperations.GetAddress(); Settings.Default.FirstLaunch = false; Settings.Default.Save(); } MainWindow main = new MainWindow { WindowStartupLocation = WindowStartupLocation.CenterScreen }; main.Show(); }
private void OnCpuBgOnDoWork(object sender, DoWorkEventArgs args) { if (_cpuBg.CancellationPending) { args.Cancel = true; return; } if (File.Exists(MiningOperations.CpuDirectory)) { var commands = MiningOperations.GetCPUCommandLine(MiningOperations.CommonMiningPoolVariables); using (var process = new Process()) { ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C " + "\"" + MiningOperations.CpuDirectory + "\"" + $" -a groestl {commands}", RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, UseShellExecute = false }; process.StartInfo = info; process.EnableRaisingEvents = true; process.ErrorDataReceived += (o, eventArgs) => { try { Dispatcher.Invoke(() => { var lines = uxCpuLog.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None) .ToList(); if (lines.Count() == 30) { lines.RemoveAt(0); } lines.Add(eventArgs.Data); uxCpuLog.Text = string.Join(Environment.NewLine, lines); uxCpuScroller.ScrollToVerticalOffset(uxGpuScroller.ExtentHeight); }); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message + Environment.NewLine + Environment.NewLine + ex.StackTrace); } }; process.Start(); process.BeginErrorReadLine(); MiningOperations.CpuStarted = true; process.WaitForExit(); Dispatcher.Invoke(() => OnCpuMinerClosed(new EventArgs())); } } else { Dispatcher.Invoke(() => { MessageBox.Show("minerd.exe file not found. Please check your antivirus settings, re-run the installer and select repair"); OnCpuMinerClosed(new EventArgs()); }); } }
private void UxPoolSelectorDdl_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (TxtAddress != null && TxtUsername != null && TxtPassword != null) { TxtPool.Text = MiningOperations.GetAddressForPool((MiningOperations.MiningPools)uxPoolSelectorDdl.SelectedIndex); TxtUsername.Text = MiningOperations.GetUsernameForPool((MiningOperations.MiningPools)uxPoolSelectorDdl.SelectedIndex); TxtPassword.Text = MiningOperations.GetPasswordForPool((MiningOperations.MiningPools)uxPoolSelectorDdl.SelectedIndex); } SetStatsURL(); }
private void UxGetWalletAddressTxt_Click(object sender, RoutedEventArgs e) { if (!MiningOperations.WalletFileExists) { StartingGuide guide = new StartingGuide { WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = this, }; guide.FromMainWindow = true; guide.ShowDialog(); } else { if (TxtAddress.Text == MiningOperations.GetAddress()) { return; } var messageBoxResult = MessageBox.Show(this, "Warning: Resetting your mining address will reset your rewards. Are you sure?", "Address Warning", MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { TxtAddress.Text = MiningOperations.GetAddress(); } } }
private void PopulatePage() { if (Debugger.IsAttached) { Settings.Default.P2PoolSettings = null; Settings.Default.CustomSettings = null; Settings.Default.MiningPoolHubSettings = null; Settings.Default.SuprNovaSettings = null; } uxIntervalSlider.Value = Settings.Default.MineIntensity; TxtAddress.Text = string.IsNullOrEmpty(Settings.Default.GrsWalletAddress) ? MiningOperations.GetAddress() : Settings.Default.GrsWalletAddress; uxPoolSelectorDdl.SelectedIndex = Settings.Default.SelectedMiningPool; TxtPool.Text = MiningOperations.GetAddressForPool((MiningOperations.MiningPools)uxPoolSelectorDdl.SelectedIndex); TxtUsername.Text = Settings.Default.MiningPoolUsername; TxtPassword.Text = Settings.Default.MiningPoolPassword; uxAutoIntensityChk.IsChecked = Settings.Default.UseAutoIntensity; UxIntensityTxt.Text = Settings.Default.MineIntensity.ToString(); UxCpuTgl.IsChecked = Settings.Default.CPUMining; uxnVidiaRb.IsChecked = (MiningOperations.GpuMiningSettings)Settings.Default.GPUMining == MiningOperations.GpuMiningSettings.NVidia; uxnAMDRb.IsChecked = (MiningOperations.GpuMiningSettings)Settings.Default.GPUMining == MiningOperations.GpuMiningSettings.Amd; WpCustom3.Visibility = uxnAMDRb.IsChecked == true ? Visibility.Visible : Visibility.Collapsed; if (uxAutoIntensityChk.IsChecked == true) { UxIntensityTxt.Visibility = Visibility.Collapsed; uxIntervalSlider.Visibility = Visibility.Collapsed; } else { UxIntensityTxt.Visibility = Visibility.Visible; uxIntervalSlider.Visibility = Visibility.Visible; } if (Settings.Default.P2PoolSettings == null) { Settings.Default.P2PoolSettings = new StringCollection { MiningOperations.GetAddressForPool(MiningOperations.MiningPools.P2Pool), MiningOperations.GetUsernameForPool(MiningOperations.MiningPools.P2Pool), MiningOperations.GetPasswordForPool(MiningOperations.MiningPools.P2Pool) }; } if (Settings.Default.CustomSettings == null) { Settings.Default.CustomSettings = new StringCollection { MiningOperations.GetAddressForPool(MiningOperations.MiningPools.Custom), MiningOperations.GetUsernameForPool(MiningOperations.MiningPools.Custom), MiningOperations.GetPasswordForPool(MiningOperations.MiningPools.Custom) }; } if (Settings.Default.MiningPoolHubSettings == null) { Settings.Default.MiningPoolHubSettings = new StringCollection { MiningOperations.GetAddressForPool(MiningOperations.MiningPools.MiningPoolHub), MiningOperations.GetUsernameForPool(MiningOperations.MiningPools.MiningPoolHub), MiningOperations.GetPasswordForPool(MiningOperations.MiningPools.MiningPoolHub) }; } if (Settings.Default.SuprNovaSettings == null) { Settings.Default.SuprNovaSettings = new StringCollection { MiningOperations.GetAddressForPool(MiningOperations.MiningPools.Suprnova), MiningOperations.GetUsernameForPool(MiningOperations.MiningPools.Suprnova), MiningOperations.GetPasswordForPool(MiningOperations.MiningPools.Suprnova) }; } Settings.Default.Save(); }
private void OnNVidiaBgOnDoWork(object sender, DoWorkEventArgs args) { if (_nVidiaBg.CancellationPending) { args.Cancel = true; return; } var commands = MiningOperations.GetNVidiaCommandLine(MiningOperations.CommonMiningPoolVariables, MiningOperations.UseAutoIntensity, MiningOperations.MiningIntensity.ToString()); using (var process = new Process()) { ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = "/C " + "\"" + MiningOperations.NVididiaDirectory + "\"" + $" -a groestl {commands}", RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true, UseShellExecute = false }; process.StartInfo = info; if (Debugger.IsAttached) { Dispatcher.Invoke(() => { MessageBox.Show(info.FileName + " " + info.Arguments); }); } process.EnableRaisingEvents = true; process.OutputDataReceived += (o, eventArgs) => { try { Dispatcher.Invoke(() => { var lines = uxGpuLog.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList(); if (lines.Count() == 30) { lines.RemoveAt(0); } lines.Add(eventArgs.Data); uxGpuLog.Text = string.Join(Environment.NewLine, lines); uxGpuScroller.ScrollToVerticalOffset(uxGpuScroller.ExtentHeight); }); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message + Environment.NewLine + Environment.NewLine + ex.StackTrace); } }; process.Start(); MiningOperations.GpuStarted = true; process.BeginOutputReadLine(); process.BeginErrorReadLine(); process.WaitForExit(); try { Dispatcher.Invoke(() => OnGpuMinerClosed(new EventArgs())); } catch (Exception ex) { MessageBox.Show("Error " + ex.Message + Environment.NewLine + Environment.NewLine + ex.StackTrace); } } }
private void OnAmdBgOnDoWork(object sender, DoWorkEventArgs args) { if (_amdBg.CancellationPending) { args.Cancel = true; return; } #region Surrounding the Directory Path in Quotes var path = MiningOperations.AMDDirectory; var folderNames = path.Split('\\'); folderNames = folderNames.Select(fn => (fn.Contains(' ')) ? $"\"{fn}\"" : fn) .ToArray(); #endregion var fullPathWithQuotes = string.Join("\\", folderNames); using (var process = new Process()) { var commands = MiningOperations.GetAMDCommandLine(MiningOperations.CommonMiningPoolVariables, MiningOperations.UseAutoIntensity, MiningOperations.MiningIntensity.ToString(), "groestlcoin"); ProcessStartInfo info = new ProcessStartInfo { FileName = "cmd.exe", Arguments = $"/C {fullPathWithQuotes} -g 4 -w 64 -k groestlcoin {commands}", // RedirectStandardOutput = true, // RedirectStandardError = true, CreateNoWindow = false, UseShellExecute = false }; process.StartInfo = info; process.EnableRaisingEvents = true; #region Writing to local window //process.OutputDataReceived += (o, eventArgs) => { // try { // Dispatcher.Invoke(() => { // var lines = // uxGpuLog.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None) // .ToList(); // if (lines.Count() == 30) { // lines.RemoveAt(0); // } // lines.Add(eventArgs.Data); // uxGpuLog.Text = string.Join(Environment.NewLine, lines); // uxGpuScroller.ScrollToVerticalOffset(uxGpuScroller.ExtentHeight); // }); // } // catch (Exception e) { //#if DEBUG // MessageBox.Show("Errr: " + e.Message); // //Do Nothing //#endif // } // }; // process.ErrorDataReceived += (o, eventArgs) => { // try { // Dispatcher.Invoke(() => { // var lines = uxGpuLog.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList(); // if (lines.Count() == 30) { // lines.RemoveAt(0); // } // lines.Add(eventArgs.Data); // uxGpuLog.Text = string.Join(Environment.NewLine, lines); // uxGpuScroller.ScrollToVerticalOffset(uxGpuScroller.ExtentHeight); // }); // } // catch (Exception e) { //#if DEBUG // MessageBox.Show("Errr: " + e.Message); // //Do Nothing //#endif // } // }; #endregion Writing to local window process.Start(); MiningOperations.GpuStarted = true; // process.BeginErrorReadLine(); process.WaitForExit(); Dispatcher.Invoke(() => OnGpuMinerClosed(new EventArgs())); } }
private void Populate() { if (File.Exists(MiningOperations.WalletFolder)) { uxStepContent.Text = "Groestlcoin EasyMiner has detected your receiving address from your default Electrum-GRS wallet. You can change this at any time if required." + Environment.NewLine + Environment.NewLine + "Receiving Address: " + MiningOperations.GetAddress(); uxCheckInstallBtn.Visibility = Visibility.Collapsed; uxStepContent2.Visibility = Visibility.Collapsed; uxStepContent3.Visibility = Visibility.Collapsed; } else { uxStepContent2.Inlines.Clear(); StringBuilder sb = new StringBuilder(); sb.Append("Groestlcoin EasyMiner will automatically detect a receiving address from your Electrum-GRS Wallet."); sb.Append("You can download the Electrum-GRS Wallet from here:" + Environment.NewLine); uxStepContent.Text = sb.ToString(); uxCheckInstallBtn.Visibility = Visibility.Visible; uxStepContent2.Visibility = Visibility.Visible; uxStepContent3.Visibility = Visibility.Visible; Hyperlink link = new Hyperlink { NavigateUri = new Uri("https://www.groestlcoin.org/groestlcoin-electrum-wallet/"), Foreground = Brushes.White }; link.RequestNavigate += (sender, args) => { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(args.Uri.AbsoluteUri)); args.Handled = true; }; link.Inlines.Add("Electrum GRS"); uxStepContent2.Inlines.Add(link); uxStepContent3.Text = "Install the Electrum-GRS Wallet. Once it is installed, click 'Check Electrum Install'. This should find your receiving address."; if (Attempts >= 5) { System.Windows.MessageBox.Show( "Electrum-GRS has not been found. Please ensure you have the latest Electrum-GRS wallet installed."); } } if (MiningOperations.HasNVidia) { uxHardwareTxt.Text = "Setup has detected that you are using an nVidia graphics card. This will be automatically set. If this is wrong, please change before starting to mine."; } else if (MiningOperations.HasAmd) { uxHardwareTxt.Text = "Setup has detected that you are using an AMD graphics card. This will be automatically set. If this is wrong, please change before starting to mine."; } else { uxHardwareTxt.Text = "Setup has not detected any graphics card. CPU mining will be automatically set. If this is wrong, please change before starting to mine."; } }