更新 Controller类

改善错误输出
This commit is contained in:
ChsBuffer
2020-07-17 19:18:29 +08:00
parent a779295525
commit 281c67aced
17 changed files with 195 additions and 254 deletions

View File

@@ -9,15 +9,13 @@ namespace Netch.Controllers
{
public PrivoxyController()
{
MainFile = "Privoxy";
ExtFiles = new[] {"default.conf"};
InitCheck();
Name = "Privoxy";
MainFile = "Privoxy.exe";
RedirectStd = false;
}
public bool Start(Server server, Mode mode)
{
if (!Ready) return false;
var isSocks5 = server.Type == "Socks5";
var socks5Port = isSocks5 ? server.Port : Global.Settings.Socks5LocalPort;
var text = File.ReadAllText("bin\\default.conf")
@@ -28,7 +26,7 @@ namespace Netch.Controllers
text = text.Replace("/ 127.0.0.1", $"/ {server.Hostname}");
File.WriteAllText("data\\privoxy.conf", text);
Instance = GetProcess("bin\\Privoxy.exe", false);
Instance = GetProcess();
Instance.StartInfo.Arguments = "..\\data\\privoxy.conf";
Instance.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
Instance.StartInfo.UseShellExecute = true;