mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d002edf65 | ||
|
|
28a17562a8 |
@@ -1,9 +1,8 @@
|
|||||||
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
// Source thanks to https://github.com/vddCore/Starlight with some adjustments from me
|
||||||
|
|
||||||
using Starlight.Communication;
|
using Starlight.Communication;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Starlight.AnimeMatrix
|
namespace Starlight.AnimeMatrix
|
||||||
@@ -104,13 +103,14 @@ namespace Starlight.AnimeMatrix
|
|||||||
_model = AnimeType.GA401;
|
_model = AnimeType.GA401;
|
||||||
|
|
||||||
MaxColumns = 33;
|
MaxColumns = 33;
|
||||||
dx = 0;
|
dx = 1;
|
||||||
|
|
||||||
//FullRows = 7;
|
//FullRows = 7;
|
||||||
//FullEvenRows = 3;
|
//FullEvenRows = 3;
|
||||||
|
|
||||||
MaxRows = 55;
|
MaxRows = 55;
|
||||||
LedCount = 1214;
|
LedCount = 1245;
|
||||||
|
|
||||||
UpdatePageLength = 410;
|
UpdatePageLength = 410;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
if (y < 11)
|
if (y < 11)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return (y) / 2 - 5;
|
return (y) / 2 - 5;
|
||||||
}
|
}
|
||||||
@@ -359,43 +360,44 @@ namespace Starlight.AnimeMatrix
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void PresentText(string text, float fontSize = 8.5F)
|
public void PresentText(string text1, string text2 = "")
|
||||||
{
|
{
|
||||||
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
using (Bitmap bmp = new Bitmap(MaxColumns * 3, MaxRows))
|
||||||
{
|
{
|
||||||
using (Graphics g = Graphics.FromImage(bmp))
|
using (Graphics g = Graphics.FromImage(bmp))
|
||||||
{
|
{
|
||||||
using (Font font = new Font("Arial", fontSize))
|
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
|
||||||
|
using (Font font = new Font("Arial", 12F))
|
||||||
{
|
{
|
||||||
|
SizeF textSize = g.MeasureString(text1, font);
|
||||||
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
g.DrawString(text1, font, Brushes.White, (MaxColumns*3 - textSize.Width)+3, -5);
|
||||||
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
|
||||||
|
|
||||||
/*
|
|
||||||
SizeF textSize = g.MeasureString(text, font);
|
|
||||||
g.TranslateTransform(bmp.Width / 2, bmp.Height / 2);
|
|
||||||
g.RotateTransform(33);
|
|
||||||
g.DrawString(text, font, Brushes.White, -textSize.Width/2, -textSize.Height / 2);
|
|
||||||
*/
|
|
||||||
|
|
||||||
g.DrawString(text, font, Brushes.White, 5, -2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (text2.Length > 0)
|
||||||
|
using (Font font = new Font("Arial", 9F))
|
||||||
|
{
|
||||||
|
SizeF textSize = g.MeasureString(text2, font);
|
||||||
|
g.DrawString(text2, font, Brushes.White, (MaxColumns * 3 - textSize.Width), 25);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateFrame(bmp, System.Drawing.Drawing2D.InterpolationMode.Bicubic);
|
GenerateFrame(bmp, InterpolationMode.Bicubic);
|
||||||
Present();
|
Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateFrame(Image image, System.Drawing.Drawing2D.InterpolationMode interpolation = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic)
|
public void GenerateFrame(Image image, InterpolationMode interpolation = InterpolationMode.HighQualityBicubic)
|
||||||
{
|
{
|
||||||
|
|
||||||
int width = MaxColumns * 3;
|
int width = MaxColumns/2 * 6;
|
||||||
int height = MaxRows;
|
int height = MaxRows;
|
||||||
|
|
||||||
int targetWidth = MaxColumns * 2;
|
int targetWidth = MaxColumns * 2;
|
||||||
|
|
||||||
float scale;
|
float scale;
|
||||||
|
|
||||||
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
using (Bitmap bmp = new Bitmap(targetWidth, height))
|
||||||
@@ -408,8 +410,8 @@ namespace Starlight.AnimeMatrix
|
|||||||
var scaleHeight = (float)(image.Height * scale);
|
var scaleHeight = (float)(image.Height * scale);
|
||||||
|
|
||||||
graph.InterpolationMode = interpolation;
|
graph.InterpolationMode = interpolation;
|
||||||
graph.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
graph.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
graph.SmoothingMode = System.Drawing.Drawing2D.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 * targetWidth / width), 0, (float)Math.Round(scaleWidth * targetWidth / width), scaleHeight);
|
||||||
|
|
||||||
@@ -418,7 +420,7 @@ namespace Starlight.AnimeMatrix
|
|||||||
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 % 2)
|
if (x % 2 == (y+dx) % 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;
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ namespace CustomControls
|
|||||||
return (int)registryValueObject <= 0;
|
return (int)registryValueObject <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitTheme(bool setDPI = true)
|
public bool InitTheme(bool setDPI = true)
|
||||||
{
|
{
|
||||||
bool newDarkTheme = IsDarkTheme();
|
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||||
bool changed = (darkTheme != newDarkTheme);
|
bool changed = (darkTheme != newDarkTheme);
|
||||||
darkTheme = newDarkTheme;
|
darkTheme = newDarkTheme;
|
||||||
|
|
||||||
@@ -45,6 +45,8 @@ namespace CustomControls
|
|||||||
ControlHelper.Adjust(this, darkTheme, changed);
|
ControlHelper.Adjust(this, darkTheme, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
app/Fans.cs
10
app/Fans.cs
@@ -146,7 +146,7 @@ namespace GHelper
|
|||||||
InitPower();
|
InitPower();
|
||||||
InitBoost();
|
InitBoost();
|
||||||
|
|
||||||
comboBoost.SelectedIndexChanged += ComboBoost_Changed;
|
comboBoost.SelectedValueChanged += ComboBoost_Changed;
|
||||||
|
|
||||||
Shown += Fans_Shown;
|
Shown += Fans_Shown;
|
||||||
|
|
||||||
@@ -162,9 +162,11 @@ namespace GHelper
|
|||||||
|
|
||||||
private void ComboBoost_Changed(object? sender, EventArgs e)
|
private void ComboBoost_Changed(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is null) return;
|
if (Program.config.getConfigPerf("auto_boost") != comboBoost.SelectedIndex)
|
||||||
ComboBox cmb = (ComboBox)sender;
|
{
|
||||||
NativeMethods.SetCPUBoost(cmb.SelectedIndex);
|
NativeMethods.SetCPUBoost(comboBoost.SelectedIndex);
|
||||||
|
Program.config.setConfigPerf("auto_boost", comboBoost.SelectedIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
private void CheckApplyPower_Click(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.40</AssemblyVersion>
|
<AssemblyVersion>0.41</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Xml.Linq;
|
||||||
using static Tools.ScreenInterrogatory;
|
using static Tools.ScreenInterrogatory;
|
||||||
|
|
||||||
namespace Tools
|
namespace Tools
|
||||||
@@ -672,7 +674,6 @@ public class NativeMethods
|
|||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
|
||||||
/*
|
|
||||||
var hrDC = PowerWriteDCValueIndex(
|
var hrDC = PowerWriteDCValueIndex(
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
activeSchemeGuid,
|
activeSchemeGuid,
|
||||||
@@ -681,8 +682,8 @@ public class NativeMethods
|
|||||||
boost);
|
boost);
|
||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
*/
|
|
||||||
|
|
||||||
|
Logger.WriteLine("Boost " + boost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetPowerScheme(int mode)
|
public static void SetPowerScheme(int mode)
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -61,13 +59,12 @@ namespace GHelper
|
|||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
|
|
||||||
SystemEvents.UserPreferenceChanged += new
|
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
||||||
UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);
|
|
||||||
|
|
||||||
var ds = settingsForm.Handle;
|
var ds = settingsForm.Handle;
|
||||||
|
|
||||||
trayIcon.MouseClick += TrayIcon_MouseClick;
|
trayIcon.MouseClick += TrayIcon_MouseClick;
|
||||||
|
|
||||||
|
|
||||||
wmi.SubscribeToEvents(WatcherEventArrived);
|
wmi.SubscribeToEvents(WatcherEventArrived);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace GHelper
|
|||||||
public Keyboard keyb;
|
public Keyboard keyb;
|
||||||
|
|
||||||
static AnimeMatrixDevice mat;
|
static AnimeMatrixDevice mat;
|
||||||
|
static int matrixTick = 0;
|
||||||
static long lastRefresh;
|
static long lastRefresh;
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
@@ -356,7 +357,27 @@ namespace GHelper
|
|||||||
mat.PresentNextFrame();
|
mat.PresentNextFrame();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
mat.PresentText(DateTime.Now.ToString("H:mm:ss"));
|
string format1, format2;
|
||||||
|
if (CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern.Contains("H"))
|
||||||
|
{
|
||||||
|
format1 = "H:mm";
|
||||||
|
format2 = "";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
format1 = "h:mm";
|
||||||
|
format2 = "tt";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matrixTick > 0)
|
||||||
|
{
|
||||||
|
format1 = format1.Replace(":", " ");
|
||||||
|
matrixTick = 0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
matrixTick++;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat.PresentText(DateTime.Now.ToString(format1), DateTime.Now.ToString(format2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,6 +953,10 @@ namespace GHelper
|
|||||||
timer.Start();
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Program.config.getConfigPerf("auto_boost") != -1)
|
||||||
|
{
|
||||||
|
NativeMethods.SetCPUBoost(Program.config.getConfigPerf("auto_boost"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||||
@@ -991,6 +1016,7 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
fans.InitFans();
|
fans.InitFans();
|
||||||
fans.InitPower();
|
fans.InitPower();
|
||||||
|
fans.InitBoost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user