mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-27 13:26:59 +00:00
51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
using System.Diagnostics;
|
|
|
|
namespace AmazTool;
|
|
|
|
internal class Utils
|
|
{
|
|
public static string GetExePath()
|
|
{
|
|
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
|
}
|
|
|
|
public static string StartupPath()
|
|
{
|
|
return AppDomain.CurrentDomain.BaseDirectory;
|
|
}
|
|
|
|
public static string GetPath(string fileName)
|
|
{
|
|
var startupPath = StartupPath();
|
|
if (string.IsNullOrEmpty(fileName))
|
|
{
|
|
return startupPath;
|
|
}
|
|
return Path.Combine(startupPath, fileName);
|
|
}
|
|
|
|
public static string V2rayN => "v2rayN";
|
|
|
|
public static void StartV2RayN()
|
|
{
|
|
Process process = new()
|
|
{
|
|
StartInfo = new()
|
|
{
|
|
UseShellExecute = true,
|
|
FileName = V2rayN,
|
|
WorkingDirectory = StartupPath()
|
|
}
|
|
};
|
|
process.Start();
|
|
}
|
|
|
|
public static void Waiting(int second)
|
|
{
|
|
for (var i = second; i > 0; i--)
|
|
{
|
|
Console.WriteLine(i);
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
}
|