-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommandLine.cs
More file actions
36 lines (31 loc) · 767 Bytes
/
CommandLine.cs
File metadata and controls
36 lines (31 loc) · 767 Bytes
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
using System;
using IqFeed.Core;
namespace IqFeed
{
public class CommandLine : CommanderBase
{
public CommandLine(Action<string> RequestTracer, Action<string> ResponseTracer) : base(RequestTracer, ResponseTracer)
{
}
public void Run()
{
string cmd = "";
while (true) {
try {
history.Connect();
history.SetProtocol();
Console.Write("cmd <- ");
cmd = Console.ReadLine().Trim();
if (!String.IsNullOrWhiteSpace(cmd) && cmd[0] != '\0') {
if (cmd.ToLower().TrimStart().IndexOf("quit", StringComparison.CurrentCulture) == 0) {
return;
}
Execute(cmd);
}
} catch (Exception e) {
Console.Error.WriteLine("Error {0} processing command {1}", e.Message, cmd);
}
}
}
}
}