/**
* Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
namespace MemoryProfiler2
{
/// Managed version of FCommandLineWrapper.
class FManagedCommandLineWrapper
{
private Process CmdProcess;
/// Constructor. Creates a command line process.
public FManagedCommandLineWrapper( string Filename, string Args )
{
ProcessStartInfo StartInfo = new ProcessStartInfo( Filename, Args );
// Don't create any window and redirect all communication.
StartInfo.CreateNoWindow = true;
StartInfo.RedirectStandardInput = true;
StartInfo.RedirectStandardOutput = true;
StartInfo.UseShellExecute = false;
CmdProcess = Process.Start( StartInfo );
}
/// Terminates previously created process.
public void Terminate()
{
CmdProcess.Close();
}
/// Reads a line from the standard output and returns the data as a string.
public string ReadLine()
{
return CmdProcess.StandardOutput.ReadLine();
}
/// Write a string into the standard input.
public void Write( string Str )
{
CmdProcess.StandardInput.Write( Str );
}
}
}