mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-01-14 22:18:43 +00:00
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace LibMpcTest
|
|
{
|
|
internal class MpdServerTest : IDisposable
|
|
{
|
|
private Process _process;
|
|
|
|
public MpdServerTest()
|
|
{
|
|
var serverPath = Path.Combine(AppContext.BaseDirectory, "Server");
|
|
|
|
MpdConf.Create(serverPath);
|
|
|
|
var mpdExePath = Path.Combine(serverPath, "mpd.exe");
|
|
var mpdConfPath = Path.Combine(serverPath, "mpd.conf");
|
|
|
|
_process = new Process
|
|
{
|
|
StartInfo = new ProcessStartInfo
|
|
{
|
|
FileName = mpdExePath,
|
|
WorkingDirectory = serverPath,
|
|
Arguments = string.Join(" ", mpdConfPath, "-v"),
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = true,
|
|
RedirectStandardError = true,
|
|
CreateNoWindow = true,
|
|
}
|
|
};
|
|
|
|
_process.Start();
|
|
var logOutput = _process.StandardOutput.ReadToEnd();
|
|
var logError = _process.StandardError.ReadToEnd();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_process?.Kill();
|
|
_process?.Dispose();
|
|
_process = null;
|
|
}
|
|
}
|
|
} |