示例#1
0
        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);
            }
        }
示例#2
0
 public void SendMessageToClient(Messages message, ClientHandler clientHandler)
 {
     clientHandler.tcpSocket.Send(messageSerializer.Serialize(message));
 }