Console.Waterworks.Core is the .Net Core version of Console.Waterworks.
https://www.craigoates.net/Software/project/8
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.0 KiB
67 lines
2.0 KiB
using System; |
|
using System.Collections.Generic; |
|
|
|
namespace Console.Waterworks.Core.Specialists |
|
{ |
|
class ConsoleIOSpecialist |
|
{ |
|
string _consolePrompt; |
|
|
|
internal void PrepareConsoleEnvironment() |
|
{ |
|
#if DEBUG |
|
System.Console.BackgroundColor = ConsoleColor.DarkGray; |
|
System.Console.Clear(); |
|
System.Console.ForegroundColor = ConsoleColor.White; |
|
System.Console.WriteLine(" ------------ "); |
|
System.Console.WriteLine("| DEBUG MODE |"); |
|
System.Console.WriteLine(" ------------ "); |
|
#endif |
|
} |
|
|
|
internal void SetConsoleTitle(string title) => System.Console.Title = title; |
|
|
|
internal void SetInputPrompt(string prompt) => _consolePrompt = prompt; |
|
|
|
internal void WriteProgramInfo(List<string> programInfo) |
|
{ |
|
foreach (var line in programInfo) |
|
{ |
|
if (!string.IsNullOrEmpty(line)) System.Console.WriteLine(line); |
|
} |
|
} |
|
|
|
internal string GetInputFromUser() |
|
{ |
|
System.Console.ForegroundColor = ConsoleColor.Green; |
|
System.Console.Write(_consolePrompt); |
|
System.Console.ResetColor(); |
|
return System.Console.ReadLine(); |
|
} |
|
|
|
internal void WriteOutputToConsole(string message) => System.Console.WriteLine(message); |
|
|
|
internal void LineBreak() => System.Console.WriteLine(); |
|
|
|
internal void WriteErrorSuffix() |
|
{ |
|
System.Console.ForegroundColor = ConsoleColor.Red; |
|
System.Console.Write("[ERROR] "); |
|
} |
|
|
|
internal void WriteErrorMessage(string message) |
|
{ |
|
System.Console.ForegroundColor = ConsoleColor.Red; |
|
System.Console.WriteLine($"[ERROR] {message}"); |
|
System.Console.ResetColor(); |
|
} |
|
|
|
internal void ResetConsoleColour() => System.Console.ResetColor(); |
|
|
|
internal void WriteInfoSuffix() |
|
{ |
|
System.Console.ForegroundColor = ConsoleColor.Yellow; |
|
System.Console.Write("[INFO] "); |
|
} |
|
} |
|
}
|
|
|