public static FriendOp Desserialize(byte[] data) { FriendOp result = new FriendOp(); using (MemoryStream m = new MemoryStream(data)) { using (BinaryReader reader = new BinaryReader(m)) { result.Id = reader.ReadInt32(); result.Friend = reader.ReadString(); result.Group = reader.ReadString(); } } return result; }
private void SendMessageFriendOp(int type, String Group, String Friend) { FriendOp op = new FriendOp(); op.Id = type; op.Group = Group; op.Friend = Friend; byte[] buff = op.Serialize(); ClientServerCommunicator.SendData(ClientServerCommunicator.server_socket, buff, 2); }