mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-17 21:37:43 +01:00
Add Argument parser
This commit is contained in:
parent
a90a5673f2
commit
693babc1e3
8 changed files with 87 additions and 15 deletions
|
|
@ -8,10 +8,10 @@ namespace Dalamud.Injector
|
|||
[Option('p', "pid", Required = true, HelpText = "A target process id to inject.")]
|
||||
public uint Pid { get; set; }
|
||||
|
||||
[Option("root", Required = false)]
|
||||
[Option("root")]
|
||||
public string? RootDirectory { get; set; }
|
||||
|
||||
[Option("bin", Required = false)]
|
||||
[Option("bin")]
|
||||
public string? BinaryDirectory { get; set; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,17 @@ namespace Dalamud.Injector
|
|||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
var pid = 12336u;
|
||||
var binDirectory = "";
|
||||
var rootDirectory = "";
|
||||
|
||||
var boot = new Bootstrapper(new BootstrapperOptions
|
||||
{
|
||||
BinaryDirectory = "",
|
||||
RootDirectory = "",
|
||||
});
|
||||
|
||||
boot.Launch("", "");
|
||||
boot.Relaunch(pid);
|
||||
|
||||
Parser.Default.ParseArguments<InjectOptions, LaunchOptions>(args)
|
||||
.WithParsed<InjectOptions>(Inject)
|
||||
|
|
@ -25,6 +29,7 @@ namespace Dalamud.Injector
|
|||
|
||||
private static void Inject(InjectOptions options)
|
||||
{
|
||||
var pid = options.Pid;
|
||||
var binDirectory = options.BinaryDirectory ?? GetDefaultBinaryDirectory();
|
||||
var rootDirectory = options.RootDirectory ?? GetDefaultRootDirectory();
|
||||
|
||||
|
|
@ -34,7 +39,7 @@ namespace Dalamud.Injector
|
|||
RootDirectory = rootDirectory,
|
||||
});
|
||||
|
||||
boot.Relaunch(options.Pid);
|
||||
boot.Relaunch(pid);
|
||||
}
|
||||
|
||||
private static void Launch(LaunchOptions options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue