public List<Coord> GetCoordinates(int Id)
{
List<Coord> loc = new List<Coord>();
string buffer = "";
List<string> stopString = new List<string>();
stopString.Add("$$SOE");
stopString.Add("$$EOE");
buffer = Conn.ReadUntil(">");
Conn.Write(String.Format("{0}\n", Id));
for (int i = 0; i <= _cmds.Count - 1; i++)
{
buffer += Conn.Read();//(_cmds[i].Key, 100);
Conn.WriteLine(_cmds[i].Value);
}
buffer += Conn.Read();
buffer = buffer.Split(stopString.ToArray(), StringSplitOptions.RemoveEmptyEntries)[1];
foreach (string set in Regex.Split(buffer.Trim(), "\r\n"))
{
string[] element = set.Split(',');
if (element.Length > 0)
{
Coord temp = new Coord();
temp.X = double.Parse(element[2]);
temp.Y = double.Parse(element[3]);
temp.Z = double.Parse(element[4]);
loc.Add(temp);
}
}
/*
TcpClient client = new TcpClient(HOST, PORT);
TelnetStream conn = new TelnetStream(client.GetStream());
conn.SetRemoteMode(TelnetOption.Echo, false);
Expector expect = new Expector(conn);
expect.Expect("Horizons>");
expect.SendLine(String.Format("{0}\n", Id));
for (var i = 0; i <= 14; i++)
{
expect.Expect(_cmds[i].Key);
expect.SendLine(_cmds[i].Value);
}
*/
return loc;
}