Folder reorganisation
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"GHelper": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"workingDirectory": "C:\\Users\\serge\\source\\GHelper"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|
||||||
public class ASUSWmi
|
public class ASUSWmi
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<System.Windows.Forms.ApplicationConfigurationSection>
|
<System.Windows.Forms.ApplicationConfigurationSection>
|
||||||
<add key="DpiAwareness" value="PerMonitorV2" />
|
<add key="DpiAwareness" value="System" />
|
||||||
</System.Windows.Forms.ApplicationConfigurationSection>
|
</System.Windows.Forms.ApplicationConfigurationSection>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
|
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
|
||||||
0
Fans.Designer.cs → app/Fans.Designer.cs
generated
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="favicon.ico">
|
<Content Include="favicon.ico">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
39
app/Logger.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
public static class Logger
|
||||||
|
{
|
||||||
|
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
||||||
|
static string logFile = appPath + "\\log.txt";
|
||||||
|
|
||||||
|
public static void WriteLine(string logMessage)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(logMessage);
|
||||||
|
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (StreamWriter w = File.AppendText(logFile))
|
||||||
|
{
|
||||||
|
w.WriteLine($"{DateTime.Now}: {logMessage}");
|
||||||
|
w.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
if (new Random().Next(100) == 1) Cleanup();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Cleanup()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var file = File.ReadAllLines(logFile);
|
||||||
|
int skip = Math.Max(0, file.Count() - 500);
|
||||||
|
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,43 +2,7 @@ using Microsoft.Win32;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
public static class Logger
|
|
||||||
{
|
|
||||||
static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
|
|
||||||
static string logFile = appPath + "\\log.txt";
|
|
||||||
|
|
||||||
public static void WriteLine(string logMessage)
|
|
||||||
{
|
|
||||||
Debug.WriteLine(logMessage);
|
|
||||||
if (!Directory.Exists(appPath)) Directory.CreateDirectory(appPath);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (StreamWriter w = File.AppendText(logFile))
|
|
||||||
{
|
|
||||||
w.WriteLine($"{DateTime.Now}: {logMessage}");
|
|
||||||
w.Close();
|
|
||||||
}
|
|
||||||
} catch { }
|
|
||||||
|
|
||||||
if (new Random().Next(100) == 1) Cleanup();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Cleanup()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var file = File.ReadAllLines(logFile);
|
|
||||||
int skip = Math.Max(0, file.Count() - 500);
|
|
||||||
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
|
|
||||||
} catch { }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -163,7 +127,7 @@ namespace GHelper
|
|||||||
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));
|
||||||
|
|
||||||
settingsForm.AutoPerformance(isPlugged);
|
settingsForm.AutoPerformance(isPlugged);
|
||||||
|
|
||||||
bool switched = settingsForm.AutoGPUMode(isPlugged);
|
bool switched = settingsForm.AutoGPUMode(isPlugged);
|
||||||
if (!switched) settingsForm.AutoScreen(isPlugged);
|
if (!switched) settingsForm.AutoScreen(isPlugged);
|
||||||
|
|
||||||
7
app/Properties/launchSettings.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"GHelper": {
|
||||||
|
"commandName": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 515 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 428 B |
|
Before Width: | Height: | Size: 710 B After Width: | Height: | Size: 710 B |
|
Before Width: | Height: | Size: 885 B After Width: | Height: | Size: 885 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 955 KiB After Width: | Height: | Size: 955 KiB |