Make the menu fancy

This commit is contained in:
Matt Nadareski
2016-03-25 00:24:30 -07:00
parent bbddf0f6c6
commit 0b1a0016f0

View File

@@ -12,11 +12,12 @@ namespace DATabase
private static string _dbName = "DATabase.sqlite"; private static string _dbName = "DATabase.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;"; private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
private static string _header = private static string _header =
@"+-------------------------------------------------------------------+ @"+-----------------------------------------------------------------------------+
| DATabase 0.0.5.0 | | DATabase 0.0.5.0 |
| | | |
| by Matt Nadareski (darksabre76) | | by Matt Nadareski (darksabre76) |
+-------------------------------------------------------------------+"; +-----------------------------------------------------------------------------+
";
static void Main(string[] args) static void Main(string[] args)
{ {
@@ -95,14 +96,26 @@ namespace DATabase
return; return;
} }
private static void PrintHeader()
{
ConsoleColor formertext = Console.ForegroundColor;
ConsoleColor formerback = Console.BackgroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine(_header);
Console.ForegroundColor = formertext;
Console.BackgroundColor = formerback;
}
private static void ShowMainMenu() private static void ShowMainMenu()
{ {
Console.Clear();
string selection = ""; string selection = "";
while (selection.ToLowerInvariant() != "x") while (selection.ToLowerInvariant() != "x")
{ {
Console.Clear(); Console.Clear();
Console.WriteLine(_header + @" PrintHeader();
MAIN MENU Console.WriteLine(@"MAIN MENU
=========================== ===========================
Make a selection: Make a selection:
@@ -145,6 +158,7 @@ Make a selection:
} }
Console.Clear(); Console.Clear();
Console.WriteLine("Thank you for using DATabase!"); Console.WriteLine("Thank you for using DATabase!");
Console.ResetColor();
} }
private static void Help() private static void Help()
@@ -184,8 +198,8 @@ unless prefixed by 'input='
while (selection.ToLowerInvariant() != "b") while (selection.ToLowerInvariant() != "b")
{ {
Console.Clear(); Console.Clear();
Console.WriteLine(_header + @" PrintHeader();
IMPORT MENU Console.WriteLine( @"IMPORT MENU
=========================== ===========================
Enter the name of a DAT file or folder containing DAT files Enter the name of a DAT file or folder containing DAT files
or 'b' to go back to the previous menu:"); or 'b' to go back to the previous menu:");
@@ -238,8 +252,8 @@ or 'b' to go back to the previous menu:");
while (selection.ToLowerInvariant() != "b") while (selection.ToLowerInvariant() != "b")
{ {
Console.Clear(); Console.Clear();
Console.WriteLine(_header + @" PrintHeader();
GENERATE MENU Console.WriteLine(@"GENERATE MENU
=========================== ===========================
Make a selection: Make a selection:
@@ -296,8 +310,8 @@ Make a selection:
while (selection.ToLowerInvariant() != "b") while (selection.ToLowerInvariant() != "b")
{ {
Console.Clear(); Console.Clear();
Console.WriteLine(_header + @" PrintHeader();
CONVERT MENU Console.WriteLine(@"CONVERT MENU
=========================== ===========================
Enter the name of a DAT file to convert from RV to XML Enter the name of a DAT file to convert from RV to XML
or 'b' to go back to the previous menu: or 'b' to go back to the previous menu: