forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptConsole.cs
More file actions
58 lines (48 loc) · 1.09 KB
/
ScriptConsole.cs
File metadata and controls
58 lines (48 loc) · 1.09 KB
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
57
58
using System;
using ScriptCs.Contracts;
using Mono.Terminal;
namespace ScriptCs.Hosting
{
public class ScriptConsole : IConsole
{
LineEditor _editor;
public ScriptConsole()
{
_editor = new LineEditor ("scriptcs");
}
public void Write(string value)
{
Console.Write(value);
}
public void WriteLine()
{
Console.WriteLine();
}
public void WriteLine(string value)
{
Console.WriteLine(value);
}
public string ReadLine(string prompt)
{
return _editor.Edit (prompt, "");
}
public void Clear()
{
Console.Clear();
}
public void Exit()
{
ResetColor();
Environment.Exit(0);
}
public void ResetColor()
{
Console.ResetColor();
}
public ConsoleColor ForegroundColor
{
get { return Console.ForegroundColor; }
set { Console.ForegroundColor = value; }
}
}
}