Instances
NuGet Instances package re-bundled for convenient consumption and dependency management.
About this mod Author’s original text
Instances
A.NET Standard Process wrapper with an elegant API, for both asyncronous and syncronous use, providing both Events and support for Tasks with cancellation support
Usage
There are three ways to use this library, requiring at least 1, 2, or 3 lines of code to use.
Shortest form, supporting only few options
var result = await Instance.FinishAsync("dotnet", "build -c Release", cancellationToken);
Console.WriteLine(result.ExitCode);
// or
var result = Instance.Finish("dotnet", "build -c Release");
Short form, supporting more options
using var instance = Instance.Start("dotnet", "build -c Release");
var result = await instance.WaitForExitAsync(cancellationToken);
// or
using var instance = Instance.Start("dotnet", "build -c Release");
var result = instance.WaitForExit();
Full form, supporting all options
var processArgument = new ProcessArguments("dotnet", "build -c Release");
processArgument.Exited += (_, exitResult) => Console.WriteLine(exitResult.ExitCode);
processArgument.OutputDataReceived += (_, data) => Console.WriteLine(data);
processArgument.ErrorDataReceived += (_, data) => Console.WriteLine(data);
using var instance = processArgument.Start();
var result = await instance.WaitForExitAsync(cancellationToken);
// or
var result = instance.WaitForExit();
Features
using var instance = Instance.Start("dotnet", "build -c Release");
// send input to process' standard input
instance.SendInput("Hello World");
// stop the process
instance.Kill();
// access process output
foreach (var line in instance.OutputData)
Console.WriteLine(line);
// and error data easily while the process is running
foreach (var line in instance.ErrorData)
Console.WriteLine(line);
// or wait for the process to exit (with support for cancellation token)
var result = await instance.WaitForExitAsync(cancellationToken);
Console.WriteLine(result.ExitCode);
Console.WriteLine(result.OutputData.Count);
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.