From 3d6d0c81d589062b690782630f29b1671f68b646 Mon Sep 17 00:00:00 2001 From: Darren Ohonba - Evans Date: Mon, 24 Feb 2025 00:04:29 +0000 Subject: [PATCH] Bugfixes --- .../AsusFanControl.Application.csproj | 54 +++ AsusFanControl.Application/Class1.cs | 13 + .../Properties/AssemblyInfo.cs | 36 ++ .../AsusFanControl.Domain.csproj | 50 +++ .../Properties/AssemblyInfo.cs | 36 ++ AsusFanControl.Domain/services/FanCurve.cs | 78 ++++ AsusFanControl.sln | 30 ++ AsusFanControlGUI/App.config | 23 +- ...-fan-icon-iconbunny_1_.ico => AppIcon.ico} | Bin AsusFanControlGUI/AsusFanControlGUI.csproj | 57 ++- AsusFanControlGUI/Form1.Designer.cs | 192 +++++---- AsusFanControlGUI/Form1.cs | 408 ++++++++++++------ AsusFanControlGUI/Program.cs | 144 ++++++- AsusFanControlGUI/Properties/AssemblyInfo.cs | 4 +- .../Properties/Settings.Designer.cs | 14 +- .../Properties/Settings.settings | 5 +- AsusFanControlGUI/packages.config | 14 + ClassLibrary1/Class1.cs | 12 + ClassLibrary1/ClassLibrary1.csproj | 54 +++ ClassLibrary1/Properties/AssemblyInfo.cs | 36 ++ 20 files changed, 1019 insertions(+), 241 deletions(-) create mode 100644 AsusFanControl.Application/AsusFanControl.Application.csproj create mode 100644 AsusFanControl.Application/Class1.cs create mode 100644 AsusFanControl.Application/Properties/AssemblyInfo.cs create mode 100644 AsusFanControl.Domain/AsusFanControl.Domain.csproj create mode 100644 AsusFanControl.Domain/Properties/AssemblyInfo.cs create mode 100644 AsusFanControl.Domain/services/FanCurve.cs rename AsusFanControlGUI/{3038.7-fan-icon-iconbunny_1_.ico => AppIcon.ico} (100%) create mode 100644 ClassLibrary1/Class1.cs create mode 100644 ClassLibrary1/ClassLibrary1.csproj create mode 100644 ClassLibrary1/Properties/AssemblyInfo.cs diff --git a/AsusFanControl.Application/AsusFanControl.Application.csproj b/AsusFanControl.Application/AsusFanControl.Application.csproj new file mode 100644 index 0000000..78ef1b4 --- /dev/null +++ b/AsusFanControl.Application/AsusFanControl.Application.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + 479790b8-79ce-4915-893c-d4d769fcd9b1 + Library + Properties + AsusFanControl.Application + AsusFanControl.Application + v4.8.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AsusFanControl.Application/Class1.cs b/AsusFanControl.Application/Class1.cs new file mode 100644 index 0000000..c6e3189 --- /dev/null +++ b/AsusFanControl.Application/Class1.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AsusFanControl.Application +{ + public class Class1 + { + + } +} diff --git a/AsusFanControl.Application/Properties/AssemblyInfo.cs b/AsusFanControl.Application/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..07b237d --- /dev/null +++ b/AsusFanControl.Application/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AsusFanControl.Application")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AsusFanControl.Application")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("479790b8-79ce-4915-893c-d4d769fcd9b1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AsusFanControl.Domain/AsusFanControl.Domain.csproj b/AsusFanControl.Domain/AsusFanControl.Domain.csproj new file mode 100644 index 0000000..9b332db --- /dev/null +++ b/AsusFanControl.Domain/AsusFanControl.Domain.csproj @@ -0,0 +1,50 @@ + + + + + Debug + AnyCPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9} + Library + Properties + AsusFanControl.Domain + AsusFanControl.Domain + v4.8.1 + 512 + true + 12.0 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AsusFanControl.Domain/Properties/AssemblyInfo.cs b/AsusFanControl.Domain/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..29d9560 --- /dev/null +++ b/AsusFanControl.Domain/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AsusFanControl.Domain")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AsusFanControl.Domain")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("27de14f4-82b0-4d2b-b694-d2f563810bd9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AsusFanControl.Domain/services/FanCurve.cs b/AsusFanControl.Domain/services/FanCurve.cs new file mode 100644 index 0000000..5f7f048 --- /dev/null +++ b/AsusFanControl.Domain/services/FanCurve.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AsusFanControl.Domain.services +{ + public class FanCurve + { + // private readonly Dictionary _fanCurvePoints = new Dictionary(); + + public Dictionary? convertStringToPointsDictionary( + string fanCurvePointsString, int temperatureLowerBound, int temperatureUpperBound, int fanSpeedLowerBound, int fanSpeedUpperBound + ) + { + if (fanCurvePointsString == null) + { + return null; + } + + // Define the allowed characters + var allowedChars = new HashSet("0123456789-,"); + // Check if the string contains any invalid characters + if (fanCurvePointsString.Any(c => !allowedChars.Contains(c))) + { + throw new ArgumentException($"The fan curve points string contains invalid characters. Allowed characters: {string.Join("", allowedChars)}"); + } + + + // Parse the string + int pointCount = 1; + var pointsDictionary = new Dictionary(); + try + { + var pointStrings = fanCurvePointsString.Split('-'); + + foreach (var pointString in pointStrings) + { + // Split the point string into temperature and fan speed parts + string[] parts = pointString.Split(','); + + // Ensure there are exactly two parts (temperature and fan speed) + if (parts.Length != 2) + { + throw new ArgumentException($"Invalid point format: '{pointString}'. Expected format: 'temperature,fanSpeed'."); + } + + // Parse the temperature and fan speed values + int temperature = int.Parse(parts[0]); + int fanSpeed = int.Parse(parts[1]); + + // Validate temperature and fan speed ranges + if (temperature < temperatureLowerBound || temperature > temperatureUpperBound) + { + throw new ArgumentOutOfRangeException(nameof(temperature), $"Temperature value {temperature} is out of range. Valid range: {temperatureLowerBound}-{temperatureUpperBound}."); + } + + if (fanSpeed < fanSpeedLowerBound || fanSpeed > fanSpeedUpperBound) + { + throw new ArgumentOutOfRangeException(nameof(fanSpeed), $"Fan speed value {fanSpeed} is out of range. Valid range: {fanSpeedLowerBound}-{fanSpeedUpperBound}."); + } + + // Create a new KeyValuePair with an incremented ID and the parsed Point + pointsDictionary.Add(pointCount++, new Point(temperature, fanSpeed)); + }; + } + catch (Exception ex) + { + throw new ArgumentException("An error occurred while parsing the fan curve points string" + + $"\n\n{ex.Message}", ex); + } + + return pointsDictionary; + } + } +} diff --git a/AsusFanControl.sln b/AsusFanControl.sln index 3b81b15..03d4de8 100644 --- a/AsusFanControl.sln +++ b/AsusFanControl.sln @@ -7,20 +7,50 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsusFanControl", "AsusFanCo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsusFanControlGUI", "AsusFanControlGUI\AsusFanControlGUI.csproj", "{42CC78B6-E3BB-4092-A423-A4EC20FB3C11}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsusFanControl.Application", "AsusFanControl.Application\AsusFanControl.Application.csproj", "{479790B8-79CE-4915-893C-D4D769FCD9B1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsusFanControl.Domain", "AsusFanControl.Domain\AsusFanControl.Domain.csproj", "{27DE14F4-82B0-4D2B-B694-D2F563810BD9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DF94635E-4107-4EE9-8675-7137E750BC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF94635E-4107-4EE9-8675-7137E750BC86}.Debug|Any CPU.Build.0 = Debug|Any CPU {DF94635E-4107-4EE9-8675-7137E750BC86}.Debug|x64.ActiveCfg = Debug|x64 {DF94635E-4107-4EE9-8675-7137E750BC86}.Debug|x64.Build.0 = Debug|x64 + {DF94635E-4107-4EE9-8675-7137E750BC86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF94635E-4107-4EE9-8675-7137E750BC86}.Release|Any CPU.Build.0 = Release|Any CPU {DF94635E-4107-4EE9-8675-7137E750BC86}.Release|x64.ActiveCfg = Release|x64 {DF94635E-4107-4EE9-8675-7137E750BC86}.Release|x64.Build.0 = Release|x64 + {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Debug|Any CPU.Build.0 = Debug|Any CPU {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Debug|x64.ActiveCfg = Debug|x64 {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Debug|x64.Build.0 = Debug|x64 + {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Release|Any CPU.Build.0 = Release|Any CPU {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Release|x64.ActiveCfg = Release|x64 {42CC78B6-E3BB-4092-A423-A4EC20FB3C11}.Release|x64.Build.0 = Release|x64 + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Debug|x64.ActiveCfg = Debug|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Debug|x64.Build.0 = Debug|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Release|Any CPU.Build.0 = Release|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Release|x64.ActiveCfg = Release|Any CPU + {479790B8-79CE-4915-893C-D4D769FCD9B1}.Release|x64.Build.0 = Release|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Debug|x64.ActiveCfg = Debug|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Debug|x64.Build.0 = Debug|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Release|Any CPU.Build.0 = Release|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Release|x64.ActiveCfg = Release|Any CPU + {27DE14F4-82B0-4D2B-B694-D2F563810BD9}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AsusFanControlGUI/App.config b/AsusFanControlGUI/App.config index dfcb056..3856c47 100644 --- a/AsusFanControlGUI/App.config +++ b/AsusFanControlGUI/App.config @@ -1,12 +1,12 @@ - + -
+
- + @@ -23,7 +23,7 @@ Off - 20,1-60,1-61,20-70,20-71,30-80,55 + 20,1-60,1-61,20-70,20-71,30-100,100-105,100 False @@ -46,6 +46,21 @@ + + 20,1-60,1-61,20-70,20-71,30-100,100-105,100 + + + + + + + + + + + + + diff --git a/AsusFanControlGUI/3038.7-fan-icon-iconbunny_1_.ico b/AsusFanControlGUI/AppIcon.ico similarity index 100% rename from AsusFanControlGUI/3038.7-fan-icon-iconbunny_1_.ico rename to AsusFanControlGUI/AppIcon.ico diff --git a/AsusFanControlGUI/AsusFanControlGUI.csproj b/AsusFanControlGUI/AsusFanControlGUI.csproj index f0e612f..37b0e6e 100644 --- a/AsusFanControlGUI/AsusFanControlGUI.csproj +++ b/AsusFanControlGUI/AsusFanControlGUI.csproj @@ -74,7 +74,7 @@ true - 3038.7-fan-icon-iconbunny_1_.ico + AppIcon.ico 3896F9A71C1385218E0E436CCCE1201230675364 @@ -92,18 +92,40 @@ ..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll + + False + ..\bin\x64\Release\LibreHardwareMonitorLib.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.2\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.9.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.dll + + + ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll + ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll True True + + ..\packages\Sentry.5.1.1\lib\net462\Sentry.dll + ..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll True True + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll + ..\packages\System.Console.4.3.0\lib\net46\System.Console.dll @@ -160,6 +182,10 @@ True True + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll True @@ -171,16 +197,25 @@ True + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll True True + + ..\packages\System.Reflection.Metadata.5.0.0\lib\net461\System.Reflection.Metadata.dll + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll True True + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + ..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll True @@ -216,11 +251,23 @@ True True + + ..\packages\System.Text.Encodings.Web.6.0.0\lib\net461\System.Text.Encodings.Web.dll + + + ..\packages\System.Text.Json.6.0.10\lib\net461\System.Text.Json.dll + ..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll True True + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + @@ -273,13 +320,17 @@ + + {27DE14F4-82B0-4D2B-B694-D2F563810BD9} + AsusFanControl.Domain + {df94635e-4107-4ee9-8675-7137e750bc86} AsusFanControl - + @@ -303,6 +354,8 @@ + + \ No newline at end of file diff --git a/AsusFanControlGUI/Form1.Designer.cs b/AsusFanControlGUI/Form1.Designer.cs index 744e700..cc274ef 100644 --- a/AsusFanControlGUI/Form1.Designer.cs +++ b/AsusFanControlGUI/Form1.Designer.cs @@ -34,14 +34,13 @@ this.label1 = new System.Windows.Forms.Label(); this.labelValue = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); + this.RefreshFanRPM = new System.Windows.Forms.Button(); this.labelRPM = new System.Windows.Forms.Label(); this.labelCPUTemp = new System.Windows.Forms.Label(); - this.button2 = new System.Windows.Forms.Button(); + this.RefreshCPUTemp = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemTurnOffControlOnExit = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemForbidUnsafeSettings = new System.Windows.Forms.ToolStripMenuItem(); this.allowFanCurveSettingViaTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -51,15 +50,16 @@ this.restartApplicationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resetToDefaultsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.label5 = new System.Windows.Forms.Label(); this.pictureBoxFanCurve = new System.Windows.Forms.PictureBox(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.radioButton1 = new System.Windows.Forms.RadioButton(); - this.fanControl = new System.Windows.Forms.RadioButton(); - this.fanCurve = new System.Windows.Forms.RadioButton(); + this.fanControlRadioButton = new System.Windows.Forms.RadioButton(); + this.fanCurveRadioButton = new System.Windows.Forms.RadioButton(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); + this.ResetCurvePoints = new System.Windows.Forms.Button(); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -73,9 +73,10 @@ this.label7 = new System.Windows.Forms.Label(); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.label3 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); + this.CurvePointsTextbox = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); + this.InvisibleLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.trackBarFanSpeed)).BeginInit(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFanCurve)).BeginInit(); @@ -95,7 +96,7 @@ this.trackBarFanSpeed.Name = "trackBarFanSpeed"; this.trackBarFanSpeed.Size = new System.Drawing.Size(519, 56); this.trackBarFanSpeed.TabIndex = 0; - this.trackBarFanSpeed.Value = 100; + this.trackBarFanSpeed.Value = 50; this.trackBarFanSpeed.ValueChanged += new System.EventHandler(this.trackBarFanSpeed_ValueChanged); this.trackBarFanSpeed.KeyUp += new System.Windows.Forms.KeyEventHandler(this.trackBarFanSpeed_KeyUp); this.trackBarFanSpeed.MouseMove += new System.Windows.Forms.MouseEventHandler(this.trackBarFanSpeed_MouseMove); @@ -131,16 +132,16 @@ this.label2.TabIndex = 3; this.label2.Text = "Current RPM:"; // - // button1 + // RefreshFanRPM // - this.button1.Location = new System.Drawing.Point(13, 655); - this.button1.Margin = new System.Windows.Forms.Padding(4); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(29, 28); - this.button1.TabIndex = 4; - this.button1.Text = "↻"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.RefreshFanRPM.Location = new System.Drawing.Point(13, 655); + this.RefreshFanRPM.Margin = new System.Windows.Forms.Padding(4); + this.RefreshFanRPM.Name = "RefreshFanRPM"; + this.RefreshFanRPM.Size = new System.Drawing.Size(29, 28); + this.RefreshFanRPM.TabIndex = 4; + this.RefreshFanRPM.Text = "↻"; + this.RefreshFanRPM.UseVisualStyleBackColor = true; + this.RefreshFanRPM.Click += new System.EventHandler(this.button1_Click); // // labelRPM // @@ -162,16 +163,16 @@ this.labelCPUTemp.TabIndex = 9; this.labelCPUTemp.Text = "-"; // - // button2 + // RefreshCPUTemp // - this.button2.Location = new System.Drawing.Point(13, 691); - this.button2.Margin = new System.Windows.Forms.Padding(4); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(29, 28); - this.button2.TabIndex = 8; - this.button2.Text = "↻"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + this.RefreshCPUTemp.Location = new System.Drawing.Point(13, 691); + this.RefreshCPUTemp.Margin = new System.Windows.Forms.Padding(4); + this.RefreshCPUTemp.Name = "RefreshCPUTemp"; + this.RefreshCPUTemp.Size = new System.Drawing.Size(29, 28); + this.RefreshCPUTemp.TabIndex = 8; + this.RefreshCPUTemp.Text = "↻"; + this.RefreshCPUTemp.UseVisualStyleBackColor = true; + this.RefreshCPUTemp.Click += new System.EventHandler(this.button2_Click); // // label4 // @@ -189,31 +190,23 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1, this.optionsToolStripMenuItem, - this.toolStripMenuItemCheckForUpdates}); + this.toolStripMenuItemCheckForUpdates, + this.aboutToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(670, 28); + this.menuStrip1.Size = new System.Drawing.Size(685, 28); this.menuStrip1.TabIndex = 10; this.menuStrip1.Text = "menuStrip1"; // // toolStripMenuItem1 // this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItemTurnOffControlOnExit, this.toolStripMenuItemForbidUnsafeSettings, this.allowFanCurveSettingViaTextToolStripMenuItem}); this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(89, 24); this.toolStripMenuItem1.Text = "Advanced"; // - // toolStripMenuItemTurnOffControlOnExit - // - this.toolStripMenuItemTurnOffControlOnExit.CheckOnClick = true; - this.toolStripMenuItemTurnOffControlOnExit.Name = "toolStripMenuItemTurnOffControlOnExit"; - this.toolStripMenuItemTurnOffControlOnExit.Size = new System.Drawing.Size(293, 26); - this.toolStripMenuItemTurnOffControlOnExit.Text = "Turn off control on exit"; - this.toolStripMenuItemTurnOffControlOnExit.CheckedChanged += new System.EventHandler(this.toolStripMenuItemTurnOffControlOnExit_CheckedChanged); - // // toolStripMenuItemForbidUnsafeSettings // this.toolStripMenuItemForbidUnsafeSettings.CheckOnClick = true; @@ -287,6 +280,13 @@ this.toolStripMenuItemCheckForUpdates.Text = "Check for updates"; this.toolStripMenuItemCheckForUpdates.Click += new System.EventHandler(this.toolStripMenuItemCheckForUpdates_Click); // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(64, 24); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // // label5 // this.label5.AutoSize = true; @@ -313,8 +313,8 @@ // groupBox1 // this.groupBox1.Controls.Add(this.radioButton1); - this.groupBox1.Controls.Add(this.fanControl); - this.groupBox1.Controls.Add(this.fanCurve); + this.groupBox1.Controls.Add(this.fanControlRadioButton); + this.groupBox1.Controls.Add(this.fanCurveRadioButton); this.groupBox1.Controls.Add(this.trackBarFanSpeed); this.groupBox1.Controls.Add(this.label5); this.groupBox1.Location = new System.Drawing.Point(12, 37); @@ -336,27 +336,27 @@ this.radioButton1.UseVisualStyleBackColor = true; this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); // - // fanControl + // fanControlRadioButton // - this.fanControl.AutoSize = true; - this.fanControl.Location = new System.Drawing.Point(17, 67); - this.fanControl.Name = "fanControl"; - this.fanControl.Size = new System.Drawing.Size(137, 20); - this.fanControl.TabIndex = 15; - this.fanControl.Text = "Turn on fan control"; - this.fanControl.UseVisualStyleBackColor = true; - this.fanControl.CheckedChanged += new System.EventHandler(this.fanControl_CheckedChanged); + this.fanControlRadioButton.AutoSize = true; + this.fanControlRadioButton.Location = new System.Drawing.Point(17, 67); + this.fanControlRadioButton.Name = "fanControlRadioButton"; + this.fanControlRadioButton.Size = new System.Drawing.Size(137, 20); + this.fanControlRadioButton.TabIndex = 15; + this.fanControlRadioButton.Text = "Turn on fan control"; + this.fanControlRadioButton.UseVisualStyleBackColor = true; + this.fanControlRadioButton.CheckedChanged += new System.EventHandler(this.fanControl_CheckedChanged); // - // fanCurve + // fanCurveRadioButton // - this.fanCurve.AutoSize = true; - this.fanCurve.Location = new System.Drawing.Point(17, 150); - this.fanCurve.Name = "fanCurve"; - this.fanCurve.Size = new System.Drawing.Size(130, 20); - this.fanCurve.TabIndex = 14; - this.fanCurve.Text = "Turn on fan curve"; - this.fanCurve.UseVisualStyleBackColor = true; - this.fanCurve.CheckedChanged += new System.EventHandler(this.fanCurve_CheckedChanged); + this.fanCurveRadioButton.AutoSize = true; + this.fanCurveRadioButton.Location = new System.Drawing.Point(17, 150); + this.fanCurveRadioButton.Name = "fanCurveRadioButton"; + this.fanCurveRadioButton.Size = new System.Drawing.Size(130, 20); + this.fanCurveRadioButton.TabIndex = 14; + this.fanCurveRadioButton.Text = "Turn on fan curve"; + this.fanCurveRadioButton.UseVisualStyleBackColor = true; + this.fanCurveRadioButton.CheckedChanged += new System.EventHandler(this.fanCurve_CheckedChanged); // // button3 // @@ -369,16 +369,16 @@ this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // - // button4 + // ResetCurvePoints // - this.button4.Location = new System.Drawing.Point(13, 552); - this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(35, 27); - this.button4.TabIndex = 23; - this.button4.Text = "R"; - this.toolTip1.SetToolTip(this.button4, "Reset"); - this.button4.UseVisualStyleBackColor = true; - this.button4.Click += new System.EventHandler(this.button4_Click); + this.ResetCurvePoints.Location = new System.Drawing.Point(13, 552); + this.ResetCurvePoints.Name = "ResetCurvePoints"; + this.ResetCurvePoints.Size = new System.Drawing.Size(35, 27); + this.ResetCurvePoints.TabIndex = 23; + this.ResetCurvePoints.Text = "R"; + this.toolTip1.SetToolTip(this.ResetCurvePoints, "Reset"); + this.ResetCurvePoints.UseVisualStyleBackColor = true; + this.ResetCurvePoints.Click += new System.EventHandler(this.button4_Click); // // notifyIcon1 // @@ -396,6 +396,7 @@ this.closeToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(115, 52); + this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // openToolStripMenuItem // @@ -508,6 +509,10 @@ this.label7.TabIndex = 21; this.label7.Text = "Update Speed:"; // + // backgroundWorker1 + // + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork); + // // label3 // this.label3.Location = new System.Drawing.Point(12, 755); @@ -517,16 +522,16 @@ this.label3.Text = "."; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // textBox1 + // CurvePointsTextbox // - this.textBox1.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox1.Location = new System.Drawing.Point(53, 552); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(564, 27); - this.textBox1.TabIndex = 21; - this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress); - this.textBox1.MouseHover += new System.EventHandler(this.textBox1_MouseHover); + this.CurvePointsTextbox.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.CurvePointsTextbox.Location = new System.Drawing.Point(53, 552); + this.CurvePointsTextbox.Name = "CurvePointsTextbox"; + this.CurvePointsTextbox.ReadOnly = true; + this.CurvePointsTextbox.Size = new System.Drawing.Size(564, 27); + this.CurvePointsTextbox.TabIndex = 21; + this.CurvePointsTextbox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress); + this.CurvePointsTextbox.MouseHover += new System.EventHandler(this.textBox1_MouseHover); // // label10 // @@ -544,24 +549,36 @@ this.label11.Size = new System.Drawing.Size(645, 2); this.label11.TabIndex = 25; // + // InvisibleLabel + // + this.InvisibleLabel.AutoSize = true; + this.InvisibleLabel.Location = new System.Drawing.Point(103, 225); + this.InvisibleLabel.Name = "InvisibleLabel"; + this.InvisibleLabel.Size = new System.Drawing.Size(56, 16); + this.InvisibleLabel.TabIndex = 26; + this.InvisibleLabel.Text = "Invisible"; + this.InvisibleLabel.Visible = false; + this.InvisibleLabel.Click += new System.EventHandler(this.InvisibleLabel_Click); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(670, 786); + this.ClientSize = new System.Drawing.Size(685, 786); + this.Controls.Add(this.InvisibleLabel); this.Controls.Add(this.label11); this.Controls.Add(this.label10); - this.Controls.Add(this.button4); + this.Controls.Add(this.ResetCurvePoints); this.Controls.Add(this.button3); - this.Controls.Add(this.textBox1); + this.Controls.Add(this.CurvePointsTextbox); this.Controls.Add(this.label3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.pictureBoxFanCurve); this.Controls.Add(this.labelCPUTemp); - this.Controls.Add(this.button2); + this.Controls.Add(this.RefreshCPUTemp); this.Controls.Add(this.label4); this.Controls.Add(this.labelRPM); - this.Controls.Add(this.button1); + this.Controls.Add(this.RefreshFanRPM); this.Controls.Add(this.label2); this.Controls.Add(this.labelValue); this.Controls.Add(this.label1); @@ -597,21 +614,20 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Label labelValue; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button RefreshFanRPM; private System.Windows.Forms.Label labelRPM; private System.Windows.Forms.Label labelCPUTemp; - private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button RefreshCPUTemp; private System.Windows.Forms.Label label4; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemTurnOffControlOnExit; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemForbidUnsafeSettings; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemCheckForUpdates; private System.Windows.Forms.Label label5; private System.Windows.Forms.PictureBox pictureBoxFanCurve; private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.RadioButton fanCurve; - private System.Windows.Forms.RadioButton fanControl; + private System.Windows.Forms.RadioButton fanCurveRadioButton; + private System.Windows.Forms.RadioButton fanControlRadioButton; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.NotifyIcon notifyIcon1; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; @@ -627,9 +643,9 @@ private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label8; private System.Windows.Forms.NumericUpDown numericUpDown2; - private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox CurvePointsTextbox; private System.Windows.Forms.Button button3; - private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button ResetCurvePoints; private System.Windows.Forms.ToolStripMenuItem allowFanCurveSettingViaTextToolStripMenuItem; private System.Windows.Forms.Label label10; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; @@ -639,6 +655,8 @@ private System.Windows.Forms.Label label11; private System.Windows.Forms.ToolStripMenuItem restartApplicationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem resetToDefaultsToolStripMenuItem; + private System.Windows.Forms.Label InvisibleLabel; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; } } diff --git a/AsusFanControlGUI/Form1.cs b/AsusFanControlGUI/Form1.cs index 9f67d78..5cc23e4 100644 --- a/AsusFanControlGUI/Form1.cs +++ b/AsusFanControlGUI/Form1.cs @@ -1,34 +1,43 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; -using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Reflection; -using System.Security.AccessControl; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using AsusFanControl; -using AsusFanControlGUI.Properties; using Microsoft.Win32; -using static System.Security.Cryptography.ECCurve; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; -using static AsusFanControlGUI.Form1; +using LibreHardwareMonitor.Hardware; +using System.Management; +using System; +using AsusFanControl.Domain.services; namespace AsusFanControlGUI { public partial class Form1 : Form { + // Dependency injection + private readonly FanCurve _fanCurve; + private readonly Random rnd = new Random(); readonly AsusControl asusControl = new AsusControl(); - int currentFanSpeed = 0; + int currentFanRPM = 0; ulong currentTemp = 0; - public Form1() + int temperatureLowerBound = 20; + int temperatureUpperBound = 105; + + int fanSpeedLowerBound = 1; + int fanSpeedUpperBound = 100; + + public Form1( + FanCurve fanCurve + ) { + _fanCurve = fanCurve; + InitializeComponent(); AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); @@ -42,94 +51,142 @@ namespace AsusFanControlGUI { if (IsHandleCreated) { - startErrorHandler(); - - toolStripMenuItemTurnOffControlOnExit.Checked = Properties.Settings.Default.turnOffControlOnExit; + // Load settings from the settings file + //toolStripMenuItemTurnOffControlOnExit.Checked = Properties.Settings.Default.turnOffControlOnExit; toolStripMenuItemForbidUnsafeSettings.Checked = Properties.Settings.Default.forbidUnsafeSettings; startMinimisedToolStripMenuItem.Checked = Properties.Settings.Default.startMinimised; - startWithWindowsToolStripMenuItem.Checked = Properties.Settings.Default.startWithWindows; + //startWithWindowsToolStripMenuItem.Checked = Properties.Settings.Default.startWithWindows; + checkIfAppIsInStartup(); trackBarFanSpeed.Value = Properties.Settings.Default.fanSpeed; radioButton1.Checked = Properties.Settings.Default.fanControlState == "Off"; - fanControl.Checked = Properties.Settings.Default.fanControlState == "Manual"; - fanCurve.Checked = Properties.Settings.Default.fanControlState == "Curve"; + fanControlRadioButton.Checked = Properties.Settings.Default.fanControlState == "Manual"; + fanCurveRadioButton.Checked = Properties.Settings.Default.fanControlState == "Curve"; allowFanCurveSettingViaTextToolStripMenuItem.Checked = Properties.Settings.Default.allowFanCurveSettingViaText; numericUpDown1.Value = Properties.Settings.Default.hysteresis; numericUpDown2.Value = Properties.Settings.Default.updateSpeed; // Manually trigger events radioButton1_CheckedChanged(radioButton1, EventArgs.Empty); - fanCurve_CheckedChanged(fanCurve, EventArgs.Empty); - fanControl_CheckedChanged(fanControl, EventArgs.Empty); + fanCurve_CheckedChanged(fanCurveRadioButton, EventArgs.Empty); + fanControl_CheckedChanged(fanControlRadioButton, EventArgs.Empty); allowFanCurveSettingViaTextToolStripMenuItem_Click(allowFanCurveSettingViaTextToolStripMenuItem, EventArgs.Empty); Properties.Settings.Default.PropertyChanged += (sender, e) => { if (e.PropertyName == "FanCurvePoints") { - textBox1.Text = Properties.Settings.Default.FanCurvePoints; + CurvePointsTextbox.Text = Properties.Settings.Default.FanCurvePoints; } }; - SetFanCurvePoints(null); - //SetFanCurvePoints("20,1;60,1;61,20;70,20;71,30;80,55"); - Timer_Tick(); + SetFanCurvePoints(Properties.Settings.Default.FanCurvePoints); + AutoRefreshStats(); + startErrorHandler(temperatureLowerBound, temperatureUpperBound); + } else { // Restart the init function after a short delay - await System.Threading.Tasks.Task.Delay(20); + await Task.Delay(20); init(); } } - private async void startErrorHandler() + public void checkForNewVersion() { - int minTemp = 1; - int maxTemp = 200; - Console.WriteLine("Running"); - if ((fanCurve.Checked || fanControl.Checked) && (currentTemp < (ulong)minTemp || currentTemp > (ulong)maxTemp)) + // Check for new version + // If new version is available, show a notification + // If the user clicks on the notification, open the download page in the default web browser + // https://github.com/Darren80/AsusFanControlEnhanced/releases + } + + private async void startErrorHandler(int minTemp, int maxTemp, bool debug = false) + { + while (true) { - // Give it a second chance - await Task.Delay(1000); - ulong temp = await Task.Run(() => asusControl.Thermal_Read_Cpu_Temperature()); - if (temp >= (ulong)minTemp && temp < (ulong)maxTemp) + // Wait for X seconds + await Task.Delay(3000); + + // Check if the CPU temperature is outside of the good range + // Out of bounds values + + Console.WriteLine($"Current temp: {currentTemp}"); + if ((currentTemp < (ulong)minTemp || currentTemp > (ulong)maxTemp) || debug) { - return; + Console.WriteLine("Error!"); + + Properties.Settings.Default.wasError = true; + string errorMsg = $"CPU temprature is outside of good range at {currentTemp}°C. \n" + + $"Maybe try restarting the application? Options -> Restart application"; + Properties.Settings.Default.errorMsg = errorMsg; + Properties.Settings.Default.Save(); + + Console.WriteLine(errorMsg); + InvisibleLabel.Text = errorMsg; + InvisibleLabel.Visible = true; + } + else + { + InvisibleLabel.Text = ""; + InvisibleLabel.Visible = false; + } + } + + } + + public async Task updateFanRPMLabel() + { + var speeds = await Task.Run(() => asusControl.GetFanSpeeds()); + Console.WriteLine($"Fan speeds: {string.Join(" ", speeds)}"); + labelRPM.Text = string.Join(" ", speeds); + } + + public async Task updateCPUTempLabel() + { + var temp = await Task.Run(() => asusControl.Thermal_Read_Cpu_Temperature()); + Console.WriteLine($"CPU temp: {temp}"); + currentTemp = temp; + labelCPUTemp.Text = $"{temp}"; + } + + private async void AutoRefreshStats() + { + while (true) + { + if (WindowState == FormWindowState.Minimized) + { + await Task.Delay(1000); + } + else + { + await Task.Delay(500); } - Properties.Settings.Default.wasError = true; - Properties.Settings.Default.errorMsg = $"CPU temprature were outside of good range at {currentTemp}°C, either something has not loaded properly or CPU sensors are faulty."; - Properties.Settings.Default.Save(); - Console.WriteLine("Restarting"); - Application.Restart(); - Environment.Exit(0); + Console.WriteLine($"Refreshing stats"); + + // Update fan speeds and CPU temperature. + // Run both tasks concurrently + // Wait for both tasks to complete + await Task.WhenAll(updateFanRPMLabel(), updateCPUTempLabel()); } } - private async void Timer_Tick() + private void checkIfAppIsInStartup() { - if (WindowState == FormWindowState.Minimized) + string appName = Assembly.GetExecutingAssembly().GetName().Name; + + RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); + startWithWindowsToolStripMenuItem.Checked = registryKey.GetValue(appName) != null; + + // If app name is in startup, but app path does not match the current app path, update the startup entry + if (startWithWindowsToolStripMenuItem.Checked) { - await Task.Delay(1000); - Timer_Tick(); - return; + string appPath = Assembly.GetExecutingAssembly().Location; + string registryValue = registryKey.GetValue(appName).ToString(); + if (registryValue != appPath) + { + Console.WriteLine("Updating startup entry"); + registryKey.SetValue(appName, appPath); + } } - - //Console.WriteLine($"Refreshing {rnd.Next(100)}"); - // Update fan speeds and CPU temperature. - // Run both tasks concurrently - Task fanSpeedsTask = Task.Run(() => string.Join(" ", asusControl.GetFanSpeeds())); - Task cpuTempTask = Task.Run(() => $"{asusControl.Thermal_Read_Cpu_Temperature()}"); - - // Wait for both tasks to complete - await Task.WhenAll(fanSpeedsTask, cpuTempTask); - - // Get the results from the completed tasks - labelRPM.Text = fanSpeedsTask.Result; - labelCPUTemp.Text = cpuTempTask.Result; - currentTemp = (ulong)Decimal.Parse(cpuTempTask.Result); - startErrorHandler(); - - await Task.Delay(250); - Timer_Tick(); } private void AddToStartup() @@ -157,8 +214,8 @@ namespace AsusFanControlGUI private void toolStripMenuItemTurnOffControlOnExit_CheckedChanged(object sender, EventArgs e) { - Properties.Settings.Default.turnOffControlOnExit = toolStripMenuItemTurnOffControlOnExit.Checked; - Properties.Settings.Default.Save(); + //Properties.Settings.Default.turnOffControlOnExit = toolStripMenuItemTurnOffControlOnExit.Checked; + //Properties.Settings.Default.Save(); } private void toolStripMenuItemForbidUnsafeSettings_CheckedChanged(object sender, EventArgs e) @@ -172,6 +229,19 @@ namespace AsusFanControlGUI System.Diagnostics.Process.Start("https://github.com/Darren80/AsusFanControlEnhanced/releases"); } + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + // Get version number + string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + MessageBox.Show($"AsusFanControlEnhanced\n\nVersion: {version}\n\nAuthor: Darren80\n\nhttps://github.com/Darren80/AsusFanControlEnhanced", "About AsusFanControlEnhanced"); + } + + private void setNotifyIconText(string text) + { + Console.WriteLine($"Setting notify icon text to: {text}"); + notifyIcon1.Text = text; + } + private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) @@ -179,14 +249,14 @@ namespace AsusFanControlGUI Properties.Settings.Default.fanControlState = "Off"; Properties.Settings.Default.Save(); - notifyIcon1.Text = $"AsusFanControlEnhanced - Off"; + setNotifyIconText("AsusFanControlEnhanced - Off"); setFanSpeed(0, null); } } private async void fanControl_CheckedChanged(object sender, EventArgs e) { - if (fanControl.Checked) + if (fanControlRadioButton.Checked) { Properties.Settings.Default.fanControlState = "Manual"; Properties.Settings.Default.Save(); @@ -206,11 +276,11 @@ namespace AsusFanControlGUI bool firstRun = true; private async void setFanSpeed(int value, bool? xyz) { - if (currentFanSpeed == value) + if (currentFanRPM == value) return; await Task.Run(() => asusControl.SetFanSpeeds(value)); - currentFanSpeed = value; + currentFanRPM = value; if (value == 0) labelValue.Text = "turned off"; @@ -220,7 +290,7 @@ namespace AsusFanControlGUI if (firstRun) { await Task.Delay(1000); - currentFanSpeed = 999999; + currentFanRPM = 999999; setFanSpeed(value, null); firstRun = false; } @@ -243,11 +313,11 @@ namespace AsusFanControlGUI label5.Text = trackBarFanSpeedValue.ToString() + "% Fan"; Console.WriteLine($"Setting speed to: {(int)trackBarFanSpeedValue}"); label3.Text = $"Setting speed to: {(int)trackBarFanSpeedValue}%";// (Stamp: {rnd.Next(1000)})"; - notifyIcon1.Text = $"AsusFanControlEnhanced - Fan Speed: {(int)trackBarFanSpeedValue}%"; + setNotifyIconText($"Fan RPM: {(int)trackBarFanSpeedValue}% - Temp: {currentTemp}°C"); if ((int)trackBarFanSpeedValue == 0) - notifyIcon1.Text = $"AsusFanControlEnhanced - Off"; + setNotifyIconText("AsusFanControlEnhanced - Off"); - setFanSpeed((int)trackBarFanSpeedValue, fanControl.Checked); + setFanSpeed((int)trackBarFanSpeedValue, fanControlRadioButton.Checked); } private void trackBarFanSpeed_KeyUp(object sender, KeyEventArgs e) @@ -269,12 +339,9 @@ namespace AsusFanControlGUI ulong temp = await Task.Run(() => asusControl.Thermal_Read_Cpu_Temperature()); currentTemp = temp; labelCPUTemp.Text = $"{temp}"; - startErrorHandler(); + startErrorHandler(temperatureLowerBound, temperatureUpperBound); } - // My Code: - private Point maxPoint; - private Point minPoint; private Dictionary fanCurvePoints = new Dictionary() { { 1, new Point(20, 1) }, @@ -284,15 +351,6 @@ namespace AsusFanControlGUI { 8, new Point(71, 30) }, { 9, new Point(80, 55) }, }; - private Timer fanCurveTimer; // Declare the timer as a class-level variable - - // Set up the graph dimensions - const int padding = 40; - - // Draw the temperature axis and labels - const int tempMin = 20; - const int tempMax = 100; - const int tempInterval = 10; private void pictureBoxFanCurve_Paint(object sender, PaintEventArgs e) { @@ -364,8 +422,29 @@ namespace AsusFanControlGUI private void pictureBoxFanCurve_MouseDoubleClick(object sender, MouseEventArgs e) { - (int temperature, int fanSpeed) = mousePosition(e.Location); + (int temperature, int fanSpeed) = convertMousePositionToTemperatureAndFanSpeed(e.Location); + if (temperature < temperatureLowerBound || temperature > temperatureUpperBound) + { + temperature = Math.Max(temperatureLowerBound, Math.Min(temperature, temperatureUpperBound)); + } + if (fanSpeed < fanSpeedLowerBound || fanSpeed > fanSpeedUpperBound) + { + fanSpeed = Math.Max(fanSpeedLowerBound, Math.Min(fanSpeed, fanSpeedUpperBound)); + } + + // If a point already exists at the same temperature, update its fan speed + foreach (KeyValuePair point in fanCurvePoints) + { + if (point.Value.X == temperature) + { + fanCurvePoints[point.Key] = new Point(temperature, fanSpeed); + pictureBoxFanCurve.Invalidate(); // Redraw the graph + return; + } + } + + // Check if the maximum number of points has been reached if (fanCurvePoints.Count >= 20) { MessageBox.Show("Maximum number of points reached."); @@ -387,7 +466,7 @@ namespace AsusFanControlGUI private int selectedPointId = 0; - private (int temperature, int fanSpeed) mousePosition(Point e) + private (int temperature, int fanSpeed) convertMousePositionToTemperatureAndFanSpeed(Point e) { // Set up the graph dimensions int padding = 40; @@ -409,7 +488,7 @@ namespace AsusFanControlGUI private KeyValuePair nearestPointToMouse(MouseEventArgs e, int maxDistance) { - (int temperature, int fanSpeed) = mousePosition(e.Location); + (int temperature, int fanSpeed) = convertMousePositionToTemperatureAndFanSpeed(e.Location); var nearestPoints = fanCurvePoints @@ -466,7 +545,7 @@ namespace AsusFanControlGUI if (selectedPointId != 0) { // Get mouse location on grid - (int temperature, int fanSpeed) = mousePosition(e.Location); + (int temperature, int fanSpeed) = convertMousePositionToTemperatureAndFanSpeed(e.Location); if (temperature < minimumTemperature || temperature > maximumTemperature) { @@ -492,7 +571,7 @@ namespace AsusFanControlGUI { selectedPointId = 0; toolTip1.SetToolTip(pictureBoxFanCurve, "Fan Curve Graph"); - SaveFanCurvePoints(); + SaveFanCurvePoints(fanCurvePoints); runFanCurve(true, true); // fanCurvePoints.ToList().ForEach(point => Console.Write($"ID: {point.Key}, X: {point.Value.X}, Y: {point.Value.Y}")); @@ -510,7 +589,7 @@ namespace AsusFanControlGUI { Properties.Settings.Default.fanControlState = "Curve"; Properties.Settings.Default.Save(); - Console.WriteLine(fanCurve.Checked); + Console.WriteLine(fanCurveRadioButton.Checked); runFanCurve(); } @@ -541,7 +620,7 @@ namespace AsusFanControlGUI // Temperature is outside the range, yield control to the system. label3.Text = "Control yeilded to system when temprature is outside range."; Console.WriteLine("Temperature is outside the range, yield control to the system."); - notifyIcon1.Text = $"AsusFanControlEnhanced - Off"; + setNotifyIconText("AsusFanControlEnhanced - Off"); return 0; }else { @@ -554,24 +633,19 @@ namespace AsusFanControlGUI private async void runFanCurve(bool bypassHysteresisCheck=false, bool runOnce=false) { - if (!fanCurve.Checked) + if (!fanCurveRadioButton.Checked) { label3.Text = $""; return; } //Console.WriteLine("Fan Curve, " + (int)numericUpDown2.Value); - - // Read the current temperature - ulong temp = await Task.Run(() => asusControl.Thermal_Read_Cpu_Temperature()); // Implement the ReadTemperature method to get the current temperature - currentTemp = temp; - startErrorHandler(); //Console.WriteLine("Temp, " + currentTemp); - double fanSpeed = CalculateFanSpeed(temp); + double fanSpeed = CalculateFanSpeed(currentTemp); // Apply hysteresis to prevent rapid fan speed changes int hysteresis = (int)numericUpDown1.Value; // Adjust the hysteresis value as needed - if ((int)temp > lastTemperature + hysteresis || (int)temp < lastTemperature - hysteresis || fanSpeed < 10 || bypassHysteresisCheck) + if ((int)currentTemp > lastTemperature + hysteresis || (int)currentTemp < lastTemperature - hysteresis || fanSpeed < 10 || bypassHysteresisCheck) { // Update the fan speed fanSpeed = Math.Max(0, Math.Min(100, fanSpeed)); @@ -580,10 +654,10 @@ namespace AsusFanControlGUI Console.WriteLine($"Set fan speed to {(int)fanSpeed}% {rnd.Next(1000)}, last fan speed = {lastTemperature}"); if (fanSpeed != 0) { - label3.Text = $"Set fan speed to {(int)fanSpeed}%, current temp: {temp}°C";// (Stamp: {rnd.Next(1000)})"; - notifyIcon1.Text = $"AsusFanControlEnhanced - Current Temp: {(int)temp}°C - Fan Speed: {(int)fanSpeed}%"; + label3.Text = $"Set fan speed to {(int)fanSpeed}%, current temp: {currentTemp}°C";// (Stamp: {rnd.Next(1000)})"; + setNotifyIconText($"Fan RPM: {(int)fanSpeed}% - Temp: {currentTemp}°C"); } - lastTemperature = (int)temp; + lastTemperature = (int)currentTemp; } @@ -597,8 +671,6 @@ namespace AsusFanControlGUI // Keep track of the last fan speed to apply hysteresis private int lastTemperature = 0; - - private void Form1_Resize(object sender, EventArgs e) { if (WindowState == FormWindowState.Minimized) @@ -637,9 +709,13 @@ namespace AsusFanControlGUI } } - private void SaveFanCurvePoints() + private void SaveFanCurvePoints(Dictionary _fanCurvePoints) { - string fanCurvePointsString = string.Join("-", fanCurvePoints.OrderBy(x => x.Value.X).Select(x => $"{x.Value.X},{x.Value.Y}")); + // Save to state + fanCurvePoints = _fanCurvePoints; + + // Convert the fan curve points to a string + string fanCurvePointsString = string.Join("-", _fanCurvePoints.OrderBy(x => x.Value.X).Select(x => $"{x.Value.X},{x.Value.Y}")); Properties.Settings.Default.FanCurvePoints = fanCurvePointsString; Properties.Settings.Default.Save(); @@ -647,56 +723,52 @@ namespace AsusFanControlGUI Console.WriteLine(fanCurvePointsString); } - private void SetFanCurvePoints(String? fanCurveString) + private void SetFanCurvePoints(String fanCurvePointsString) { - int count = 1; - string fanCurvePointsString = fanCurveString ?? Properties.Settings.Default.FanCurvePoints; - Console.WriteLine(fanCurvePointsString); - - if (string.IsNullOrEmpty(fanCurvePointsString)) - { - return; - } - // Parse the string + Dictionary fanCurvePointsDictionaryFromString; try { - - fanCurvePoints = fanCurvePointsString.Split('-') - .Select(x => - { - string[] parts = x.Split(','); - return new KeyValuePair(count++, new Point(int.Parse(parts[0]), int.Parse(parts[1]))); - }) - .ToDictionary(x => x.Key, x => x.Value); - - //Save - textBox1.Text = fanCurvePointsString; - SaveFanCurvePoints(); + fanCurvePointsDictionaryFromString = _fanCurve.convertStringToPointsDictionary( + fanCurvePointsString, temperatureLowerBound, temperatureUpperBound, fanSpeedLowerBound, fanSpeedUpperBound + ); } - catch (Exception ex) + catch (Exception ex) { + // Show the error message and stack trace in a MessageBox + //MessageBox.Show($"An error occurred: {ex.Message}\n\nStack Trace:\n{ex.StackTrace}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } + //Save + // CurvePointsTextbox.Text = fanCurvePointsString; + SaveFanCurvePoints(fanCurvePointsDictionaryFromString); + pictureBoxFanCurve.Invalidate(); } private void button4_Click(object sender, EventArgs e) { - textBox1.Text = Properties.Settings.Default.FanCurvePoints; - SetFanCurvePoints(null); + try + { + SetFanCurvePoints(Properties.Settings.Default.DefaultFanCurvePoints); + CurvePointsTextbox.Text = Properties.Settings.Default.DefaultFanCurvePoints; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } } private void button3_Click(object sender, EventArgs e) { try { - SetFanCurvePoints(textBox1.Text); + SetFanCurvePoints(CurvePointsTextbox.Text); MessageBox.Show("Save successful."); } catch (Exception ex) { - MessageBox.Show("An error occurred: " + ex.Message); + MessageBox.Show(ex.Message); } } @@ -714,12 +786,12 @@ namespace AsusFanControlGUI try { - SetFanCurvePoints(textBox1.Text); + SetFanCurvePoints(CurvePointsTextbox.Text); MessageBox.Show("Save successful."); } catch (Exception ex) { - MessageBox.Show("An error occurred: " + ex.Message); + MessageBox.Show(ex.Message); } } @@ -729,19 +801,19 @@ namespace AsusFanControlGUI { Properties.Settings.Default.allowFanCurveSettingViaText = true; Properties.Settings.Default.Save(); - button3.Enabled = true; textBox1.ReadOnly = false; button4.Enabled = true; + button3.Enabled = true; CurvePointsTextbox.ReadOnly = false; //ResetCurvePoints.Enabled = true; } else { Properties.Settings.Default.allowFanCurveSettingViaText = false; Properties.Settings.Default.Save(); - button3.Enabled = false; textBox1.ReadOnly = true; button4.Enabled = false; + button3.Enabled = false; CurvePointsTextbox.ReadOnly = true; //ResetCurvePoints.Enabled = false; } } private void textBox1_MouseHover(object sender, EventArgs e) { - toolTip1.Show(textBox1.Text, textBox1); + toolTip1.Show(CurvePointsTextbox.Text, CurvePointsTextbox); } private void startWithWindowsToolStripMenuItem1_Click_1(object sender, EventArgs e) @@ -750,6 +822,7 @@ namespace AsusFanControlGUI { Properties.Settings.Default.startWithWindows = true; Properties.Settings.Default.Save(); + RemoveFromStartup(); AddToStartup(); } else @@ -791,7 +864,7 @@ namespace AsusFanControlGUI Console.WriteLine($"asdad: {Properties.Settings.Default.wasError}"); if (Properties.Settings.Default.wasError == true) { - MessageBox.Show($"An error caused the application to restart:\n\nError: {Properties.Settings.Default.errorMsg}"); + //MessageBox.Show($"An error caused the application to restart:\n\nError: {Properties.Settings.Default.errorMsg}"); Properties.Settings.Default.wasError = false; Properties.Settings.Default.errorMsg = ""; Properties.Settings.Default.Save(); @@ -805,8 +878,7 @@ namespace AsusFanControlGUI private void Form1_FormClosing(object sender, FormClosingEventArgs e) { - if (Properties.Settings.Default.turnOffControlOnExit) - asusControl.SetFanSpeeds(0); + asusControl.SetFanSpeeds(0); } private void numericUpDown1_ValueChanged(object sender, EventArgs e) @@ -853,6 +925,58 @@ namespace AsusFanControlGUI } } + public static double GetCpuTemperature() + { + try + { + // Create a ManagementObjectSearcher to query WMI + ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature"); + + // Iterate through the results + foreach (ManagementObject obj in searcher.Get()) + { + // The temperature is given in tenths of Kelvin. Convert to Celsius. + double temperature = Convert.ToDouble(obj["CurrentTemperature"].ToString()); + temperature = (temperature / 10.0) - 273.15; + + return temperature; + } + } + catch (ManagementException e) + { + Console.WriteLine("An error occurred while querying for WMI data: " + e.Message); + } + catch (Exception e) + { + Console.WriteLine("An unexpected error occurred: " + e.Message); + } + + // Return 0 if no temperature data is found or an error occurs + return 0; + } + + private void InvisibleLabel_Click(object sender, EventArgs e) + { + + } + + private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) + { + + } + + private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e) + { + + } + + private void toolStripMenuItemTurnOffControlOnExit_Click(object sender, EventArgs e) + { + + } + + + //notifyIcon1.BalloonTipText = string.Join(" ", asusControl.GetFanSpeeds()) + $" Temp: {asusControl.Thermal_Read_Cpu_Temperature()}"; } } } diff --git a/AsusFanControlGUI/Program.cs b/AsusFanControlGUI/Program.cs index 4bf367c..ed902c6 100644 --- a/AsusFanControlGUI/Program.cs +++ b/AsusFanControlGUI/Program.cs @@ -1,8 +1,13 @@ -using System; +using AsusFanControl.Domain.services; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; +using Microsoft.Extensions.DependencyInjection; +using System.Threading; +using System.Configuration; +using System.Text; namespace AsusFanControlGUI { @@ -16,7 +21,142 @@ namespace AsusFanControlGUI { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + + // Subscribe to unhandled exception events + Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + + // Simulate an unhandled exception on the UI thread + //throw new InvalidOperationException("Simulated UI thread exception"); + + // Configure the DI container + var serviceProvider = ConfigureServices(); + + // Resolve the main form and run the application + using (var form = serviceProvider.GetRequiredService()) + { + Application.Run(form); + } + } + + private static IServiceProvider ConfigureServices() + { + var services = new ServiceCollection(); + + // Register domain layer + services.AddSingleton(); + + // Register application layer + + // Register infrastructure layer + + // Register presentation layer + services.AddSingleton(); + + return services.BuildServiceProvider(); + } + + static string GetApplicationSettings() + { + StringBuilder settings = new StringBuilder(); + foreach (SettingsProperty property in Properties.Settings.Default.Properties) + { + settings.AppendLine($"{property.Name}: {Properties.Settings.Default[property.Name]}"); + } + return settings.ToString(); + } + static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) + { + ShowErrorDialog(e.Exception); + } + + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + ShowErrorDialog(e.ExceptionObject as Exception); + } + + static void ShowErrorDialog(Exception ex) + { + // Get the current state of application settings + string settings = GetApplicationSettings(); + + // Build the message + string message = $"An error occured, please try restarting the application.\n\n" + + "If the error persists then create a GitHub issue at:\n" + + "https://github.com/Darren80/AsusFanControlEnhanced/issues if one does not already exist \n\n" + + $"Stack Trace:\n{ex.StackTrace}\n\n" + + $"Application Settings:\n{settings}\n\n" + + $"Error Message:\n{ex.Message}\n\n"; + + // Create a custom form to display the error message with scroll bars + using (var form = new Form()) + { + form.Text = "Unhandled Exception - AsusFanControlEnhanced"; + form.Size = new System.Drawing.Size(600, 400); + form.StartPosition = FormStartPosition.CenterScreen; + //form.Icon = Properties.Resources.ResourceManager.GetObject("AppIcon") as System.Drawing.Icon; + + // Add a RichTextBox to display the message with scroll bars + var textBox = new RichTextBox + { + Text = message, + ReadOnly = true, + Dock = DockStyle.Fill, + ScrollBars = RichTextBoxScrollBars.Vertical, + Font = new System.Drawing.Font("Consolas", 9.75f) // Use a monospaced font for better readability + }; + + // Add Restart and Exit buttons + var restartButton = new Button + { + Text = "Restart", + DialogResult = DialogResult.Yes, + Dock = DockStyle.Bottom + }; + + var exitButton = new Button + { + Text = "Exit", + DialogResult = DialogResult.No, + Dock = DockStyle.Bottom + }; + + // Add controls to the form + form.Controls.Add(textBox); + form.Controls.Add(restartButton); + form.Controls.Add(exitButton); + + // Handle button clicks + form.AcceptButton = restartButton; + form.CancelButton = exitButton; + + // Show the form and handle the result + DialogResult result = form.ShowDialog(); + + if (result == DialogResult.Yes) + { + // Restart the application + RestartApplication(); + } + else if (result == DialogResult.No) + { + // Exit the application + Environment.Exit(1); + } } } + + static void RestartApplication() + { + // Reset application properties + Properties.Settings.Default.Reset(); + Properties.Settings.Default.Save(); + + // Restart the application + string applicationPath = Application.ExecutablePath; + System.Diagnostics.Process.Start(applicationPath); + Environment.Exit(0); + } +} } diff --git a/AsusFanControlGUI/Properties/AssemblyInfo.cs b/AsusFanControlGUI/Properties/AssemblyInfo.cs index fb8b54e..46b8586 100644 --- a/AsusFanControlGUI/Properties/AssemblyInfo.cs +++ b/AsusFanControlGUI/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] diff --git a/AsusFanControlGUI/Properties/Settings.Designer.cs b/AsusFanControlGUI/Properties/Settings.Designer.cs index 711b539..c250805 100644 --- a/AsusFanControlGUI/Properties/Settings.Designer.cs +++ b/AsusFanControlGUI/Properties/Settings.Designer.cs @@ -73,7 +73,7 @@ namespace AsusFanControlGUI.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("20,1-60,1-61,20-70,20-71,30-80,55")] + [global::System.Configuration.DefaultSettingValueAttribute("20,1-60,1-61,20-70,20-71,30-100,100-105,100")] public string FanCurvePoints { get { return ((string)(this["FanCurvePoints"])); @@ -166,5 +166,17 @@ namespace AsusFanControlGUI.Properties { this["errorMsg"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("20,1-60,1-61,20-70,20-71,30-100,100-105,100")] + public string DefaultFanCurvePoints { + get { + return ((string)(this["DefaultFanCurvePoints"])); + } + set { + this["DefaultFanCurvePoints"] = value; + } + } } } diff --git a/AsusFanControlGUI/Properties/Settings.settings b/AsusFanControlGUI/Properties/Settings.settings index e852e05..8aa8100 100644 --- a/AsusFanControlGUI/Properties/Settings.settings +++ b/AsusFanControlGUI/Properties/Settings.settings @@ -15,7 +15,7 @@ Off - 20,1-60,1-61,20-70,20-71,30-80,55 + 20,1-60,1-61,20-70,20-71,30-100,100-105,100 False @@ -38,5 +38,8 @@ + + 20,1-60,1-61,20-70,20-71,30-100,100-105,100 + \ No newline at end of file diff --git a/AsusFanControlGUI/packages.config b/AsusFanControlGUI/packages.config index 045df22..723a64a 100644 --- a/AsusFanControlGUI/packages.config +++ b/AsusFanControlGUI/packages.config @@ -2,12 +2,18 @@ + + + + + + @@ -22,15 +28,19 @@ + + + + @@ -42,10 +52,14 @@ + + + + \ No newline at end of file diff --git a/ClassLibrary1/Class1.cs b/ClassLibrary1/Class1.cs new file mode 100644 index 0000000..08281c6 --- /dev/null +++ b/ClassLibrary1/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + public class Class1 + { + } +} diff --git a/ClassLibrary1/ClassLibrary1.csproj b/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 0000000..c46d349 --- /dev/null +++ b/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + 63918cd4-92e1-4a6b-9c3e-e1f082a167c3 + Library + Properties + ClassLibrary1 + ClassLibrary1 + v4.8.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ClassLibrary1/Properties/AssemblyInfo.cs b/ClassLibrary1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4df1292 --- /dev/null +++ b/ClassLibrary1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ClassLibrary1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ClassLibrary1")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("63918cd4-92e1-4a6b-9c3e-e1f082a167c3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]