|
2 | 2 |
|
3 | 3 | namespace InEngine.Core.IO |
4 | 4 | { |
5 | | - public class Write |
| 5 | + public class Write : IWrite |
6 | 6 | { |
7 | 7 | public ConsoleColor InfoColor { get; set; } = ConsoleColor.Green; |
8 | 8 | public ConsoleColor WarningColor { get; set; } = ConsoleColor.Yellow; |
9 | 9 | public ConsoleColor ErrorColor { get; set; } = ConsoleColor.Red; |
10 | 10 | public ConsoleColor LineColor { get; set; } = ConsoleColor.White; |
11 | 11 |
|
12 | | - public Write Newline() |
| 12 | + public IWrite Newline() |
13 | 13 | { |
14 | 14 | Console.WriteLine(); |
15 | 15 | return this; |
16 | 16 | } |
17 | 17 |
|
18 | | - public Write Info(string val) |
| 18 | + public IWrite Info(string val) |
19 | 19 | { |
20 | | - ColoredLine(val, InfoColor); |
21 | | - return this; |
| 20 | + return ColoredLine(val, InfoColor); |
22 | 21 | } |
23 | 22 |
|
24 | | - public Write Error(string val) |
| 23 | + public IWrite Error(string val) |
25 | 24 | { |
26 | | - ColoredLine(val, ErrorColor); |
27 | | - return this; |
| 25 | + return ColoredLine(val, ErrorColor); |
28 | 26 | } |
29 | 27 |
|
30 | | - public Write Warning(string val) |
| 28 | + public IWrite Warning(string val) |
31 | 29 | { |
32 | | - ColoredLine(val, WarningColor); |
33 | | - return this; |
| 30 | + return ColoredLine(val, WarningColor); |
34 | 31 | } |
35 | 32 |
|
36 | | - public Write Line(string val) |
| 33 | + public IWrite Line(string val) |
37 | 34 | { |
38 | | - ColoredLine(val, LineColor); |
39 | | - return this; |
| 35 | + return ColoredLine(val, LineColor); |
40 | 36 | } |
41 | 37 |
|
42 | | - public static void ColoredLine(string val, ConsoleColor consoleColor) |
| 38 | + public IWrite ColoredLine(string val, ConsoleColor consoleColor) |
43 | 39 | { |
44 | 40 | Console.ForegroundColor = consoleColor; |
45 | 41 | Console.WriteLine(val); |
46 | 42 | Console.ResetColor(); |
| 43 | + return this; |
47 | 44 | } |
48 | 45 |
|
49 | | - |
50 | | - public Write InfoText(string val) |
| 46 | + public IWrite InfoText(string val) |
51 | 47 | { |
52 | | - ColoredText(val, InfoColor); |
53 | | - return this; |
| 48 | + return ColoredText(val, InfoColor); |
54 | 49 | } |
55 | 50 |
|
56 | | - public Write ErrorText(string val) |
| 51 | + public IWrite ErrorText(string val) |
57 | 52 | { |
58 | | - ColoredText(val, ErrorColor); |
59 | | - return this; |
| 53 | + return ColoredText(val, ErrorColor); |
60 | 54 | } |
61 | 55 |
|
62 | | - public Write WarningText(string val) |
| 56 | + public IWrite WarningText(string val) |
63 | 57 | { |
64 | | - ColoredText(val, WarningColor); |
65 | | - return this; |
| 58 | + return ColoredText(val, WarningColor); |
66 | 59 | } |
67 | 60 |
|
68 | | - public Write LineText(string val) |
| 61 | + public IWrite LineText(string val) |
69 | 62 | { |
70 | | - ColoredText(val, LineColor); |
71 | | - return this; |
| 63 | + return ColoredText(val, LineColor); |
72 | 64 | } |
73 | 65 |
|
74 | | - public static void ColoredText(string val, ConsoleColor consoleColor) |
| 66 | + public IWrite ColoredText(string val, ConsoleColor consoleColor) |
75 | 67 | { |
76 | 68 | Console.ForegroundColor = consoleColor; |
77 | 69 | Console.Write(val); |
78 | 70 | Console.ResetColor(); |
| 71 | + return this; |
79 | 72 | } |
80 | 73 | } |
81 | 74 | } |
0 commit comments