Skip to content

Commit 32cae4f

Browse files
committed
Initial commit of Zenith Fan Utility v1.0.0
0 parents  commit 32cae4f

39 files changed

+6876
-0
lines changed

.gitignore

Lines changed: 428 additions & 0 deletions
Large diffs are not rendered by default.

.vscode/launch.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"WARNING01": "*********************************************************************************",
12+
"WARNING02": "The C# extension was unable to automatically decode projects in the current",
13+
"WARNING03": "workspace to create a runnable launch.json file. A template launch.json file has",
14+
"WARNING04": "been created as a placeholder.",
15+
"WARNING05": "",
16+
"WARNING06": "If the server is currently unable to load your project, you can attempt to",
17+
"WARNING07": "resolve this by restoring any missing project dependencies (example: run 'dotnet",
18+
"WARNING08": "restore') and by fixing any reported errors from building the projects in your",
19+
"WARNING09": "workspace.",
20+
"WARNING10": "If this allows the server to now load your project then --",
21+
"WARNING11": " * Delete this file",
22+
"WARNING12": " * Open the Visual Studio Code command palette (View->Command Palette)",
23+
"WARNING13": " * run the command: '.NET: Generate Assets for Build and Debug'.",
24+
"WARNING14": "",
25+
"WARNING15": "If your project requires a more complex launch configuration, you may wish to",
26+
"WARNING16": "delete this configuration and pick a different template using the 'Add",
27+
"WARNING17": "Configuration...' button at the bottom of this file.",
28+
"WARNING18": "*********************************************************************************",
29+
"preLaunchTask": "build",
30+
"program": "${workspaceFolder}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll",
31+
"args": [],
32+
"cwd": "${workspaceFolder}",
33+
"console": "internalConsole",
34+
"stopAtEntry": false
35+
},
36+
{
37+
"name": ".NET Core Attach",
38+
"type": "coreclr",
39+
"request": "attach"
40+
}
41+
]
42+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dotnet.preferCSharpExtension": true
3+
}

AsusFanControl/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

AsusFanControl/AsusControl.cs

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading.Tasks;
4+
using AsusSystemAnalysis;
5+
6+
namespace AsusFanControl
7+
{
8+
public class AsusControl : IDisposable
9+
{
10+
private bool disposed = false;
11+
12+
public AsusControl()
13+
{
14+
AsusWinIO64.InitializeWinIo();
15+
}
16+
17+
public void Dispose()
18+
{
19+
Dispose(true);
20+
GC.SuppressFinalize(this);
21+
}
22+
23+
protected virtual void Dispose(bool disposing)
24+
{
25+
if (!disposed)
26+
{
27+
if (disposing)
28+
{
29+
// Dispose managed resources if any
30+
}
31+
AsusWinIO64.ShutdownWinIo();
32+
disposed = true;
33+
}
34+
}
35+
36+
public void SetFanSpeed(byte value, byte fanIndex = 0)
37+
{
38+
AsusWinIO64.HealthyTable_SetFanIndex(fanIndex);
39+
AsusWinIO64.HealthyTable_SetFanTestMode((char)(value > 0 ? 0x01 : 0x00));
40+
AsusWinIO64.HealthyTable_SetFanPwmDuty(value);
41+
}
42+
43+
public void SetFanSpeed(int percent, byte fanIndex = 0)
44+
{
45+
var value = (byte)(percent / 100.0f * 255);
46+
SetFanSpeed(value, fanIndex);
47+
}
48+
49+
public async Task SetFanSpeedsAsync(byte value)
50+
{
51+
var fanCount = AsusWinIO64.HealthyTable_FanCounts();
52+
for (byte fanIndex = 0; fanIndex < fanCount; fanIndex++)
53+
{
54+
SetFanSpeed(value, fanIndex);
55+
await Task.Delay(10);
56+
}
57+
}
58+
59+
public async Task SetFanSpeedsAsync(int percent)
60+
{
61+
var value = (byte)(percent / 100.0f * 255);
62+
await SetFanSpeedsAsync(value);
63+
}
64+
65+
public int GetFanSpeed(byte fanIndex = 0)
66+
{
67+
AsusWinIO64.HealthyTable_SetFanIndex(fanIndex);
68+
var fanSpeed = AsusWinIO64.HealthyTable_FanRPM();
69+
return fanSpeed;
70+
}
71+
72+
public List<int> GetFanSpeeds()
73+
{
74+
var fanSpeeds = new List<int>();
75+
76+
var fanCount = AsusWinIO64.HealthyTable_FanCounts();
77+
for (byte fanIndex = 0; fanIndex < fanCount; fanIndex++)
78+
{
79+
var fanSpeed = GetFanSpeed(fanIndex);
80+
fanSpeeds.Add(fanSpeed);
81+
}
82+
83+
return fanSpeeds;
84+
}
85+
86+
public int HealthyTable_FanCounts()
87+
{
88+
return AsusWinIO64.HealthyTable_FanCounts();
89+
}
90+
91+
public ulong Thermal_Read_Cpu_Temperature()
92+
{
93+
return AsusWinIO64.Thermal_Read_Cpu_Temperature();
94+
}
95+
96+
public ulong Thermal_Read_GpuTS1L_Temperature()
97+
{
98+
return AsusWinIO64.Thermal_Read_GpuTS1L_Temperature();
99+
}
100+
101+
public ulong Thermal_Read_GpuTS1R_Temperature()
102+
{
103+
return AsusWinIO64.Thermal_Read_GpuTS1R_Temperature();
104+
}
105+
106+
public ulong Thermal_Read_Highest_Gpu_Temperature()
107+
{
108+
ulong num1 = AsusWinIO64.Thermal_Read_GpuTS1L_Temperature();
109+
ulong num2 = AsusWinIO64.Thermal_Read_GpuTS1R_Temperature();
110+
return num1 > num2 ? num1 : num2;
111+
}
112+
}
113+
}
114+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{DF94635E-4107-4EE9-8675-7137E750BC86}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>AsusFanControl</RootNamespace>
10+
<AssemblyName>AsusFanControl</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<IsWebBootstrapper>false</IsWebBootstrapper>
16+
<PublishUrl>C:\Users\Patric\Desktop\Finished\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>true</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<UpdateUrl>http://localhost/AsusFanControl/</UpdateUrl>
27+
<AutorunEnabled>true</AutorunEnabled>
28+
<ApplicationRevision>1</ApplicationRevision>
29+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
30+
<UseApplicationTrust>false</UseApplicationTrust>
31+
<PublishWizardCompleted>true</PublishWizardCompleted>
32+
<BootstrapperEnabled>true</BootstrapperEnabled>
33+
</PropertyGroup>
34+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
35+
<PlatformTarget>AnyCPU</PlatformTarget>
36+
<DebugSymbols>true</DebugSymbols>
37+
<DebugType>full</DebugType>
38+
<Optimize>false</Optimize>
39+
<OutputPath>bin\Debug\</OutputPath>
40+
<DefineConstants>DEBUG;TRACE</DefineConstants>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
</PropertyGroup>
44+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
45+
<PlatformTarget>AnyCPU</PlatformTarget>
46+
<DebugType>pdbonly</DebugType>
47+
<Optimize>true</Optimize>
48+
<OutputPath>bin\Release\</OutputPath>
49+
<DefineConstants>TRACE</DefineConstants>
50+
<ErrorReport>prompt</ErrorReport>
51+
<WarningLevel>4</WarningLevel>
52+
</PropertyGroup>
53+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
54+
<DebugSymbols>true</DebugSymbols>
55+
<OutputPath>..\bin\x64\Debug\</OutputPath>
56+
<DefineConstants>DEBUG;TRACE</DefineConstants>
57+
<DebugType>full</DebugType>
58+
<PlatformTarget>x64</PlatformTarget>
59+
<LangVersion>7.3</LangVersion>
60+
<ErrorReport>prompt</ErrorReport>
61+
<Prefer32Bit>true</Prefer32Bit>
62+
</PropertyGroup>
63+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
64+
<OutputPath>..\bin\x64\Release\</OutputPath>
65+
<DefineConstants>TRACE</DefineConstants>
66+
<Optimize>true</Optimize>
67+
<DebugType>pdbonly</DebugType>
68+
<PlatformTarget>x64</PlatformTarget>
69+
<LangVersion>7.3</LangVersion>
70+
<ErrorReport>prompt</ErrorReport>
71+
<Prefer32Bit>true</Prefer32Bit>
72+
</PropertyGroup>
73+
<PropertyGroup>
74+
<ManifestCertificateThumbprint>AC3266EA640BF006D5A4E5F9F8FA619BCC2716FD</ManifestCertificateThumbprint>
75+
</PropertyGroup>
76+
<PropertyGroup>
77+
<ManifestKeyFile>AsusFanControl_TemporaryKey.pfx</ManifestKeyFile>
78+
</PropertyGroup>
79+
<PropertyGroup>
80+
<GenerateManifests>true</GenerateManifests>
81+
</PropertyGroup>
82+
<PropertyGroup>
83+
<SignManifests>true</SignManifests>
84+
</PropertyGroup>
85+
<ItemGroup>
86+
<Reference Include="System" />
87+
<Reference Include="System.Core" />
88+
<Reference Include="System.Xml.Linq" />
89+
<Reference Include="System.Data.DataSetExtensions" />
90+
<Reference Include="Microsoft.CSharp" />
91+
<Reference Include="System.Data" />
92+
<Reference Include="System.Net.Http" />
93+
<Reference Include="System.Xml" />
94+
</ItemGroup>
95+
<ItemGroup>
96+
<Compile Include="AsusControl.cs" />
97+
<Compile Include="AsusWinIO64.cs" />
98+
<Compile Include="Program.cs" />
99+
<Compile Include="Properties\AssemblyInfo.cs" />
100+
</ItemGroup>
101+
<ItemGroup>
102+
<None Include="App.config" />
103+
<None Include="AsusFanControl_TemporaryKey.pfx" />
104+
</ItemGroup>
105+
<ItemGroup>
106+
<Content Include="AsusWinIO64.dll">
107+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
108+
</Content>
109+
</ItemGroup>
110+
<ItemGroup>
111+
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
112+
<Visible>False</Visible>
113+
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
114+
<Install>true</Install>
115+
</BootstrapperPackage>
116+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
117+
<Visible>False</Visible>
118+
<ProductName>.NET Framework 3.5 SP1</ProductName>
119+
<Install>false</Install>
120+
</BootstrapperPackage>
121+
</ItemGroup>
122+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
123+
</Project>

AsusFanControl/AsusWinIO64.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Runtime.InteropServices;
2+
3+
namespace AsusSystemAnalysis
4+
{
5+
public class AsusWinIO64
6+
{
7+
[DllImport("AsusWinIO64.dll")]
8+
public static extern void InitializeWinIo();
9+
[DllImport("AsusWinIO64.dll")]
10+
public static extern void ShutdownWinIo();
11+
[DllImport("AsusWinIO64.dll")]
12+
public static extern int HealthyTable_FanCounts();
13+
[DllImport("AsusWinIO64.dll")]
14+
public static extern void HealthyTable_SetFanIndex(byte index);
15+
[DllImport("AsusWinIO64.dll")]
16+
public static extern int HealthyTable_FanRPM();
17+
[DllImport("AsusWinIO64.dll")]
18+
public static extern void HealthyTable_SetFanTestMode(char mode);
19+
[DllImport("AsusWinIO64.dll")]
20+
public static extern void HealthyTable_SetFanPwmDuty(short duty);
21+
[DllImport("AsusWinIO64.dll")]
22+
public static extern ulong Thermal_Read_Cpu_Temperature();
23+
[DllImport("AsusWinIO64.dll")]
24+
public static extern ulong Thermal_Read_GpuTS1L_Temperature(); // Add this line
25+
[DllImport("AsusWinIO64.dll")]
26+
public static extern ulong Thermal_Read_GpuTS1R_Temperature(); // Add this line
27+
}
28+
}

AsusFanControl/AsusWinIO64.dll

1.02 MB
Binary file not shown.

0 commit comments

Comments
 (0)