mirror of https://github.com/2dust/v2rayN
parent
7513ff860b
commit
a70b5eeef5
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in New Issue