private string ConvertBytesToString(byte[] bytes) { //char[] chars = new char[iRx + 1]; //System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder(); //d.GetChars(bytes, 0, iRx, chars, 0); //string szData = new string(chars); //return szData; int messageKind; MessageBase msg; MessageComposer.Deserialize(bytes, out messageKind, out msg); MessageKind kind = (MessageKind)messageKind; switch (kind) { case MessageKind.SendingTime: SendingTimeMessage sendingTimeMessage = (SendingTimeMessage)msg; return("SendingTimeMessage: " + sendingTimeMessage.Message); case MessageKind.Simple: SimpleMessage simpleMessage = (SimpleMessage)msg; return("SimpleMessage: " + simpleMessage.Message); } return("UnKnown"); }
private string ConvertBytesToString(byte[] bytes) { int messageKind; MessageBase msg; MessageComposer.Deserialize(bytes, out messageKind, out msg); MessageKind kind = (MessageKind)messageKind; switch (kind) { case MessageKind.SendingTime: SendingTimeMessage sendingTimeMessage = (SendingTimeMessage)msg; return("SendingTimeMessage: " + sendingTimeMessage.Message); case MessageKind.Simple: SimpleMessage simpleMessage = (SimpleMessage)msg; return("SimpleMessage: " + simpleMessage.Message); } return("UnKnown"); }