更新 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

@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using Netch.Utils;
namespace Netch.Controllers
@@ -8,10 +7,8 @@ namespace Netch.Controllers
{
public DNSController()
{
Name = "dns Service";
MainFile = "unbound";
ExtFiles = new[] {"unbound-service.conf", "forward-zone.conf"};
InitCheck();
Name = "DNS Service";
MainFile = "unbound.exe";
}
/// <summary>
@@ -20,9 +17,7 @@ namespace Netch.Controllers
/// <returns></returns>
public bool Start()
{
if (!Ready) return false;
Instance = GetProcess("bin\\unbound.exe");
Instance = GetProcess();
Instance.StartInfo.Arguments = "-c unbound-service.conf -v";
Instance.OutputDataReceived += OnOutputDataReceived;
@@ -42,11 +37,6 @@ namespace Netch.Controllers
}
}
private void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
Write(e.Data);
}
public override void Stop()
{
StopInstance();