예제 #1
0
        private void OnImageMessageRecievedHandler(ImageDataMessage message)
        {
            string path = Database.DatabaseManager.WriteImage(message, info);

            AddMessage(new ImageMessage(path, message.Sender));
            Database.DatabaseManager.WriteMessages(Messages.ToList(), info);
        }
예제 #2
0
        public static string WriteImage(ImageDataMessage image, ConversationInfo info)
        {
            string imagePath = info.ImagePath;
            string fullpath  = imagePath + image.extension;

            Console.WriteLine(fullpath);
            File.WriteAllBytes(fullpath, image.ImageBytes());
            return(fullpath);
        }
예제 #3
0
        public void SendImageMessage(byte[] data, string extension)
        {
            ImageDataMessage imageDataMessage = new ImageDataMessage(Convert.ToBase64String(data), extension, info.MyUsername);
            string           path             = Database.DatabaseManager.WriteImage(imageDataMessage, info);

            AddMessage(new ImageMessage(path, info.MyUsername));
            Database.DatabaseManager.WriteMessages(Messages.ToList(), info);
            Runner.Secondary(() => socket.SendMessage(imageDataMessage, MessageType.ImageMessage));
            //socket.SendImageMessage(imageDataMessage)
        }