Skip to content

Commit

Permalink
Folder reorganisation
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Mar 17, 2023
1 parent 014ee63 commit 5fd7b74
Show file tree
Hide file tree
Showing 55 changed files with 49 additions and 48 deletions.
8 changes: 0 additions & 8 deletions Properties/launchSettings.json

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion ASUSWmi.cs → app/ASUSWmi.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Management;
using System.Runtime.InteropServices;


public class ASUSWmi
{

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion App.config → app/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
<add key="DpiAwareness" value="System" />
</System.Windows.Forms.ApplicationConfigurationSection>
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion GHelper.csproj → app/GHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<ItemGroup>
<Content Include="favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions app/Logger.cs
Original file line number Diff line number Diff line change
@@ -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 { }
}

}
File renamed without changes.
File renamed without changes.
38 changes: 1 addition & 37 deletions Program.cs → app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,7 @@
using System.Diagnostics;
using System.Management;
using System.Reflection;
using System.Runtime.InteropServices;
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
{
Expand Down Expand Up @@ -163,7 +127,7 @@ public static void SetAutoModes()
settingsForm.SetBatteryChargeLimit(config.getConfig("charge_limit"));

settingsForm.AutoPerformance(isPlugged);

bool switched = settingsForm.AutoGPUMode(isPlugged);
if (!switched) settingsForm.AutoScreen(isPlugged);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions app/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profiles": {
"GHelper": {
"commandName": "Project"
}
}
}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes

0 comments on commit 5fd7b74

Please sign in to comment.