private void DoThreadJob() { if (Info.IsUploadJob && Info.TaskSettings.AdvancedSettings.AutoClearClipboard) { ClipboardHelpers.Clear(); } if (Info.Job == TaskJob.Job) { if (tempImage != null) { DoAfterCaptureJobs(); } DoFileJobs(); } else if (Info.Job == TaskJob.TextUpload && !string.IsNullOrEmpty(tempText)) { byte[] byteArray = Encoding.UTF8.GetBytes(tempText); Data = new MemoryStream(byteArray); } if (Info.IsUploadJob && Data != null && Data.CanSeek) { Data.Position = 0; } }
private void ThreadDoWork() { CreateTaskReferenceHelper(); try { StopRequested = !DoThreadJob(); OnImageReady(); if (!StopRequested) { if (Info.IsUploadJob && TaskHelpers.IsUploadAllowed()) { DoUploadJob(); } else { Info.Result.IsURLExpected = false; } } } finally { KeepImage = Image != null && Info.TaskSettings.GeneralSettings.ShowToastNotificationAfterTaskCompleted; Dispose(); if (EarlyURLCopied && (StopRequested || Info.Result == null || string.IsNullOrEmpty(Info.Result.URL)) && ClipboardHelpers.ContainsText()) { ClipboardHelpers.Clear(); } if ((Info.Job == TaskJob.Job || (Info.Job == TaskJob.FileUpload && Info.TaskSettings.AdvancedSettings.UseAfterCaptureTasksDuringFileUpload)) && Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.DeleteFile) && !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath)) { File.Delete(Info.FilePath); } } if (!StopRequested && Info.Result != null && Info.Result.IsURLExpected && !Info.Result.IsError) { if (string.IsNullOrEmpty(Info.Result.URL)) { AddErrorMessage(Resources.UploadTask_ThreadDoWork_URL_is_empty_); } else { DoAfterUploadJobs(); } } }
private bool DoThreadJob() { if (Info.IsUploadJob && Info.TaskSettings.AdvancedSettings.AutoClearClipboard) { ClipboardHelpers.Clear(); } if (Info.Job == TaskJob.Download || Info.Job == TaskJob.DownloadUpload) { bool downloadResult = DownloadFromURL(Info.Job == TaskJob.DownloadUpload); if (!downloadResult) { return(false); } else if (Info.Job == TaskJob.Download) { return(true); } } if (Info.Job == TaskJob.Job) { if (!DoAfterCaptureJobs()) { return(false); } DoFileJobs(); } else if (Info.Job == TaskJob.TextUpload && !string.IsNullOrEmpty(tempText)) { DoTextJobs(); } else if (Info.Job == TaskJob.FileUpload && Info.TaskSettings.AdvancedSettings.UseAfterCaptureTasksDuringFileUpload) { DoFileJobs(); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.DoOCR)) { DoOCR(); } if (Info.IsUploadJob && Data != null && Data.CanSeek) { Data.Position = 0; } return(true); }