简化代码

组合 StartupPath 未见意义
pull/543/head
YFdyh000 2020-03-16 06:31:52 +08:00
parent 9f3b128044
commit 6da0b6a628
1 changed files with 4 additions and 20 deletions

View File

@ -485,24 +485,16 @@ namespace v2rayN
/// </summary>
/// <param name="run"></param>
/// <returns></returns>
public static int SetAutoRun(bool run)
public static void SetAutoRun(bool run)
{
try
{
if (run)
{
string exePath = GetExePath();
RegWriteValue(autoRunRegPath, autoRunName, exePath);
}
else
{
RegWriteValue(autoRunRegPath, autoRunName, "");
}
string exePath = GetExePath();
RegWriteValue(autoRunRegPath, autoRunName, run ? exePath : "");
}
catch
{
}
return 0;
}
/// <summary>
@ -551,15 +543,7 @@ namespace v2rayN
public static string StartupPath()
{
try
{
string exePath = GetExePath();
return exePath.Substring(0, exePath.LastIndexOf("\\", StringComparison.Ordinal));
}
catch
{
return Application.StartupPath;
}
return Application.StartupPath;
}
public static string RegReadValue(string path, string name, string def)