mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Custom fan-axis for 401 model
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
using System.Text.Json;
|
||||
|
||||
public class AppConfig
|
||||
{
|
||||
@@ -6,6 +8,8 @@ public class AppConfig
|
||||
public string appPath;
|
||||
string configFile;
|
||||
|
||||
string _model;
|
||||
|
||||
public Dictionary<string, object> config = new Dictionary<string, object>();
|
||||
|
||||
public AppConfig()
|
||||
@@ -36,6 +40,26 @@ public class AppConfig
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool ContainsModel(string contains)
|
||||
{
|
||||
if (_model is null)
|
||||
{
|
||||
_model = "";
|
||||
using (var searcher = new ManagementObjectSearcher(@"Select * from Win32_ComputerSystem"))
|
||||
{
|
||||
foreach (var process in searcher.Get())
|
||||
{
|
||||
_model = process["Model"].ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (_model is not null && _model.Contains(contains));
|
||||
|
||||
}
|
||||
private void initConfig()
|
||||
{
|
||||
config = new Dictionary<string, object>();
|
||||
|
||||
14
app/Fans.cs
14
app/Fans.cs
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace GHelper
|
||||
@@ -17,8 +12,13 @@ namespace GHelper
|
||||
|
||||
static string ChartPercToRPM(int percentage, string unit = "")
|
||||
{
|
||||
int MinRPM, MaxRPM;
|
||||
MinRPM = 1800;
|
||||
MaxRPM = Program.config.ContainsModel("401") ? 7200 : 5800;
|
||||
|
||||
if (percentage == 0) return "OFF";
|
||||
return (1800 + 200 * Math.Floor(percentage * 0.2)).ToString() + unit;
|
||||
|
||||
return (200*Math.Round((float)(MinRPM + (MaxRPM-MinRPM)*percentage*0.01)/200)).ToString() + unit;
|
||||
}
|
||||
|
||||
void SetChart(Chart chart, int device)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<AssemblyVersion>0.31</AssemblyVersion>
|
||||
<AssemblyVersion>0.33</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user