/// <summary> /// Uploads the screenshot to the currently configured server. /// </summary> /// <returns> /// A value indicating whether the upload succeeded without errors. /// </returns> public bool Upload() { var args = new UploadingEventArgs(GetFileName()); OnUploading(args); if (args.Cancel) { return(true); } var target = PathUtility.UriCombine(Program.Config.FtpServerPath, args.FileName); var uploader = Uploader.Create(Program.Config); uploader.DuplicateFileFound += (sender, e) => { OnDuplicateFileFound(e); }; if (IsFile && Program.Config.CheckForDuplicateFiles) { var name = Path.GetFileNameWithoutExtension(OriginalFileName); if (!uploader.CheckDuplicates(name, ref target)) { return(false); } } using (var stream = new MemoryStream()) { Save(stream); if (uploader.Upload(stream, ref target)) { ServerPath = target; return(true); } } return(false); }
/// <summary> /// Deletes the screenshot from the server. /// </summary> /// <returns>A value indicating whether the deletion succeeded.</returns> public bool Delete() { var uploader = Uploader.Create(Program.Config); return(uploader.Delete(ServerPath)); }