mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30f678d08f | ||
|
|
cf201632d5 | ||
|
|
003a19d94b | ||
|
|
6c3d4b9cb2 | ||
|
|
aa62330c1c | ||
|
|
954861f2b1 | ||
|
|
e3e9022111 | ||
|
|
24014dd20f | ||
|
|
321bc2623d | ||
|
|
52b07843a2 |
@@ -2,6 +2,7 @@
|
|||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|
||||||
public class ASUSWmi
|
public class ASUSWmi
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
// Source thanks to https://github.com/vddCore/Starlight :)
|
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
||||||
|
|
||||||
using System.Text;
|
|
||||||
using Starlight.Communication;
|
using Starlight.Communication;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
{
|
{
|
||||||
@@ -71,13 +72,41 @@ namespace Starlight.AnimeMatrix
|
|||||||
public int LedCount => 1450;
|
public int LedCount => 1450;
|
||||||
public int Rows => 61;
|
public int Rows => 61;
|
||||||
|
|
||||||
private readonly byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
private byte[] _displayBuffer = new byte[UpdatePageLength * 3];
|
||||||
|
private List<byte[]> frames = new List<byte[]>();
|
||||||
|
|
||||||
|
private int frameIndex = 0;
|
||||||
|
|
||||||
public AnimeMatrixDevice()
|
public AnimeMatrixDevice()
|
||||||
: base(0x0B05, 0x193B, 640)
|
: base(0x0B05, 0x193B, 640)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] GetBuffer()
|
||||||
|
{
|
||||||
|
return _displayBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PresentNextFrame()
|
||||||
|
{
|
||||||
|
//Debug.WriteLine(frameIndex);
|
||||||
|
if (frameIndex >= frames.Count) frameIndex = 0;
|
||||||
|
_displayBuffer = frames[frameIndex];
|
||||||
|
Present();
|
||||||
|
frameIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearFrames()
|
||||||
|
{
|
||||||
|
frames.Clear();
|
||||||
|
frameIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddFrame()
|
||||||
|
{
|
||||||
|
frames.Add(_displayBuffer.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
public void SendRaw(params byte[] data)
|
public void SendRaw(params byte[] data)
|
||||||
{
|
{
|
||||||
Set(Packet<AnimeMatrixPacket>(data));
|
Set(Packet<AnimeMatrixPacket>(data));
|
||||||
@@ -90,7 +119,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
public int Columns(int row)
|
public int Columns(int row)
|
||||||
{
|
{
|
||||||
EnsureRowInRange(row);
|
EnsureRowInRange(row);
|
||||||
return 34 - EmptyColumns(row);
|
return 34 - EmptyColumns(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,13 +231,48 @@ namespace Starlight.AnimeMatrix
|
|||||||
var enabled = enable ? (byte)0x00 : (byte)0x80;
|
var enabled = enable ? (byte)0x00 : (byte)0x80;
|
||||||
Set(Packet<AnimeMatrixPacket>(0xC4, 0x01, enabled));
|
Set(Packet<AnimeMatrixPacket>(0xC4, 0x01, enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBuiltInAnimation(bool enable, BuiltInAnimation animation)
|
public void SetBuiltInAnimation(bool enable, BuiltInAnimation animation)
|
||||||
{
|
{
|
||||||
SetBuiltInAnimation(enable);
|
SetBuiltInAnimation(enable);
|
||||||
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
|
Set(Packet<AnimeMatrixPacket>(0xC5, animation.AsByte));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GenerateFrame(Image image)
|
||||||
|
{
|
||||||
|
|
||||||
|
int width = 34 * 3;
|
||||||
|
int height = 61;
|
||||||
|
float scale;
|
||||||
|
|
||||||
|
Bitmap canvas = new Bitmap(width, height);
|
||||||
|
|
||||||
|
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
||||||
|
|
||||||
|
var graph = Graphics.FromImage(canvas);
|
||||||
|
var scaleWidth = (int)(image.Width * scale);
|
||||||
|
var scaleHeight = (int)(image.Height * scale);
|
||||||
|
|
||||||
|
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||||
|
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||||
|
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
|
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
|
||||||
|
|
||||||
|
Bitmap bmp = new Bitmap(canvas, 34, 61);
|
||||||
|
|
||||||
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
|
{
|
||||||
|
var pixel = bmp.GetPixel(x, y);
|
||||||
|
byte color = (byte)(Math.Max((pixel.R + pixel.G + pixel.B) / 3 - 10, 0));
|
||||||
|
SetLedPlanar(x, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void EnsureRowInRange(int row)
|
private void EnsureRowInRange(int row)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= Rows)
|
if (row < 0 || row >= Rows)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
public class AppConfig
|
public class AppConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
4
Aura.cs
4
Aura.cs
@@ -3,8 +3,8 @@
|
|||||||
public class Aura
|
public class Aura
|
||||||
{
|
{
|
||||||
|
|
||||||
static byte[] MESSAGE_SET = { 0x5d, 0xb5 };
|
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0,0,0 };
|
||||||
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
|
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4};
|
||||||
|
|
||||||
public const int Static = 0;
|
public const int Static = 0;
|
||||||
public const int Breathe = 1;
|
public const int Breathe = 1;
|
||||||
|
|||||||
299
Fans.Designer.cs
generated
299
Fans.Designer.cs
generated
@@ -28,114 +28,208 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||||
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
chartCPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||||
buttonApply = new Button();
|
buttonApply = new Button();
|
||||||
buttonReset = new Button();
|
buttonReset = new Button();
|
||||||
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
chartGPU = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||||
groupBox1 = new GroupBox();
|
groupBox1 = new GroupBox();
|
||||||
|
panelCPU = new Panel();
|
||||||
|
labelCPU = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
trackCPU = new TrackBar();
|
||||||
|
panelTotal = new Panel();
|
||||||
|
labelTotal = new Label();
|
||||||
|
label1 = new Label();
|
||||||
|
trackTotal = new TrackBar();
|
||||||
labelApplied = new Label();
|
labelApplied = new Label();
|
||||||
pictureFine = new PictureBox();
|
pictureFine = new PictureBox();
|
||||||
labelInfo = new Label();
|
labelInfo = new Label();
|
||||||
labelCPU = new Label();
|
|
||||||
labelTotal = new Label();
|
|
||||||
label2 = new Label();
|
|
||||||
label1 = new Label();
|
|
||||||
trackCPU = new TrackBar();
|
|
||||||
trackTotal = new TrackBar();
|
|
||||||
buttonApplyPower = new Button();
|
buttonApplyPower = new Button();
|
||||||
checkAuto = new CheckBox();
|
checkAuto = new CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)chartCPU).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)chartGPU).BeginInit();
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureFine).BeginInit();
|
panelCPU.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackCPU).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackCPU).BeginInit();
|
||||||
|
panelTotal.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackTotal).BeginInit();
|
((System.ComponentModel.ISupportInitialize)trackTotal).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureFine).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// chartCPU
|
// chartCPU
|
||||||
//
|
//
|
||||||
chartArea1.Name = "ChartArea1";
|
chartArea3.Name = "ChartArea1";
|
||||||
chartCPU.ChartAreas.Add(chartArea1);
|
chartCPU.ChartAreas.Add(chartArea3);
|
||||||
chartCPU.Location = new Point(195, 14);
|
chartCPU.Location = new Point(390, 28);
|
||||||
chartCPU.Margin = new Padding(2, 1, 2, 1);
|
chartCPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
chartCPU.Name = "chartCPU";
|
chartCPU.Name = "chartCPU";
|
||||||
chartCPU.Size = new Size(416, 218);
|
chartCPU.Size = new Size(832, 436);
|
||||||
chartCPU.TabIndex = 0;
|
chartCPU.TabIndex = 0;
|
||||||
chartCPU.Text = "chartCPU";
|
chartCPU.Text = "chartCPU";
|
||||||
//
|
//
|
||||||
// buttonApply
|
// buttonApply
|
||||||
//
|
//
|
||||||
buttonApply.Location = new Point(473, 476);
|
buttonApply.Location = new Point(946, 952);
|
||||||
buttonApply.Margin = new Padding(2, 1, 2, 1);
|
buttonApply.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonApply.Name = "buttonApply";
|
buttonApply.Name = "buttonApply";
|
||||||
buttonApply.Size = new Size(137, 22);
|
buttonApply.Size = new Size(274, 44);
|
||||||
buttonApply.TabIndex = 1;
|
buttonApply.TabIndex = 1;
|
||||||
buttonApply.Text = "Apply Fan Curve";
|
buttonApply.Text = "Apply Fan Curve";
|
||||||
buttonApply.UseVisualStyleBackColor = true;
|
buttonApply.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// buttonReset
|
// buttonReset
|
||||||
//
|
//
|
||||||
buttonReset.Location = new Point(195, 476);
|
buttonReset.Location = new Point(390, 952);
|
||||||
buttonReset.Margin = new Padding(2, 1, 2, 1);
|
buttonReset.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonReset.Name = "buttonReset";
|
buttonReset.Name = "buttonReset";
|
||||||
buttonReset.Size = new Size(137, 22);
|
buttonReset.Size = new Size(274, 44);
|
||||||
buttonReset.TabIndex = 2;
|
buttonReset.TabIndex = 2;
|
||||||
buttonReset.Text = "Factory Defaults";
|
buttonReset.Text = "Factory Defaults";
|
||||||
buttonReset.UseVisualStyleBackColor = true;
|
buttonReset.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// chartGPU
|
// chartGPU
|
||||||
//
|
//
|
||||||
chartArea2.Name = "ChartArea1";
|
chartArea4.Name = "ChartArea1";
|
||||||
chartGPU.ChartAreas.Add(chartArea2);
|
chartGPU.ChartAreas.Add(chartArea4);
|
||||||
chartGPU.Location = new Point(195, 240);
|
chartGPU.Location = new Point(390, 480);
|
||||||
chartGPU.Margin = new Padding(2, 1, 2, 1);
|
chartGPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
chartGPU.Name = "chartGPU";
|
chartGPU.Name = "chartGPU";
|
||||||
chartGPU.Size = new Size(416, 225);
|
chartGPU.Size = new Size(832, 450);
|
||||||
chartGPU.TabIndex = 3;
|
chartGPU.TabIndex = 3;
|
||||||
chartGPU.Text = "chart1";
|
chartGPU.Text = "chart1";
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
groupBox1.Controls.Add(panelCPU);
|
||||||
|
groupBox1.Controls.Add(panelTotal);
|
||||||
groupBox1.Controls.Add(labelApplied);
|
groupBox1.Controls.Add(labelApplied);
|
||||||
groupBox1.Controls.Add(pictureFine);
|
groupBox1.Controls.Add(pictureFine);
|
||||||
groupBox1.Controls.Add(labelInfo);
|
groupBox1.Controls.Add(labelInfo);
|
||||||
groupBox1.Controls.Add(labelCPU);
|
groupBox1.Location = new Point(12, 12);
|
||||||
groupBox1.Controls.Add(labelTotal);
|
groupBox1.Margin = new Padding(4, 2, 4, 2);
|
||||||
groupBox1.Controls.Add(label2);
|
|
||||||
groupBox1.Controls.Add(label1);
|
|
||||||
groupBox1.Controls.Add(trackCPU);
|
|
||||||
groupBox1.Controls.Add(trackTotal);
|
|
||||||
groupBox1.Location = new Point(6, 6);
|
|
||||||
groupBox1.Margin = new Padding(2, 1, 2, 1);
|
|
||||||
groupBox1.Name = "groupBox1";
|
groupBox1.Name = "groupBox1";
|
||||||
groupBox1.Padding = new Padding(3, 2, 3, 2);
|
groupBox1.Padding = new Padding(6, 4, 6, 4);
|
||||||
groupBox1.Size = new Size(178, 459);
|
groupBox1.Size = new Size(356, 918);
|
||||||
groupBox1.TabIndex = 4;
|
groupBox1.TabIndex = 4;
|
||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
groupBox1.Text = "Power Limits (PPT)";
|
groupBox1.Text = "Power Limits (PPT)";
|
||||||
//
|
//
|
||||||
|
// panelCPU
|
||||||
|
//
|
||||||
|
panelCPU.Controls.Add(labelCPU);
|
||||||
|
panelCPU.Controls.Add(label2);
|
||||||
|
panelCPU.Controls.Add(trackCPU);
|
||||||
|
panelCPU.Location = new Point(186, 72);
|
||||||
|
panelCPU.Name = "panelCPU";
|
||||||
|
panelCPU.Size = new Size(160, 510);
|
||||||
|
panelCPU.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// labelCPU
|
||||||
|
//
|
||||||
|
labelCPU.AutoSize = true;
|
||||||
|
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelCPU.Location = new Point(43, 41);
|
||||||
|
labelCPU.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelCPU.Name = "labelCPU";
|
||||||
|
labelCPU.Size = new Size(61, 32);
|
||||||
|
labelCPU.TabIndex = 13;
|
||||||
|
labelCPU.Text = "CPU";
|
||||||
|
labelCPU.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(45, 7);
|
||||||
|
label2.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(58, 32);
|
||||||
|
label2.TabIndex = 12;
|
||||||
|
label2.Text = "CPU";
|
||||||
|
label2.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// trackCPU
|
||||||
|
//
|
||||||
|
trackCPU.Location = new Point(47, 89);
|
||||||
|
trackCPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
trackCPU.Maximum = 85;
|
||||||
|
trackCPU.Minimum = 15;
|
||||||
|
trackCPU.Name = "trackCPU";
|
||||||
|
trackCPU.Orientation = Orientation.Vertical;
|
||||||
|
trackCPU.Size = new Size(90, 416);
|
||||||
|
trackCPU.TabIndex = 11;
|
||||||
|
trackCPU.TickFrequency = 5;
|
||||||
|
trackCPU.Value = 80;
|
||||||
|
//
|
||||||
|
// panelTotal
|
||||||
|
//
|
||||||
|
panelTotal.Controls.Add(labelTotal);
|
||||||
|
panelTotal.Controls.Add(label1);
|
||||||
|
panelTotal.Controls.Add(trackTotal);
|
||||||
|
panelTotal.Location = new Point(8, 72);
|
||||||
|
panelTotal.Name = "panelTotal";
|
||||||
|
panelTotal.Size = new Size(160, 511);
|
||||||
|
panelTotal.TabIndex = 14;
|
||||||
|
//
|
||||||
|
// labelTotal
|
||||||
|
//
|
||||||
|
labelTotal.AutoSize = true;
|
||||||
|
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelTotal.Location = new Point(46, 41);
|
||||||
|
labelTotal.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
labelTotal.Name = "labelTotal";
|
||||||
|
labelTotal.Size = new Size(70, 32);
|
||||||
|
labelTotal.TabIndex = 12;
|
||||||
|
labelTotal.Text = "Total";
|
||||||
|
labelTotal.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(48, 7);
|
||||||
|
label1.Margin = new Padding(4, 0, 4, 0);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(65, 32);
|
||||||
|
label1.TabIndex = 11;
|
||||||
|
label1.Text = "Total";
|
||||||
|
label1.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// trackTotal
|
||||||
|
//
|
||||||
|
trackTotal.Location = new Point(44, 89);
|
||||||
|
trackTotal.Margin = new Padding(4, 2, 4, 2);
|
||||||
|
trackTotal.Maximum = 150;
|
||||||
|
trackTotal.Minimum = 15;
|
||||||
|
trackTotal.Name = "trackTotal";
|
||||||
|
trackTotal.Orientation = Orientation.Vertical;
|
||||||
|
trackTotal.Size = new Size(90, 416);
|
||||||
|
trackTotal.TabIndex = 10;
|
||||||
|
trackTotal.TickFrequency = 5;
|
||||||
|
trackTotal.TickStyle = TickStyle.TopLeft;
|
||||||
|
trackTotal.Value = 125;
|
||||||
|
//
|
||||||
// labelApplied
|
// labelApplied
|
||||||
//
|
//
|
||||||
labelApplied.AutoSize = true;
|
labelApplied.AutoSize = true;
|
||||||
labelApplied.ForeColor = Color.Tomato;
|
labelApplied.ForeColor = Color.Tomato;
|
||||||
labelApplied.Location = new Point(8, 18);
|
labelApplied.Location = new Point(13, 36);
|
||||||
labelApplied.Margin = new Padding(2, 0, 2, 0);
|
labelApplied.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelApplied.Name = "labelApplied";
|
labelApplied.Name = "labelApplied";
|
||||||
labelApplied.Size = new Size(71, 15);
|
labelApplied.Size = new Size(143, 32);
|
||||||
labelApplied.TabIndex = 13;
|
labelApplied.TabIndex = 13;
|
||||||
labelApplied.Text = "Not Applied";
|
labelApplied.Text = "Not Applied";
|
||||||
//
|
//
|
||||||
// pictureFine
|
// pictureFine
|
||||||
//
|
//
|
||||||
pictureFine.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
pictureFine.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
pictureFine.BackgroundImage = Properties.Resources.everything_is_fine_itsfine;
|
|
||||||
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
|
pictureFine.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
pictureFine.Location = new Point(5, 343);
|
pictureFine.Image = Properties.Resources.everything_is_fine_itsfine;
|
||||||
pictureFine.Margin = new Padding(2, 1, 2, 1);
|
pictureFine.Location = new Point(10, 682);
|
||||||
|
pictureFine.Margin = new Padding(4, 2, 4, 2);
|
||||||
pictureFine.Name = "pictureFine";
|
pictureFine.Name = "pictureFine";
|
||||||
pictureFine.Size = new Size(167, 112);
|
pictureFine.Size = new Size(336, 226);
|
||||||
|
pictureFine.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
pictureFine.TabIndex = 12;
|
pictureFine.TabIndex = 12;
|
||||||
pictureFine.TabStop = false;
|
pictureFine.TabStop = false;
|
||||||
pictureFine.Visible = false;
|
pictureFine.Visible = false;
|
||||||
@@ -144,92 +238,19 @@
|
|||||||
//
|
//
|
||||||
labelInfo.AutoSize = true;
|
labelInfo.AutoSize = true;
|
||||||
labelInfo.Dock = DockStyle.Bottom;
|
labelInfo.Dock = DockStyle.Bottom;
|
||||||
labelInfo.Location = new Point(3, 442);
|
labelInfo.Location = new Point(6, 882);
|
||||||
labelInfo.Margin = new Padding(2, 0, 2, 0);
|
labelInfo.Margin = new Padding(4, 0, 4, 0);
|
||||||
labelInfo.Name = "labelInfo";
|
labelInfo.Name = "labelInfo";
|
||||||
labelInfo.Size = new Size(32, 15);
|
labelInfo.Size = new Size(65, 32);
|
||||||
labelInfo.TabIndex = 11;
|
labelInfo.TabIndex = 11;
|
||||||
labelInfo.Text = "label";
|
labelInfo.Text = "label";
|
||||||
//
|
//
|
||||||
// labelCPU
|
|
||||||
//
|
|
||||||
labelCPU.AutoSize = true;
|
|
||||||
labelCPU.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
|
||||||
labelCPU.Location = new Point(106, 59);
|
|
||||||
labelCPU.Margin = new Padding(2, 0, 2, 0);
|
|
||||||
labelCPU.Name = "labelCPU";
|
|
||||||
labelCPU.Size = new Size(30, 15);
|
|
||||||
labelCPU.TabIndex = 10;
|
|
||||||
labelCPU.Text = "CPU";
|
|
||||||
labelCPU.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// labelTotal
|
|
||||||
//
|
|
||||||
labelTotal.AutoSize = true;
|
|
||||||
labelTotal.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
|
||||||
labelTotal.Location = new Point(21, 59);
|
|
||||||
labelTotal.Margin = new Padding(2, 0, 2, 0);
|
|
||||||
labelTotal.Name = "labelTotal";
|
|
||||||
labelTotal.Size = new Size(34, 15);
|
|
||||||
labelTotal.TabIndex = 9;
|
|
||||||
labelTotal.Text = "Total";
|
|
||||||
labelTotal.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(108, 43);
|
|
||||||
label2.Margin = new Padding(2, 0, 2, 0);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(30, 15);
|
|
||||||
label2.TabIndex = 8;
|
|
||||||
label2.Text = "CPU";
|
|
||||||
label2.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(22, 43);
|
|
||||||
label1.Margin = new Padding(2, 0, 2, 0);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(32, 15);
|
|
||||||
label1.TabIndex = 7;
|
|
||||||
label1.Text = "Total";
|
|
||||||
label1.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
//
|
|
||||||
// trackCPU
|
|
||||||
//
|
|
||||||
trackCPU.Location = new Point(109, 83);
|
|
||||||
trackCPU.Margin = new Padding(2, 1, 2, 1);
|
|
||||||
trackCPU.Maximum = 85;
|
|
||||||
trackCPU.Minimum = 15;
|
|
||||||
trackCPU.Name = "trackCPU";
|
|
||||||
trackCPU.Orientation = Orientation.Vertical;
|
|
||||||
trackCPU.Size = new Size(45, 208);
|
|
||||||
trackCPU.TabIndex = 6;
|
|
||||||
trackCPU.TickFrequency = 5;
|
|
||||||
trackCPU.Value = 80;
|
|
||||||
//
|
|
||||||
// trackTotal
|
|
||||||
//
|
|
||||||
trackTotal.Location = new Point(23, 83);
|
|
||||||
trackTotal.Margin = new Padding(2, 1, 2, 1);
|
|
||||||
trackTotal.Maximum = 150;
|
|
||||||
trackTotal.Minimum = 15;
|
|
||||||
trackTotal.Name = "trackTotal";
|
|
||||||
trackTotal.Orientation = Orientation.Vertical;
|
|
||||||
trackTotal.Size = new Size(45, 208);
|
|
||||||
trackTotal.TabIndex = 5;
|
|
||||||
trackTotal.TickFrequency = 5;
|
|
||||||
trackTotal.TickStyle = TickStyle.TopLeft;
|
|
||||||
trackTotal.Value = 125;
|
|
||||||
//
|
|
||||||
// buttonApplyPower
|
// buttonApplyPower
|
||||||
//
|
//
|
||||||
buttonApplyPower.Location = new Point(8, 476);
|
buttonApplyPower.Location = new Point(16, 952);
|
||||||
buttonApplyPower.Margin = new Padding(2, 1, 2, 1);
|
buttonApplyPower.Margin = new Padding(4, 2, 4, 2);
|
||||||
buttonApplyPower.Name = "buttonApplyPower";
|
buttonApplyPower.Name = "buttonApplyPower";
|
||||||
buttonApplyPower.Size = new Size(176, 22);
|
buttonApplyPower.Size = new Size(352, 44);
|
||||||
buttonApplyPower.TabIndex = 11;
|
buttonApplyPower.TabIndex = 11;
|
||||||
buttonApplyPower.Text = "Apply Power Limits";
|
buttonApplyPower.Text = "Apply Power Limits";
|
||||||
buttonApplyPower.UseVisualStyleBackColor = true;
|
buttonApplyPower.UseVisualStyleBackColor = true;
|
||||||
@@ -237,19 +258,20 @@
|
|||||||
// checkAuto
|
// checkAuto
|
||||||
//
|
//
|
||||||
checkAuto.AutoSize = true;
|
checkAuto.AutoSize = true;
|
||||||
checkAuto.Location = new Point(381, 479);
|
checkAuto.Location = new Point(772, 958);
|
||||||
checkAuto.Margin = new Padding(2, 1, 2, 1);
|
checkAuto.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkAuto.Name = "checkAuto";
|
checkAuto.Name = "checkAuto";
|
||||||
checkAuto.Size = new Size(86, 19);
|
checkAuto.Size = new Size(165, 36);
|
||||||
checkAuto.TabIndex = 12;
|
checkAuto.TabIndex = 12;
|
||||||
checkAuto.Text = "Auto Apply";
|
checkAuto.Text = "Auto Apply";
|
||||||
checkAuto.UseVisualStyleBackColor = true;
|
checkAuto.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// Fans
|
// Fans
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Dpi;
|
||||||
ClientSize = new Size(621, 510);
|
AutoSize = true;
|
||||||
|
ClientSize = new Size(1242, 1020);
|
||||||
Controls.Add(checkAuto);
|
Controls.Add(checkAuto);
|
||||||
Controls.Add(buttonApplyPower);
|
Controls.Add(buttonApplyPower);
|
||||||
Controls.Add(groupBox1);
|
Controls.Add(groupBox1);
|
||||||
@@ -257,8 +279,7 @@
|
|||||||
Controls.Add(buttonReset);
|
Controls.Add(buttonReset);
|
||||||
Controls.Add(buttonApply);
|
Controls.Add(buttonApply);
|
||||||
Controls.Add(chartCPU);
|
Controls.Add(chartCPU);
|
||||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
Margin = new Padding(4, 2, 4, 2);
|
||||||
Margin = new Padding(2, 1, 2, 1);
|
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MdiChildrenMinimizedAnchorBottom = false;
|
MdiChildrenMinimizedAnchorBottom = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
@@ -271,9 +292,13 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)chartGPU).EndInit();
|
||||||
groupBox1.ResumeLayout(false);
|
groupBox1.ResumeLayout(false);
|
||||||
groupBox1.PerformLayout();
|
groupBox1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureFine).EndInit();
|
panelCPU.ResumeLayout(false);
|
||||||
|
panelCPU.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackCPU).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackCPU).EndInit();
|
||||||
|
panelTotal.ResumeLayout(false);
|
||||||
|
panelTotal.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)trackTotal).EndInit();
|
((System.ComponentModel.ISupportInitialize)trackTotal).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureFine).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@@ -285,16 +310,18 @@
|
|||||||
private Button buttonReset;
|
private Button buttonReset;
|
||||||
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
|
private System.Windows.Forms.DataVisualization.Charting.Chart chartGPU;
|
||||||
private GroupBox groupBox1;
|
private GroupBox groupBox1;
|
||||||
private Label labelCPU;
|
|
||||||
private Label labelTotal;
|
|
||||||
private Label label2;
|
|
||||||
private Label label1;
|
|
||||||
private TrackBar trackCPU;
|
|
||||||
private TrackBar trackTotal;
|
|
||||||
private Button buttonApplyPower;
|
private Button buttonApplyPower;
|
||||||
private Label labelInfo;
|
private Label labelInfo;
|
||||||
private PictureBox pictureFine;
|
private PictureBox pictureFine;
|
||||||
private Label labelApplied;
|
private Label labelApplied;
|
||||||
private CheckBox checkAuto;
|
private CheckBox checkAuto;
|
||||||
|
private Panel panelTotal;
|
||||||
|
private Label labelTotal;
|
||||||
|
private Label label1;
|
||||||
|
private TrackBar trackTotal;
|
||||||
|
private Panel panelCPU;
|
||||||
|
private Label labelCPU;
|
||||||
|
private Label label2;
|
||||||
|
private TrackBar trackCPU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
4
Fans.cs
4
Fans.cs
@@ -145,7 +145,6 @@ namespace GHelper
|
|||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA1, limit_total);
|
||||||
|
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu);
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUA2, limit_cpu);
|
|
||||||
|
|
||||||
labelApplied.ForeColor = Color.Blue;
|
labelApplied.ForeColor = Color.Blue;
|
||||||
labelApplied.Text = "Applied";
|
labelApplied.Text = "Applied";
|
||||||
@@ -155,6 +154,9 @@ namespace GHelper
|
|||||||
public void VisualisePower(bool init = false)
|
public void VisualisePower(bool init = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
panelTotal.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0);
|
||||||
|
panelCPU.Visible = (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0);
|
||||||
|
|
||||||
int limit_total;
|
int limit_total;
|
||||||
int limit_cpu;
|
int limit_cpu;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<AssemblyName>GHelper</AssemblyName>
|
<AssemblyName>GHelper</AssemblyName>
|
||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AssemblyVersion>0.15.1</AssemblyVersion>
|
<AssemblyVersion>0.17</AssemblyVersion>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
38
Keyboard.Designer.cs
generated
38
Keyboard.Designer.cs
generated
@@ -35,11 +35,17 @@
|
|||||||
labelM4 = new Label();
|
labelM4 = new Label();
|
||||||
comboM3 = new ComboBox();
|
comboM3 = new ComboBox();
|
||||||
labelM3 = new Label();
|
labelM3 = new Label();
|
||||||
|
textFNF4 = new TextBox();
|
||||||
|
comboFNF4 = new ComboBox();
|
||||||
|
labelFNF4 = new Label();
|
||||||
groupBox1.SuspendLayout();
|
groupBox1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
groupBox1.Controls.Add(textFNF4);
|
||||||
|
groupBox1.Controls.Add(comboFNF4);
|
||||||
|
groupBox1.Controls.Add(labelFNF4);
|
||||||
groupBox1.Controls.Add(textM4);
|
groupBox1.Controls.Add(textM4);
|
||||||
groupBox1.Controls.Add(textM3);
|
groupBox1.Controls.Add(textM3);
|
||||||
groupBox1.Controls.Add(comboM4);
|
groupBox1.Controls.Add(comboM4);
|
||||||
@@ -49,7 +55,7 @@
|
|||||||
groupBox1.Dock = DockStyle.Top;
|
groupBox1.Dock = DockStyle.Top;
|
||||||
groupBox1.Location = new Point(10, 10);
|
groupBox1.Location = new Point(10, 10);
|
||||||
groupBox1.Name = "groupBox1";
|
groupBox1.Name = "groupBox1";
|
||||||
groupBox1.Size = new Size(751, 196);
|
groupBox1.Size = new Size(751, 242);
|
||||||
groupBox1.TabIndex = 0;
|
groupBox1.TabIndex = 0;
|
||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
groupBox1.Text = "Key Bindings";
|
groupBox1.Text = "Key Bindings";
|
||||||
@@ -58,7 +64,7 @@
|
|||||||
//
|
//
|
||||||
textM4.Location = new Point(411, 113);
|
textM4.Location = new Point(411, 113);
|
||||||
textM4.Name = "textM4";
|
textM4.Name = "textM4";
|
||||||
textM4.PlaceholderText = "notepad /p \"file.txt\"";
|
textM4.PlaceholderText = "action";
|
||||||
textM4.Size = new Size(320, 39);
|
textM4.Size = new Size(320, 39);
|
||||||
textM4.TabIndex = 5;
|
textM4.TabIndex = 5;
|
||||||
//
|
//
|
||||||
@@ -106,6 +112,31 @@
|
|||||||
labelM3.TabIndex = 0;
|
labelM3.TabIndex = 0;
|
||||||
labelM3.Text = "M3:";
|
labelM3.Text = "M3:";
|
||||||
//
|
//
|
||||||
|
// textFNF4
|
||||||
|
//
|
||||||
|
textFNF4.Location = new Point(411, 176);
|
||||||
|
textFNF4.Name = "textFNF4";
|
||||||
|
textFNF4.PlaceholderText = "action";
|
||||||
|
textFNF4.Size = new Size(320, 39);
|
||||||
|
textFNF4.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// comboFNF4
|
||||||
|
//
|
||||||
|
comboFNF4.FormattingEnabled = true;
|
||||||
|
comboFNF4.Location = new Point(93, 175);
|
||||||
|
comboFNF4.Name = "comboFNF4";
|
||||||
|
comboFNF4.Size = new Size(312, 40);
|
||||||
|
comboFNF4.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// labelFNF4
|
||||||
|
//
|
||||||
|
labelFNF4.AutoSize = true;
|
||||||
|
labelFNF4.Location = new Point(2, 178);
|
||||||
|
labelFNF4.Name = "labelFNF4";
|
||||||
|
labelFNF4.Size = new Size(90, 32);
|
||||||
|
labelFNF4.TabIndex = 6;
|
||||||
|
labelFNF4.Text = "FN+F4:";
|
||||||
|
//
|
||||||
// Keyboard
|
// Keyboard
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
@@ -135,5 +166,8 @@
|
|||||||
private Label labelM4;
|
private Label labelM4;
|
||||||
private TextBox textM4;
|
private TextBox textM4;
|
||||||
private TextBox textM3;
|
private TextBox textM3;
|
||||||
|
private TextBox textFNF4;
|
||||||
|
private ComboBox comboFNF4;
|
||||||
|
private Label labelFNF4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
104
Keyboard.cs
104
Keyboard.cs
@@ -1,11 +1,8 @@
|
|||||||
using System.Diagnostics.Metrics;
|
namespace GHelper
|
||||||
|
|
||||||
namespace GHelper
|
|
||||||
{
|
{
|
||||||
public partial class Keyboard : Form
|
public partial class Keyboard : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
Dictionary<string, string> customActions = new Dictionary<string, string>
|
Dictionary<string, string> customActions = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{"","--------------" },
|
{"","--------------" },
|
||||||
@@ -13,85 +10,60 @@ namespace GHelper
|
|||||||
{"screenshot", "Screenshot"},
|
{"screenshot", "Screenshot"},
|
||||||
{"play", "Play/Pause"},
|
{"play", "Play/Pause"},
|
||||||
{"aura", "Aura"},
|
{"aura", "Aura"},
|
||||||
|
{"ghelper", "Open GHelper"},
|
||||||
{"custom", "Custom"}
|
{"custom", "Custom"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void SetKeyCombo(ComboBox combo, TextBox txbox, string name)
|
||||||
|
{
|
||||||
|
if (name == "m4")
|
||||||
|
customActions[""] = "Performance";
|
||||||
|
|
||||||
|
if (name == "fnf4")
|
||||||
|
{
|
||||||
|
customActions[""] = "Aura";
|
||||||
|
customActions.Remove("aura");
|
||||||
|
}
|
||||||
|
|
||||||
|
combo.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
combo.DataSource = new BindingSource(customActions, null);
|
||||||
|
combo.DisplayMember = "Value";
|
||||||
|
combo.ValueMember = "Key";
|
||||||
|
|
||||||
|
string action = Program.config.getConfigString(name);
|
||||||
|
|
||||||
|
combo.SelectedValue = (action is not null) ? action : "";
|
||||||
|
if (combo.SelectedValue is null) combo.SelectedValue = "";
|
||||||
|
|
||||||
|
combo.SelectedValueChanged += delegate
|
||||||
|
{
|
||||||
|
if (combo.SelectedValue is not null)
|
||||||
|
Program.config.setConfig(name, combo.SelectedValue.ToString());
|
||||||
|
};
|
||||||
|
|
||||||
|
txbox.Text = Program.config.getConfigString(name + "_custom");
|
||||||
|
txbox.TextChanged += delegate
|
||||||
|
{
|
||||||
|
Program.config.setConfig(name + "_custom", txbox.Text);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public Keyboard()
|
public Keyboard()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
comboM3.DropDownStyle = ComboBoxStyle.DropDownList;
|
SetKeyCombo(comboM3, textM3, "m3");
|
||||||
comboM3.DataSource = new BindingSource(customActions, null);
|
SetKeyCombo(comboM4, textM4, "m4");
|
||||||
comboM3.DisplayMember = "Value";
|
SetKeyCombo(comboFNF4, textFNF4, "fnf4");
|
||||||
comboM3.ValueMember = "Key";
|
|
||||||
|
|
||||||
customActions[""] = "Performance";
|
|
||||||
comboM4.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboM4.DataSource = new BindingSource(customActions, null);
|
|
||||||
comboM4.DisplayMember = "Value";
|
|
||||||
comboM4.ValueMember = "Key";
|
|
||||||
|
|
||||||
comboM3.SelectedValueChanged += ComboM3_SelectedValueChanged;
|
|
||||||
comboM4.SelectedValueChanged += ComboM4_SelectedValueChanged;
|
|
||||||
|
|
||||||
textM3.TextChanged += TextM3_TextChanged;
|
|
||||||
textM4.TextChanged += TextM4_TextChanged;
|
|
||||||
|
|
||||||
Shown += Keyboard_Shown;
|
Shown += Keyboard_Shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextM3_TextChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is null) return;
|
|
||||||
TextBox tb = (TextBox)sender;
|
|
||||||
Program.config.setConfig("m3_custom", tb.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextM4_TextChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sender is null) return;
|
|
||||||
TextBox tb = (TextBox)sender;
|
|
||||||
Program.config.setConfig("m4_custom", tb.Text);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ComboKeyChanged(object? sender, string name = "m3")
|
|
||||||
{
|
|
||||||
if (sender is null) return;
|
|
||||||
ComboBox cmb = (ComboBox)sender;
|
|
||||||
|
|
||||||
if (cmb.SelectedValue is not null)
|
|
||||||
Program.config.setConfig(name, cmb.SelectedValue.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ComboM4_SelectedValueChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ComboKeyChanged(sender, "m4");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ComboM3_SelectedValueChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
ComboKeyChanged(sender, "m3");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Keyboard_Shown(object? sender, EventArgs e)
|
private void Keyboard_Shown(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
Top = Program.settingsForm.Top;
|
Top = Program.settingsForm.Top;
|
||||||
Left = Program.settingsForm.Left - Width - 5;
|
Left = Program.settingsForm.Left - Width - 5;
|
||||||
|
|
||||||
string m3 = Program.config.getConfigString("m3");
|
|
||||||
string m4 = Program.config.getConfigString("m4");
|
|
||||||
|
|
||||||
comboM3.SelectedValue = (m3 is not null) ? m3 : "";
|
|
||||||
comboM4.SelectedValue = (m4 is not null) ? m4 : "";
|
|
||||||
|
|
||||||
if (comboM3.SelectedValue is null) comboM3.SelectedValue = "";
|
|
||||||
if (comboM4.SelectedValue is null) comboM4.SelectedValue = "";
|
|
||||||
|
|
||||||
textM3.Text = Program.config.getConfigString("m3_custom");
|
|
||||||
textM4.Text = Program.config.getConfigString("m4_custom");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
121
NativeMethods.cs
121
NativeMethods.cs
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public class NativeMethods
|
public class NativeMethods
|
||||||
@@ -160,10 +161,42 @@ public class NativeMethods
|
|||||||
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
string lpszDeviceName, ref DEVMODE lpDevMode, IntPtr hwnd,
|
||||||
DisplaySettingsFlags dwflags, IntPtr lParam);
|
DisplaySettingsFlags dwflags, IntPtr lParam);
|
||||||
|
|
||||||
|
// ENUM DISPLAYS
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern bool EnumDisplayDevicesA(string lpDevice, uint iDevNum, ref DISPLAY_DEVICE lpDisplayDevice, uint dwFlags);
|
||||||
|
|
||||||
public const int ENUM_CURRENT_SETTINGS = -1;
|
[Flags()]
|
||||||
|
public enum DisplayDeviceStateFlags : int
|
||||||
|
{
|
||||||
|
AttachedToDesktop = 0x1,
|
||||||
|
MultiDriver = 0x2,
|
||||||
|
PrimaryDevice = 0x4,
|
||||||
|
MirroringDriver = 0x8,
|
||||||
|
VGACompatible = 0x10,
|
||||||
|
Removable = 0x20,
|
||||||
|
ModesPruned = 0x8000000,
|
||||||
|
Remote = 0x4000000,
|
||||||
|
Disconnect = 0x2000000
|
||||||
|
}
|
||||||
|
|
||||||
public const string laptopScreenName = "\\\\.\\DISPLAY1";
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||||
|
public struct DISPLAY_DEVICE
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.U4)]
|
||||||
|
public int cb;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||||
|
public string DeviceName;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
|
public string DeviceString;
|
||||||
|
[MarshalAs(UnmanagedType.U4)]
|
||||||
|
public DisplayDeviceStateFlags StateFlags;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
|
public string DeviceID;
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||||
|
public string DeviceKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----
|
||||||
|
|
||||||
public static DEVMODE CreateDevmode()
|
public static DEVMODE CreateDevmode()
|
||||||
{
|
{
|
||||||
@@ -174,34 +207,90 @@ public class NativeMethods
|
|||||||
return dm;
|
return dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Screen FindLaptopScreen()
|
public const int ENUM_CURRENT_SETTINGS = -1;
|
||||||
{
|
public const string laptopScreenName = "\\\\.\\DISPLAY1";
|
||||||
var screens = Screen.AllScreens;
|
|
||||||
Screen laptopScreen = null;
|
|
||||||
|
|
||||||
foreach (var screen in screens)
|
public static string FindLaptopScreen()
|
||||||
|
{
|
||||||
|
string laptopScreen = null;
|
||||||
|
|
||||||
|
DISPLAY_DEVICE d = new DISPLAY_DEVICE();
|
||||||
|
d.cb = Marshal.SizeOf(d);
|
||||||
|
|
||||||
|
List<string> activeScreens = new List<string>();
|
||||||
|
int counter = 0;
|
||||||
|
int deviceNum = -1;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (screen.DeviceName == laptopScreenName)
|
var searcherActive = new ManagementObjectSearcher(@"\\.\root\wmi", "SELECT * FROM WmiMonitorBasicDisplayParams");
|
||||||
|
var resultsActive = searcherActive.Get();
|
||||||
|
foreach (var result in resultsActive)
|
||||||
{
|
{
|
||||||
laptopScreen = screen;
|
activeScreens.Add(result["InstanceName"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var searcher = new ManagementObjectSearcher(@"\\.\root\wmi", "SELECT * FROM WmiMonitorConnectionParams");
|
||||||
|
var results = searcher.Get();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var result in results)
|
||||||
|
{
|
||||||
|
long technology;
|
||||||
|
long.TryParse(result["VideoOutputTechnology"].ToString(), out technology);
|
||||||
|
string instanceName = result["InstanceName"].ToString();
|
||||||
|
|
||||||
|
if (technology == 0x80000000 && activeScreens.Contains(instanceName))
|
||||||
|
{
|
||||||
|
deviceNum = counter;
|
||||||
|
//Debug.WriteLine(result["InstanceName"]);
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Failed to detect built in display");
|
||||||
|
deviceNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (laptopScreen is null) return null;
|
counter = 0;
|
||||||
else return laptopScreen;
|
for (uint id = 0; EnumDisplayDevicesA(null, id, ref d, 0); id++)
|
||||||
|
{
|
||||||
|
if ((d.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != 0)
|
||||||
|
{
|
||||||
|
if (counter == deviceNum)
|
||||||
|
{
|
||||||
|
laptopScreen = d.DeviceName;
|
||||||
|
//Debug.WriteLine(d.DeviceID);
|
||||||
|
//Debug.WriteLine(d.DeviceName);
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (laptopScreen is null)
|
||||||
|
{
|
||||||
|
foreach (var screen in screens)
|
||||||
|
Debug.WriteLine(screen.DeviceName);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
return laptopScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetRefreshRate()
|
public static int GetRefreshRate()
|
||||||
{
|
{
|
||||||
DEVMODE dm = CreateDevmode();
|
DEVMODE dm = CreateDevmode();
|
||||||
|
|
||||||
Screen laptopScreen = FindLaptopScreen();
|
string laptopScreen = FindLaptopScreen();
|
||||||
int frequency = -1;
|
int frequency = -1;
|
||||||
|
|
||||||
if (laptopScreen is null)
|
if (laptopScreen is null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||||
{
|
{
|
||||||
frequency = dm.dmDisplayFrequency;
|
frequency = dm.dmDisplayFrequency;
|
||||||
}
|
}
|
||||||
@@ -212,15 +301,15 @@ public class NativeMethods
|
|||||||
public static int SetRefreshRate(int frequency = 120)
|
public static int SetRefreshRate(int frequency = 120)
|
||||||
{
|
{
|
||||||
DEVMODE dm = CreateDevmode();
|
DEVMODE dm = CreateDevmode();
|
||||||
Screen laptopScreen = FindLaptopScreen();
|
string laptopScreen = FindLaptopScreen();
|
||||||
|
|
||||||
if (laptopScreen is null)
|
if (laptopScreen is null)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen.DeviceName, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
if (0 != NativeMethods.EnumDisplaySettingsEx(laptopScreen, NativeMethods.ENUM_CURRENT_SETTINGS, ref dm))
|
||||||
{
|
{
|
||||||
dm.dmDisplayFrequency = frequency;
|
dm.dmDisplayFrequency = frequency;
|
||||||
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen.DeviceName, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
int iRet = NativeMethods.ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
Program.cs
36
Program.cs
@@ -1,7 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using Starlight.AnimeMatrix;
|
|
||||||
|
|
||||||
public class HardwareMonitor
|
public class HardwareMonitor
|
||||||
{
|
{
|
||||||
@@ -44,7 +43,7 @@ namespace GHelper
|
|||||||
Visible = true
|
Visible = true
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ASUSWmi wmi = new ASUSWmi();
|
public static ASUSWmi wmi;
|
||||||
public static AppConfig config = new AppConfig();
|
public static AppConfig config = new AppConfig();
|
||||||
|
|
||||||
public static SettingsForm settingsForm = new SettingsForm();
|
public static SettingsForm settingsForm = new SettingsForm();
|
||||||
@@ -53,6 +52,23 @@ namespace GHelper
|
|||||||
// The main entry point for the application
|
// The main entry point for the application
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
wmi = new ASUSWmi();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
DialogResult dialogResult = MessageBox.Show("Can't connect to ASUS ACPI. Application can't function without it. Try to install Asus System Controll Interface", "Startup Error", MessageBoxButtons.YesNo);
|
||||||
|
if (dialogResult == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo("https://www.asus.com/support/FAQ/1047338/") { UseShellExecute = true });
|
||||||
|
}
|
||||||
|
|
||||||
|
Application.Exit();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
trayIcon.MouseClick += TrayIcon_MouseClick; ;
|
||||||
|
|
||||||
@@ -61,6 +77,7 @@ namespace GHelper
|
|||||||
settingsForm.InitGPUMode();
|
settingsForm.InitGPUMode();
|
||||||
settingsForm.InitBoost();
|
settingsForm.InitBoost();
|
||||||
settingsForm.InitAura();
|
settingsForm.InitAura();
|
||||||
|
settingsForm.InitMatrix();
|
||||||
|
|
||||||
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
|
||||||
settingsForm.VisualiseScreenAuto(config.getConfig("screen_auto"));
|
settingsForm.VisualiseScreenAuto(config.getConfig("screen_auto"));
|
||||||
@@ -82,6 +99,9 @@ namespace GHelper
|
|||||||
settingsForm.AutoGPUMode(isPlugged);
|
settingsForm.AutoGPUMode(isPlugged);
|
||||||
settingsForm.AutoScreen(isPlugged);
|
settingsForm.AutoScreen(isPlugged);
|
||||||
settingsForm.AutoPerformance(isPlugged);
|
settingsForm.AutoPerformance(isPlugged);
|
||||||
|
|
||||||
|
settingsForm.SetMatrix(isPlugged);
|
||||||
|
|
||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +137,8 @@ namespace GHelper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
intKey = Convert.ToInt32(command, 16);
|
intKey = Convert.ToInt32(command, 16);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
intKey = -1;
|
intKey = -1;
|
||||||
}
|
}
|
||||||
@@ -134,10 +155,12 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
string action = config.getConfigString(name);
|
string action = config.getConfigString(name);
|
||||||
|
|
||||||
if (action.Length == 0)
|
if (action is null || action.Length <= 1)
|
||||||
{
|
{
|
||||||
if (name == "m4")
|
if (name == "m4")
|
||||||
action = "performance";
|
action = "performance";
|
||||||
|
if (name == "fnf4")
|
||||||
|
action = "aura";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
@@ -157,6 +180,9 @@ namespace GHelper
|
|||||||
case "performance":
|
case "performance":
|
||||||
settingsForm.BeginInvoke(settingsForm.CyclePerformanceMode);
|
settingsForm.BeginInvoke(settingsForm.CyclePerformanceMode);
|
||||||
break;
|
break;
|
||||||
|
case "ghelper":
|
||||||
|
settingsForm.BeginInvoke(SettingsToggle);
|
||||||
|
break;
|
||||||
case "custom":
|
case "custom":
|
||||||
CustomKey(name);
|
CustomKey(name);
|
||||||
break;
|
break;
|
||||||
@@ -188,7 +214,7 @@ namespace GHelper
|
|||||||
settingsForm.BeginInvoke(settingsForm.CyclePerformanceMode);
|
settingsForm.BeginInvoke(settingsForm.CyclePerformanceMode);
|
||||||
return;
|
return;
|
||||||
case 179: // FN+F4
|
case 179: // FN+F4
|
||||||
settingsForm.BeginInvoke(settingsForm.CycleAuraMode);
|
KeyProcess("fnf4");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1187
Settings.Designer.cs
generated
1187
Settings.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
220
Settings.cs
220
Settings.cs
@@ -1,10 +1,8 @@
|
|||||||
using Starlight.AnimeMatrix;
|
using Starlight.AnimeMatrix;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.CodeDom.Compiler;
|
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -20,12 +18,17 @@ namespace GHelper
|
|||||||
static int buttonActive = 5;
|
static int buttonActive = 5;
|
||||||
|
|
||||||
static System.Timers.Timer aTimer = default!;
|
static System.Timers.Timer aTimer = default!;
|
||||||
|
static System.Timers.Timer matrixTimer = default!;
|
||||||
|
|
||||||
public string perfName = "Balanced";
|
public string perfName = "Balanced";
|
||||||
|
|
||||||
Fans fans;
|
Fans fans;
|
||||||
Keyboard keyb;
|
Keyboard keyb;
|
||||||
|
|
||||||
|
static AnimeMatrixDevice mat;
|
||||||
|
static bool matEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -80,72 +83,89 @@ namespace GHelper
|
|||||||
labelCPUFan.Click += LabelCPUFan_Click;
|
labelCPUFan.Click += LabelCPUFan_Click;
|
||||||
labelGPUFan.Click += LabelCPUFan_Click;
|
labelGPUFan.Click += LabelCPUFan_Click;
|
||||||
|
|
||||||
|
|
||||||
InitMatrix();
|
|
||||||
|
|
||||||
comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboMatrix.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboMatrixRunning.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboMatrix.SelectedValueChanged += ComboMatrix_SelectedValueChanged;
|
|
||||||
comboMatrixRunning.SelectedValueChanged += ComboMatrixRunning_SelectedValueChanged;
|
comboMatrix.DropDownClosed += ComboMatrix_SelectedValueChanged;
|
||||||
|
comboMatrixRunning.DropDownClosed += ComboMatrixRunning_SelectedValueChanged;
|
||||||
|
|
||||||
|
checkMatrix.CheckedChanged += CheckMatrix_CheckedChanged; ;
|
||||||
|
|
||||||
buttonMatrix.Click += ButtonMatrix_Click;
|
buttonMatrix.Click += ButtonMatrix_Click;
|
||||||
|
|
||||||
|
|
||||||
SetTimer();
|
SetTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is null) return;
|
||||||
|
CheckBox check = (CheckBox)sender;
|
||||||
|
Program.config.setConfig("matrix_auto", check.Checked ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StartMatrixTimer()
|
||||||
|
{
|
||||||
|
matrixTimer.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StopMatrixTimer()
|
||||||
|
{
|
||||||
|
matrixTimer.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MatrixTimer_Elapsed(object? sender, ElapsedEventArgs e)
|
||||||
|
{
|
||||||
|
if (mat is null) return;
|
||||||
|
mat.PresentNextFrame();
|
||||||
|
}
|
||||||
|
|
||||||
void SetMatrixPicture(string fileName)
|
void SetMatrixPicture(string fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = 34 * 3;
|
if (mat is null) return;
|
||||||
int height = 61;
|
|
||||||
float scale;
|
|
||||||
|
|
||||||
Bitmap image;
|
StopMatrixTimer();
|
||||||
|
|
||||||
|
Image image;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var bmpTemp = (Bitmap)Image.FromFile(fileName))
|
using (var fs = new FileStream(fileName, FileMode.Open))
|
||||||
{
|
{
|
||||||
image = new Bitmap(bmpTemp);
|
var ms = new MemoryStream();
|
||||||
|
fs.CopyTo(ms);
|
||||||
Bitmap canvas = new Bitmap(width, height);
|
ms.Position = 0;
|
||||||
|
image = Image.FromStream(ms);
|
||||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
|
||||||
|
|
||||||
var graph = Graphics.FromImage(canvas);
|
|
||||||
var scaleWidth = (int)(image.Width * scale);
|
|
||||||
var scaleHeight = (int)(image.Height * scale);
|
|
||||||
|
|
||||||
graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
|
||||||
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
|
||||||
graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
|
||||||
|
|
||||||
graph.DrawImage(image, ((int)width - scaleWidth), ((int)height - scaleHeight) / 2, scaleWidth, scaleHeight);
|
|
||||||
|
|
||||||
Bitmap bmp = new Bitmap(canvas, 34, 61);
|
|
||||||
|
|
||||||
var mat = new AnimeMatrixDevice();
|
|
||||||
mat.SetBuiltInAnimation(false);
|
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
|
||||||
{
|
|
||||||
var pixel = bmp.GetPixel(x, y);
|
|
||||||
byte color = (byte)((pixel.R + pixel.G + pixel.B) / 3);
|
|
||||||
mat.SetLedPlanar(x, y, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mat.Present();
|
|
||||||
mat.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Error loading picture");
|
Debug.WriteLine("Error loading picture");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat.SetBuiltInAnimation(false);
|
||||||
|
mat.ClearFrames();
|
||||||
|
|
||||||
|
FrameDimension dimension = new FrameDimension(image.FrameDimensionsList[0]);
|
||||||
|
int frameCount = image.GetFrameCount(dimension);
|
||||||
|
|
||||||
|
if (frameCount > 1)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < frameCount; i++)
|
||||||
|
{
|
||||||
|
image.SelectActiveFrame(dimension, i);
|
||||||
|
mat.GenerateFrame(image);
|
||||||
|
mat.AddFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
StartMatrixTimer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mat.GenerateFrame(image);
|
||||||
|
mat.Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,18 +174,15 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ButtonMatrix_Click(object? sender, EventArgs e)
|
private void ButtonMatrix_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
string fileName = "";
|
||||||
|
|
||||||
Thread t = new Thread((ThreadStart)(() =>
|
Thread t = new Thread((ThreadStart)(() =>
|
||||||
{
|
{
|
||||||
OpenFileDialog of = new OpenFileDialog();
|
OpenFileDialog of = new OpenFileDialog();
|
||||||
of.Filter = "Image Files (*.bmp;*.jpg;*.jpeg,*.png)|*.BMP;*.JPG;*.JPEG;*.PNG";
|
of.Filter = "Image Files (*.bmp;*.jpg;*.jpeg,*.png,*.gif)|*.BMP;*.JPG;*.JPEG;*.PNG;*.GIF";
|
||||||
if (of.ShowDialog() == DialogResult.OK)
|
if (of.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
Program.config.setConfig("matrix_picture", of.FileName);
|
fileName = of.FileName;
|
||||||
SetMatrixPicture(of.FileName);
|
|
||||||
BeginInvoke(delegate
|
|
||||||
{
|
|
||||||
comboMatrixRunning.SelectedIndex = 2;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}));
|
}));
|
||||||
@@ -173,26 +190,40 @@ namespace GHelper
|
|||||||
t.SetApartmentState(ApartmentState.STA);
|
t.SetApartmentState(ApartmentState.STA);
|
||||||
t.Start();
|
t.Start();
|
||||||
t.Join();
|
t.Join();
|
||||||
|
|
||||||
|
Program.config.setConfig("matrix_picture", fileName);
|
||||||
|
SetMatrixPicture(fileName);
|
||||||
|
BeginInvoke(delegate
|
||||||
|
{
|
||||||
|
comboMatrixRunning.SelectedIndex = 2;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetAnimeMatrix();
|
Program.config.setConfig("matrix_running", comboMatrixRunning.SelectedIndex);
|
||||||
|
SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetAnimeMatrix();
|
Program.config.setConfig("matrix_brightness", comboMatrix.SelectedIndex);
|
||||||
|
SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAnimeMatrix()
|
public void SetMatrix(PowerLineStatus Plugged = PowerLineStatus.Online)
|
||||||
{
|
{
|
||||||
|
|
||||||
int brightness = comboMatrix.SelectedIndex;
|
if (mat is null) return;
|
||||||
int running = comboMatrixRunning.SelectedIndex;
|
|
||||||
|
|
||||||
var mat = new AnimeMatrixDevice();
|
int brightness = Program.config.getConfig("matrix_brightness");
|
||||||
|
int running = Program.config.getConfig("matrix_running");
|
||||||
|
bool auto = Program.config.getConfig("matrix_auto") == 1;
|
||||||
|
|
||||||
|
if (brightness < 0) brightness = 0;
|
||||||
|
if (running < 0) running = 0;
|
||||||
|
|
||||||
BuiltInAnimation animation = new BuiltInAnimation(
|
BuiltInAnimation animation = new BuiltInAnimation(
|
||||||
(BuiltInAnimation.Running)running,
|
(BuiltInAnimation.Running)running,
|
||||||
@@ -201,8 +232,9 @@ namespace GHelper
|
|||||||
BuiltInAnimation.Startup.StaticEmergence
|
BuiltInAnimation.Startup.StaticEmergence
|
||||||
);
|
);
|
||||||
|
|
||||||
|
StopMatrixTimer();
|
||||||
|
|
||||||
if (brightness == 0)
|
if (brightness == 0 || (auto && Plugged != PowerLineStatus.Online))
|
||||||
{
|
{
|
||||||
mat.SetDisplayState(false);
|
mat.SetDisplayState(false);
|
||||||
}
|
}
|
||||||
@@ -222,10 +254,6 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mat.Dispose();
|
|
||||||
|
|
||||||
Program.config.setConfig("matrix_brightness", comboMatrix.SelectedIndex);
|
|
||||||
Program.config.setConfig("matrix_running", comboMatrixRunning.SelectedIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -338,11 +366,38 @@ namespace GHelper
|
|||||||
|
|
||||||
public void InitMatrix()
|
public void InitMatrix()
|
||||||
{
|
{
|
||||||
int brightness = Program.config.getConfig("matrix_brightness");
|
|
||||||
int running = Program.config.getConfig("matrix_running");
|
|
||||||
|
|
||||||
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
|
matrixTimer = new System.Timers.Timer();
|
||||||
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
|
matrixTimer.Enabled = false;
|
||||||
|
matrixTimer.Interval = 100;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
matEnabled = true;
|
||||||
|
mat = new AnimeMatrixDevice();
|
||||||
|
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
matEnabled = false;
|
||||||
|
Debug.WriteLine("Anime Matrix not detected");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!matEnabled)
|
||||||
|
{
|
||||||
|
panelMatrix.Visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int brightness = Program.config.getConfig("matrix_brightness");
|
||||||
|
int running = Program.config.getConfig("matrix_running");
|
||||||
|
|
||||||
|
comboMatrix.SelectedIndex = (brightness != -1) ? brightness : 0;
|
||||||
|
comboMatrixRunning.SelectedIndex = (running != -1) ? running : 0;
|
||||||
|
|
||||||
|
checkMatrix.Checked = (Program.config.getConfig("matrix_auto") == 1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -927,37 +982,24 @@ namespace GHelper
|
|||||||
|
|
||||||
private void trackBatteryChange(object? sender, EventArgs e)
|
private void trackBatteryChange(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null)
|
if (sender is null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
TrackBar bar = (TrackBar)sender;
|
TrackBar bar = (TrackBar)sender;
|
||||||
SetBatteryChargeLimit(bar.Value);
|
SetBatteryChargeLimit(bar.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkGPU_CheckedChanged(object? sender, EventArgs e)
|
private void checkGPU_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null)
|
if (sender is null) return;
|
||||||
return;
|
CheckBox check = (CheckBox)sender;
|
||||||
|
Program.config.setConfig("gpu_auto", check.Checked ? 1 : 0);
|
||||||
CheckBox chk = (CheckBox)sender;
|
|
||||||
if (chk.Checked)
|
|
||||||
Program.config.setConfig("gpu_auto", 1);
|
|
||||||
else
|
|
||||||
Program.config.setConfig("gpu_auto", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
|
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (sender is null) return;
|
||||||
if (sender is null)
|
CheckBox check = (CheckBox)sender;
|
||||||
return;
|
Program.config.setConfig("screen_auto", check.Checked ? 1 : 0);
|
||||||
|
|
||||||
CheckBox chk = (CheckBox)sender;
|
|
||||||
if (chk.Checked)
|
|
||||||
Program.config.setConfig("screen_auto", 1);
|
|
||||||
else
|
|
||||||
Program.config.setConfig("screen_auto", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,19 +69,6 @@
|
|||||||
vtSpbWIlX5XHkK/OOiq2RE5+H2ZRgx1v4RpMqBhHG5XElccIHie4EPW9o82fP8yx11SyLuxDm9L38yy8
|
vtSpbWIlX5XHkK/OOiq2RE5+H2ZRgx1v4RpMqBhHG5XElccIHie4EPW9o82fP8yx11SyLuxDm9L38yy8
|
||||||
gDa8UP+WK+UiLIIXaiZQiduQtYsv9Qme53kn5bWujY3NGqzFtin+5YMgCIIgCP4PVfUNWXMTLz5Z0sYA
|
gDa8UP+WK+UiLIIXaiZQiduQtYsv9Qme53kn5bWujY3NGqzFtin+5YMgCIIgCP4PVfUNWXMTLz5Z0sYA
|
||||||
AAAASUVORK5CYII=
|
AAAASUVORK5CYII=
|
||||||
</value>
|
|
||||||
</data>
|
|
||||||
<data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>
|
|
||||||
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
|
||||||
DAAACwwBP0AiyAAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
|
|
||||||
EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k
|
|
||||||
vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k
|
|
||||||
d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar
|
|
||||||
gyEuVOpPM/cTG9LVwRAXKnXqDOxKVwdDXAhLViHW+SmcSFcHQ1wIS1YhNqmx8Jn7JF0dDHEhLFmFkPV9
|
|
||||||
DOfS5ZMhLlRDdthoEHT+13biWrJJsc7zojJzXHnmhx6b3BAXaskQF2rF2X8PzP6LbE+GuOAq5V8J7vyo
|
|
||||||
zkMeniX/ZgB5u5oWM7ZY3q6mxYwtxsuVt61hlTOJdFbAdQjOFWoOglrXshg6xqnNLI6YOp1OZ1UsFt/W
|
|
||||||
cWCm8IATjAAAAABJRU5ErkJggg==
|
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
@@ -103,6 +90,19 @@
|
|||||||
nbLijqltby+mGSx+Qlk5AtuQ6LdryGR4dcrQliFkF7w6h1E6emm9fZEe+QpopVTDtrysQ1BbzfZJ2v+0
|
nbLijqltby+mGSx+Qlk5AtuQ6LdryGR4dcrQliFkF7w6h1E6emm9fZEe+QpopVTDtrysQ1BbzfZJ2v+0
|
||||||
/N10MWyDnbYUbUVfjr2GO+Eo2o5+I5f5EFWVyj4tKvrQehneibqDZqJ+qDR6EnrhcjZlrVLbOofOVadO
|
/N10MWyDnbYUbUVfjr2GO+Eo2o5+I5f5EFWVyj4tKvrQehneibqDZqJ+qDR6EnrhcjZlrVLbOofOVadO
|
||||||
nTr/fBqNP4sju3bXhjy/AAAAAElFTkSuQmCC
|
nTr/fBqNP4sju3bXhjy/AAAAAElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||||
|
DAAACwwBP0AiyAAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
|
||||||
|
EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k
|
||||||
|
vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k
|
||||||
|
d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar
|
||||||
|
gyEuVOpPM/cTG9LVwRAXKnXqDOxKVwdDXAhLViHW+SmcSFcHQ1wIS1YhNqmx8Jn7JF0dDHEhLFmFkPV9
|
||||||
|
DOfS5ZMhLlRDdthoEHT+13biWrJJsc7zojJzXHnmhx6b3BAXaskQF2rF2X8PzP6LbE+GuOAq5V8J7vyo
|
||||||
|
zkMeniX/ZgB5u5oWM7ZY3q6mxYwtxsuVt61hlTOJdFbAdQjOFWoOglrXshg6xqnNLI6YOp1OZ1UsFt/W
|
||||||
|
cWCm8IATjAAAAABJRU5ErkJggg==
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
|||||||
@@ -55,7 +55,6 @@
|
|||||||
<windowsSettings>
|
<windowsSettings>
|
||||||
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
|
||||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
|
||||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
|
||||||
</windowsSettings>
|
</windowsSettings>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user