public void SendFileMessage(string content, int selectedDialog, Dictionary <int, string> filesToLoad) { var files = GetCopyOfLoadedFilesDictionary(filesToLoad); if (participants[selectedDialog].Id == 0) { tcpSocket.Send(messageSerializer.Serialize(GetFileCommonMessage(content, files))); } else { var fileIndividualMessage = GetFileIndividualMessage(content, participants[selectedDialog].Id, files); if (fileIndividualMessage.SenderId != fileIndividualMessage.ReceiverId) { tcpSocket.Send(messageSerializer.Serialize(fileIndividualMessage)); } participants[selectedDialog].MessageHistory.Add(fileIndividualMessage); ReceiveMessageEvent(fileIndividualMessage); } }
public void SendMessageToClient(Messages message, ClientHandler clientHandler) { clientHandler.tcpSocket.Send(messageSerializer.Serialize(message)); }