mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d36cd409a4 | ||
|
|
082eceed9a | ||
|
|
46c91d1956 | ||
|
|
edfb829988 | ||
|
|
83cb28e99c | ||
|
|
957916bfdf | ||
|
|
2f98606a7d | ||
|
|
c791421c3e | ||
|
|
fa79a72247 | ||
|
|
831f7b8989 | ||
|
|
77800475cb | ||
|
|
96553a162c | ||
|
|
d1e987f4da | ||
|
|
a1fb740c27 | ||
|
|
cff47002e1 | ||
|
|
c34ba9c620 | ||
|
|
3da2d042c8 | ||
|
|
b93499c20d | ||
|
|
feb7f1915e | ||
|
|
bd7f494830 | ||
|
|
1fc5095a65 | ||
|
|
920ed5e176 | ||
|
|
fce9cddd02 | ||
|
|
3332bd4b36 | ||
|
|
56289abc36 | ||
|
|
9be02a102d | ||
|
|
e1e94e1118 | ||
|
|
2ffd08e754 | ||
|
|
0378b65763 | ||
|
|
5dd3760e90 | ||
|
|
e7eb7fab8a | ||
|
|
ce128adc4f | ||
|
|
a794f8ed5f |
@@ -2,7 +2,9 @@
|
|||||||
using NAudio.Wave;
|
using NAudio.Wave;
|
||||||
using Starlight.AnimeMatrix;
|
using Starlight.AnimeMatrix;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.IO;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace GHelper.AnimeMatrix
|
namespace GHelper.AnimeMatrix
|
||||||
@@ -14,12 +16,12 @@ namespace GHelper.AnimeMatrix
|
|||||||
SettingsForm settings;
|
SettingsForm settings;
|
||||||
|
|
||||||
System.Timers.Timer matrixTimer = default!;
|
System.Timers.Timer matrixTimer = default!;
|
||||||
AnimeMatrixDevice? mat;
|
public AnimeMatrixDevice? device;
|
||||||
|
|
||||||
double[]? AudioValues;
|
double[]? AudioValues;
|
||||||
WasapiCapture? AudioDevice;
|
WasapiCapture? AudioDevice;
|
||||||
|
|
||||||
public bool IsValid => mat != null;
|
public bool IsValid => device != null;
|
||||||
|
|
||||||
private long lastPresent;
|
private long lastPresent;
|
||||||
private List<double> maxes = new List<double>();
|
private List<double> maxes = new List<double>();
|
||||||
@@ -30,14 +32,14 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mat = new AnimeMatrixDevice();
|
device = new AnimeMatrixDevice();
|
||||||
Task.Run(mat.WakeUp);
|
Task.Run(device.WakeUp);
|
||||||
matrixTimer = new System.Timers.Timer(100);
|
matrixTimer = new System.Timers.Timer(100);
|
||||||
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
matrixTimer.Elapsed += MatrixTimer_Elapsed;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
mat = null;
|
device = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,24 +69,26 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mat.SetProvider();
|
device.SetProvider();
|
||||||
} catch (Exception ex) {
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
Logger.WriteLine(ex.Message);
|
Logger.WriteLine(ex.Message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wakeUp && AppConfig.ContainsModel("401")) mat.WakeUp();
|
if (wakeUp && AppConfig.ContainsModel("401")) device.WakeUp();
|
||||||
|
|
||||||
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
if (brightness == 0 || (auto && SystemInformation.PowerStatus.PowerLineStatus != PowerLineStatus.Online))
|
||||||
{
|
{
|
||||||
mat.SetDisplayState(false);
|
device.SetDisplayState(false);
|
||||||
mat.SetDisplayState(false); // some devices are dumb
|
device.SetDisplayState(false); // some devices are dumb
|
||||||
Logger.WriteLine("Matrix Off");
|
Logger.WriteLine("Matrix Off");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mat.SetDisplayState(true);
|
device.SetDisplayState(true);
|
||||||
mat.SetBrightness((BrightnessMode)brightness);
|
device.SetBrightness((BrightnessMode)brightness);
|
||||||
|
|
||||||
switch (running)
|
switch (running)
|
||||||
{
|
{
|
||||||
@@ -98,7 +102,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
SetMatrixAudio();
|
SetMatrixAudio();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mat.SetBuiltInAnimation(true, animation);
|
device.SetBuiltInAnimation(true, animation);
|
||||||
Logger.WriteLine("Matrix builtin " + animation.AsByte);
|
Logger.WriteLine("Matrix builtin " + animation.AsByte);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -127,10 +131,10 @@ namespace GHelper.AnimeMatrix
|
|||||||
switch (AppConfig.Get("matrix_running"))
|
switch (AppConfig.Get("matrix_running"))
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
mat.PresentNextFrame();
|
device.PresentNextFrame();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
mat.PresentClock();
|
device.PresentClock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +143,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
public void SetMatrixClock()
|
public void SetMatrixClock()
|
||||||
{
|
{
|
||||||
mat.SetBuiltInAnimation(false);
|
device.SetBuiltInAnimation(false);
|
||||||
StartMatrixTimer(1000);
|
StartMatrixTimer(1000);
|
||||||
Logger.WriteLine("Matrix Clock");
|
Logger.WriteLine("Matrix Clock");
|
||||||
}
|
}
|
||||||
@@ -169,7 +173,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
{
|
{
|
||||||
if (!IsValid) return;
|
if (!IsValid) return;
|
||||||
|
|
||||||
mat.SetBuiltInAnimation(false);
|
device.SetBuiltInAnimation(false);
|
||||||
StopMatrixTimer();
|
StopMatrixTimer();
|
||||||
StopMatrixAudio();
|
StopMatrixAudio();
|
||||||
|
|
||||||
@@ -238,8 +242,8 @@ namespace GHelper.AnimeMatrix
|
|||||||
for (int x = 0; x < 2 - (y % 2); x++)
|
for (int x = 0; x < 2 - (y % 2); x++)
|
||||||
{
|
{
|
||||||
//color = (byte)(Math.Min(1,(h - y - 2)*2) * 255);
|
//color = (byte)(Math.Min(1,(h - y - 2)*2) * 255);
|
||||||
mat.SetLedPlanar(x + dx, dy + y, (byte)(h * 255 / 30));
|
device.SetLedPlanar(x + dx, dy + y, (byte)(h * 255 / 30));
|
||||||
mat.SetLedPlanar(x + dx, dy - y, 255);
|
device.SetLedPlanar(x + dx, dy - y, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +253,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastPresent) < 70) return;
|
if (Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastPresent) < 70) return;
|
||||||
lastPresent = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
lastPresent = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||||
|
|
||||||
mat.Clear();
|
device.Clear();
|
||||||
|
|
||||||
int size = 20;
|
int size = 20;
|
||||||
double[] bars = new double[size];
|
double[] bars = new double[size];
|
||||||
@@ -267,7 +271,7 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
for (int i = 0; i < size; i++) DrawBar(20 - i, bars[i] * 20 / maxAverage);
|
for (int i = 0; i < size; i++) DrawBar(20 - i, bars[i] * 20 / maxAverage);
|
||||||
|
|
||||||
mat.Present();
|
device.Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -302,22 +306,30 @@ namespace GHelper.AnimeMatrix
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMatrixPicture(string fileName)
|
public void SetMatrixPicture(string fileName, bool visualise = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!IsValid) return;
|
if (!IsValid) return;
|
||||||
StopMatrixTimer();
|
StopMatrixTimer();
|
||||||
|
|
||||||
Image image;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var fs = new FileStream(fileName, FileMode.Open))
|
using (var fs = new FileStream(fileName, FileMode.Open))
|
||||||
|
//using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
var ms = new MemoryStream();
|
/*
|
||||||
|
ms.SetLength(0);
|
||||||
fs.CopyTo(ms);
|
fs.CopyTo(ms);
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
image = Image.FromStream(ms);
|
*/
|
||||||
|
using (Image image = Image.FromStream(fs))
|
||||||
|
{
|
||||||
|
ProcessPicture(image);
|
||||||
|
Logger.WriteLine("Matrix " + fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.Close();
|
||||||
|
if (visualise) settings.VisualiseMatrix(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -326,30 +338,49 @@ namespace GHelper.AnimeMatrix
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mat.SetBuiltInAnimation(false);
|
}
|
||||||
mat.ClearFrames();
|
|
||||||
|
protected void ProcessPicture(Image image)
|
||||||
|
{
|
||||||
|
device.SetBuiltInAnimation(false);
|
||||||
|
device.ClearFrames();
|
||||||
|
|
||||||
|
int matrixX = AppConfig.Get("matrix_x", 0);
|
||||||
|
int matrixY = AppConfig.Get("matrix_y", 0);
|
||||||
|
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
||||||
|
int matrixSpeed = AppConfig.Get("matrix_speed", 50);
|
||||||
|
|
||||||
|
InterpolationMode matrixQuality = (InterpolationMode)AppConfig.Get("matrix_quality", 0);
|
||||||
|
|
||||||
|
|
||||||
FrameDimension dimension = new FrameDimension(image.FrameDimensionsList[0]);
|
FrameDimension dimension = new FrameDimension(image.FrameDimensionsList[0]);
|
||||||
int frameCount = image.GetFrameCount(dimension);
|
int frameCount = image.GetFrameCount(dimension);
|
||||||
|
|
||||||
if (frameCount > 1)
|
if (frameCount > 1)
|
||||||
{
|
{
|
||||||
|
var delayPropertyBytes = image.GetPropertyItem(0x5100).Value;
|
||||||
|
var frameDelay = BitConverter.ToInt32(delayPropertyBytes) * 10;
|
||||||
|
|
||||||
for (int i = 0; i < frameCount; i++)
|
for (int i = 0; i < frameCount; i++)
|
||||||
{
|
{
|
||||||
image.SelectActiveFrame(dimension, i);
|
image.SelectActiveFrame(dimension, i);
|
||||||
mat.GenerateFrame(image);
|
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
mat.AddFrame();
|
device.AddFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
StartMatrixTimer();
|
|
||||||
Logger.WriteLine("Matrix GIF " + fileName);
|
Logger.WriteLine("GIF Delay:" + frameDelay);
|
||||||
|
StartMatrixTimer(Math.Max(matrixSpeed, frameDelay));
|
||||||
|
|
||||||
|
//image.SelectActiveFrame(dimension, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mat.GenerateFrame(image);
|
device.GenerateFrame(image, matrixZoom, matrixX, matrixY, matrixQuality);
|
||||||
mat.Present();
|
device.Present();
|
||||||
Logger.WriteLine("Matrix " + fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using GHelper.AnimeMatrix.Communication;
|
using GHelper.AnimeMatrix.Communication;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Drawing.Text;
|
using System.Drawing.Text;
|
||||||
using System.Globalization;
|
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -77,6 +77,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class AnimeMatrixDevice : Device
|
public class AnimeMatrixDevice : Device
|
||||||
{
|
{
|
||||||
int UpdatePageLength = 490;
|
int UpdatePageLength = 490;
|
||||||
@@ -86,33 +87,36 @@ namespace Starlight.AnimeMatrix
|
|||||||
List<byte[]> frames = new List<byte[]>();
|
List<byte[]> frames = new List<byte[]>();
|
||||||
|
|
||||||
public int MaxRows = 61;
|
public int MaxRows = 61;
|
||||||
//public int FullRows = 11;
|
|
||||||
//public int FullEvenRows = -1;
|
|
||||||
|
|
||||||
public int dx = 0;
|
|
||||||
public int MaxColumns = 34;
|
public int MaxColumns = 34;
|
||||||
|
public int LedStart = 0;
|
||||||
|
|
||||||
|
public int TextShift = 8;
|
||||||
|
|
||||||
private int frameIndex = 0;
|
private int frameIndex = 0;
|
||||||
|
|
||||||
private static AnimeType _model = AnimeType.GA402;
|
private static AnimeType _model = AnimeType.GA402;
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
|
||||||
|
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts);
|
||||||
|
private PrivateFontCollection fonts = new PrivateFontCollection();
|
||||||
|
|
||||||
public AnimeMatrixDevice()
|
public AnimeMatrixDevice() : base(0x0B05, 0x193B, 640)
|
||||||
: base(0x0B05, 0x193B, 640)
|
|
||||||
{
|
{
|
||||||
string model = GetModel();
|
string model = GetModel();
|
||||||
|
|
||||||
if (model.Contains("401"))
|
if (model.Contains("401"))
|
||||||
{
|
{
|
||||||
|
|
||||||
_model = AnimeType.GA401;
|
_model = AnimeType.GA401;
|
||||||
|
|
||||||
MaxColumns = 33;
|
MaxColumns = 33;
|
||||||
dx = 1;
|
|
||||||
|
|
||||||
MaxRows = 55;
|
MaxRows = 55;
|
||||||
LedCount = 1245;
|
LedCount = 1245;
|
||||||
|
|
||||||
UpdatePageLength = 410;
|
UpdatePageLength = 410;
|
||||||
|
|
||||||
|
TextShift = 11;
|
||||||
|
|
||||||
|
LedStart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.Contains("GU604"))
|
if (model.Contains("GU604"))
|
||||||
@@ -123,12 +127,35 @@ namespace Starlight.AnimeMatrix
|
|||||||
MaxRows = 92;
|
MaxRows = 92;
|
||||||
LedCount = 1711;
|
LedCount = 1711;
|
||||||
UpdatePageLength = 630;
|
UpdatePageLength = 630;
|
||||||
|
|
||||||
|
TextShift = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
_displayBuffer = new byte[LedCount];
|
_displayBuffer = new byte[LedCount];
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (int i = 0; i < MaxRows; i++)
|
||||||
|
{
|
||||||
|
_model = AnimeType.GA401;
|
||||||
|
Logger.WriteLine(FirstX(i) + " " + Pitch(i));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
LoadMFont();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadMFont()
|
||||||
|
{
|
||||||
|
byte[] fontData = GHelper.Properties.Resources.MFont;
|
||||||
|
IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length);
|
||||||
|
System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length);
|
||||||
|
uint dummy = 0;
|
||||||
|
|
||||||
|
fonts.AddMemoryFont(fontPtr, GHelper.Properties.Resources.MFont.Length);
|
||||||
|
AddFontMemResourceEx(fontPtr, (uint)GHelper.Properties.Resources.MFont.Length, IntPtr.Zero, ref dummy);
|
||||||
|
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
|
||||||
|
}
|
||||||
|
|
||||||
public string GetModel()
|
public string GetModel()
|
||||||
{
|
{
|
||||||
@@ -172,32 +199,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int FirstX(int y)
|
public int Width()
|
||||||
{
|
|
||||||
switch (_model)
|
|
||||||
{
|
|
||||||
case AnimeType.GA401:
|
|
||||||
if (y < 5)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (y + 1) / 2 - 3;
|
|
||||||
}
|
|
||||||
case AnimeType.GU604:
|
|
||||||
if (y < 9 && y % 2 == 0)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return (int)Math.Ceiling(Math.Max(0, y - 9) / 2F);
|
|
||||||
|
|
||||||
default:
|
|
||||||
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int Width(int y)
|
|
||||||
{
|
{
|
||||||
switch (_model)
|
switch (_model)
|
||||||
{
|
{
|
||||||
@@ -210,7 +212,30 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int Pitch(int y)
|
public int FirstX(int y)
|
||||||
|
{
|
||||||
|
switch (_model)
|
||||||
|
{
|
||||||
|
case AnimeType.GA401:
|
||||||
|
if (y < 5 && y % 2 == 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 5) / 2F);
|
||||||
|
case AnimeType.GU604:
|
||||||
|
if (y < 9 && y % 2 == 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 9) / 2F);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return (int)Math.Ceiling(Math.Max(0, y - 11) / 2F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int Pitch(int y)
|
||||||
{
|
{
|
||||||
switch (_model)
|
switch (_model)
|
||||||
{
|
{
|
||||||
@@ -246,19 +271,19 @@ namespace Starlight.AnimeMatrix
|
|||||||
return 39;
|
return 39;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Width(y) - FirstX(y);
|
return Width() - FirstX(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return Width(y) - FirstX(y);
|
return Width() - FirstX(y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int RowToLinearAddress(int y)
|
public int RowToLinearAddress(int y)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = LedStart;
|
||||||
for (var i = 0; i < y; i++)
|
for (var i = 0; i < y; i++)
|
||||||
ret += Pitch(i);
|
ret += Pitch(i);
|
||||||
|
|
||||||
@@ -269,8 +294,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
if (!IsRowInRange(y)) return;
|
if (!IsRowInRange(y)) return;
|
||||||
|
|
||||||
if (x >= FirstX(y) && x < Width(y))
|
if (x >= FirstX(y) && x < Width())
|
||||||
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x + dx, value);
|
SetLedLinear(RowToLinearAddress(y) - FirstX(y) + x, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WakeUp()
|
public void WakeUp()
|
||||||
@@ -368,20 +393,49 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
public void PresentClock()
|
public void PresentClock()
|
||||||
{
|
{
|
||||||
int second = DateTime.Now.Second;
|
string second = (DateTime.Now.Second % 2 == 0) ? ":" : " ";
|
||||||
string time;
|
string time = DateTime.Now.ToString("HH" + second + "mm");
|
||||||
|
|
||||||
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
Clear();
|
||||||
time = DateTime.Now.ToString("H" + ((second % 2 == 0) ? ":" : " ") + "mm");
|
TextDiagonal(time, 15, 12, TextShift + 11);
|
||||||
else
|
TextDiagonal(DateTime.Now.ToString("yy'. 'MM'. 'dd"), 11.5F, 3, TextShift);
|
||||||
time = DateTime.Now.ToString("h" + ((second % 2 == 0) ? ":" : " ") + "mmtt");
|
Present();
|
||||||
|
|
||||||
if (_model == AnimeType.GA401)
|
|
||||||
PresentText(time);
|
|
||||||
else
|
|
||||||
PresentTextDiagonal(time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TextDiagonal(string text, float fontSize = 10, int deltaX = 0, int deltaY = 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
||||||
|
int textHeight;
|
||||||
|
|
||||||
|
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
||||||
|
{
|
||||||
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
||||||
|
|
||||||
|
using (Font font = new Font(fonts.Families[0], fontSize, FontStyle.Regular, GraphicsUnit.Pixel))
|
||||||
|
{
|
||||||
|
SizeF textSize = g.MeasureString(text, font);
|
||||||
|
textHeight = (int)textSize.Height;
|
||||||
|
g.DrawString(text, font, Brushes.White, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
|
{
|
||||||
|
var pixel = bmp.GetPixel(x, y);
|
||||||
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
|
if (color > 100) SetLedDiagonal(x, y, (byte)color, deltaX, deltaY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void PresentText(string text1, string text2 = "")
|
public void PresentText(string text1, string text2 = "")
|
||||||
@@ -392,8 +446,9 @@ namespace Starlight.AnimeMatrix
|
|||||||
{
|
{
|
||||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
||||||
|
|
||||||
using (Font font = new Font("Consolas", 21F, FontStyle.Regular, GraphicsUnit.Pixel))
|
using (Font font = new Font("Consolas", 22F, FontStyle.Regular, GraphicsUnit.Pixel))
|
||||||
{
|
{
|
||||||
SizeF textSize = g.MeasureString(text1, font);
|
SizeF textSize = g.MeasureString(text1, font);
|
||||||
g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -4);
|
g.DrawString(text1, font, Brushes.White, (MaxColumns * 3 - textSize.Width) + 3, -4);
|
||||||
@@ -408,13 +463,15 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateFrame(bmp, InterpolationMode.Bicubic);
|
bmp.Save("test.bmp", ImageFormat.Bmp);
|
||||||
|
|
||||||
|
GenerateFrame(bmp);
|
||||||
Present();
|
Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateFrame(Image image, InterpolationMode interpolation = InterpolationMode.High)
|
public void GenerateFrame(Image image, float zoom = 100, int panX = 0, int panY = 0, InterpolationMode quality = InterpolationMode.Default)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = MaxColumns / 2 * 6;
|
int width = MaxColumns / 2 * 6;
|
||||||
@@ -426,25 +483,25 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
||||||
{
|
{
|
||||||
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height);
|
scale = Math.Min((float)width / (float)image.Width, (float)height / (float)image.Height) * zoom / 100;
|
||||||
|
|
||||||
using (var graph = Graphics.FromImage(bmp))
|
using (var graph = Graphics.FromImage(bmp))
|
||||||
{
|
{
|
||||||
var scaleWidth = (float)(image.Width * scale);
|
var scaleWidth = (float)(image.Width * scale);
|
||||||
var scaleHeight = (float)(image.Height * scale);
|
var scaleHeight = (float)(image.Height * scale);
|
||||||
|
|
||||||
graph.InterpolationMode = interpolation;
|
graph.InterpolationMode = quality;
|
||||||
graph.CompositingQuality = CompositingQuality.HighQuality;
|
graph.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
graph.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
graph.DrawImage(image, (float)Math.Round(targetWidth - scaleWidth * targetWidth / width), 0, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
graph.DrawImage(image, (float)Math.Round(targetWidth - (scaleWidth + panX) * targetWidth / width), -panY, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
for (int y = 0; y < bmp.Height; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
for (int x = 0; x < bmp.Width; x++)
|
||||||
if (x % 2 == (y + dx) % 2)
|
if (x % 2 == y % 2)
|
||||||
{
|
{
|
||||||
var pixel = bmp.GetPixel(x, y);
|
var pixel = bmp.GetPixel(x, y);
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
||||||
@@ -456,68 +513,16 @@ namespace Starlight.AnimeMatrix
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetLedDiagonal(int x, int y, byte color, int delta = 10)
|
public void SetLedDiagonal(int x, int y, byte color, int deltaX = 0, int deltaY = 10)
|
||||||
{
|
{
|
||||||
//x+=delta;
|
x += deltaX;
|
||||||
y -= delta;
|
y -= deltaY;
|
||||||
|
|
||||||
int dx = (x - y) / 2;
|
int plX = (x - y) / 2;
|
||||||
int dy = x + y;
|
int plY = x + y;
|
||||||
SetLedPlanar(dx, dy, color);
|
SetLedPlanar(plX, plY, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PresentTextDiagonal(string text)
|
|
||||||
{
|
|
||||||
|
|
||||||
Clear();
|
|
||||||
|
|
||||||
|
|
||||||
InstalledFontCollection installedFontCollection = new InstalledFontCollection();
|
|
||||||
|
|
||||||
|
|
||||||
string familyName;
|
|
||||||
string familyList = "";
|
|
||||||
FontFamily[] fontFamilies;
|
|
||||||
// Get the array of FontFamily objects.
|
|
||||||
fontFamilies = installedFontCollection.Families;
|
|
||||||
|
|
||||||
int count = fontFamilies.Length;
|
|
||||||
for (int j = 0; j < count; ++j)
|
|
||||||
{
|
|
||||||
familyName = fontFamilies[j].Name;
|
|
||||||
familyList = familyList + familyName;
|
|
||||||
familyList = familyList + ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
int maxX = (int)Math.Sqrt(MaxRows * MaxRows + MaxColumns * MaxColumns);
|
|
||||||
|
|
||||||
using (Bitmap bmp = new Bitmap(maxX, MaxRows))
|
|
||||||
{
|
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
|
||||||
{
|
|
||||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
|
||||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
|
||||||
|
|
||||||
using (Font font = new Font("Consolas", 13F, FontStyle.Regular, GraphicsUnit.Pixel))
|
|
||||||
{
|
|
||||||
SizeF textSize = g.MeasureString(text, font);
|
|
||||||
g.DrawString(text, font, Brushes.White, 4, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int y = 0; y < bmp.Height; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < bmp.Width; x++)
|
|
||||||
{
|
|
||||||
var pixel = bmp.GetPixel(x, y);
|
|
||||||
var color = (pixel.R + pixel.G + pixel.B) / 3;
|
|
||||||
SetLedDiagonal(x, y, (byte)color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Present();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsRowInRange(int row)
|
private bool IsRowInRange(int row)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -380,4 +380,10 @@ public static class AppConfig
|
|||||||
{
|
{
|
||||||
return Is("gpu_mode_force_set") || ContainsModel("503");
|
return Is("gpu_mode_force_set") || ContainsModel("503");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsNoGPUModes()
|
||||||
|
{
|
||||||
|
return ContainsModel("GV301RA") || ContainsModel("GV302XA") || IsAlly();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,8 +59,10 @@ public class AsusACPI
|
|||||||
public const uint VivoBookMode = 0x00110019; // Vivobook performance modes
|
public const uint VivoBookMode = 0x00110019; // Vivobook performance modes
|
||||||
|
|
||||||
public const uint GPUEco = 0x00090020;
|
public const uint GPUEco = 0x00090020;
|
||||||
|
|
||||||
public const uint GPUXGConnected = 0x00090018;
|
public const uint GPUXGConnected = 0x00090018;
|
||||||
public const uint GPUXG = 0x00090019;
|
public const uint GPUXG = 0x00090019;
|
||||||
|
|
||||||
public const uint GPUMux = 0x00090016;
|
public const uint GPUMux = 0x00090016;
|
||||||
|
|
||||||
public const uint BatteryLimit = 0x00120057;
|
public const uint BatteryLimit = 0x00120057;
|
||||||
@@ -91,6 +93,7 @@ public class AsusACPI
|
|||||||
|
|
||||||
public const int TUF_KB_BRIGHTNESS = 0x00050021;
|
public const int TUF_KB_BRIGHTNESS = 0x00050021;
|
||||||
public const int TUF_KB = 0x00100056;
|
public const int TUF_KB = 0x00100056;
|
||||||
|
public const int TUF_KB2 = 0x0010005a;
|
||||||
public const int TUF_KB_STATE = 0x00100057;
|
public const int TUF_KB_STATE = 0x00100057;
|
||||||
|
|
||||||
public const int MICMUTE_LED = 0x00040017;
|
public const int MICMUTE_LED = 0x00040017;
|
||||||
@@ -508,16 +511,17 @@ public class AsusACPI
|
|||||||
public void TUFKeyboardRGB(int mode, Color color, int speed)
|
public void TUFKeyboardRGB(int mode, Color color, int speed)
|
||||||
{
|
{
|
||||||
|
|
||||||
byte[] setting = new byte[12];
|
byte[] setting = new byte[6];
|
||||||
setting[0] = (byte)0xB4;
|
|
||||||
|
setting[0] = (byte)0xb4;
|
||||||
setting[1] = (byte)mode;
|
setting[1] = (byte)mode;
|
||||||
setting[2] = color.R;
|
setting[2] = color.R;
|
||||||
setting[3] = color.G;
|
setting[3] = color.G;
|
||||||
setting[4] = color.B;
|
setting[4] = color.B;
|
||||||
setting[5] = (byte)speed;
|
setting[5] = (byte)speed;
|
||||||
|
|
||||||
DeviceSet(TUF_KB, setting, "TUF RGB");
|
int result = DeviceSet(TUF_KB, setting, "TUF RGB");
|
||||||
//Debug.WriteLine(BitConverter.ToString(setting));
|
if (result != 1) DeviceSet(TUF_KB2, setting, "TUF RGB");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,10 @@ namespace GHelper
|
|||||||
private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e)
|
private void ComboBoxAnimationSpeed_DropDownClosed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
|
LightingSetting? ls = mouse.LightingSettingForZone(visibleZone);
|
||||||
ls.AnimationSpeed = (AnimationSpeed)comboBoxAnimationSpeed.SelectedIndex;
|
// 0 => 0x9
|
||||||
|
// 1 => 0x7
|
||||||
|
// 2 => 0x5
|
||||||
|
ls.AnimationSpeed = (AnimationSpeed)(0x9 - (comboBoxAnimationSpeed.SelectedIndex * 0x2));
|
||||||
UpdateLightingSettings(ls, visibleZone);
|
UpdateLightingSettings(ls, visibleZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -602,6 +604,12 @@ namespace GHelper
|
|||||||
labelLowBatteryWarningValue.Visible = false;
|
labelLowBatteryWarningValue.Visible = false;
|
||||||
sliderLowBatteryWarning.Visible = false;
|
sliderLowBatteryWarning.Visible = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sliderLowBatteryWarning.Min = 0;
|
||||||
|
sliderLowBatteryWarning.Step = mouse.LowBatteryWarningStep();
|
||||||
|
sliderLowBatteryWarning.Max = mouse.LowBatteryWarningMax();
|
||||||
|
}
|
||||||
|
|
||||||
if (!mouse.HasAutoPowerOff() && !mouse.HasLowBatteryWarning())
|
if (!mouse.HasAutoPowerOff() && !mouse.HasLowBatteryWarning())
|
||||||
{
|
{
|
||||||
@@ -824,8 +832,10 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
pictureBoxLightingColor.BackColor = ls.RGBColor;
|
pictureBoxLightingColor.BackColor = ls.RGBColor;
|
||||||
|
|
||||||
|
//0x09 => 0
|
||||||
comboBoxAnimationSpeed.SelectedIndex = (((int)ls.AnimationSpeed) - 5) / 2;
|
//0x07 => 1
|
||||||
|
//0x05 => 2
|
||||||
|
comboBoxAnimationSpeed.SelectedIndex = 2 - ((((int)ls.AnimationSpeed) - 5) / 2);
|
||||||
comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection;
|
comboBoxAnimationDirection.SelectedIndex = (int)ls.AnimationDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace GHelper
|
|||||||
isSingleColor = AppConfig.ContainsModel("GA401") || AppConfig.ContainsModel("X13"); // Mono Color
|
isSingleColor = AppConfig.ContainsModel("GA401") || AppConfig.ContainsModel("X13"); // Mono Color
|
||||||
|
|
||||||
var device = GetDevice(AURA_HID_ID);
|
var device = GetDevice(AURA_HID_ID);
|
||||||
if (device is not null && device.Attributes.Version == 22 && AppConfig.ContainsModel("GA402X")) isSingleColor = true;
|
if (device is not null && (device.Attributes.Version == 22 || device.Attributes.Version == 23) && (AppConfig.ContainsModel("GA402X") || AppConfig.ContainsModel("GA402N"))) isSingleColor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
private static void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
|
||||||
@@ -641,11 +641,17 @@ namespace GHelper
|
|||||||
|
|
||||||
public static void InitXGM()
|
public static void InitXGM()
|
||||||
{
|
{
|
||||||
SetXGM(LED_INIT1);
|
byte[] ASUS_INIT = Encoding.ASCII.GetBytes("^ASUS Tech.Inc.");
|
||||||
SetXGM(LED_INIT2);
|
|
||||||
SetXGM(LED_INIT3);
|
SetXGM(ASUS_INIT);
|
||||||
SetXGM(LED_INIT4);
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x02 });
|
||||||
SetXGM(LED_INIT5);
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x03 });
|
||||||
|
SetXGM(ASUS_INIT);
|
||||||
|
SetXGM(new byte[] { 0x5e, 0xd1, 0x02 }); // reset fan
|
||||||
|
SetXGM(ASUS_INIT);
|
||||||
|
SetXGM(new byte[] { 0x5e, 0xce, 0x03 });
|
||||||
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x04 });
|
||||||
|
SetXGM(new byte[] { 0x5e, 0xd0, 0x01 });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyXGMLight(bool status)
|
public static void ApplyXGMLight(bool status)
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
if (limit < 0) limit = AppConfig.Get("charge_limit");
|
if (limit < 0) limit = AppConfig.Get("charge_limit");
|
||||||
if (limit < 40 || limit > 100) return;
|
if (limit < 40 || limit > 100) return;
|
||||||
|
|
||||||
Program.settingsForm.VisualiseBattery(limit);
|
|
||||||
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
|
Program.acpi.DeviceSet(AsusACPI.BatteryLimit, limit, "BatteryLimit");
|
||||||
|
Program.settingsForm.VisualiseBattery(limit);
|
||||||
|
|
||||||
AppConfig.Set("charge_limit", limit);
|
AppConfig.Set("charge_limit", limit);
|
||||||
|
|
||||||
|
|||||||
17
app/Fans.cs
17
app/Fans.cs
@@ -78,15 +78,19 @@ namespace GHelper
|
|||||||
|
|
||||||
chartCPU.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.CPU);
|
chartCPU.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.CPU);
|
||||||
chartCPU.MouseUp += ChartCPU_MouseUp;
|
chartCPU.MouseUp += ChartCPU_MouseUp;
|
||||||
|
chartCPU.MouseLeave += ChartCPU_MouseLeave;
|
||||||
|
|
||||||
chartGPU.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.GPU);
|
chartGPU.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.GPU);
|
||||||
chartGPU.MouseUp += ChartCPU_MouseUp;
|
chartGPU.MouseUp += ChartCPU_MouseUp;
|
||||||
|
chartGPU.MouseLeave += ChartCPU_MouseLeave;
|
||||||
|
|
||||||
chartMid.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.Mid);
|
chartMid.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.Mid);
|
||||||
chartMid.MouseUp += ChartCPU_MouseUp;
|
chartMid.MouseUp += ChartCPU_MouseUp;
|
||||||
|
chartMid.MouseLeave += ChartCPU_MouseLeave;
|
||||||
|
|
||||||
chartXGM.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.XGM);
|
chartXGM.MouseMove += (sender, e) => ChartCPU_MouseMove(sender, e, AsusFan.XGM);
|
||||||
chartXGM.MouseUp += ChartCPU_MouseUp;
|
chartXGM.MouseUp += ChartCPU_MouseUp;
|
||||||
|
chartXGM.MouseLeave += ChartCPU_MouseLeave;
|
||||||
|
|
||||||
chartCPU.MouseClick += ChartCPU_MouseClick;
|
chartCPU.MouseClick += ChartCPU_MouseClick;
|
||||||
chartGPU.MouseClick += ChartCPU_MouseClick;
|
chartGPU.MouseClick += ChartCPU_MouseClick;
|
||||||
@@ -141,6 +145,7 @@ namespace GHelper
|
|||||||
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
|
trackGPUMemory.MouseUp += TrackGPU_MouseUp;
|
||||||
trackGPUBoost.MouseUp += TrackGPU_MouseUp;
|
trackGPUBoost.MouseUp += TrackGPU_MouseUp;
|
||||||
trackGPUTemp.MouseUp += TrackGPU_MouseUp;
|
trackGPUTemp.MouseUp += TrackGPU_MouseUp;
|
||||||
|
|
||||||
trackGPUClockLimit.MouseUp += TrackGPU_MouseUp;
|
trackGPUClockLimit.MouseUp += TrackGPU_MouseUp;
|
||||||
|
|
||||||
//labelInfo.MaximumSize = new Size(280, 0);
|
//labelInfo.MaximumSize = new Size(280, 0);
|
||||||
@@ -201,6 +206,7 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ChartCPU_MouseClick(object? sender, MouseEventArgs e)
|
private void ChartCPU_MouseClick(object? sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null) return;
|
if (sender is null) return;
|
||||||
@@ -984,7 +990,7 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
private void Chart_Save()
|
||||||
{
|
{
|
||||||
curPoint = null;
|
curPoint = null;
|
||||||
curIndex = -1;
|
curIndex = -1;
|
||||||
@@ -1001,8 +1007,17 @@ namespace GHelper
|
|||||||
SaveProfile(seriesXGM, AsusFan.XGM);
|
SaveProfile(seriesXGM, AsusFan.XGM);
|
||||||
|
|
||||||
modeControl.AutoFans();
|
modeControl.AutoFans();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Chart_Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ChartCPU_MouseLeave(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Chart_Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e, AsusFan device)
|
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e, AsusFan device)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.118</AssemblyVersion>
|
<AssemblyVersion>0.120</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ namespace GHelper.Gpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
AppConfig.Set("gpu_mode", gpuMode);
|
AppConfig.Set("gpu_mode", gpuMode);
|
||||||
|
|
||||||
InitXGM();
|
|
||||||
settings.VisualiseGPUMode(gpuMode);
|
settings.VisualiseGPUMode(gpuMode);
|
||||||
|
|
||||||
AsusUSB.ApplyGPUColor();
|
AsusUSB.ApplyGPUColor();
|
||||||
@@ -280,9 +278,12 @@ namespace GHelper.Gpu
|
|||||||
|
|
||||||
public void InitXGM()
|
public void InitXGM()
|
||||||
{
|
{
|
||||||
bool connected = Program.acpi.IsXGConnected();
|
if (Program.acpi.IsXGConnected())
|
||||||
int activated = Program.acpi.DeviceGet(AsusACPI.GPUXG);
|
{
|
||||||
settings.VisualizeXGM(connected, activated == 1);
|
//Program.acpi.DeviceSet(AsusACPI.GPUXGInit, 1, "XG Init");
|
||||||
|
AsusUSB.InitXGM();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleXGM()
|
public void ToggleXGM()
|
||||||
@@ -306,9 +307,14 @@ namespace GHelper.Gpu
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Program.acpi.DeviceSet(AsusACPI.GPUXG, 1, "GPU XGM");
|
|
||||||
|
|
||||||
AsusUSB.ResetXGM();
|
if (AppConfig.Is("xgm_special"))
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.GPUXG, 0x101, "GPU XGM");
|
||||||
|
else
|
||||||
|
Program.acpi.DeviceSet(AsusACPI.GPUXG, 1, "GPU XGM");
|
||||||
|
|
||||||
|
InitXGM();
|
||||||
|
|
||||||
AsusUSB.ApplyXGMLight(AppConfig.Is("xmg_light"));
|
AsusUSB.ApplyXGMLight(AppConfig.Is("xmg_light"));
|
||||||
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(15));
|
await Task.Delay(TimeSpan.FromSeconds(15));
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ namespace GHelper.Helpers
|
|||||||
return Process.GetProcessesByName("AsusOptimization").Count() > 0;
|
return Process.GetProcessesByName("AsusOptimization").Count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsOSDRunning()
|
||||||
|
{
|
||||||
|
return Process.GetProcessesByName("AsusOSD").Count() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int GetRunningCount()
|
public static int GetRunningCount()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|||||||
@@ -507,6 +507,9 @@ namespace GHelper.Input
|
|||||||
case 56: // M4 / Rog button
|
case 56: // M4 / Rog button
|
||||||
KeyProcess("m4");
|
KeyProcess("m4");
|
||||||
return;
|
return;
|
||||||
|
case 55: // Arconym
|
||||||
|
KeyProcess("m6");
|
||||||
|
return;
|
||||||
case 181: // FN + Numpad Enter
|
case 181: // FN + Numpad Enter
|
||||||
KeyProcess("fne");
|
KeyProcess("fne");
|
||||||
return;
|
return;
|
||||||
@@ -624,8 +627,11 @@ namespace GHelper.Input
|
|||||||
AsusUSB.ApplyBrightness(backlight, "HotKey");
|
AsusUSB.ApplyBrightness(backlight, "HotKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] backlightNames = new string[] { "Off", "Low", "Mid", "Max" };
|
if (!OptimizationService.IsOSDRunning())
|
||||||
Program.toast.RunToast(backlightNames[backlight], delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown);
|
{
|
||||||
|
string[] backlightNames = new string[] { "Off", "Low", "Mid", "Max" };
|
||||||
|
Program.toast.RunToast(backlightNames[backlight], delta > 0 ? ToastIcon.BacklightUp : ToastIcon.BacklightDown);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
258
app/Matrix.Designer.cs
generated
Normal file
258
app/Matrix.Designer.cs
generated
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
namespace GHelper
|
||||||
|
{
|
||||||
|
partial class Matrix
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
pictureMatrix = new PictureBox();
|
||||||
|
trackZoom = new TrackBar();
|
||||||
|
buttonPicture = new UI.RButton();
|
||||||
|
panelPicture = new Panel();
|
||||||
|
panelMain = new Panel();
|
||||||
|
panelButtons = new Panel();
|
||||||
|
buttonReset = new UI.RButton();
|
||||||
|
panelScaling = new Panel();
|
||||||
|
comboScaling = new UI.RComboBox();
|
||||||
|
labelScaling = new Label();
|
||||||
|
panelZoom = new Panel();
|
||||||
|
labelZoom = new Label();
|
||||||
|
labelZoomTitle = new Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureMatrix).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackZoom).BeginInit();
|
||||||
|
panelPicture.SuspendLayout();
|
||||||
|
panelMain.SuspendLayout();
|
||||||
|
panelButtons.SuspendLayout();
|
||||||
|
panelScaling.SuspendLayout();
|
||||||
|
panelZoom.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureMatrix
|
||||||
|
//
|
||||||
|
pictureMatrix.BackColor = Color.Black;
|
||||||
|
pictureMatrix.Cursor = Cursors.SizeAll;
|
||||||
|
pictureMatrix.Location = new Point(731, 27);
|
||||||
|
pictureMatrix.Name = "pictureMatrix";
|
||||||
|
pictureMatrix.Size = new Size(81, 73);
|
||||||
|
pictureMatrix.TabIndex = 0;
|
||||||
|
pictureMatrix.TabStop = false;
|
||||||
|
//
|
||||||
|
// trackZoom
|
||||||
|
//
|
||||||
|
trackZoom.LargeChange = 50;
|
||||||
|
trackZoom.Location = new Point(16, 52);
|
||||||
|
trackZoom.Maximum = 200;
|
||||||
|
trackZoom.Minimum = 10;
|
||||||
|
trackZoom.Name = "trackZoom";
|
||||||
|
trackZoom.Size = new Size(782, 90);
|
||||||
|
trackZoom.SmallChange = 10;
|
||||||
|
trackZoom.TabIndex = 2;
|
||||||
|
trackZoom.TickFrequency = 20;
|
||||||
|
trackZoom.TickStyle = TickStyle.TopLeft;
|
||||||
|
trackZoom.Value = 100;
|
||||||
|
//
|
||||||
|
// buttonPicture
|
||||||
|
//
|
||||||
|
buttonPicture.Activated = false;
|
||||||
|
buttonPicture.BackColor = SystemColors.ControlLight;
|
||||||
|
buttonPicture.BorderColor = Color.Transparent;
|
||||||
|
buttonPicture.BorderRadius = 5;
|
||||||
|
buttonPicture.FlatAppearance.BorderSize = 0;
|
||||||
|
buttonPicture.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonPicture.Image = Properties.Resources.icons8_matrix_32;
|
||||||
|
buttonPicture.Location = new Point(16, 19);
|
||||||
|
buttonPicture.Name = "buttonPicture";
|
||||||
|
buttonPicture.Secondary = true;
|
||||||
|
buttonPicture.Size = new Size(258, 56);
|
||||||
|
buttonPicture.TabIndex = 3;
|
||||||
|
buttonPicture.Text = "Picture / Gif";
|
||||||
|
buttonPicture.TextAlign = ContentAlignment.MiddleRight;
|
||||||
|
buttonPicture.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||||
|
buttonPicture.UseVisualStyleBackColor = false;
|
||||||
|
//
|
||||||
|
// panelPicture
|
||||||
|
//
|
||||||
|
panelPicture.BackColor = Color.Black;
|
||||||
|
panelPicture.Controls.Add(pictureMatrix);
|
||||||
|
panelPicture.Dock = DockStyle.Top;
|
||||||
|
panelPicture.Location = new Point(0, 0);
|
||||||
|
panelPicture.Name = "panelPicture";
|
||||||
|
panelPicture.Size = new Size(834, 419);
|
||||||
|
panelPicture.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// panelMain
|
||||||
|
//
|
||||||
|
panelMain.Controls.Add(panelButtons);
|
||||||
|
panelMain.Controls.Add(panelScaling);
|
||||||
|
panelMain.Controls.Add(panelZoom);
|
||||||
|
panelMain.Controls.Add(panelPicture);
|
||||||
|
panelMain.Dock = DockStyle.Top;
|
||||||
|
panelMain.Location = new Point(20, 20);
|
||||||
|
panelMain.Name = "panelMain";
|
||||||
|
panelMain.Size = new Size(834, 924);
|
||||||
|
panelMain.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panelButtons
|
||||||
|
//
|
||||||
|
panelButtons.Controls.Add(buttonReset);
|
||||||
|
panelButtons.Controls.Add(buttonPicture);
|
||||||
|
panelButtons.Dock = DockStyle.Top;
|
||||||
|
panelButtons.Location = new Point(0, 642);
|
||||||
|
panelButtons.Name = "panelButtons";
|
||||||
|
panelButtons.Size = new Size(834, 94);
|
||||||
|
panelButtons.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// buttonReset
|
||||||
|
//
|
||||||
|
buttonReset.Activated = false;
|
||||||
|
buttonReset.BackColor = SystemColors.ControlLight;
|
||||||
|
buttonReset.BorderColor = Color.Transparent;
|
||||||
|
buttonReset.BorderRadius = 5;
|
||||||
|
buttonReset.FlatAppearance.BorderSize = 0;
|
||||||
|
buttonReset.FlatStyle = FlatStyle.Flat;
|
||||||
|
buttonReset.Image = Properties.Resources.icons8_refresh_32;
|
||||||
|
buttonReset.Location = new Point(290, 19);
|
||||||
|
buttonReset.Name = "buttonReset";
|
||||||
|
buttonReset.Secondary = true;
|
||||||
|
buttonReset.Size = new Size(258, 56);
|
||||||
|
buttonReset.TabIndex = 4;
|
||||||
|
buttonReset.Text = "Reset";
|
||||||
|
buttonReset.TextAlign = ContentAlignment.MiddleRight;
|
||||||
|
buttonReset.TextImageRelation = TextImageRelation.ImageBeforeText;
|
||||||
|
buttonReset.UseVisualStyleBackColor = false;
|
||||||
|
//
|
||||||
|
// panelScaling
|
||||||
|
//
|
||||||
|
panelScaling.Controls.Add(comboScaling);
|
||||||
|
panelScaling.Controls.Add(labelScaling);
|
||||||
|
panelScaling.Dock = DockStyle.Top;
|
||||||
|
panelScaling.Location = new Point(0, 564);
|
||||||
|
panelScaling.Name = "panelScaling";
|
||||||
|
panelScaling.Size = new Size(834, 78);
|
||||||
|
panelScaling.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// comboScaling
|
||||||
|
//
|
||||||
|
comboScaling.BorderColor = Color.White;
|
||||||
|
comboScaling.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
|
comboScaling.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
comboScaling.FormattingEnabled = true;
|
||||||
|
comboScaling.ItemHeight = 32;
|
||||||
|
comboScaling.Items.AddRange(new object[] { "Default", "Low", "High", "Bilinear", "Bicubic", "NearestNeighbor", "HighQualityBilinear", "HighQualityBicubic" });
|
||||||
|
comboScaling.Location = new Point(229, 17);
|
||||||
|
comboScaling.Margin = new Padding(4, 11, 4, 8);
|
||||||
|
comboScaling.Name = "comboScaling";
|
||||||
|
comboScaling.Size = new Size(322, 40);
|
||||||
|
comboScaling.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// labelScaling
|
||||||
|
//
|
||||||
|
labelScaling.AutoSize = true;
|
||||||
|
labelScaling.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelScaling.Location = new Point(16, 20);
|
||||||
|
labelScaling.Name = "labelScaling";
|
||||||
|
labelScaling.Size = new Size(185, 32);
|
||||||
|
labelScaling.TabIndex = 4;
|
||||||
|
labelScaling.Text = "Scaling Quality";
|
||||||
|
//
|
||||||
|
// panelZoom
|
||||||
|
//
|
||||||
|
panelZoom.AutoSize = true;
|
||||||
|
panelZoom.Controls.Add(labelZoom);
|
||||||
|
panelZoom.Controls.Add(labelZoomTitle);
|
||||||
|
panelZoom.Controls.Add(trackZoom);
|
||||||
|
panelZoom.Dock = DockStyle.Top;
|
||||||
|
panelZoom.Location = new Point(0, 419);
|
||||||
|
panelZoom.Name = "panelZoom";
|
||||||
|
panelZoom.Size = new Size(834, 145);
|
||||||
|
panelZoom.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// labelZoom
|
||||||
|
//
|
||||||
|
labelZoom.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
|
labelZoom.AutoSize = true;
|
||||||
|
labelZoom.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
labelZoom.Location = new Point(731, 17);
|
||||||
|
labelZoom.Name = "labelZoom";
|
||||||
|
labelZoom.Size = new Size(77, 32);
|
||||||
|
labelZoom.TabIndex = 4;
|
||||||
|
labelZoom.Text = "Zoom";
|
||||||
|
//
|
||||||
|
// labelZoomTitle
|
||||||
|
//
|
||||||
|
labelZoomTitle.AutoSize = true;
|
||||||
|
labelZoomTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
|
labelZoomTitle.Location = new Point(16, 17);
|
||||||
|
labelZoomTitle.Name = "labelZoomTitle";
|
||||||
|
labelZoomTitle.Size = new Size(81, 32);
|
||||||
|
labelZoomTitle.TabIndex = 3;
|
||||||
|
labelZoomTitle.Text = "Zoom";
|
||||||
|
//
|
||||||
|
// Matrix
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(192F, 192F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Dpi;
|
||||||
|
AutoSize = true;
|
||||||
|
ClientSize = new Size(874, 978);
|
||||||
|
Controls.Add(panelMain);
|
||||||
|
MaximizeBox = false;
|
||||||
|
MinimizeBox = false;
|
||||||
|
MinimumSize = new Size(900, 0);
|
||||||
|
Name = "Matrix";
|
||||||
|
Padding = new Padding(20);
|
||||||
|
ShowIcon = false;
|
||||||
|
ShowInTaskbar = false;
|
||||||
|
Text = "Matrix";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureMatrix).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)trackZoom).EndInit();
|
||||||
|
panelPicture.ResumeLayout(false);
|
||||||
|
panelMain.ResumeLayout(false);
|
||||||
|
panelMain.PerformLayout();
|
||||||
|
panelButtons.ResumeLayout(false);
|
||||||
|
panelScaling.ResumeLayout(false);
|
||||||
|
panelScaling.PerformLayout();
|
||||||
|
panelZoom.ResumeLayout(false);
|
||||||
|
panelZoom.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureMatrix;
|
||||||
|
private TrackBar trackZoom;
|
||||||
|
private UI.RButton buttonPicture;
|
||||||
|
private Panel panelPicture;
|
||||||
|
private Panel panelMain;
|
||||||
|
private Panel panelZoom;
|
||||||
|
private Label labelZoom;
|
||||||
|
private Label labelZoomTitle;
|
||||||
|
private Panel panelButtons;
|
||||||
|
private UI.RButton buttonReset;
|
||||||
|
private Panel panelScaling;
|
||||||
|
private Label labelScaling;
|
||||||
|
private UI.RComboBox comboScaling;
|
||||||
|
}
|
||||||
|
}
|
||||||
211
app/Matrix.cs
Normal file
211
app/Matrix.cs
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
using GHelper.AnimeMatrix;
|
||||||
|
using GHelper.UI;
|
||||||
|
|
||||||
|
namespace GHelper
|
||||||
|
{
|
||||||
|
public partial class Matrix : RForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public AniMatrixControl matrixControl = Program.settingsForm.matrixControl;
|
||||||
|
|
||||||
|
private bool Dragging;
|
||||||
|
private int xPos;
|
||||||
|
private int yPos;
|
||||||
|
|
||||||
|
private int baseX;
|
||||||
|
private int baseY;
|
||||||
|
|
||||||
|
private float uiScale;
|
||||||
|
|
||||||
|
Image picture;
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
|
||||||
|
public Matrix()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
InitTheme(true);
|
||||||
|
|
||||||
|
Shown += Matrix_Shown;
|
||||||
|
FormClosing += Matrix_FormClosed;
|
||||||
|
|
||||||
|
buttonPicture.Click += ButtonPicture_Click;
|
||||||
|
buttonReset.Click += ButtonReset_Click;
|
||||||
|
|
||||||
|
pictureMatrix.MouseUp += PictureMatrix_MouseUp;
|
||||||
|
pictureMatrix.MouseMove += PictureMatrix_MouseMove;
|
||||||
|
pictureMatrix.MouseDown += PictureMatrix_MouseDown;
|
||||||
|
|
||||||
|
trackZoom.MouseUp += TrackZoom_MouseUp;
|
||||||
|
trackZoom.ValueChanged += TrackZoom_Changed;
|
||||||
|
|
||||||
|
trackZoom.Value = Math.Min(trackZoom.Maximum, AppConfig.Get("matrix_zoom", 100));
|
||||||
|
VisualiseZoom();
|
||||||
|
|
||||||
|
comboScaling.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboScaling.SelectedIndex = AppConfig.Get("matrix_quality", 0);
|
||||||
|
comboScaling.SelectedValueChanged += ComboScaling_SelectedValueChanged;
|
||||||
|
|
||||||
|
uiScale = panelPicture.Width / matrixControl.device.MaxColumns / 3;
|
||||||
|
panelPicture.Height = (int)(matrixControl.device.MaxRows * uiScale);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ComboScaling_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppConfig.Set("matrix_quality", comboScaling.SelectedIndex);
|
||||||
|
SetMatrixPicture(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Matrix_FormClosed(object? sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
if (picture is not null) picture.Dispose();
|
||||||
|
if (ms is not null) ms.Dispose();
|
||||||
|
|
||||||
|
pictureMatrix.Dispose();
|
||||||
|
|
||||||
|
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VisualiseZoom()
|
||||||
|
{
|
||||||
|
labelZoom.Text = trackZoom.Value + "%";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonReset_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppConfig.Set("matrix_zoom", 100);
|
||||||
|
AppConfig.Set("matrix_x", 0);
|
||||||
|
AppConfig.Set("matrix_y", 0);
|
||||||
|
|
||||||
|
trackZoom.Value = 100;
|
||||||
|
|
||||||
|
SetMatrixPicture();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TrackZoom_MouseUp(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AppConfig.Set("matrix_zoom", trackZoom.Value);
|
||||||
|
SetMatrixPicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TrackZoom_Changed(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
VisualiseZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void PictureMatrix_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
Dragging = true;
|
||||||
|
xPos = e.X;
|
||||||
|
yPos = e.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureMatrix_MouseMove(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Control c = sender as Control;
|
||||||
|
if (Dragging && c != null)
|
||||||
|
{
|
||||||
|
c.Top = e.Y + c.Top - yPos;
|
||||||
|
c.Left = e.X + c.Left - xPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureMatrix_MouseUp(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Dragging = false;
|
||||||
|
|
||||||
|
Control c = sender as Control;
|
||||||
|
|
||||||
|
int matrixX = (int)((baseX - c.Left) / uiScale);
|
||||||
|
int matrixY = (int)((baseY - c.Top) / uiScale);
|
||||||
|
|
||||||
|
AppConfig.Set("matrix_x", matrixX);
|
||||||
|
AppConfig.Set("matrix_y", matrixY);
|
||||||
|
|
||||||
|
SetMatrixPicture(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Matrix_Shown(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormPosition();
|
||||||
|
SetMatrixPicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetMatrixPicture(bool visualise = true)
|
||||||
|
{
|
||||||
|
matrixControl.SetMatrixPicture(AppConfig.GetString("matrix_picture"), visualise);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonPicture_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
matrixControl.OpenMatrixPicture();
|
||||||
|
|
||||||
|
}
|
||||||
|
public void FormPosition()
|
||||||
|
{
|
||||||
|
if (Height > Program.settingsForm.Height)
|
||||||
|
{
|
||||||
|
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Height = Program.settingsForm.Height;
|
||||||
|
Top = Program.settingsForm.Top;
|
||||||
|
}
|
||||||
|
|
||||||
|
Left = Program.settingsForm.Left - Width - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void VisualiseMatrix(string fileName)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (picture is not null) picture.Dispose();
|
||||||
|
|
||||||
|
using (var fs = new FileStream(fileName, FileMode.Open))
|
||||||
|
{
|
||||||
|
|
||||||
|
ms.SetLength(0);
|
||||||
|
fs.CopyTo(ms);
|
||||||
|
ms.Position = 0;
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
picture = Image.FromStream(ms);
|
||||||
|
|
||||||
|
int width = picture.Width;
|
||||||
|
int height = picture.Height;
|
||||||
|
|
||||||
|
int matrixX = AppConfig.Get("matrix_x", 0);
|
||||||
|
int matrixY = AppConfig.Get("matrix_y", 0);
|
||||||
|
int matrixZoom = AppConfig.Get("matrix_zoom", 100);
|
||||||
|
|
||||||
|
|
||||||
|
float scale = Math.Min((float)panelPicture.Width / (float)width, (float)panelPicture.Height / (float)height) * matrixZoom / 100;
|
||||||
|
|
||||||
|
pictureMatrix.Width = (int)(width * scale);
|
||||||
|
pictureMatrix.Height = (int)(height * scale);
|
||||||
|
|
||||||
|
baseX = panelPicture.Width - pictureMatrix.Width;
|
||||||
|
baseY = 0;
|
||||||
|
|
||||||
|
pictureMatrix.Left = baseX - (int)(matrixX * uiScale);
|
||||||
|
pictureMatrix.Top = baseY - (int)(matrixY * uiScale);
|
||||||
|
|
||||||
|
pictureMatrix.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
pictureMatrix.Image = picture;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
120
app/Matrix.resx
Normal file
120
app/Matrix.resx
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
@@ -134,6 +134,7 @@ namespace GHelper.Mode
|
|||||||
bool xgmFan = false;
|
bool xgmFan = false;
|
||||||
if (AppConfig.Is("xgm_fan") && Program.acpi.IsXGConnected())
|
if (AppConfig.Is("xgm_fan") && Program.acpi.IsXGConnected())
|
||||||
{
|
{
|
||||||
|
//AsusUSB.InitXGM();
|
||||||
AsusUSB.SetXGMFan(AppConfig.GetFanConfig(AsusFan.XGM));
|
AsusUSB.SetXGMFan(AppConfig.GetFanConfig(AsusFan.XGM));
|
||||||
xgmFan = true;
|
xgmFan = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,6 +445,16 @@ namespace GHelper.Peripherals.Mouse
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual int LowBatteryWarningStep()
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual int LowBatteryWarningMax()
|
||||||
|
{
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool HasLowBatteryWarning()
|
public virtual bool HasLowBatteryWarning()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
209
app/Peripherals/Mouse/Models/PugioII.cs
Normal file
209
app/Peripherals/Mouse/Models/PugioII.cs
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
|
||||||
|
namespace GHelper.Peripherals.Mouse.Models
|
||||||
|
{
|
||||||
|
//P705
|
||||||
|
public class PugioII : AsusMouse
|
||||||
|
{
|
||||||
|
public PugioII() : base(0x0B05, 0x1908, "mi_00", true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PugioII(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
public override int DPIProfileCount()
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayName()
|
||||||
|
{
|
||||||
|
return "ROG Pugio II (Wireless)";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PollingRate[] SupportedPollingrates()
|
||||||
|
{
|
||||||
|
return new PollingRate[] {
|
||||||
|
PollingRate.PR125Hz,
|
||||||
|
PollingRate.PR250Hz,
|
||||||
|
PollingRate.PR500Hz,
|
||||||
|
PollingRate.PR1000Hz
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override int ProfileCount()
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
public override int MaxDPI()
|
||||||
|
{
|
||||||
|
return 16_000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasDebounceSetting()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public override bool HasLiftOffSetting()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public override int DPIIncrements()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasRGB()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public override int MaxBrightness()
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override LightingZone[] SupportedLightingZones()
|
||||||
|
{
|
||||||
|
return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel, LightingZone.Underglow };
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAutoPowerOff()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAngleSnapping()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasAngleTuning()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool HasLowBatteryWarning()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int LowBatteryWarningStep()
|
||||||
|
{
|
||||||
|
return 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int LowBatteryWarningMax()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override int ParseBattery(byte[] packet)
|
||||||
|
{
|
||||||
|
return base.ParseBattery(packet) * 25;
|
||||||
|
}
|
||||||
|
protected override int ParseLowBatteryWarning(byte[] packet)
|
||||||
|
{
|
||||||
|
return base.ParseLowBatteryWarning(packet) * 25;
|
||||||
|
}
|
||||||
|
protected override byte[] GetUpdateEnergySettingsPacket(int lowBatteryWarning, PowerOffSetting powerOff)
|
||||||
|
{
|
||||||
|
return base.GetUpdateEnergySettingsPacket(lowBatteryWarning / 25, powerOff);
|
||||||
|
}
|
||||||
|
protected override byte[] GetReadLightingModePacket(LightingZone zone)
|
||||||
|
{
|
||||||
|
return new byte[] { 0x00, 0x12, 0x03, 0x00 };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LightingSetting? ParseLightingSetting(byte[] packet, LightingZone zone)
|
||||||
|
{
|
||||||
|
if (packet[1] != 0x12 || packet[2] != 0x03)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int offset = 5 + (((int)zone) * 5);
|
||||||
|
|
||||||
|
LightingSetting setting = new LightingSetting();
|
||||||
|
|
||||||
|
setting.LightingMode = LightingModeForIndex(packet[offset + 0]);
|
||||||
|
setting.Brightness = packet[offset + 1];
|
||||||
|
|
||||||
|
setting.RGBColor = Color.FromArgb(packet[offset + 2], packet[offset + 3], packet[offset + 4]);
|
||||||
|
|
||||||
|
setting.AnimationDirection = SupportsAnimationDirection(setting.LightingMode)
|
||||||
|
? (AnimationDirection)packet[21]
|
||||||
|
: AnimationDirection.Clockwise;
|
||||||
|
|
||||||
|
if (setting.AnimationDirection != AnimationDirection.Clockwise
|
||||||
|
&& setting.AnimationDirection != AnimationDirection.CounterClockwise)
|
||||||
|
{
|
||||||
|
setting.AnimationDirection = AnimationDirection.Clockwise;
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.RandomColor = SupportsRandomColor(setting.LightingMode) && packet[22] == 0x01;
|
||||||
|
setting.AnimationSpeed = SupportsAnimationSpeed(setting.LightingMode)
|
||||||
|
? (AnimationSpeed)packet[23]
|
||||||
|
: AnimationSpeed.Medium;
|
||||||
|
|
||||||
|
//If the mouse reports an out of range value, which it does when the current setting has no speed option, chose medium as default
|
||||||
|
if (setting.AnimationSpeed != AnimationSpeed.Fast
|
||||||
|
&& setting.AnimationSpeed != AnimationSpeed.Medium
|
||||||
|
&& setting.AnimationSpeed != AnimationSpeed.Slow)
|
||||||
|
{
|
||||||
|
setting.AnimationSpeed = AnimationSpeed.Medium;
|
||||||
|
}
|
||||||
|
return setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReadLightingSetting()
|
||||||
|
{
|
||||||
|
if (!HasRGB())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Mouse sends all lighting zones in one response
|
||||||
|
//21: Direction
|
||||||
|
//22: Random
|
||||||
|
//23: Speed
|
||||||
|
// 20 21 22 23
|
||||||
|
//00 12 03 00 00 [03 04 00 00 ff] [03 04 00 00 ff] [03 04 00 00 ff] 00 04 00 00
|
||||||
|
//00 12 03 00 00 [05 02 ff 00 ff] [05 02 ff 00 ff] [05 02 ff 00 ff] 00 01 01 00
|
||||||
|
//00 12 03 00 00 [03 01 00 00 ff] [03 01 00 00 ff] [03 01 00 00 ff] 00 01 00 01
|
||||||
|
byte[]? response = WriteForResponse(GetReadLightingModePacket(LightingZone.All));
|
||||||
|
if (response is null) return;
|
||||||
|
|
||||||
|
LightingZone[] lz = SupportedLightingZones();
|
||||||
|
for (int i = 0; i < lz.Length; ++i)
|
||||||
|
{
|
||||||
|
LightingSetting? ls = ParseLightingSetting(response, lz[i]);
|
||||||
|
if (ls is null)
|
||||||
|
{
|
||||||
|
Logger.WriteLine(GetDisplayName() + ": Failed to read RGB Setting for Zone " + lz[i].ToString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.WriteLine(GetDisplayName() + ": Read RGB Setting for Zone " + lz[i].ToString() + ": " + ls.ToString());
|
||||||
|
LightingSetting[i] = ls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanChangeDPIProfile()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class PugioIIWired : PugioII
|
||||||
|
{
|
||||||
|
public PugioIIWired() : base(0x1906, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetDisplayName()
|
||||||
|
{
|
||||||
|
return "ROG Pugio II (Wired)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -202,6 +202,8 @@ namespace GHelper.Peripherals
|
|||||||
DetectMouse(new TUFM3());
|
DetectMouse(new TUFM3());
|
||||||
DetectMouse(new KerisWirelssAimpoint());
|
DetectMouse(new KerisWirelssAimpoint());
|
||||||
DetectMouse(new KerisWirelssAimpointWired());
|
DetectMouse(new KerisWirelssAimpointWired());
|
||||||
|
DetectMouse(new PugioII());
|
||||||
|
DetectMouse(new PugioIIWired());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DetectMouse(AsusMouse am)
|
public static void DetectMouse(AsusMouse am)
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace GHelper
|
|||||||
settingsForm.InitAura();
|
settingsForm.InitAura();
|
||||||
settingsForm.InitMatrix();
|
settingsForm.InitMatrix();
|
||||||
|
|
||||||
|
gpuControl.InitXGM();
|
||||||
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
|
|
||||||
@@ -164,6 +165,8 @@ namespace GHelper
|
|||||||
if (settingsForm.updates is not null && settingsForm.updates.Text != "")
|
if (settingsForm.updates is not null && settingsForm.updates.Text != "")
|
||||||
settingsForm.updates.InitTheme();
|
settingsForm.updates.InitTheme();
|
||||||
|
|
||||||
|
if (settingsForm.matrix is not null && settingsForm.matrix.Text != "")
|
||||||
|
settingsForm.matrix.InitTheme();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,7 +197,7 @@ namespace GHelper
|
|||||||
BatteryControl.SetBatteryChargeLimit();
|
BatteryControl.SetBatteryChargeLimit();
|
||||||
|
|
||||||
settingsForm.AutoKeyboard();
|
settingsForm.AutoKeyboard();
|
||||||
settingsForm.matrix.SetMatrix(true);
|
settingsForm.matrixControl.SetMatrix(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
private static void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||||
|
|||||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -610,6 +610,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Byte[].
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] MFont {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("MFont", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -130,6 +130,9 @@
|
|||||||
<data name="icons8_mute_unmute_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8_mute_unmute_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-mute-unmute-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="icons8-hibernate-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-hibernate-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="icons8-quit-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-quit-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-quit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-quit-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -286,7 +289,7 @@
|
|||||||
<data name="icons8_rocket_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8_rocket_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-rocket-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="icons8-hibernate-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="MFont" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-hibernate-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Font.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -235,7 +235,7 @@
|
|||||||
<value>Automatycznie ustaw odświeżanie 60 Hz w czasie pracy na baterii</value>
|
<value>Automatycznie ustaw odświeżanie 60 Hz w czasie pracy na baterii</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Awake" xml:space="preserve">
|
<data name="Awake" xml:space="preserve">
|
||||||
<value>Aktywność</value>
|
<value>Włączone</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="BacklightTimeout" xml:space="preserve">
|
<data name="BacklightTimeout" xml:space="preserve">
|
||||||
<value>Limit czasu podłączonego / na baterii (0 - Włączony)</value>
|
<value>Limit czasu podłączonego / na baterii (0 - Włączony)</value>
|
||||||
@@ -256,7 +256,7 @@
|
|||||||
<value>Aktualizacje BIOS i sterowników</value>
|
<value>Aktualizacje BIOS i sterowników</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Boot" xml:space="preserve">
|
<data name="Boot" xml:space="preserve">
|
||||||
<value>Podczas uruchamiania</value>
|
<value>Uruchamianie</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Brightness" xml:space="preserve">
|
<data name="Brightness" xml:space="preserve">
|
||||||
<value>Jasność</value>
|
<value>Jasność</value>
|
||||||
|
|||||||
@@ -357,10 +357,10 @@ Quer prosseguir?</value>
|
|||||||
<value>Carregando</value>
|
<value>Carregando</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GPUCoreClockOffset" xml:space="preserve">
|
<data name="GPUCoreClockOffset" xml:space="preserve">
|
||||||
<value>Aumento da frequência básica</value>
|
<value>Frequência da GPU</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GPUMemoryClockOffset" xml:space="preserve">
|
<data name="GPUMemoryClockOffset" xml:space="preserve">
|
||||||
<value>Aumento da frequência da memória</value>
|
<value>Frequência da Memória</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GPUMode" xml:space="preserve">
|
<data name="GPUMode" xml:space="preserve">
|
||||||
<value>Modo da GPU</value>
|
<value>Modo da GPU</value>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="Acceleration" xml:space="preserve">
|
<data name="Acceleration" xml:space="preserve">
|
||||||
<value>Acceleration</value>
|
<value>滑鼠加速</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ACPIError" xml:space="preserve">
|
<data name="ACPIError" xml:space="preserve">
|
||||||
<value>無法連結到華碩 ACPI。 没有它,應用程式將無法執行。 嘗試安裝Asus System Control Interface</value>
|
<value>無法連結到華碩 ACPI。 没有它,應用程式將無法執行。 嘗試安裝Asus System Control Interface</value>
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
<value>順時針</value>
|
<value>順時針</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="AuraColorCycle" xml:space="preserve">
|
<data name="AuraColorCycle" xml:space="preserve">
|
||||||
<value>循環</value>
|
<value>彩色循環</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="AuraComet" xml:space="preserve">
|
<data name="AuraComet" xml:space="preserve">
|
||||||
<value>彗星</value>
|
<value>彗星</value>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
<value>慢</value>
|
<value>慢</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="AuraStatic" xml:space="preserve">
|
<data name="AuraStatic" xml:space="preserve">
|
||||||
<value>靜態</value>
|
<value>靜態恆亮</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="AuraStrobe" xml:space="preserve">
|
<data name="AuraStrobe" xml:space="preserve">
|
||||||
<value>閃爍</value>
|
<value>閃爍</value>
|
||||||
@@ -280,7 +280,7 @@
|
|||||||
<value>自定義設置</value>
|
<value>自定義設置</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Deceleration" xml:space="preserve">
|
<data name="Deceleration" xml:space="preserve">
|
||||||
<value>Deceleration</value>
|
<value>滑鼠減速</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Default" xml:space="preserve">
|
<data name="Default" xml:space="preserve">
|
||||||
<value>預設</value>
|
<value>預設</value>
|
||||||
|
|||||||
BIN
app/Resources/Font.otf
Normal file
BIN
app/Resources/Font.otf
Normal file
Binary file not shown.
@@ -25,10 +25,13 @@ namespace GHelper
|
|||||||
ScreenControl screenControl = new ScreenControl();
|
ScreenControl screenControl = new ScreenControl();
|
||||||
AutoUpdateControl updateControl;
|
AutoUpdateControl updateControl;
|
||||||
|
|
||||||
public AniMatrixControl matrix;
|
AsusMouseSettings? mouseSettings;
|
||||||
|
|
||||||
|
public AniMatrixControl matrixControl;
|
||||||
|
|
||||||
public static System.Timers.Timer sensorTimer = default!;
|
public static System.Timers.Timer sensorTimer = default!;
|
||||||
|
|
||||||
|
public Matrix? matrix;
|
||||||
public Fans? fans;
|
public Fans? fans;
|
||||||
public Extra? keyb;
|
public Extra? keyb;
|
||||||
public Updates? updates;
|
public Updates? updates;
|
||||||
@@ -47,7 +50,7 @@ namespace GHelper
|
|||||||
|
|
||||||
gpuControl = new GPUModeControl(this);
|
gpuControl = new GPUModeControl(this);
|
||||||
updateControl = new AutoUpdateControl(this);
|
updateControl = new AutoUpdateControl(this);
|
||||||
matrix = new AniMatrixControl(this);
|
matrixControl = new AniMatrixControl(this);
|
||||||
|
|
||||||
buttonSilent.Text = Properties.Strings.Silent;
|
buttonSilent.Text = Properties.Strings.Silent;
|
||||||
buttonBalanced.Text = Properties.Strings.Balanced;
|
buttonBalanced.Text = Properties.Strings.Balanced;
|
||||||
@@ -242,7 +245,8 @@ namespace GHelper
|
|||||||
if (this.Visible)
|
if (this.Visible)
|
||||||
{
|
{
|
||||||
screenControl.InitScreen();
|
screenControl.InitScreen();
|
||||||
gpuControl.InitXGM();
|
VisualizeXGM();
|
||||||
|
|
||||||
Task.Run((Action)RefreshPeripheralsBattery);
|
Task.Run((Action)RefreshPeripheralsBattery);
|
||||||
updateControl.CheckForUpdates();
|
updateControl.CheckForUpdates();
|
||||||
}
|
}
|
||||||
@@ -266,6 +270,12 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void VisualiseMatrix(string image)
|
||||||
|
{
|
||||||
|
if (matrix == null || matrix.Text == "") return;
|
||||||
|
matrix.VisualiseMatrix(image);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void WndProc(ref Message m)
|
protected override void WndProc(ref Message m)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -503,14 +513,29 @@ namespace GHelper
|
|||||||
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
|
private void CheckMatrix_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("matrix_auto", checkMatrix.Checked ? 1 : 0);
|
AppConfig.Set("matrix_auto", checkMatrix.Checked ? 1 : 0);
|
||||||
matrix.SetMatrix();
|
matrixControl.SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ButtonMatrix_Click(object? sender, EventArgs e)
|
private void ButtonMatrix_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
matrix.OpenMatrixPicture();
|
|
||||||
|
if (matrix == null || matrix.Text == "")
|
||||||
|
{
|
||||||
|
matrix = new Matrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matrix.Visible)
|
||||||
|
{
|
||||||
|
matrix.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
matrix.FormPosition();
|
||||||
|
matrix.Show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMatrixRunning(int mode)
|
public void SetMatrixRunning(int mode)
|
||||||
@@ -518,20 +543,21 @@ namespace GHelper
|
|||||||
Invoke(delegate
|
Invoke(delegate
|
||||||
{
|
{
|
||||||
comboMatrixRunning.SelectedIndex = mode;
|
comboMatrixRunning.SelectedIndex = mode;
|
||||||
|
if (comboMatrix.SelectedIndex == 0) comboMatrix.SelectedIndex = 3;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboMatrixRunning_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex);
|
AppConfig.Set("matrix_running", comboMatrixRunning.SelectedIndex);
|
||||||
matrix.SetMatrix();
|
matrixControl.SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e)
|
private void ComboMatrix_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex);
|
AppConfig.Set("matrix_brightness", comboMatrix.SelectedIndex);
|
||||||
matrix.SetMatrix();
|
matrixControl.SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -679,7 +705,7 @@ namespace GHelper
|
|||||||
public void InitMatrix()
|
public void InitMatrix()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!matrix.IsValid)
|
if (!matrixControl.IsValid)
|
||||||
{
|
{
|
||||||
panelMatrix.Visible = false;
|
panelMatrix.Visible = false;
|
||||||
return;
|
return;
|
||||||
@@ -783,7 +809,7 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ButtonQuit_Click(object? sender, EventArgs e)
|
private void ButtonQuit_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
matrix.Dispose();
|
matrixControl.Dispose();
|
||||||
Close();
|
Close();
|
||||||
Program.trayIcon.Visible = false;
|
Program.trayIcon.Visible = false;
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
@@ -964,15 +990,24 @@ namespace GHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void VisualizeXGM(bool connected, bool activated)
|
public void VisualizeXGM(int GPUMode = -1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool connected = Program.acpi.IsXGConnected();
|
||||||
buttonXGM.Enabled = buttonXGM.Visible = connected;
|
buttonXGM.Enabled = buttonXGM.Visible = connected;
|
||||||
|
|
||||||
if (!connected) return;
|
if (!connected) return;
|
||||||
|
|
||||||
buttonXGM.Activated = activated;
|
if (GPUMode != -1)
|
||||||
|
ButtonEnabled(buttonXGM, AppConfig.IsNoGPUModes() || GPUMode != AsusACPI.GPUModeEco);
|
||||||
|
|
||||||
if (activated)
|
|
||||||
|
int activated = Program.acpi.DeviceGet(AsusACPI.GPUXG);
|
||||||
|
Logger.WriteLine("XGM Activated flag: " + activated);
|
||||||
|
|
||||||
|
buttonXGM.Activated = activated == 1;
|
||||||
|
|
||||||
|
if (activated == 1)
|
||||||
{
|
{
|
||||||
ButtonEnabled(buttonOptimized, false);
|
ButtonEnabled(buttonOptimized, false);
|
||||||
ButtonEnabled(buttonEco, false);
|
ButtonEnabled(buttonEco, false);
|
||||||
@@ -1057,7 +1092,6 @@ namespace GHelper
|
|||||||
buttonOptimized.Activated = GPUAuto;
|
buttonOptimized.Activated = GPUAuto;
|
||||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
|
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeEco;
|
||||||
Program.trayIcon.Icon = Properties.Resources.eco;
|
Program.trayIcon.Icon = Properties.Resources.eco;
|
||||||
ButtonEnabled(buttonXGM, false);
|
|
||||||
break;
|
break;
|
||||||
case AsusACPI.GPUModeUltimate:
|
case AsusACPI.GPUModeUltimate:
|
||||||
buttonUltimate.Activated = true;
|
buttonUltimate.Activated = true;
|
||||||
@@ -1070,10 +1104,12 @@ namespace GHelper
|
|||||||
buttonOptimized.Activated = GPUAuto;
|
buttonOptimized.Activated = GPUAuto;
|
||||||
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
|
labelGPU.Text = Properties.Strings.GPUMode + ": " + Properties.Strings.GPUModeStandard;
|
||||||
Program.trayIcon.Icon = Properties.Resources.standard;
|
Program.trayIcon.Icon = Properties.Resources.standard;
|
||||||
ButtonEnabled(buttonXGM, true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VisualizeXGM(GPUMode);
|
||||||
|
|
||||||
|
|
||||||
if (isGpuSection)
|
if (isGpuSection)
|
||||||
{
|
{
|
||||||
menuEco.Checked = buttonEco.Activated;
|
menuEco.Checked = buttonEco.Activated;
|
||||||
@@ -1187,6 +1223,12 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ButtonPeripheral_Click(object? sender, EventArgs e)
|
private void ButtonPeripheral_Click(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (mouseSettings is not null)
|
||||||
|
{
|
||||||
|
mouseSettings.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (sender == buttonPeripheral2) index = 1;
|
if (sender == buttonPeripheral2) index = 1;
|
||||||
if (sender == buttonPeripheral3) index = 2;
|
if (sender == buttonPeripheral3) index = 2;
|
||||||
@@ -1207,16 +1249,30 @@ namespace GHelper
|
|||||||
//Should not happen if all device classes are implemented correctly. But better safe than sorry.
|
//Should not happen if all device classes are implemented correctly. But better safe than sorry.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AsusMouseSettings s = new AsusMouseSettings(am);
|
mouseSettings = new AsusMouseSettings(am);
|
||||||
if (!s.IsDisposed)
|
mouseSettings.TopMost = true;
|
||||||
|
mouseSettings.FormClosed += MouseSettings_FormClosed;
|
||||||
|
mouseSettings.Disposed += MouseSettings_Disposed;
|
||||||
|
if (!mouseSettings.IsDisposed)
|
||||||
{
|
{
|
||||||
s.Show();
|
mouseSettings.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MouseSettings_Disposed(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MouseSettings_FormClosed(object? sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
mouseSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseFnLock()
|
public void VisualiseFnLock()
|
||||||
|
|||||||
24
app/Updates.Designer.cs
generated
24
app/Updates.Designer.cs
generated
@@ -54,16 +54,17 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
tableBios.AutoSize = true;
|
tableBios.AutoSize = true;
|
||||||
tableBios.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
tableBios.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
tableBios.ColumnCount = 3;
|
tableBios.ColumnCount = 4;
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
|
||||||
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
|
||||||
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableBios.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||||
tableBios.Dock = DockStyle.Top;
|
tableBios.Dock = DockStyle.Top;
|
||||||
tableBios.Location = new Point(20, 20);
|
tableBios.Location = new Point(20, 20);
|
||||||
tableBios.Margin = new Padding(4);
|
tableBios.Margin = new Padding(4);
|
||||||
tableBios.MinimumSize = new Size(1100, 0);
|
tableBios.MinimumSize = new Size(1300, 0);
|
||||||
tableBios.Name = "tableBios";
|
tableBios.Name = "tableBios";
|
||||||
tableBios.Size = new Size(1216, 0);
|
tableBios.Size = new Size(1300, 0);
|
||||||
tableBios.TabIndex = 0;
|
tableBios.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// labelBIOS
|
// labelBIOS
|
||||||
@@ -105,7 +106,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
labelUpdates.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
labelUpdates.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
|
||||||
labelUpdates.Location = new Point(941, 23);
|
labelUpdates.Location = new Point(810, 23);
|
||||||
labelUpdates.Name = "labelUpdates";
|
labelUpdates.Name = "labelUpdates";
|
||||||
labelUpdates.Size = new Size(245, 32);
|
labelUpdates.Size = new Size(245, 32);
|
||||||
labelUpdates.TabIndex = 4;
|
labelUpdates.TabIndex = 4;
|
||||||
@@ -156,16 +157,17 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
tableDrivers.AutoSize = true;
|
tableDrivers.AutoSize = true;
|
||||||
tableDrivers.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
tableDrivers.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
tableDrivers.ColumnCount = 3;
|
tableDrivers.ColumnCount = 4;
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F));
|
||||||
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F));
|
||||||
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
tableDrivers.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
|
||||||
tableDrivers.Dock = DockStyle.Top;
|
tableDrivers.Dock = DockStyle.Top;
|
||||||
tableDrivers.Location = new Point(20, 20);
|
tableDrivers.Location = new Point(20, 20);
|
||||||
tableDrivers.Margin = new Padding(4);
|
tableDrivers.Margin = new Padding(4);
|
||||||
tableDrivers.MinimumSize = new Size(1100, 0);
|
tableDrivers.MinimumSize = new Size(1300, 0);
|
||||||
tableDrivers.Name = "tableDrivers";
|
tableDrivers.Name = "tableDrivers";
|
||||||
tableDrivers.Size = new Size(1216, 0);
|
tableDrivers.Size = new Size(1300, 0);
|
||||||
tableDrivers.TabIndex = 0;
|
tableDrivers.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// panelDriversTitle
|
// panelDriversTitle
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ namespace GHelper
|
|||||||
|
|
||||||
public partial class Updates : RForm
|
public partial class Updates : RForm
|
||||||
{
|
{
|
||||||
|
const int DRIVER_NOT_FOUND = 2;
|
||||||
|
const int DRIVER_NEWER = 1;
|
||||||
|
|
||||||
//static int rowCount = 0;
|
//static int rowCount = 0;
|
||||||
static string model;
|
static string model;
|
||||||
static string bios;
|
static string bios;
|
||||||
@@ -21,6 +24,7 @@ namespace GHelper
|
|||||||
public string title;
|
public string title;
|
||||||
public string version;
|
public string version;
|
||||||
public string downloadUrl;
|
public string downloadUrl;
|
||||||
|
public string date;
|
||||||
public JsonElement hardwares;
|
public JsonElement hardwares;
|
||||||
}
|
}
|
||||||
private void LoadUpdates(bool force = false)
|
private void LoadUpdates(bool force = false)
|
||||||
@@ -156,7 +160,8 @@ namespace GHelper
|
|||||||
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
table.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||||
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.categoryName, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, table.RowCount);
|
||||||
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.title, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 1, table.RowCount);
|
||||||
table.Controls.Add(versionLabel, 2, table.RowCount);
|
table.Controls.Add(new Label { Text = driver.date, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 2, table.RowCount);
|
||||||
|
table.Controls.Add(versionLabel, 3, table.RowCount);
|
||||||
table.RowCount++;
|
table.RowCount++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -171,15 +176,21 @@ namespace GHelper
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void VisualiseNewDriver(int position, TableLayoutPanel table)
|
public void VisualiseNewDriver(int position, int newer, TableLayoutPanel table)
|
||||||
{
|
{
|
||||||
var label = table.GetControlFromPosition(2, position) as Label;
|
var label = table.GetControlFromPosition(3, position) as Label;
|
||||||
if (label != null)
|
if (label != null)
|
||||||
{
|
{
|
||||||
Invoke(delegate
|
Invoke(delegate
|
||||||
{
|
{
|
||||||
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
|
if (newer == DRIVER_NEWER)
|
||||||
label.ForeColor = colorTurbo;
|
{
|
||||||
|
label.Font = new Font(label.Font, FontStyle.Underline | FontStyle.Bold);
|
||||||
|
label.ForeColor = colorTurbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newer == DRIVER_NOT_FOUND) label.ForeColor = Color.Gray;
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -237,6 +248,7 @@ namespace GHelper
|
|||||||
driver.version = file.GetProperty("Version").ToString().Replace("V", "");
|
driver.version = file.GetProperty("Version").ToString().Replace("V", "");
|
||||||
driver.downloadUrl = file.GetProperty("DownloadUrl").GetProperty("Global").ToString();
|
driver.downloadUrl = file.GetProperty("DownloadUrl").GetProperty("Global").ToString();
|
||||||
driver.hardwares = file.GetProperty("HardwareInfoList");
|
driver.hardwares = file.GetProperty("HardwareInfoList");
|
||||||
|
driver.date = file.GetProperty("ReleaseDate").ToString();
|
||||||
drivers.Add(driver);
|
drivers.Add(driver);
|
||||||
|
|
||||||
VisualiseDriver(driver, table);
|
VisualiseDriver(driver, table);
|
||||||
@@ -257,26 +269,28 @@ namespace GHelper
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (var driver in drivers)
|
foreach (var driver in drivers)
|
||||||
{
|
{
|
||||||
int newer = -2;
|
int newer = DRIVER_NOT_FOUND;
|
||||||
if (type == 0 && driver.hardwares.ToString().Length > 0)
|
if (type == 0 && driver.hardwares.ToString().Length > 0)
|
||||||
for (int k = 0; k < driver.hardwares.GetArrayLength(); k++)
|
for (int k = 0; k < driver.hardwares.GetArrayLength(); k++)
|
||||||
{
|
{
|
||||||
var deviceID = driver.hardwares[k].GetProperty("hardwareid").ToString();
|
var deviceID = driver.hardwares[k].GetProperty("hardwareid").ToString();
|
||||||
var localVersion = devices.Where(p => p.Key.Contains(deviceID)).Select(p => p.Value).FirstOrDefault();
|
var localVersions = devices.Where(p => p.Key.Contains(deviceID)).Select(p => p.Value);
|
||||||
if (localVersion is not null)
|
foreach (var localVersion in localVersions)
|
||||||
{
|
{
|
||||||
newer = new Version(driver.version).CompareTo(new Version(localVersion));
|
newer = Math.Min(newer, new Version(driver.version).CompareTo(new Version(localVersion)));
|
||||||
break;
|
Logger.WriteLine(driver.title + " " + driver.version + " vs " + localVersion + " = " + newer);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 1)
|
if (type == 1)
|
||||||
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
newer = Int32.Parse(driver.version) > Int32.Parse(bios) ? 1 : -1;
|
||||||
|
|
||||||
if (newer > 0)
|
VisualiseNewDriver(count, newer, table);
|
||||||
|
|
||||||
|
if (newer == DRIVER_NEWER)
|
||||||
{
|
{
|
||||||
updatesCount++;
|
updatesCount++;
|
||||||
VisualiseNewDriver(count, table);
|
|
||||||
VisualiseNewCount(updatesCount, table);
|
VisualiseNewCount(updatesCount, table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ Each BIOS mode is paired with matching Windows Power Mode. You can adjust this s
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## :question: FAQ
|
## :question: FAQ
|
||||||
|
|
||||||
#### How do I stop the Armoury Crate install popup appearing every time I press the M4 / Rog key?
|
#### How do I stop the Armoury Crate install popup appearing every time I press the M4 / Rog key?
|
||||||
@@ -247,6 +249,13 @@ Example (for default windows "balanced" power plan):
|
|||||||
"scheme_2": "381b4222-f694-41f0-9685-ff5bb260df2e",
|
"scheme_2": "381b4222-f694-41f0-9685-ff5bb260df2e",
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Alternative Activation for XG Mobile 6850XT
|
||||||
|
If you experience situation when your XG Mobile doesn't work on full power when Activated. It's possible it needs "alternative" command to get activated.
|
||||||
|
To turn it on, add following line to config :
|
||||||
|
```
|
||||||
|
"xgm_special" : 1,
|
||||||
|
```
|
||||||
|
|
||||||
### Override UI theme
|
### Override UI theme
|
||||||
|
|
||||||
By default app would set UI theme from "app" theme in windows setting. You can override it to specific theme, or general windows theme
|
By default app would set UI theme from "app" theme in windows setting. You can override it to specific theme, or general windows theme
|
||||||
|
|||||||
Reference in New Issue
Block a user