Files
UnrealEngineUWP/Engine/Source/Programs/MemoryProfiler2/CommandLineWrapper.cs
Ben Marsh 7598af0532 Update copyright notices to 2019.
#rb none
#lockdown Nick.Penwarden

[CL 4662404 by Ben Marsh in Main branch]
2018-12-14 13:41:00 -05:00

49 lines
1.3 KiB
C#

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
namespace MemoryProfiler2
{
/// <summary> Managed version of FCommandLineWrapper. </summary>
class FManagedCommandLineWrapper
{
private Process CmdProcess;
/// <summary> Constructor. Creates a command line process. </summary>
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 );
}
/// <summary> Terminates previously created process. </summary>
public void Terminate()
{
CmdProcess.Close();
}
/// <summary> Reads a line from the standard output and returns the data as a string. </summary>
public string ReadLine()
{
return CmdProcess.StandardOutput.ReadLine();
}
/// <summary> Write a string into the standard input. </summary>
public void Write( string Str )
{
CmdProcess.StandardInput.Write( Str );
}
}
}