Skip to content

Commit

Permalink
-Add configuration options for colors of ASCII banners
Browse files Browse the repository at this point in the history
  • Loading branch information
e4rthdog committed Apr 12, 2020
1 parent bb44097 commit 9387f4d
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
56 changes: 55 additions & 1 deletion App.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,59 @@
<add key="VATSIMURL" value="http://cluster.data.vatsim.net/" />
<add key="VATSIMDATAFILE" value="vatsim-data.txt" />
<add key="VATSIMINTERVAL" value="5" />
<add key="ASCIICOLORVATBOARD" value="7" />
<add key="ASCIICOLORARRIVALS" value="2" />
<add key="ASCIICOLORDEPARTURES" value="6" />
</appSettings>
</configuration>
</configuration>

<!--
COLOR CODES
Black 0
The color black.
Blue 9
The color blue.
Cyan 11
The color cyan (blue-green).
DarkBlue 1
The color dark blue.
DarkCyan 3
The color dark cyan (dark blue-green).
DarkGray 8
The color dark gray.
DarkGreen 2
The color dark green.
DarkMagenta 5
The color dark magenta (dark purplish-red).
DarkRed 4
The color dark red.
DarkYellow 6
The color dark yellow (ochre).
Gray 7
The color gray.
Green 10
The color green.
Magenta 13
The color magenta (purplish-red).
Red 12
The color red.
White 15
The color white.
Yellow 14
The color yellow.-->
10 changes: 7 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ static void Main(string[] args)



Util.typeWriter(Util.ascVATSIM, 4, ConsoleColor.DarkGray);
Util.typeWriter(
Util.ascVATSIM,
4,
(ConsoleColor)Convert.ToInt32(ConfigurationManager.AppSettings.Get("ASCIICOLORVATBOARD")));

Util.WriteLn(
"\n(c) 2020 - Elias Stassinos - More Info: http://www.estassinos.com/vatboard ",
ConsoleColor.DarkGreen,
Expand Down Expand Up @@ -73,12 +77,12 @@ static void Main(string[] args)
});

Console.Clear();
Util.typeWriter(Util.ascARRIVALS, 4, ConsoleColor.DarkGray);
Util.typeWriter(Util.ascARRIVALS, 4, (ConsoleColor)Convert.ToInt32(ConfigurationManager.AppSettings.Get("ASCIICOLORARRIVALS")));
Util.typeWriter(tableArrivals.ToString(), 4);
System.Threading.Thread.Sleep(5000);

Console.Clear();
Util.typeWriter(Util.ascDEPARTURES, 4, ConsoleColor.DarkGray);
Util.typeWriter(Util.ascDEPARTURES, 4, (ConsoleColor)Convert.ToInt32(ConfigurationManager.AppSettings.Get("ASCIICOLORDEPARTURES")));
Util.typeWriter(tableDepartures.ToString(), 4);
System.Threading.Thread.Sleep(refreshInterval * 1000);
} while (true);
Expand Down
7 changes: 5 additions & 2 deletions Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ public static double rad2deg(double rad)
return (rad / Math.PI * 180.0);
}

public static void typeWriter(string _str, int speed, ConsoleColor _col = ConsoleColor.White)
public static void typeWriter(string _str, int speed, ConsoleColor _colFG = ConsoleColor.White, ConsoleColor _colBG = ConsoleColor.Black)
{
ConsoleColor currentForeground = Console.ForegroundColor;
Console.ForegroundColor = _col;
ConsoleColor currentBackground = Console.BackgroundColor;
Console.ForegroundColor = _colFG;
Console.BackgroundColor = _colBG;
for (int i = 0; i < _str.Length; i++)
{
Console.Write(_str[i]);
Expand All @@ -125,6 +127,7 @@ public static void typeWriter(string _str, int speed, ConsoleColor _col = Consol
}
}
Console.ForegroundColor = currentForeground;
Console.BackgroundColor = currentBackground;
}

public static List<Airport> LoadAirports()
Expand Down

0 comments on commit 9387f4d

Please sign in to comment.