mirror of https://github.com/2dust/v2rayN
parent
9f3b128044
commit
6da0b6a628
|
@ -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();
|
string exePath = GetExePath();
|
||||||
RegWriteValue(autoRunRegPath, autoRunName, exePath);
|
RegWriteValue(autoRunRegPath, autoRunName, run ? exePath : "");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegWriteValue(autoRunRegPath, autoRunName, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -550,17 +542,9 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string StartupPath()
|
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)
|
public static string RegReadValue(string path, string name, string def)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue