private void OnImageMessageRecievedHandler(ImageDataMessage message) { string path = Database.DatabaseManager.WriteImage(message, info); AddMessage(new ImageMessage(path, message.Sender)); Database.DatabaseManager.WriteMessages(Messages.ToList(), info); }
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); }
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) }