using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace BepInEx
{
///
/// Paths used by BepInEx
///
public static class Paths
{
private static string executablePath;
///
/// The directory that the core BepInEx DLLs reside in.
///
public static string BepInExAssemblyDirectory { get; private set; }
///
/// The path to the core BepInEx DLL.
///
public static string BepInExAssemblyPath { get; private set; }
///
/// The path of the currently executing program BepInEx is encapsulated in.
///
public static string ExecutablePath
{
get => executablePath;
internal set
{
executablePath = value;
ProcessName = Path.GetFileNameWithoutExtension(value);
GameRootPath = Path.GetDirectoryName(value);
ManagedPath = Utility.CombinePaths(GameRootPath, $"{ProcessName}_Data", "Managed");
PluginPath = Utility.CombinePaths(GameRootPath, "BepInEx");
PatcherPluginPath = Utility.CombinePaths(GameRootPath, "BepInEx", "patchers");
BepInExAssemblyDirectory = Utility.CombinePaths(GameRootPath, "BepInEx", "core");
BepInExAssemblyPath =
Utility.CombinePaths(BepInExAssemblyDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.dll");
}
}
///
/// The directory that the currently executing process resides in.
///
public static string GameRootPath { get; private set; }
///
/// The path to the Managed folder of the currently running Unity game.
///
public static string ManagedPath { get; private set; }
///
/// The path to the patcher plugin folder which resides in the BepInEx folder.
///
public static string PatcherPluginPath { get; private set; }
///
/// The path to the main BepInEx folder.
///
public static string PluginPath { get; private set; }
///
/// The name of the currently executing process.
///
public static string ProcessName { get; private set; }
}
}