Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Advanced Users only] CPU AutoTDP #2151

Open
wants to merge 161 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
b0e412f
Automatically restart audio capture when device changes.
IceStormNG Jan 12, 2024
0dc16c5
Merge branch 'seerge:main' into main
IceStormNG Jan 13, 2024
b006a11
Wait for process to terminate instead of waiting a fixed amount of time.
IceStormNG Jan 13, 2024
acf52c2
Application.Exit might not exit if there is a child process running. …
IceStormNG Jan 13, 2024
0a86b6d
Merge branch 'seerge:main' into main
IceStormNG Jan 31, 2024
df52fbe
Merge branch 'seerge:main' into main
IceStormNG Feb 1, 2024
0d18e5b
Merge branch 'seerge:main' into main
IceStormNG Feb 4, 2024
cf44717
Merge branch 'seerge:main' into main
IceStormNG Feb 5, 2024
7e3d6ea
Merge branch 'seerge:main' into main
IceStormNG Feb 8, 2024
e08092a
Merge branch 'seerge:main' into main
IceStormNG Feb 10, 2024
ac9b678
Merge branch 'seerge:main' into main
IceStormNG Feb 10, 2024
dea90f6
Merge branch 'seerge:main' into main
IceStormNG Feb 16, 2024
7cc4e87
Merge branch 'seerge:main' into main
IceStormNG Feb 28, 2024
84a6fd4
Added AutoTDP feature with RTSS source and Intel + ASUS power limiters
IceStormNG Mar 1, 2024
20c9d57
Merge branch 'seerge:main' into main
IceStormNG Mar 1, 2024
54dcb46
Merge branch 'seerge:main' into cpu-auto-tdp
IceStormNG Mar 1, 2024
4af2bf6
Remove unnecessary usings
IceStormNG Mar 1, 2024
82f90fc
Make sure the game list is initialzed
IceStormNG Mar 1, 2024
06205a1
Make interface more flexible by passing the whole instance object to …
IceStormNG Mar 1, 2024
20a04dd
Merge branch 'seerge:main' into cpu-auto-tdp
IceStormNG Mar 1, 2024
9b59e7b
Merge branch 'seerge:main' into main
IceStormNG Mar 1, 2024
37dfa19
Merge branch 'seerge:main' into cpu-auto-tdp
IceStormNG Mar 1, 2024
b9b9857
ASUS power limiter fixes
IceStormNG Mar 1, 2024
5d231ea
Fix min slider affecting the max slider the wrong way
IceStormNG Mar 1, 2024
2aebf30
Fix for not detecting older games
IceStormNG Mar 1, 2024
8cd2564
Use watts as double to have more fine grained control
IceStormNG Mar 1, 2024
f119844
Better calibration for tdp adjustments to not cause extreme stutters
IceStormNG Mar 1, 2024
0370aa8
Fixed reset not working when a game was running
IceStormNG Mar 1, 2024
6850b64
Fix for detecting exit of game
IceStormNG Mar 1, 2024
7f087d3
Ignore case when finding game profile by process name
IceStormNG Mar 1, 2024
5fee6e0
Logic to find a stable minimum TDP for improved stability and less fr…
IceStormNG Mar 1, 2024
c31e52b
PID already does that. Therefore it is not necessary
IceStormNG Mar 1, 2024
599def9
Merge branch 'seerge:main' into main
IceStormNG Mar 1, 2024
181a16b
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 1, 2024
2e9a34d
Adjusted some comments to reflect recent code changes
IceStormNG Mar 2, 2024
082c703
Check whether autotdp is available at all.
IceStormNG Mar 2, 2024
edf0593
Use constants instead of hardcoding the MSR index.
IceStormNG Mar 2, 2024
40d31c0
Merge branch 'seerge:main' into cpu-auto-tdp
IceStormNG Mar 2, 2024
89de581
Also set FPPT boost for non all-amd models
IceStormNG Mar 2, 2024
b104d85
Explicitly save previous power limits
IceStormNG Mar 2, 2024
f2ef77b
Better logic to handle availability of tdp limiters
IceStormNG Mar 2, 2024
da47c09
Streamlined options and availability checks for limiters and fps sources
IceStormNG Mar 2, 2024
b765514
Check limiters for their availability before using them
IceStormNG Mar 2, 2024
0eb5394
Merge branch 'seerge:main' into cpu-auto-tdp
IceStormNG Mar 2, 2024
b8c3c04
Lower default min power to 15W and remove the .exe from the default g…
IceStormNG Mar 2, 2024
6523d6a
Added more logging.
IceStormNG Mar 2, 2024
cb685f9
Fixes for stability checks
IceStormNG Mar 2, 2024
12d7afc
Stuttering has bigger impact on stability.
IceStormNG Mar 2, 2024
adcec74
Do not use top most, but dialog for the game settings.
IceStormNG Mar 2, 2024
61803db
Renamed some controls
IceStormNG Mar 2, 2024
65c5b64
Small bugfix: Do not allow to open the autotdp window more than once.
IceStormNG Mar 2, 2024
02c2a7f
Power limits in Asus way
seerge Mar 2, 2024
8cde3cc
Merge branch 'seerge:main' into main
IceStormNG Mar 3, 2024
9d12c4c
Merge pull request #1 from seerge/cpu-auto-tdp
IceStormNG Mar 3, 2024
df10af9
Start RTSS again if it got stopped
IceStormNG Mar 5, 2024
531138f
Do not spam the ACPI driver with power limits if the limit hasn't cha…
IceStormNG Mar 5, 2024
bc5f568
Separate logger for auto tdp. Increased sampling rate to have smoothe…
IceStormNG Mar 5, 2024
b2064c2
Merge branch 'seerge:main' into main
IceStormNG Mar 5, 2024
87eb983
Do not initiate autotdp before ACPI was not initialized
IceStormNG Mar 5, 2024
e9f6e62
Additional logging to see whether power limits were read correctly
IceStormNG Mar 5, 2024
fa10100
Additional error checking whether WinRing0 driver was loaded. Logging…
IceStormNG Mar 5, 2024
cf77977
Read RTSS path from registry
IceStormNG Mar 6, 2024
1fe8eba
Have a variable minimum sample interval defined by the power limiter.
IceStormNG Mar 6, 2024
143137b
Automatically re-apply power limiter when switching the drop down and…
IceStormNG Mar 6, 2024
5636a5b
Do not deinitialize the driver when it is still in use
IceStormNG Mar 6, 2024
8594e78
Sample less often to reduce system calls
IceStormNG Mar 6, 2024
63bf0bb
Log power limits in Ws and not in RAPL units
IceStormNG Mar 6, 2024
e9250d0
Add preparation step. ASUS ACPI needs that to switch into manual mode…
IceStormNG Mar 6, 2024
8d9c8c4
Fixed a typo
IceStormNG Mar 6, 2024
8c11521
Apparently we cannot read the power limits back from the API. Just re…
IceStormNG Mar 6, 2024
fd4ba47
Add additional logging for initialization of limiter and fps source
IceStormNG Mar 6, 2024
05591ba
Stabilize for a longer period of time to reduce stutter in constant l…
IceStormNG Mar 6, 2024
3d3f67a
Due to slower sample time, stutterings have bigger impact now on ince…
IceStormNG Mar 6, 2024
2fe9835
This is required or the function would always return "false" when the…
IceStormNG Mar 6, 2024
1e5ab00
Fix for autotdp detection which could crash on startup
IceStormNG Mar 6, 2024
207b44f
RTSS needs admin privileges for starting. But we can still attach to …
IceStormNG Mar 6, 2024
4412286
Intel MSR is not available if not run as admin due to loading the rin…
IceStormNG Mar 6, 2024
51d457c
Added a slider for FPS additionaly to the stepper
IceStormNG Mar 7, 2024
29813ef
Respect the "TopMost" setting from GHelper for the AutoTDP windows.
IceStormNG Mar 7, 2024
d82b855
Merge branch 'seerge:main' into main
IceStormNG Mar 7, 2024
f3daea2
Merge branch 'seerge:main' into main
IceStormNG Mar 8, 2024
09c0367
Pretty printing for game profiles to be better readable by humans
IceStormNG Mar 8, 2024
e36a9d6
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 8, 2024
937d329
Extracted Intel CPU controls. This way it can be used for other means…
IceStormNG Mar 9, 2024
7d1fa3e
Merge branch 'seerge:main' into main
IceStormNG Mar 9, 2024
3521ae7
Merge branch 'seerge:main' into main
IceStormNG Mar 9, 2024
db799b3
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 9, 2024
4d54b7e
Moved autoTDP to CPU section
IceStormNG Mar 9, 2024
27188e3
Allow selecting .dat files as game. CNC Tiberium Wars and Kanes's Wra…
IceStormNG Mar 10, 2024
d012fda
Auto-sort the game table by game title.
IceStormNG Mar 10, 2024
71e072b
Also replace .dat when adding a new game executable
IceStormNG Mar 10, 2024
f9de6c4
Merge branch 'seerge:main' into main
IceStormNG Mar 10, 2024
1799dc2
Code cleanup
IceStormNG Mar 10, 2024
6a54bac
Intel MSR is fast, we can change power at 30Hz if we want to without …
IceStormNG Mar 10, 2024
85f0617
Slower intervals mean longer time for stutter recover, but also less …
IceStormNG Mar 10, 2024
9572e4c
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 10, 2024
de41454
Respect the enable state of the game
IceStormNG Mar 11, 2024
1b03431
Stop autotdp on next cycle if the game profile was disabled.
IceStormNG Mar 11, 2024
973bc29
Handle case when OSD is not ready in 5s, which would otherwise crash …
IceStormNG Mar 11, 2024
0de0963
500ms seems to be the sweet spot for most games. Only ignore single d…
IceStormNG Mar 11, 2024
11f1e89
Merge branch 'seerge:main' into main
IceStormNG Mar 13, 2024
85a3e28
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 13, 2024
5e75829
Merge branch 'seerge:main' into main
IceStormNG Mar 20, 2024
e1f765d
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 20, 2024
cdb80b2
Fix UI bug that could cause profiles to duplicate if they're not enab…
IceStormNG Mar 24, 2024
69895f4
Merge branch 'seerge:main' into main
IceStormNG Mar 24, 2024
8d83d35
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 24, 2024
dc835f5
Merge branch 'seerge:main' into main
IceStormNG Mar 25, 2024
b6dac45
Merge branch 'seerge:main' into main
IceStormNG Mar 27, 2024
bd9c974
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 27, 2024
64217f1
Make Check Interval configurable per game. Default is 500ms
IceStormNG Mar 28, 2024
0973814
Merge branch 'seerge:main' into main
IceStormNG Mar 31, 2024
1b32c6d
Merge branch 'main' into cpu-auto-tdp
IceStormNG Mar 31, 2024
c6e8d0e
Merge branch 'seerge:main' into main
IceStormNG Apr 8, 2024
f01efd7
Merge branch 'main' into cpu-auto-tdp
IceStormNG Apr 8, 2024
f715194
Shortcut, when max = min TDP. In this case, there is no auto adjustme…
IceStormNG Apr 11, 2024
e7f8ef8
Merge branch 'seerge:main' into main
IceStormNG Apr 11, 2024
5ec3682
Merge branch 'main' into cpu-auto-tdp
IceStormNG Apr 11, 2024
c103b1a
Merge branch 'seerge:main' into main
IceStormNG Apr 27, 2024
6f74050
Rename button to not clash with Ally controls
IceStormNG Apr 27, 2024
2d9b29d
Merge branch 'main' into cpu-auto-tdp
IceStormNG Apr 27, 2024
3f9ef96
Fixed name clash with ally tdp buttons
IceStormNG Apr 27, 2024
4fa59b5
Merge branch 'seerge:main' into main
IceStormNG May 4, 2024
603c1fd
Merge branch 'main' into cpu-auto-tdp
IceStormNG May 4, 2024
376f60f
Merge branch 'seerge:main' into main
IceStormNG May 12, 2024
57fbcc9
Merge branch 'main' into cpu-auto-tdp
IceStormNG May 12, 2024
71b2a02
Merge branch 'seerge:main' into main
IceStormNG May 15, 2024
b641137
Merge branch 'main' into cpu-auto-tdp
IceStormNG May 15, 2024
acd1810
Merge branch 'seerge:main' into main
IceStormNG May 20, 2024
ec6ecd4
Merge branch 'seerge:main' into main
IceStormNG May 24, 2024
222ec6c
Merge branch 'main' into cpu-auto-tdp
IceStormNG May 24, 2024
153328c
Merge branch 'seerge:main' into main
IceStormNG May 29, 2024
d0421f1
Merge branch 'seerge:main' into main
IceStormNG May 30, 2024
a671b89
Merge branch 'seerge:main' into main
IceStormNG May 30, 2024
cff6976
Merge branch 'main' into cpu-auto-tdp
IceStormNG May 30, 2024
c90d293
Merge branch 'seerge:main' into main
IceStormNG Jun 8, 2024
d2c1d07
Merge branch 'seerge:main' into main
IceStormNG Jun 12, 2024
842dcf1
Merge branch 'main' into cpu-auto-tdp
IceStormNG Jun 12, 2024
d298d31
Merge branch 'main' into cpu-auto-tdp
IceStormNG Jun 30, 2024
f49387b
Merge branch 'main' into cpu-auto-tdp
IceStormNG Jul 6, 2024
8961e8d
ROG Strix Evolve https://github.com/seerge/g-helper/issues/2842
seerge Jul 16, 2024
887e636
Merge branch 'seerge:main' into main
IceStormNG Aug 3, 2024
45f0e34
Merge branch 'main' into cpu-auto-tdp
IceStormNG Aug 3, 2024
a0e62d0
Merge branch 'seerge:main' into main
IceStormNG Aug 18, 2024
ab5b77a
Merge branch 'main' into cpu-auto-tdp
IceStormNG Aug 18, 2024
4d85919
Merge branch 'seerge:main' into main
IceStormNG Aug 29, 2024
ba918ed
Merge branch 'main' into cpu-auto-tdp
IceStormNG Aug 29, 2024
fac4772
Merge branch 'seerge:main' into main
IceStormNG Sep 7, 2024
7297703
Merge branch 'main' into cpu-auto-tdp
IceStormNG Sep 7, 2024
fe377e5
Merge branch 'seerge:main' into main
IceStormNG Sep 21, 2024
6d12af7
Merge branch 'seerge:main' into main
IceStormNG Sep 27, 2024
2cfdc58
Merge branch 'seerge:main' into main
IceStormNG Oct 5, 2024
40a9750
Merge branch 'main' into cpu-auto-tdp
IceStormNG Oct 5, 2024
f6f15aa
Merge branch 'seerge:main' into main
IceStormNG Oct 15, 2024
63f57da
Merge branch 'main' into cpu-auto-tdp
IceStormNG Oct 15, 2024
6800660
Merge branch 'seerge:main' into main
IceStormNG Oct 27, 2024
3aee624
Merge branch 'main' into cpu-auto-tdp
IceStormNG Oct 27, 2024
fe30335
Merge branch 'seerge:main' into main
IceStormNG Nov 6, 2024
72e431c
Merge branch 'main' into cpu-auto-tdp
IceStormNG Nov 6, 2024
0bbbd93
Merge branch 'seerge:main' into main
IceStormNG Nov 16, 2024
6041d48
Merge branch 'main' into cpu-auto-tdp
IceStormNG Nov 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using GHelper;
using GHelper.Mode;
using System.Management;
using System.Text.Json;
Expand Down Expand Up @@ -39,7 +40,7 @@
string text = File.ReadAllText(configFile);
try
{
config = JsonSerializer.Deserialize<Dictionary<string, object>>(text);

Check warning on line 43 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
}
catch (Exception ex)
{
Expand Down Expand Up @@ -212,7 +213,7 @@
return Get(zone + "_bat", Get(zone)) != 0;
}

public static string GetString(string name, string empty = null)

Check warning on line 216 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
{
if (config.ContainsKey(name))
return config[name].ToString();
Expand Down Expand Up @@ -575,7 +576,17 @@

public static bool IsManualModeRequired()
{
if (!IsMode("auto_apply_power"))
bool isAutoTDPActive = false;


if (Program.autoTDPService is not null)
{
//If using ASUS ACPI and AutoTDP is running right now, ignore current power mode as the auto tdp power settings are temporary
isAutoTDPActive = AppConfig.GetString("auto_tdp_limiter", "").Equals("asus_acpi") && Program.autoTDPService.IsActive();
}


if (!IsMode("auto_apply_power") || isAutoTDPActive)
return false;

return
Expand Down
404 changes: 404 additions & 0 deletions app/AutoTDP/AutoTDPGameProfileUI.Designer.cs

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions app/AutoTDP/AutoTDPGameProfileUI.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using GHelper.UI;

namespace GHelper.AutoTDP
{
public partial class AutoTDPGameProfileUI : RForm
{
public GameProfile GameProfile;
private AutoTDPUI AutoTDPUI;

public AutoTDPGameProfileUI(GameProfile profile, AutoTDPUI parent)
{
AutoTDPUI = parent;
GameProfile = profile;
InitializeComponent();

sliderMinTDP.ValueChanged += SliderMinTDP_ValueChanged;
sliderMaxTDP.ValueChanged += SliderMaxTDP_ValueChanged;
buttonSave.Click += ButtonSave_Click;
buttonDelete.Click += ButtonDelete_Click;

sliderFPS.ValueChanged += SliderFPS_ValueChanged;
numericUpDownFPS.ValueChanged += NumericUpDownFPS_ValueChanged;

sliderCheckInterval.ValueChanged += SliderCheckInterval_ValueChanged;
numericCheckInterval.ValueChanged += NumericCheckInterval_ValueChanged;

InitTheme();


Shown += AutoTDPGameProfileUI_Shown;

VisualizeGameProfile();
}

private void NumericCheckInterval_ValueChanged(object? sender, EventArgs e)
{
sliderCheckInterval.Value = (int)numericCheckInterval.Value;
}

private void SliderCheckInterval_ValueChanged(object? sender, EventArgs e)
{
numericCheckInterval.Value = sliderCheckInterval.Value;
}

private void NumericUpDownFPS_ValueChanged(object? sender, EventArgs e)
{
sliderFPS.Value = (int)numericUpDownFPS.Value;
}

private void SliderFPS_ValueChanged(object? sender, EventArgs e)
{
numericUpDownFPS.Value = sliderFPS.Value;
}

private void ButtonDelete_Click(object? sender, EventArgs e)
{
AutoTDPUI.DeleteGameProfile(GameProfile);
Close();
}

private void ButtonSave_Click(object? sender, EventArgs e)
{
GameProfile.Enabled = checkBoxEnabled.Checked;
GameProfile.GameTitle = textBoxTitle.Text;
GameProfile.TargetFPS = ((int)numericUpDownFPS.Value);
GameProfile.MinTdp = sliderMinTDP.Value;
GameProfile.MaxTdp = sliderMaxTDP.Value;
GameProfile.Interval = ((int)numericCheckInterval.Value);

AutoTDPUI.UpdateGameProfile(GameProfile);

Close();
}

private void SliderMaxTDP_ValueChanged(object? sender, EventArgs e)
{
labelMaxTDP.Text = sliderMaxTDP.Value + "W";
if (sliderMaxTDP.Value < sliderMinTDP.Value)
{
sliderMinTDP.Value = sliderMaxTDP.Value;
}
}

private void SliderMinTDP_ValueChanged(object? sender, EventArgs e)
{
labelMinTDP.Text = sliderMinTDP.Value + "W";
if (sliderMaxTDP.Value < sliderMinTDP.Value)
{
sliderMaxTDP.Value = sliderMinTDP.Value;
}
}

private void AutoTDPGameProfileUI_Shown(object? sender, EventArgs e)
{
if (Height > Program.settingsForm.Height)
{
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
}
else
{
Top = Program.settingsForm.Top + 60;
}

Left = Program.settingsForm.Left - Width - ((AutoTDPUI.Width - Width) / 2);
}

private void VisualizeGameProfile()
{
if (GameProfile.Interval < sliderCheckInterval.Min || GameProfile.Interval > sliderCheckInterval.Max)
{
GameProfile.Interval = AutoTDPService.INTERVAL_FPS_CHECK;
}

sliderMinTDP.Value = GameProfile.MinTdp;
sliderMaxTDP.Value = GameProfile.MaxTdp;
numericUpDownFPS.Value = GameProfile.TargetFPS;
textBoxProcessName.Text = GameProfile.ProcessName;
textBoxTitle.Text = GameProfile.GameTitle;
checkBoxEnabled.Checked = GameProfile.Enabled;
sliderCheckInterval.Value = GameProfile.Interval;
numericCheckInterval.Value = GameProfile.Interval;
}
}
}
120 changes: 120 additions & 0 deletions app/AutoTDP/AutoTDPGameProfileUI.resx
Original file line number Diff line number Diff line change
@@ -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>
39 changes: 39 additions & 0 deletions app/AutoTDP/AutoTDPLogger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Diagnostics;

public static class AutoTDPLogger
{
public static string appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GHelper";
public static string logFile = appPath + "\\auto_tdp_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() - 5000);
File.WriteAllLines(logFile, file.Skip(skip).ToArray());
}
catch { }
}

}
Loading
Loading