public void MsgReceive(string msg, Usertype type) { Invoke((MethodInvoker) delegate { string msgToAdd = type.ToString() + ": " + msg + "\r\n"; lstChatMsg.Items.Add(msgToAdd); }); }
public byte[] ChatMsg(string msg, Usertype usertype) { bw = new BinaryWriter(new MemoryStream()); bw.Write(MessageType.ChatMsg.ToString().EncryptText()); bw.Write(msg.EncryptText()); bw.Write(usertype.ToString().EncryptText()); bw.Close(); byte[] data = ((MemoryStream)bw.BaseStream).ToArray(); return(data); }