更新NTT,优化部分代码

This commit is contained in:
AmazingDM
2020-12-28 15:21:43 +08:00
parent ac3e39e9cd
commit ca0870889a
3 changed files with 26 additions and 22 deletions

View File

@@ -102,32 +102,36 @@ namespace Netch.Controllers
{
var tasks = new[]
{
Task.Factory.StartNew(pPrivoxyController.Stop),
Task.Factory.StartNew(() =>
Task.Run(pPrivoxyController.Stop),
Task.Run(() =>
{
PACServerHandle.Stop();
if (prevEnabled)
using var service = new ProxyService();
try
{
if (prevHTTP != "")
PACServerHandle.Stop();
if (prevEnabled)
{
using var service = new ProxyService
if (prevHTTP != "")
{
Server = prevHTTP,
Bypass = prevBypass
};
service.Global();
service.Server = prevHTTP;
service.Bypass = prevBypass;
service.Global();
}
if (prevPAC != "")
{
service.AutoConfigUrl = prevPAC;
service.Pac();
}
}
if (prevPAC != "")
else
{
using var service = new ProxyService
{
AutoConfigUrl = prevPAC
};
service.Pac();
service.Direct();
}
}
else
new ProxyService().Direct();
catch (Exception e)
{
Logging.Error($"{Name} 控制器出错:\n" + e);
}
})
};
Task.WaitAll(tasks);