Files
UnrealEngineUWP/Engine/Source/Programs/GitDependencies/Log.cs
Ryan Durand 9ef3748747 Updating copyrights for Engine Programs.
#rnx
#rb none
#jira none

#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869242 in //Fortnite/Release-12.00/... via CL 10869536
#ROBOMERGE-BOT: FORTNITE (Main -> Dev-EngineMerge) (v613-10869866)

[CL 10870955 by Ryan Durand in Main branch]
2019-12-26 23:01:54 -05:00

81 lines
1.6 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GitDependencies
{
static class Log
{
static string CurrentStatus = "";
public static void WriteLine()
{
FlushStatus();
Console.WriteLine();
}
public static void WriteLine(string Line)
{
FlushStatus();
Console.WriteLine(Line);
}
public static void WriteLine(string Format, params object[] Args)
{
FlushStatus();
Console.WriteLine(Format, Args);
}
public static void WriteError(string Format, params object[] Args)
{
FlushStatus();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(Format, Args);
Console.ResetColor();
}
public static void WriteStatus(string Status)
{
// If the status is larger than the console width, truncate it
string NewStatus = Status;
try
{
int Width = Console.BufferWidth;
if(NewStatus.Length >= Width)
{
NewStatus = NewStatus.Substring(0, Width - 1);
}
}
catch(Exception)
{
}
// Write the new status, and clear any space after the end of the string if it's shorter
Console.Write("\r" + NewStatus);
if(NewStatus.Length < CurrentStatus.Length)
{
Console.Write(new string(' ', CurrentStatus.Length - NewStatus.Length) + "\r" + NewStatus);
}
CurrentStatus = NewStatus;
}
public static void WriteStatus(string Format, params object[] Args)
{
WriteStatus(String.Format(Format, Args));
}
public static void FlushStatus()
{
if(CurrentStatus.Length > 0)
{
Console.WriteLine();
CurrentStatus = "";
}
}
}
}