mirror of
https://github.com/2dust/v2rayN.git
synced 2025-12-22 11:19:45 +05:00
简化代码
组合 StartupPath 未见意义
This commit is contained in:
@@ -485,24 +485,16 @@ namespace v2rayN
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="run"></param>
|
/// <param name="run"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int SetAutoRun(bool run)
|
public static void SetAutoRun(bool run)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (run)
|
string exePath = GetExePath();
|
||||||
{
|
RegWriteValue(autoRunRegPath, autoRunName, run ? exePath : "");
|
||||||
string exePath = GetExePath();
|
|
||||||
RegWriteValue(autoRunRegPath, autoRunName, exePath);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegWriteValue(autoRunRegPath, autoRunName, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -551,15 +543,7 @@ namespace v2rayN
|
|||||||
|
|
||||||
public static string StartupPath()
|
public static string StartupPath()
|
||||||
{
|
{
|
||||||
try
|
return Application.StartupPath;
|
||||||
{
|
|
||||||
string exePath = GetExePath();
|
|
||||||
return exePath.Substring(0, exePath.LastIndexOf("\\", StringComparison.Ordinal));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return Application.StartupPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string RegReadValue(string path, string name, string def)
|
public static string RegReadValue(string path, string name, string def)
|
||||||
|
|||||||
Reference in New Issue
Block a user