mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-24 11:56:55 +00:00
修正不改变系统代理时的退出行为
This commit is contained in:
parent
f0c59e38cc
commit
20a03cde93
2 changed files with 5 additions and 2 deletions
|
@ -36,6 +36,7 @@ namespace v2rayN.Forms
|
||||||
v2rayHandler.V2rayStop();
|
v2rayHandler.V2rayStop();
|
||||||
|
|
||||||
//HttpProxyHandle.CloseHttpAgent(config);
|
//HttpProxyHandle.CloseHttpAgent(config);
|
||||||
|
// 第二个bool参数指示此次UpdateSysProxy是否为退出
|
||||||
HttpProxyHandle.UpdateSysProxy(config, true);
|
HttpProxyHandle.UpdateSysProxy(config, true);
|
||||||
|
|
||||||
ConfigHandler.SaveConfig(ref config);
|
ConfigHandler.SaveConfig(ref config);
|
||||||
|
|
|
@ -147,11 +147,12 @@ namespace v2rayN.HttpProxyHandler
|
||||||
Update(config, false);
|
Update(config, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UpdateSysProxy(Config config, bool forceDisable)
|
public static bool UpdateSysProxy(Config config, bool isExit)
|
||||||
{
|
{
|
||||||
var type = config.sysProxyType;
|
var type = config.sysProxyType;
|
||||||
|
|
||||||
if (forceDisable)
|
// 如果是程序退出那么自动配置系统代理的更新行为应当是清除
|
||||||
|
if (isExit && type == ESysProxyType.ForcedChange)
|
||||||
{
|
{
|
||||||
type = ESysProxyType.ForcedClear;
|
type = ESysProxyType.ForcedClear;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +171,7 @@ namespace v2rayN.HttpProxyHandler
|
||||||
}
|
}
|
||||||
else if (type == ESysProxyType.ForcedClear)
|
else if (type == ESysProxyType.ForcedClear)
|
||||||
{
|
{
|
||||||
|
// 系统关机时这里无法复位成功,需要改
|
||||||
SysProxyHandle.ResetIEProxy();
|
SysProxyHandle.ResetIEProxy();
|
||||||
}
|
}
|
||||||
else if (type == ESysProxyType.Unchanged)
|
else if (type == ESysProxyType.Unchanged)
|
||||||
|
|
Loading…
Reference in a new issue