This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsoleAssistance.cs
executable file
·56 lines (43 loc) · 1.76 KB
/
ConsoleAssistance.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bili_live_dm_console {
public static class ConsoleAssistance {
/// <summary>
/// the update of console.writeline()
/// </summary>
/// <param name="str"></param>
/// <param name="foreground"></param>
/// <param name="background"></param>
/// <param name="previousForeground"></param>
/// <param name="previousBackground"></param>
public static void WriteLine(string str, ConsoleColor foreground = ConsoleColor.White,
ConsoleColor background = ConsoleColor.Black) {
Console.BackgroundColor = background;
Console.ForegroundColor = foreground;
Console.WriteLine(str);
//restore
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White;
}
/// <summary>
/// the update of console.write()
/// </summary>
/// <param name="str"></param>
/// <param name="foreground"></param>
/// <param name="background"></param>
/// <param name="previousForeground"></param>
/// <param name="previousBackground"></param>
public static void Write(string str, ConsoleColor foreground = ConsoleColor.White,
ConsoleColor background = ConsoleColor.Black) {
Console.BackgroundColor = background;
Console.ForegroundColor = foreground;
Console.Write(str);
//restore
Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White;
}
}
}