Example #1
0
 public void FromBytes(byte[] bytes)
 {
     if (bytes[0] == '0') {
         ContentType = typeof(GoodbyeMessageContent);
         return;
     }
     ContentType = MessageCodes.GetType(bytes);
     BinaryFormatter formatter = new BinaryFormatter();
     Content = (MessageContent) formatter.Deserialize(new MemoryStream(bytes, 2, bytes.Length-2));
 }
Example #2
0
 public GenericMessage(Type t, MessageContent content)
 {
     ContentType = t;
     ContentCode = MessageCodes.FromType(t);
     Content = content;
 }