mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-10 01:54:35 +01:00
galaxy brain 2: bit of restructure (Bootstrap)
This commit is contained in:
parent
2438a89867
commit
350d2961c1
19 changed files with 345 additions and 136 deletions
52
Dalamud.Injector/Program.cs
Normal file
52
Dalamud.Injector/Program.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using CommandLine;
|
||||
using Dalamud.Bootstrap;
|
||||
using static System.Environment;
|
||||
|
||||
namespace Dalamud.Injector
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Parser.Default.ParseArguments<InjectOptions, LaunchOptions>(args)
|
||||
.WithParsed<InjectOptions>(Inject)
|
||||
.WithParsed<LaunchOptions>(Launch);
|
||||
}
|
||||
|
||||
private static void Inject(InjectOptions options)
|
||||
{
|
||||
var binDirectory = options.BinaryDirectory ?? GetDefaultBinaryDirectory();
|
||||
var rootDirectory = options.RootDirectory ?? GetDefaultRootDirectory();
|
||||
|
||||
var boot = new Bootstrapper(new BootstrapperOptions
|
||||
{
|
||||
BinaryDirectory = binDirectory,
|
||||
RootDirectory = rootDirectory,
|
||||
});
|
||||
|
||||
// ..
|
||||
boot.Relaunch(options.Pid);
|
||||
}
|
||||
|
||||
private static void Launch(LaunchOptions options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static string GetDefaultBinaryDirectory()
|
||||
{
|
||||
var root = GetDefaultRootDirectory();
|
||||
|
||||
return Path.Combine(root, "bin");
|
||||
}
|
||||
|
||||
private static string GetDefaultRootDirectory()
|
||||
{
|
||||
var localApp = Environment.GetFolderPath(SpecialFolder.LocalApplicationData);
|
||||
|
||||
return Path.Combine(localApp, "Dalamud");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue