Skip to content

Commit c511f6e

Browse files
committed
feat: Debug.WriteLine instead of Console.WriteLine
1 parent f0ba796 commit c511f6e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/UnlockerPatch/IpcService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void Start(int processId, nint pFpsValue)
4747
if (_stubModule == nint.Zero)
4848
{
4949
string errorMessage = $@"Failed to load stub module: {Marshal.GetLastWin32Error()}{Environment.NewLine}{Marshal.GetLastPInvokeErrorMessage()}";
50-
Console.WriteLine(errorMessage, @"Error");
50+
Debug.WriteLine(errorMessage, @"Error");
5151
return;
5252
}
5353

@@ -59,14 +59,14 @@ public void Start(int processId, nint pFpsValue)
5959
if (_wndHook == nint.Zero)
6060
{
6161
string errorMessage = $@"Failed to set window hook: {Marshal.GetLastWin32Error()}{Environment.NewLine}{Marshal.GetLastPInvokeErrorMessage()}";
62-
Console.WriteLine(errorMessage, @"Error");
62+
Debug.WriteLine(errorMessage, @"Error");
6363
return;
6464
}
6565

6666
if (!Native.PostThreadMessage(threadId, 0, nint.Zero, nint.Zero))
6767
{
6868
string errorMessage = $@"Failed to post thread message: {Marshal.GetLastWin32Error()}{Environment.NewLine}{Marshal.GetLastPInvokeErrorMessage()}";
69-
Console.WriteLine(errorMessage, @"Error");
69+
Debug.WriteLine(errorMessage, @"Error");
7070
return;
7171
}
7272

@@ -80,7 +80,7 @@ public void Start(int processId, nint pFpsValue)
8080

8181
if (retryCount >= 10)
8282
{
83-
Console.WriteLine(@"Failed to start the unlocker.", @"Error");
83+
Debug.WriteLine(@"Failed to start the unlocker.", @"Error");
8484
return;
8585
}
8686

src/UnlockerPatch/ProcessUtils.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Runtime.InteropServices;
1+
using System.Diagnostics;
2+
using System.Runtime.InteropServices;
23
using System.Text;
34

45
namespace UnlockerPatch;
@@ -118,7 +119,7 @@ public static nint GetModuleBase(nint hProcess, string moduleName)
118119
int errorCode = Marshal.GetLastWin32Error();
119120
if (errorCode != 299)
120121
{
121-
Console.WriteLine($@"EnumProcessModulesEx failed ({errorCode}){Environment.NewLine}{Marshal.GetLastPInvokeErrorMessage()}"
122+
Debug.WriteLine($@"EnumProcessModulesEx failed ({errorCode}){Environment.NewLine}{Marshal.GetLastPInvokeErrorMessage()}"
122123
, @"Error");
123124
return nint.Zero;
124125
}

0 commit comments

Comments
 (0)