2025-03-01 06:23:43 +00:00
|
|
|
using System.Diagnostics;
|
2025-01-04 09:01:57 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
namespace AmazTool;
|
|
|
|
|
|
|
|
|
|
internal class Utils
|
2025-01-04 09:01:57 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
public static string GetExePath()
|
2025-01-04 09:01:57 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
|
|
|
|
|
}
|
2025-01-04 09:01:57 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
public static string StartupPath()
|
|
|
|
|
{
|
|
|
|
|
return AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
|
}
|
2025-01-04 09:01:57 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
public static string GetPath(string fileName)
|
|
|
|
|
{
|
|
|
|
|
var startupPath = StartupPath();
|
|
|
|
|
if (string.IsNullOrEmpty(fileName))
|
2025-01-04 09:01:57 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
return startupPath;
|
2025-01-04 09:01:57 +00:00
|
|
|
}
|
2025-04-02 03:44:23 +00:00
|
|
|
return Path.Combine(startupPath, fileName);
|
|
|
|
|
}
|
2025-01-04 09:01:57 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
public static string V2rayN => "v2rayN";
|
2025-01-04 09:01:57 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
public static void StartV2RayN()
|
|
|
|
|
{
|
|
|
|
|
Process process = new()
|
2025-01-04 09:01:57 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
StartInfo = new()
|
2025-01-04 09:01:57 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
UseShellExecute = true,
|
|
|
|
|
FileName = V2rayN,
|
|
|
|
|
WorkingDirectory = StartupPath()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
process.Start();
|
|
|
|
|
}
|
2025-01-17 02:27:29 +00:00
|
|
|
|
2025-04-02 03:44:23 +00:00
|
|
|
public static void Waiting(int second)
|
|
|
|
|
{
|
|
|
|
|
for (var i = second; i > 0; i--)
|
2025-01-17 02:27:29 +00:00
|
|
|
{
|
2025-04-02 03:44:23 +00:00
|
|
|
Console.WriteLine(i);
|
|
|
|
|
Thread.Sleep(1000);
|
2025-01-17 02:27:29 +00:00
|
|
|
}
|
2025-01-04 09:01:57 +00:00
|
|
|
}
|
2025-03-01 06:23:43 +00:00
|
|
|
}
|