0
0
mirror of https://github.com/sp-tarkov/assembly-tool.git synced 2025-02-12 16:50:44 -05:00

Add ability to wait for a debugger to attach before executing. Uses preprocessor #define WAIT_FOR_DEBUGGER

This commit is contained in:
Cj 2025-01-10 04:13:56 -05:00
parent 1d3aedd7ab
commit 7ff1591674
2 changed files with 26 additions and 2 deletions

View File

@ -1,4 +1,8 @@
using CliFx; // Uncomment this to have the application wait for a debugger to attach before running.
#define WAIT_FOR_DEBUGGER
using System.Diagnostics;
using CliFx;
using CliFx.Attributes; using CliFx.Attributes;
using CliFx.Infrastructure; using CliFx.Infrastructure;
using ReCodeItLib.Models; using ReCodeItLib.Models;
@ -28,6 +32,14 @@ public class AutoMatchCommand : ICommand
Logger.LogSync("Finding match..."); Logger.LogSync("Finding match...");
var remaps = new List<RemapModel>(); var remaps = new List<RemapModel>();
#if WAIT_FOR_DEBUGGER
Logger.LogSync("Waiting for debugger...");
while (!Debugger.IsAttached)
{
Thread.Sleep(100);
}
#endif
if (!string.IsNullOrEmpty(MappingsPath)) if (!string.IsNullOrEmpty(MappingsPath))
{ {

View File

@ -1,4 +1,8 @@
using CliFx; // Uncomment this to have the application wait for a debugger to attach before running.
//#define WAIT_FOR_DEBUGGER
using System.Diagnostics;
using CliFx;
using CliFx.Attributes; using CliFx.Attributes;
using CliFx.Infrastructure; using CliFx.Infrastructure;
using ReCodeItLib.Utils; using ReCodeItLib.Utils;
@ -19,6 +23,14 @@ public class ReMap : ICommand
public ValueTask ExecuteAsync(IConsole console) public ValueTask ExecuteAsync(IConsole console)
{ {
#if WAIT_FOR_DEBUGGER
Logger.LogSync("Waiting for debugger...");
while (!Debugger.IsAttached)
{
Thread.Sleep(100);
}
#endif
DataProvider.Settings.MappingPath = MappingJsonPath; DataProvider.Settings.MappingPath = MappingJsonPath;
var remaps = DataProvider.LoadMappingFile(MappingJsonPath); var remaps = DataProvider.LoadMappingFile(MappingJsonPath);