pull/1582/head 4.17
2dust 2021-05-15 11:53:39 +08:00
parent 7513ff860b
commit a70b5eeef5
3 changed files with 26 additions and 7 deletions

View File

@ -33,7 +33,7 @@ namespace v2rayN.Forms
Application.ApplicationExit += (sender, args) =>
{
MyAppExit();
MyAppExit(false);
};
}
@ -88,8 +88,10 @@ namespace v2rayN.Forms
case CloseReason.ApplicationExitCall:
case CloseReason.FormOwnerClosing:
case CloseReason.TaskManagerClosing:
MyAppExit(false);
break;
case CloseReason.WindowsShutDown:
MyAppExit();
MyAppExit(true);
break;
}
}
@ -105,14 +107,21 @@ namespace v2rayN.Forms
//}
}
private void MyAppExit()
private void MyAppExit(bool blWindowsShutDown)
{
try
{
v2rayHandler.V2rayStop();
//HttpProxyHandle.CloseHttpAgent(config);
HttpProxyHandle.UpdateSysProxy(config, true);
if (blWindowsShutDown)
{
HttpProxyHandle.ResetIEProxy4WindowsShutDown();
}
else
{
HttpProxyHandle.UpdateSysProxy(config, true);
}
ConfigHandler.SaveConfig(ref config);
statistics?.SaveToFile();

View File

@ -170,8 +170,6 @@ namespace v2rayN.HttpProxyHandler
}
else if (type == ESysProxyType.ForcedClear)
{
//TODO To be verified
Utils.RegWriteValue(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 0);
SysProxyHandle.ResetIEProxy();
}
else if (type == ESysProxyType.Unchanged)
@ -184,5 +182,17 @@ namespace v2rayN.HttpProxyHandler
}
return true;
}
public static void ResetIEProxy4WindowsShutDown()
{
try
{
//TODO To be verified
Utils.RegWriteValue(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 0);
}
catch
{
}
}
}
}

View File

@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("4.16")]
[assembly: AssemblyFileVersion("4.17")]