public UploadFileMessage(PeerFile file) : base(PeerCommandType.UPLOAD_FILE) { var fileHead = Encoding.UTF8.GetBytes(file.ToString()); head = fileHead.ToArray(); body = file.FileBytes; }
public void UploadFile(string filePath) { var bytes = File.ReadAllBytes(filePath); var fileName = Path.GetFileName(filePath); var peerNewFile = new PeerFile(fileName, bytes); var message = new UploadFileMessage(peerNewFile); processor.Send(message); }