public void RefreshCard(VideoCard card) { string strError = string.Empty; SettingCall settingsCall = new SettingCall(); Settings settings = settingsCall.GetSettings(ref strError); ; nvidiaCard = card; int temp = Convert.ToInt32(card.TemperatureSensors[0].Value); Color clr = Color.White; if (temp < 70) clr = Color.Green; else if (temp >= 70 && temp < 90) clr = Color.Orange; else if (temp >= 90) clr = Color.Red; lblNumber.Text = card.Number.ToString(); lblName.Text = card.Name; lblTemp.Text = card.TemperatureSensors[0].Value.ToString() + "°C"; lblClockSpeed.Text = Convert.ToInt32(card.ClockSensors[0].Value).ToString() + " MHz"; lblTemp.ForeColor = clr; if (!cbxFanSpeed.DroppedDown) //We don't want to add the fan % if this is dropped down because then the user will have a hard time selecting a new value cbxFanSpeed.Text = card.FanSensors[0].Value.ToString() + "%"; if (settings.Options.IsTempProtectionActivated) { if (TemperatureRun > 0) TemperatureRun++; if (card.TemperatureSensors[0].Value >= settings.Options.TemperatureMax && !IsCoolingDown) { SendNotificationToTray("Temperature Protection", "Temperature threshold reached. The Fan will run at 100% for 3 minutes and then run at 50%."); nvidiaCard.FanSensors[0].Control.SetSoftware(100); IsCoolingDown = true; } else if (!settings.Options.IsTempProtectionActivated || card.TemperatureSensors[0].Value < settings.Options.TemperatureMax && TemperatureRun >= 180) //180 = 3 minutes. Let the fan run for 3 minutes { IsCoolingDown = false; TemperatureRun = 0; nvidiaCard.FanSensors[0].Control.SetSoftware(50); } } }
private void frmOptions_Load(object sender, EventArgs e) { string strError = string.Empty; settingsCall = new SettingCall(); optionsCall = new OptionsCall(); settings = settingsCall.GetSettings(ref strError); this.Icon = settingsCall.GetApplicationIcon(); if (!string.IsNullOrEmpty(strError)) MessageBox.Show("An error occurred while trying to get the settings file data.\r\n\r\n" + strError); chkRunOnStartup.Checked = settings.Options.IsRunningOnStartup; intActivateProtection.Value = settings.Options.TemperatureMax; intShutdownMiners.Value = settings.Options.TemperatureShutdown; chkEnableTempProtection.Checked = settings.Options.IsTempProtectionActivated; pnlTempProtectionSettings.Enabled = chkEnableTempProtection.Checked; chkContinuousMinerLogging.Checked = settings.Options.IsContinuousMinerLogging; }
private void frmMain_Load(object sender, EventArgs e) { string strError = string.Empty; ScheduleTask.CreateNewTask(); //ScheduleTask.RunTask(); //Initialize Calls and data settingsCall = new SettingCall(); settings = new Settings(); devices = new DevicesCall(); comp = new Computer(); miner = new MinerCall(); if (miner.IsMinersRunning()) if (MessageBox.Show("CUDA Administrator detected that there are CPU or GPU miners already running. Do you want to shutdown these miners now?", "Miners Running", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) miner.ShutdownMiners(); bool isNewVersion = settingsCall.IsNewVersionAvailable(ref strError); if (!string.IsNullOrEmpty(strError)) { UserMessage.ShowMessage(this, UserMessage.MessageType.Error, "There was an error while trying to check for the latest version of CUDA Administrator. Error: " + strError); strError = string.Empty; } else { if (isNewVersion) if (MessageBox.Show("A new version of CUDA Administrator is available. Would you like to go to the subreddit?", "Verion Check", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) Process.Start("http://www.reddit.com/r/CudaAdministrator"); } this.Icon = settingsCall.GetApplicationIcon(); comp.Open(); comp.CPUEnabled = true; //Set UI data AddMinersToDataGridViews(); //Setup everything required to run CUDA Admin settingsCall.CreateFolders(ref strError); if (!string.IsNullOrEmpty(strError)) { MessageBox.Show(strError, "Folder Creation", MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(Environment.ExitCode); } if (!File.Exists(FileManager.CudaMinerPath + "cudaminer.exe") || !File.Exists(FileManager.CudaMinerPath + "pthreadVC2.dll") || !(File.Exists(FileManager.CudaMinerPath + "cudart64_55.dll") || File.Exists(FileManager.CudaMinerPath + "cudart32_55.dll"))) UserMessage.ShowMessage(this, UserMessage.MessageType.Warning, "GPU Miner disabled. Either it or some/all of it's dependencies couldn't be located"); if (!File.Exists(FileManager.CpuMinerPath + "minerd.exe") || !File.Exists(FileManager.CpuMinerPath + "libwinpthread-1.dll") || !(File.Exists(FileManager.CpuMinerPath + "libcurl.dll") || File.Exists(FileManager.CpuMinerPath + "libcurl-4.dll"))) UserMessage.ShowMessage(this, UserMessage.MessageType.Warning, "CPU Miner disabled. Either it or some/all of it's dependencies couldn't be located"); settings = settingsCall.GetSettings(ref strError); if (!string.IsNullOrEmpty(strError)) UserMessage.ShowMessage(this, UserMessage.MessageType.Error, "An error occurred while trying to get the settings data. Error: " + strError); string[] args = Environment.GetCommandLineArgs(); if (args.Contains("--autorun")) btnMinerAutomation.PerformClick(); }
private void Setup() { InitializeComponent(); string strError = string.Empty; settingsCall = new SettingCall(); settings = settingsCall.GetSettings(ref strError); flpStatus = new FlowLayoutPanel() { Dock = DockStyle.Top, Height = 20, BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle }; lblPipe = new Label() { Text = "|", AutoSize = true, Margin = new Padding(0, 2, 0, 0) }; lblAvgHashrate = new Label() { Text = "Avg. Hashrate: 0 kh/s", Margin = new Padding(0, 2, 0, 0), AutoSize = true }; lblRuntime = new Label() { Text = "Run Time: 00:00:00", Margin = new Padding(0, 2, 0, 0), AutoSize = true }; txtConsole = new RichTextBox() { Dock = DockStyle.Fill, ReadOnly = true, BackColor = SystemColors.Control, ForeColor = SystemColors.WindowText, Multiline = true, Height = this.Height, BorderStyle = BorderStyle.FixedSingle }; lblAccepts = new Label() { Text = "Accepts: 0/min", Margin = new Padding(0, 2, 0, 0), AutoSize = true }; lblKernel = new Label() { Text = "Kernel: N/A", Margin = new Padding(0, 2, 0, 0), AutoSize = true }; lblGUID = new Label() { Text = "GUID: ", Margin = new Padding(0, 2, 0, 0), AutoSize = true, ForeColor = Color.Gray }; flpStatus.Controls.Add(lblAvgHashrate); flpStatus.Controls.Add(lblPipe); //Separator flpStatus.Controls.Add(lblRuntime); flpStatus.Controls.Add(lblPipe); //Separator flpStatus.Controls.Add(lblAccepts); flpStatus.Controls.Add(lblPipe); //Separator flpStatus.Controls.Add(lblKernel); flpStatus.Controls.Add(lblPipe); //Separator flpStatus.Controls.Add(lblGUID); this.Controls.Add(flpStatus); this.Controls.Add(txtConsole); watch = new Stopwatch(); watch.Start(); }
public frmMiner(Type type, Miner miner = Miner.GPU, Guid guid = default(Guid)) { InitializeComponent(); string strError = string.Empty; SetTips(); devices = new DevicesCall(); settingsCall = new SettingCall(); settings = settingsCall.GetSettings(ref strError); this.Icon = settingsCall.GetApplicationIcon(); AddVideoCardsToComboBox(); ResetAddMinerFields(Miner.GPU); ResetAddMinerFields(Miner.CPU); cbxMiner.SelectedIndex = 0; //Default to GPU minerType = type; minerGuid = guid; if (type == Type.Add) { this.Text = "Add Miner"; btnAddEditCpuMiner.Text = "Add"; } else if (type == Type.Edit) { if (guid == default(Guid)) MessageBox.Show("The user should never see this message.\r\n\r\nEdit was selected, but no GUID was passed.", "Err...", MessageBoxButtons.OK, MessageBoxIcon.Error); else { if (Debugger.IsAttached) lblOldGuid.Visible = true; txtName_CudaMiner.ForeColor = Color.Black; txtPoolAddress_CudaMiner.ForeColor = Color.Black; txtWorkerName_CudaMiner.ForeColor = Color.Black; txtWorkerPassword_CudaMiner.ForeColor = Color.Black; txtName_CpuMiner.ForeColor = Color.Black; txtPoolAddress_CpuMiner.ForeColor = Color.Black; txtWorkerName_CpuMiner.ForeColor = Color.Black; txtWorkerPassword_CpuMiner.ForeColor = Color.Black; if (miner == Miner.GPU) { tcMiners.SelectedIndex = 0; cbxMiner.SelectedIndex = 0; btnAddEditCudaMiner.Text = "Edit Miner"; GpuMinerData selectedMiner = settings.GpuMiners.SingleOrDefault(x => x.MinerGUID == guid); txtName_CudaMiner.Text = selectedMiner.Name; txtPoolAddress_CudaMiner.Text = selectedMiner.PoolAddress; txtWorkerName_CudaMiner.Text = selectedMiner.WorkerName; txtWorkerPassword_CudaMiner.Text = selectedMiner.WorkerPassword; cbxDevice_CudaMiner.SelectedIndex = selectedMiner.Device; cbxAlgorithm_CudaMiner.Text = selectedMiner.Algorithm; cbxCpuAssist_CudaMiner.Text = selectedMiner.CpuAssist; cbxTextureCache_CudaMiner.Text = selectedMiner.TextureCache; txtLookupGap_CudaMiner.Text = selectedMiner.LookupGap.ToString(); txtBatchsize_CudaMiner.Text = selectedMiner.Batchsize.ToString(); chkInteractive_CudaMiner.Checked = selectedMiner.Interactive; chkSingleMemory_CudaMiner.Checked = selectedMiner.SingleMemory; chkDebug_CudaMiner.Checked = selectedMiner.Debug; } else if (miner == Miner.CPU) { tcMiners.SelectedIndex = 1; cbxMiner.SelectedIndex = 1; btnAddEditCpuMiner.Text = "Edit Miner"; CpuMinerData selectedMiner = settings.CpuMiners.SingleOrDefault(x => x.MinerGUID == guid); txtName_CpuMiner.Text = selectedMiner.Name; txtPoolAddress_CpuMiner.Text = selectedMiner.PoolAddress; txtWorkerName_CpuMiner.Text = selectedMiner.WorkerName; txtWorkerPassword_CpuMiner.Text = selectedMiner.WorkerPassword; } cbxMiner.Enabled = false; this.Text = "Edit Miner"; btnAddEditCpuMiner.Text = "Edit"; lblOldGuid.Text = guid.ToString().ToUpper(); } } }