mirror of
https://github.com/netchx/netch.git
synced 2026-05-05 22:35:48 +08:00
refactor: TestFakeDNS
This commit is contained in:
@@ -228,33 +228,11 @@ namespace Netch.Controllers
|
||||
|
||||
public bool TestFakeDNS()
|
||||
{
|
||||
var exited = false;
|
||||
var helpStr = new StringBuilder();
|
||||
try
|
||||
{
|
||||
void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (e.Data == null)
|
||||
{
|
||||
exited = true;
|
||||
return;
|
||||
}
|
||||
|
||||
helpStr.Append(e.Data);
|
||||
}
|
||||
|
||||
InitInstance("-h");
|
||||
// Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
Instance.Start();
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
while (!exited)
|
||||
{
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
return helpStr.ToString().Contains("-fakeDns");
|
||||
return Instance.StandardError.ReadToEnd().Contains("-fakeDns");
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user