Skip to content

Commit

Permalink
up4.17
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed May 15, 2021
1 parent 7513ff8 commit a70b5ee
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
17 changes: 13 additions & 4 deletions v2rayN/v2rayN/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public MainForm()

Application.ApplicationExit += (sender, args) =>
{
MyAppExit();
MyAppExit(false);
};
}

Expand Down Expand Up @@ -88,8 +88,10 @@ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
case CloseReason.ApplicationExitCall:
case CloseReason.FormOwnerClosing:
case CloseReason.TaskManagerClosing:
MyAppExit(false);
break;
case CloseReason.WindowsShutDown:
MyAppExit();
MyAppExit(true);
break;
}
}
Expand All @@ -105,14 +107,21 @@ private void MainForm_Resize(object sender, EventArgs e)

//}
}
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();
Expand Down
14 changes: 12 additions & 2 deletions v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ public static bool UpdateSysProxy(Config config, bool forceDisable)
}
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)
Expand All @@ -184,5 +182,17 @@ public static bool UpdateSysProxy(Config config, bool forceDisable)
}
return true;
}

public static void ResetIEProxy4WindowsShutDown()
{
try
{
//TODO To be verified
Utils.RegWriteValue(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 0);
}
catch
{
}
}
}
}
2 changes: 1 addition & 1 deletion v2rayN/v2rayN/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("4.16")]
[assembly: AssemblyFileVersion("4.17")]

0 comments on commit a70b5ee

Please sign in to comment.