void ParseIt(byte[] bytes)
{
try
{
// All messages sent FROM QT Server start with a Record ID
string RecordID = System.Text.Encoding.UTF8.GetString(bytes, 0, 2);
string message = "";
switch (RecordID)
{
// Parse a Level 1 FULL QUOTE message
case "S1":
message = ParseS1(bytes);
// rich text boxes don't like multiple threads changing it at the same time
RichTextBoxAppendText(richTextBoxTicks, message);
break;
// Parse a Level1 UPDATE QUOTE message
case "L1":
message = ParseL1(bytes);
RichTextBoxAppendText(richTextBoxTicks, message);
break;
// Parse a HISTORY TICK record
case "HT":
message = ParseHT(bytes);
RichTextBoxAppendText(richTextBoxHistory, message);
break;
// Parse a HISTORY OHLC record
case "HO":
message = ParseHO(bytes);
RichTextBoxAppendText(richTextBoxHistory, message);
break;
// Parse a HISTORY END record
case "HE":
message = ParseHO(bytes);
RichTextBoxAppendText(richTextBoxHistory, message);
break;
// Parse a LOGIN feedback
case "LO":
message = ParseXML(bytes);
RichTextBoxAppendText(richTextServerResponse, message);
break;
// Parse a ER feedback
case "ER":
message = ParseXML(bytes);
RichTextBoxAppendText(richTextServerResponse, message);
break;
case "OK":
message = ParseXML(bytes);
RichTextBoxAppendText(richTextServerResponse, message);
break;
case "ST":
message = ParseXML(bytes);
RichTextBoxAppendText(richTextServerResponse, message);
break;
default:
//ParseXML(bytes);
break;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}