в моем текущем классе я использую несколько "netsh" вызовов.Поскольку я не хочу использовать CMD для этого, есть ли способ в c # сделать это иначе и, возможно, сохранить вывод в объект?
private void ExecuteNetshCheckUrlacl(string protocol, int port, string testfilenamepath)
{
OutputHandler.ColorCMDOutput(" + Port " + port, ConsoleColor.Gray);
Process netsh = new Process();
netsh.StartInfo.FileName = "netsh.exe";
netsh.StartInfo.Arguments = "http show urlacl " + protocol + "://+:" + port.ToString() + "/";
netsh.StartInfo.UseShellExecute = false;
netsh.StartInfo.RedirectStandardOutput = true;
netsh.Start();
{
using (StreamReader reader = netsh.StandardOutput)
{
string result = reader.ReadToEnd();
OutputHandler.WriteDataToFileOrOverwrite(testfilenamepath, result);
}
}
netsh.WaitForExit();
netsh.Dispose();
}