wasSharpNET – Blame information for rev 8
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
7 | office | 1 | /////////////////////////////////////////////////////////////////////////// |
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
||
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
||
5 | /////////////////////////////////////////////////////////////////////////// |
||
6 | |||
7 | using System; |
||
8 | |||
9 | namespace wasSharpNET.Console |
||
10 | { |
||
11 | public static class ConsoleExtensions |
||
12 | { |
||
13 | public static void WriteLine(this object data, ConsoleColor foreground = ConsoleColor.White, |
||
14 | ConsoleColor background = ConsoleColor.Black) |
||
15 | { |
||
16 | var cFG = System.Console.ForegroundColor; |
||
17 | var cBG = System.Console.BackgroundColor; |
||
18 | System.Console.ForegroundColor = foreground; |
||
19 | System.Console.BackgroundColor = background; |
||
20 | System.Console.WriteLine(data); |
||
21 | System.Console.ForegroundColor = cFG; |
||
22 | System.Console.BackgroundColor = cBG; |
||
23 | } |
||
24 | |||
25 | public static void Write(this object data, ConsoleColor foreground = ConsoleColor.White, |
||
26 | ConsoleColor background = ConsoleColor.Black) |
||
27 | { |
||
28 | var cFG = System.Console.ForegroundColor; |
||
29 | var cBG = System.Console.BackgroundColor; |
||
30 | System.Console.ForegroundColor = foreground; |
||
31 | System.Console.BackgroundColor = background; |
||
32 | System.Console.Write(data); |
||
33 | System.Console.ForegroundColor = cFG; |
||
34 | System.Console.BackgroundColor = cBG; |
||
35 | } |
||
36 | } |
||
37 | } |