修正不改变系统代理时的退出行为

This commit is contained in:
lrisora 2021-05-05 20:47:45 +08:00
parent f0c59e38cc
commit 20a03cde93
No known key found for this signature in database
GPG key ID: BFF52AF2FE044FEC
2 changed files with 5 additions and 2 deletions

View file

@ -36,6 +36,7 @@ namespace v2rayN.Forms
v2rayHandler.V2rayStop();
//HttpProxyHandle.CloseHttpAgent(config);
// 第二个bool参数指示此次UpdateSysProxy是否为退出
HttpProxyHandle.UpdateSysProxy(config, true);
ConfigHandler.SaveConfig(ref config);

View file

@ -147,11 +147,12 @@ namespace v2rayN.HttpProxyHandler
Update(config, false);
}
public static bool UpdateSysProxy(Config config, bool forceDisable)
public static bool UpdateSysProxy(Config config, bool isExit)
{
var type = config.sysProxyType;
if (forceDisable)
// 如果是程序退出那么自动配置系统代理的更新行为应当是清除
if (isExit && type == ESysProxyType.ForcedChange)
{
type = ESysProxyType.ForcedClear;
}
@ -170,6 +171,7 @@ namespace v2rayN.HttpProxyHandler
}
else if (type == ESysProxyType.ForcedClear)
{
// 系统关机时这里无法复位成功,需要改
SysProxyHandle.ResetIEProxy();
}
else if (type == ESysProxyType.Unchanged)