Folder reorganisation

This commit is contained in:
seerge
2023-03-17 15:03:09 +01:00
parent 014ee635d6
commit 5fd7b74519
55 changed files with 49 additions and 48 deletions

View File

@@ -1,8 +0,0 @@
{
"profiles": {
"GHelper": {
"commandName": "Project",
"workingDirectory": "C:\\Users\\serge\\source\\GHelper"
}
}
}

View File

@@ -1,7 +1,6 @@
using System.Management; using System.Management;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public class ASUSWmi public class ASUSWmi
{ {

View File

@@ -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" />

View File

@@ -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
View 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 { }
}
}

View File

@@ -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);

View File

@@ -0,0 +1,7 @@
{
"profiles": {
"GHelper": {
"commandName": "Project"
}
}
}

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 220 KiB

View File

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 421 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 428 B

After

Width:  |  Height:  |  Size: 428 B

View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

View File

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 400 B

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 955 KiB

After

Width:  |  Height:  |  Size: 955 KiB