Files
2021-01-21 14:27:11 -06:00

45 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MKVTest
{
class MkvWriter
{
public bool WriteMkvMetaData(string commandString)
{
var process = new Process();
var startInfo = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Normal,
FileName = "cmd.exe",
Arguments = commandString
};
if (!CheckFiles())
{
throw new FileNotFoundException("Required files, mkvpropedit.exe and mkvinfo.exe not found.");
}
process.StartInfo = startInfo;
process.Start();
while (!process.HasExited)
{
}
if (process.ExitCode == 0) return true;
var error = File.ReadAllLines("temp.txt");
throw new ApplicationException(error.ToString());
}
public static bool CheckFiles()
{
return File.Exists("mkvpropedit.exe") && File.Exists("mkvinfo.exe");
}
}
}