-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dc005a7
Showing
23 changed files
with
4,621 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.8.34525.116 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChipUtillo", "ChipUtillo\ChipUtillo.csproj", "{65F7BD48-FAF9-440E-B086-BFFB12722F68}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChipUtiloAsus", "ChipUtiloAsus\ChipUtiloAsus.csproj", "{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}" | ||
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 | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Debug|x64.ActiveCfg = Debug|x64 | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Debug|x64.Build.0 = Debug|x64 | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Release|x64.ActiveCfg = Release|x64 | ||
{65F7BD48-FAF9-440E-B086-BFFB12722F68}.Release|x64.Build.0 = Release|x64 | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Debug|x64.ActiveCfg = Debug|x64 | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Debug|x64.Build.0 = Debug|x64 | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Release|x64.ActiveCfg = Release|x64 | ||
{EDCC2C45-55A7-4CE8-A60A-63D5F55CDC89}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {42655AB7-ADEB-49E4-A212-15AC31004320} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Platforms>AnyCPU;x64</Platforms> | ||
<StartupObject>ChipUtillo.Program</StartupObject> | ||
<ApplicationIcon>favicon.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="favicon.ico" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ChipUtiloAsus\ChipUtiloAsus.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="AsusSASystemInfoWin32.dll"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="AsusWinIO64.dll"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
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.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace ChipUtillo | ||
{ | ||
public partial class FanCurve : UserControl | ||
{ | ||
const int ptNum = 8; | ||
const float nonWorkingAreaSize = 30f; | ||
const float pointSize = 8f; | ||
const float dpiCoeff = -0.1f; | ||
|
||
PointF[] percentPoints = new PointF[ptNum]; | ||
PointF[] curvePoints = new PointF[ptNum]; | ||
|
||
int curvePointIndx = 0; | ||
bool isDragging = false; | ||
bool highlightCurvePoint = false; | ||
|
||
HatchBrush gridBrush = null; | ||
Pen gridPen = null; | ||
|
||
public FanCurve() | ||
{ | ||
this.Disposed += new EventHandler(OnDispose); | ||
gridBrush = new HatchBrush(HatchStyle.Percent50, Color.White); | ||
gridPen = new Pen(gridBrush); | ||
for (int i = 0; i < ptNum; i++) | ||
{ | ||
percentPoints[i] = new PointF() | ||
{ | ||
X = 100.0f / ptNum * i + 10, | ||
Y = 100.0f / ptNum * i + 10 | ||
}; | ||
} | ||
percentPoints[percentPoints.Length - 1].X = percentPoints[percentPoints.Length - 1].Y = 100; | ||
|
||
InitializeComponent(); | ||
this.WorkingWidth = this.Width - (nonWorkingAreaSize * 2); | ||
this.WorkingHeight = this.Height - (nonWorkingAreaSize * 2); | ||
this.DoubleBuffered = true; | ||
BackColor = Color.Black; | ||
} | ||
|
||
void OnDispose(object sender, EventArgs e) | ||
{ | ||
if (gridBrush != null) | ||
{ | ||
gridBrush.Dispose(); | ||
} | ||
if (gridPen != null) | ||
{ | ||
gridPen.Dispose(); | ||
} | ||
} | ||
|
||
|
||
|
||
private float WorkingWidth { get; set; } | ||
private float WorkingHeight { get; set; } | ||
|
||
protected override void OnPaint(PaintEventArgs e) | ||
{ | ||
e.Graphics.Clear(Color.Black); | ||
e.Graphics.DrawString("fan rpm, %", this.Font, Brushes.White, 2, 0); | ||
e.Graphics.DrawString("Temp, ℃", this.Font, Brushes.White, this.Width - 56, this.Height - (nonWorkingAreaSize * 0.55f)); | ||
for (int i = 0; i < 11; i++) | ||
{ | ||
e.Graphics.DrawString(((i) * 10).ToString(), this.Font, Brushes.White, | ||
(this.WorkingWidth) / 10.0f * i + nonWorkingAreaSize * 0.5f , | ||
this.Height - nonWorkingAreaSize); | ||
e.Graphics.DrawString(((i) * 10).ToString(), this.Font, Brushes.White, | ||
i == 0 ? nonWorkingAreaSize * 0.5f : 0.0f, | ||
Height - ((this.WorkingHeight) / 10.0f * i) - nonWorkingAreaSize); | ||
|
||
e.Graphics.DrawLine(gridPen, | ||
this.WorkingWidth / 10.0f * i + nonWorkingAreaSize - (pointSize * dpiCoeff), | ||
this.Height - nonWorkingAreaSize, | ||
this.WorkingWidth / 10.0f * i + nonWorkingAreaSize - (pointSize * dpiCoeff), | ||
nonWorkingAreaSize); | ||
if (i < 10) | ||
{ | ||
e.Graphics.DrawLine(gridPen, | ||
nonWorkingAreaSize, | ||
this.Height - ((this.WorkingHeight) / 10.0f * i) - (nonWorkingAreaSize) + (pointSize * dpiCoeff), | ||
this.Width, | ||
this.Height - ((this.WorkingHeight) / 10.0f * i) - (nonWorkingAreaSize) + (pointSize * dpiCoeff)); | ||
} | ||
} | ||
|
||
for (int i = 0; i < percentPoints.Length; i++) | ||
{ | ||
curvePoints[i].X = nonWorkingAreaSize + this.WorkingWidth * (percentPoints[i].X / 100.0f); | ||
curvePoints[i].Y = (this.Height - nonWorkingAreaSize) - (this.WorkingHeight * (percentPoints[i].Y / 100.0f)); | ||
} | ||
e.Graphics.DrawCurve(Pens.White, curvePoints); | ||
|
||
for (int i = 0; i < curvePoints.Length; i++) | ||
{ | ||
if (highlightCurvePoint && i == curvePointIndx) | ||
{ | ||
e.Graphics.FillRectangle(Brushes.LimeGreen, curvePoints[i].X - pointSize * 0.5f, curvePoints[i].Y - pointSize * 0.5f, pointSize, pointSize); | ||
} | ||
else | ||
{ | ||
e.Graphics.FillRectangle(Brushes.White, curvePoints[i].X - pointSize * 0.5f, curvePoints[i].Y - pointSize * 0.5f, pointSize, pointSize); | ||
} | ||
} | ||
if (curvePointIndx >= 0 && curvePointIndx < curvePoints.Length) | ||
{ | ||
e.Graphics.DrawString($"{Math.Truncate(percentPoints[curvePointIndx].X)} ℃ x {Math.Truncate(percentPoints[curvePointIndx].Y)}% rpm", this.Font, Brushes.LimeGreen, this.Width * 0.5f + 40, 2); | ||
} | ||
|
||
base.OnPaint(e); | ||
} | ||
|
||
protected override void OnMouseDown(MouseEventArgs e) | ||
{ | ||
curvePointIndx = -1; | ||
if (e.Button == MouseButtons.Left) | ||
{ | ||
isDragging = true; | ||
for (int i = 0; i < curvePoints.Length; i++) | ||
{ | ||
if (e.X >= curvePoints[i].X - pointSize * 0.5f && e.X <= curvePoints[i].X + pointSize * 0.5f && | ||
e.Y >= curvePoints[i].Y - pointSize * 0.5f && e.Y <= curvePoints[i].Y + pointSize * 0.5f) | ||
{ | ||
curvePointIndx = i; | ||
this.Invalidate(); | ||
break; | ||
} | ||
} | ||
} | ||
base.OnMouseEnter(e); | ||
} | ||
protected override void OnMouseUp(MouseEventArgs e) | ||
{ | ||
isDragging = false; | ||
base.OnMouseUp(e); | ||
} | ||
|
||
protected override void OnMouseMove(MouseEventArgs e) | ||
{ | ||
bool _invalidate = highlightCurvePoint; | ||
highlightCurvePoint = false; | ||
if (isDragging && curvePointIndx >= 0 && curvePointIndx < curvePoints.Length) | ||
{ | ||
highlightCurvePoint = true; | ||
percentPoints[curvePointIndx].X = ((e.Location.X) - nonWorkingAreaSize) / this.WorkingWidth * 100.0f; | ||
if (percentPoints[curvePointIndx].X > 100) { percentPoints[curvePointIndx].X = 100; } | ||
if (percentPoints[curvePointIndx].X < 0) { percentPoints[curvePointIndx].X = 0; } | ||
|
||
percentPoints[curvePointIndx].Y = (this.WorkingHeight - (e.Location.Y - nonWorkingAreaSize)) / this.WorkingHeight * 100.0f; | ||
if (percentPoints[curvePointIndx].Y > 100) { percentPoints[curvePointIndx].Y = 100; } | ||
if (percentPoints[curvePointIndx].Y < 0) { percentPoints[curvePointIndx].Y = 0; } | ||
|
||
_invalidate = true; | ||
} | ||
else | ||
{ | ||
|
||
for (int i = 0; i < curvePoints.Length; i++) | ||
{ | ||
if (e.X >= curvePoints[i].X - pointSize * 0.5f && e.X <= curvePoints[i].X + pointSize * 0.5f && | ||
e.Y >= curvePoints[i].Y - pointSize * 0.5f && e.Y <= curvePoints[i].Y + pointSize * 0.5f) | ||
{ | ||
curvePointIndx = i; | ||
highlightCurvePoint = true; | ||
_invalidate = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if(_invalidate || highlightCurvePoint != _invalidate) | ||
{ | ||
this.Invalidate(); | ||
} | ||
base.OnMouseMove(e); | ||
} | ||
|
||
protected override void OnResize(EventArgs e) | ||
{ | ||
this.WorkingWidth = this.Width - (nonWorkingAreaSize * 2); | ||
this.WorkingHeight = this.Height - (nonWorkingAreaSize * 2); | ||
this.Invalidate(); | ||
base.OnResize(e); | ||
} | ||
|
||
public List<Point> GetPercentPoints() | ||
{ | ||
return percentPoints.Select(s => new Point() { X = (int)s.X, Y = (int)s.Y }).ToList(); | ||
} | ||
|
||
public void SetPercentPoints(List<Point> points) | ||
{ | ||
percentPoints = points.Select(s => new PointF(s.X, s.Y)).ToArray(); | ||
} | ||
} | ||
} |
Oops, something went wrong.