Fix startup issues

pull/2928/head
2dust 2023-01-02 11:01:43 +08:00
parent fd6fa1c622
commit 1c95c5861c
2 changed files with 13 additions and 4 deletions

View File

@ -597,13 +597,21 @@ namespace v2rayN
{
try
{
string exePath = GetExePath();
RegWriteValue(Global.AutoRunRegPath, Global.AutoRunName, run ? $"\"{exePath}\"" : "");
var autoRunName = $"{Global.AutoRunName}_{GetMD5(StartupPath())}";
//delete first
RegWriteValue(Global.AutoRunRegPath, autoRunName, "");
if (run)
{
string exePath = $"\"{GetExePath()}\"";
RegWriteValue(Global.AutoRunRegPath, autoRunName, exePath);
}
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
}
}
}
/// <summary>

View File

@ -125,7 +125,7 @@ namespace v2rayN.ViewModels
#endregion
#region UI
AutoRun = Utils.IsAutoRun();
AutoRun = _config.autoRun;
EnableStatistics = _config.enableStatistics;
StatisticsFreshRate = _config.statisticsFreshRate;
KeepOlderDedupl = _config.keepOlderDedupl;
@ -282,6 +282,7 @@ namespace v2rayN.ViewModels
//UI
Utils.SetAutoRun(AutoRun);
_config.autoRun = AutoRun;
_config.enableStatistics = EnableStatistics;
_config.statisticsFreshRate = StatisticsFreshRate;
if (_config.statisticsFreshRate > 100 || _config.statisticsFreshRate < 1)