Example #1
0
 public void Upload()
 {
     if (IsItemSelected && SelectedItem.IsFileExist)
     {
         UploadManager.UploadFile(SelectedItem.Info.FilePath);
     }
 }
Example #2
0
        public static void OpenVideoThumbnailer(TaskSettings taskSettings = null)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            if (!CheckFFmpeg(taskSettings))
            {
                return;
            }

            Program.Settings.VideoThumbnailOptions.DefaultOutputDirectory = taskSettings.CaptureFolder;
            VideoThumbnailerForm thumbnailerForm = new VideoThumbnailerForm(taskSettings.CaptureSettings.FFmpegOptions.CLIPath, Program.Settings.VideoThumbnailOptions);

            thumbnailerForm.ThumbnailsTaken += thumbnails =>
            {
                if (Program.Settings.VideoThumbnailOptions.UploadThumbnails)
                {
                    foreach (VideoThumbnailInfo thumbnailInfo in thumbnails)
                    {
                        UploadManager.UploadFile(thumbnailInfo.Filepath, taskSettings);
                    }
                }
            };
            thumbnailerForm.Show();
        }
Example #3
0
        public async Task UseCommandLineArgs(List <CLICommand> commands)
        {
            TaskSettings taskSettings = FindCLITask(commands);

            foreach (CLICommand command in commands)
            {
                DebugHelper.WriteLine("CommandLine: " + command);

                if (command.IsCommand)
                {
                    if (CheckCustomUploader(command) || CheckImageEffect(command) || await CheckCLIHotkey(command) || await CheckCLIWorkflow(command) ||
                        CheckNativeMessagingInput(command))
                    {
                    }

                    continue;
                }

                if (URLHelpers.IsValidURL(command.Command))
                {
                    UploadManager.DownloadAndUploadFile(command.Command, taskSettings);
                }
                else
                {
                    UploadManager.UploadFile(command.Command, taskSettings);
                }
            }
        }
Example #4
0
        public void AddWatchFolder(WatchFolderSettings watchFolderSetting, TaskSettings taskSettings)
        {
            if (!IsExist(watchFolderSetting))
            {
                if (!taskSettings.WatchFolderList.Contains(watchFolderSetting))
                {
                    taskSettings.WatchFolderList.Add(watchFolderSetting);
                }

                WatchFolder watchFolder = new WatchFolder {
                    Settings = watchFolderSetting, TaskSettings = taskSettings
                };
                watchFolder.FileWatcherTrigger += path =>
                {
                    TaskSettings taskSettingsCopy = TaskSettings.GetSafeTaskSettings(taskSettings);
                    UploadManager.UploadFile(path, taskSettingsCopy);
                };
                WatchFolders.Add(watchFolder);

                if (taskSettings.WatchFolderEnabled)
                {
                    watchFolder.Enable();
                }
            }
        }
        public void AddWatchFolder(WatchFolderSettings watchFolderSetting, TaskSettings taskSettings)
        {
            if (!IsExist(watchFolderSetting))
            {
                if (!taskSettings.WatchFolderList.Contains(watchFolderSetting))
                {
                    taskSettings.WatchFolderList.Add(watchFolderSetting);
                }

                WatchFolder watchFolder = new WatchFolder {
                    Settings = watchFolderSetting, TaskSettings = taskSettings
                };
                watchFolder.FileWatcherTrigger += origPath =>
                {
                    TaskSettings taskSettingsCopy = TaskSettings.GetSafeTaskSettings(taskSettings);
                    string       destPath         = origPath;
                    if (watchFolderSetting.MoveFilesToScreenshotsFolder)
                    {
                        destPath = Helpers.GetUniqueFilePath(Path.Combine(Program.ScreenshotsFolder, Path.GetFileName(origPath)));
                        Helpers.CreateDirectoryFromFilePath(destPath);
                        File.Move(origPath, destPath);
                    }
                    UploadManager.UploadFile(destPath, taskSettingsCopy);
                };
                WatchFolders.Add(watchFolder);

                if (taskSettings.WatchFolderEnabled)
                {
                    watchFolder.Enable();
                }
            }
        }
Example #6
0
        private void NotificationForm_MouseClick(object sender, MouseEventArgs e)
        {
            tDuration.Stop();

            if (e.Button == MouseButtons.Left)
            {
                switch (ToastConfig.Action)
                {
                case ToastClickAction.AnnotateImage:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath) && Helpers.IsImageFile(ToastConfig.FilePath))
                    {
                        TaskHelpers.AnnotateImage(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.CopyImageToClipboard:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        ClipboardHelpers.CopyImageFromFile(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.OpenFile:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        Helpers.OpenURL(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.OpenFolder:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        Helpers.OpenFolderWithFile(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.OpenUrl:
                    if (!string.IsNullOrEmpty(ToastConfig.URL))
                    {
                        Helpers.OpenURL(ToastConfig.URL);
                    }
                    break;

                case ToastClickAction.Upload:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        UploadManager.UploadFile(ToastConfig.FilePath);
                    }
                    break;
                }
            }

            Close();
        }
Example #7
0
        private void DropForm_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, true);
            UploadManager.UploadFile(files);

            if (isHovered)
            {
                SelectBitmap(logo, DropOpacity);
                isHovered = false;
            }
        }
Example #8
0
        private void ExecuteAction(ToastClickAction action)
        {
            switch (action)
            {
            case ToastClickAction.AnnotateImage:
                if (!string.IsNullOrEmpty(Config.FilePath) && Helpers.IsImageFile(Config.FilePath))
                {
                    TaskHelpers.AnnotateImageFromFile(Config.FilePath);
                }
                break;

            case ToastClickAction.CopyImageToClipboard:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    ClipboardHelpers.CopyImageFromFile(Config.FilePath);
                }
                break;

            case ToastClickAction.CopyUrl:
                if (!string.IsNullOrEmpty(Config.URL))
                {
                    ClipboardHelpers.CopyText(Config.URL);
                }
                break;

            case ToastClickAction.OpenFile:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    Helpers.OpenFile(Config.FilePath);
                }
                break;

            case ToastClickAction.OpenFolder:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    Helpers.OpenFolderWithFile(Config.FilePath);
                }
                break;

            case ToastClickAction.OpenUrl:
                if (!string.IsNullOrEmpty(Config.URL))
                {
                    URLHelpers.OpenURL(Config.URL);
                }
                break;

            case ToastClickAction.Upload:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    UploadManager.UploadFile(Config.FilePath);
                }
                break;
            }
        }
 public void UseCommandLineArgs(string[] args)
 {
     if (args != null && args.Length > 1)
     {
         for (int i = 1; i < args.Length; i++)
         {
             if (args[i].Equals("-clipboardupload", StringComparison.InvariantCultureIgnoreCase))
             {
                 UploadManager.ClipboardUpload();
             }
             else if (args[i][0] != '-')
             {
                 UploadManager.UploadFile(args[i]);
             }
         }
     }
 }
Example #10
0
        public void AddWatchFolder(WatchFolderSettings watchFolderSetting, TaskSettings taskSettings)
        {
            if (!IsExist(watchFolderSetting))
            {
                if (!taskSettings.WatchFolderList.Contains(watchFolderSetting))
                {
                    taskSettings.WatchFolderList.Add(watchFolderSetting);
                }

                WatchFolder watchFolder = new WatchFolder();
                watchFolder.Settings     = watchFolderSetting;
                watchFolder.TaskSettings = taskSettings;

                watchFolder.FileWatcherTrigger += origPath =>
                {
                    TaskSettings taskSettingsCopy = TaskSettings.GetSafeTaskSettings(taskSettings);
                    string       destPath         = origPath;

                    if (watchFolderSetting.MoveFilesToScreenshotsFolder)
                    {
                        string screenshotsFolder = TaskHelpers.GetScreenshotsFolder(taskSettingsCopy);
                        string fileName          = Path.GetFileName(origPath);
                        destPath = TaskHelpers.HandleExistsFile(screenshotsFolder, fileName, taskSettingsCopy);
                        FileHelpers.CreateDirectoryFromFilePath(destPath);
                        File.Move(origPath, destPath);
                    }

                    UploadManager.UploadFile(destPath, taskSettingsCopy);
                };

                WatchFolders.Add(watchFolder);

                if (taskSettings.WatchFolderEnabled)
                {
                    watchFolder.Enable();
                }
            }
        }
Example #11
0
        public async void StartRecording(TaskSettings TaskSettings)
        {
            if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.AVICommandLine)
            {
                if (!Program.Settings.VideoEncoders.IsValidIndex(TaskSettings.CaptureSettings.VideoEncoderSelected))
                {
                    MessageBox.Show("There is no valid CLI video encoder selected.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else if (!Program.Settings.VideoEncoders[TaskSettings.CaptureSettings.VideoEncoderSelected].IsValid())
                {
                    MessageBox.Show("There is a problem with the CLI video encoder file path.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            SelectRegion();
            Screenshot.CaptureCursor = TaskSettings.CaptureSettings.ShowCursor;

            if (IsRecording || CaptureRectangle.IsEmpty || screenRecorder != null)
            {
                return;
            }

            IsRecording = true;

            TrayIcon.Icon    = Resources.control_record_yellow.ToIcon();
            TrayIcon.Visible = true;

            string path = "";

            try
            {
                using (ScreenRegionManager screenRegionManager = new ScreenRegionManager())
                {
                    screenRegionManager.Start(CaptureRectangle);

                    await TaskEx.Run(() =>
                    {
                        if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.AVI)
                        {
                            path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, "avi"));
                        }
                        else
                        {
                            path = Program.ScreenRecorderCacheFilePath;
                        }

                        float duration = TaskSettings.CaptureSettings.ScreenRecordFixedDuration ? TaskSettings.CaptureSettings.ScreenRecordDuration : 0;

                        screenRecorder = new ScreenRecorder(TaskSettings.CaptureSettings.ScreenRecordFPS, duration, CaptureRectangle, path,
                                                            TaskSettings.CaptureSettings.ScreenRecordOutput);

                        int delay = (int)(TaskSettings.CaptureSettings.ScreenRecordStartDelay * 1000);

                        if (delay > 0)
                        {
                            Thread.Sleep(delay);
                        }

                        screenRegionManager.ChangeColor();

                        this.InvokeSafe(() => TrayIcon.Icon = Resources.control_record.ToIcon());

                        screenRecorder.StartRecording();
                    });
                }

                if (screenRecorder != null && TaskSettings.CaptureSettings.ScreenRecordOutput != ScreenRecordOutput.AVI)
                {
                    TrayIcon.Icon = Resources.camcorder__pencil.ToIcon();

                    await TaskEx.Run(() =>
                    {
                        switch (TaskSettings.CaptureSettings.ScreenRecordOutput)
                        {
                        case ScreenRecordOutput.GIF:
                            path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, "gif"));
                            screenRecorder.SaveAsGIF(path, TaskSettings.ImageSettings.ImageGIFQuality);
                            break;

                        case ScreenRecordOutput.AVICommandLine:
                            VideoEncoder encoder = Program.Settings.VideoEncoders[TaskSettings.CaptureSettings.VideoEncoderSelected];
                            path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, encoder.OutputExtension));
                            screenRecorder.EncodeUsingCommandLine(encoder, path);
                            break;
                        }
                    });
                }
            }
            finally
            {
                if (screenRecorder != null)
                {
                    if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.AVICommandLine &&
                        !string.IsNullOrEmpty(screenRecorder.CachePath) && File.Exists(screenRecorder.CachePath))
                    {
                        File.Delete(screenRecorder.CachePath);
                    }

                    screenRecorder.Dispose();
                    screenRecorder = null;
                }

                if (TrayIcon.Visible)
                {
                    TrayIcon.Visible = false;
                }
            }

            if (!string.IsNullOrEmpty(path) && File.Exists(path))
            {
                if (TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.UploadImageToHost))
                {
                    UploadManager.UploadFile(path, TaskSettings);
                }
                else
                {
                    if (TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.CopyFilePathToClipboard))
                    {
                        ClipboardHelpers.CopyText(path);
                    }

                    TaskHelpers.ShowResultNotifications(path, TaskSettings, path);
                }
            }

            IsRecording = false;
        }
Example #12
0
 private void tsbFileUpload_Click(object sender, EventArgs e)
 {
     UploadManager.UploadFile();
 }
Example #13
0
        private void HandleTask(TaskSettings taskSettings)
        {
            TaskSettings safeTaskSettings = TaskSettings.GetSafeTaskSettings(taskSettings);

            switch (safeTaskSettings.Job)
            {
            case HotkeyType.StopUploads:
                TaskManager.StopAllTasks();
                break;

            case HotkeyType.ClipboardUpload:
                UploadManager.ClipboardUpload(safeTaskSettings);
                break;

            case HotkeyType.ClipboardUploadWithContentViewer:
                UploadManager.ClipboardUploadWithContentViewer(safeTaskSettings);
                break;

            case HotkeyType.FileUpload:
                UploadManager.UploadFile(safeTaskSettings);
                break;

            case HotkeyType.DragDropUpload:
                TaskHelpers.OpenDropWindow();
                break;

            case HotkeyType.PrintScreen:
                CaptureScreenshot(CaptureType.Screen, safeTaskSettings, false);
                break;

            case HotkeyType.ActiveWindow:
                CaptureScreenshot(CaptureType.ActiveWindow, safeTaskSettings, false);
                break;

            case HotkeyType.ActiveMonitor:
                CaptureScreenshot(CaptureType.ActiveMonitor, safeTaskSettings, false);
                break;

            case HotkeyType.RectangleRegion:
                CaptureScreenshot(CaptureType.Rectangle, safeTaskSettings, false);
                break;

            case HotkeyType.WindowRectangle:
                CaptureScreenshot(CaptureType.RectangleWindow, safeTaskSettings, false);
                break;

            case HotkeyType.RoundedRectangleRegion:
                CaptureScreenshot(CaptureType.RoundedRectangle, safeTaskSettings, false);
                break;

            case HotkeyType.EllipseRegion:
                CaptureScreenshot(CaptureType.Ellipse, safeTaskSettings, false);
                break;

            case HotkeyType.TriangleRegion:
                CaptureScreenshot(CaptureType.Triangle, safeTaskSettings, false);
                break;

            case HotkeyType.DiamondRegion:
                CaptureScreenshot(CaptureType.Diamond, safeTaskSettings, false);
                break;

            case HotkeyType.PolygonRegion:
                CaptureScreenshot(CaptureType.Polygon, safeTaskSettings, false);
                break;

            case HotkeyType.FreeHandRegion:
                CaptureScreenshot(CaptureType.Freehand, safeTaskSettings, false);
                break;

            case HotkeyType.LastRegion:
                CaptureScreenshot(CaptureType.LastRegion, safeTaskSettings, false);
                break;

            case HotkeyType.ScreenRecorder:
                TaskHelpers.DoScreenRecorder(safeTaskSettings);
                break;

            case HotkeyType.AutoCapture:
                TaskHelpers.OpenAutoCapture();
                break;

            case HotkeyType.ScreenColorPicker:
                TaskHelpers.OpenScreenColorPicker(safeTaskSettings);
                break;

            case HotkeyType.Ruler:
                TaskHelpers.OpenRuler();
                break;

            case HotkeyType.FTPClient:
                TaskHelpers.OpenFTPClient();
                break;

            case HotkeyType.HashCheck:
                TaskHelpers.OpenHashCheck();
                break;

            case HotkeyType.IndexFolder:
                TaskHelpers.OpenIndexFolder();
                break;

            case HotkeyType.ImageEffects:
                TaskHelpers.OpenImageEffects();
                break;

            case HotkeyType.QRCode:
                TaskHelpers.OpenQRCode();
                break;
            }
        }
Example #14
0
        public void StartRecording(TaskSettings TaskSettings)
        {
            if (TaskSettings.CaptureSettings.RunScreencastCLI)
            {
                if (!Program.Settings.VideoEncoders.IsValidIndex(TaskSettings.CaptureSettings.VideoEncoderSelected))
                {
                    MessageBox.Show("There is no valid CLI video encoder selected.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else if (!Program.Settings.VideoEncoders[TaskSettings.CaptureSettings.VideoEncoderSelected].IsValid())
                {
                    MessageBox.Show("CLI video encoder file does not exist: " + Program.Settings.VideoEncoders[TaskSettings.CaptureSettings.VideoEncoderSelected].Path,
                                    Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.FFmpeg && !File.Exists(TaskSettings.CaptureSettings.FFmpegOptions.CLIPath))
            {
                string ffmpegText = string.IsNullOrEmpty(TaskSettings.CaptureSettings.FFmpegOptions.CLIPath) ? "ffmpeg.exe" : TaskSettings.CaptureSettings.FFmpegOptions.CLIPath;

                if (MessageBox.Show(ffmpegText + " does not exist." + Environment.NewLine + Environment.NewLine + "Would you like to automatically download it?",
                                    Application.ProductName + " - Missing ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    if (FFmpegHelper.DownloadFFmpeg(false, DownloaderForm_InstallRequested) == DialogResult.OK)
                    {
                        Program.DefaultTaskSettings.CaptureSettings.FFmpegOptions.CLIPath = TaskSettings.TaskSettingsReference.CaptureSettings.FFmpegOptions.CLIPath =
                            TaskSettings.CaptureSettings.FFmpegOptions.CLIPath            = Path.Combine(Program.ToolsFolder, "ffmpeg.exe");
                    }
                }
                else
                {
                    return;
                }
            }

            SelectRegion();

            if (IsRecording || captureRectangle.IsEmpty || screenRecorder != null)
            {
                return;
            }

            IsRecording = true;
            Screenshot.CaptureCursor = TaskSettings.CaptureSettings.ShowCursor;

            TrayIcon.Text    = "ShareX - Waiting...";
            TrayIcon.Icon    = Resources.control_record_yellow.ToIcon();
            TrayIcon.Visible = true;

            string path = "";

            ScreenRegionManager screenRegionManager = new ScreenRegionManager();

            screenRegionManager.Start(captureRectangle);

            TaskEx.Run(() =>
            {
                try
                {
                    if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.AVI)
                    {
                        path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, "avi"));
                    }
                    else if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.FFmpeg)
                    {
                        path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, TaskSettings.CaptureSettings.FFmpegOptions.Extension));
                    }
                    else
                    {
                        path = Program.ScreenRecorderCacheFilePath;
                    }

                    ScreencastOptions options = new ScreencastOptions()
                    {
                        CaptureArea     = captureRectangle,
                        GIFFPS          = TaskSettings.CaptureSettings.GIFFPS,
                        ScreenRecordFPS = TaskSettings.CaptureSettings.ScreenRecordFPS,
                        OutputPath      = path,
                        Duration        = TaskSettings.CaptureSettings.ScreenRecordFixedDuration ? TaskSettings.CaptureSettings.ScreenRecordDuration : 0,
                        AVI             = TaskSettings.CaptureSettings.AVIOptions,
                        FFmpeg          = TaskSettings.CaptureSettings.FFmpegOptions,
                        DrawCursor      = TaskSettings.CaptureSettings.ShowCursor
                    };

                    screenRecorder = new ScreenRecorder(options, captureRectangle, TaskSettings.CaptureSettings.ScreenRecordOutput);

                    int delay = (int)(TaskSettings.CaptureSettings.ScreenRecordStartDelay * 1000);

                    if (delay > 0)
                    {
                        Thread.Sleep(delay);
                    }

                    this.InvokeSafe(() =>
                    {
                        screenRegionManager.ChangeColor(Color.FromArgb(0, 255, 0));
                    });

                    TrayIcon.Text = "ShareX - Click tray icon to stop recording.";
                    TrayIcon.Icon = Resources.control_record.ToIcon();

                    screenRecorder.StartRecording();
                }
                finally
                {
                    if (screenRegionManager != null)
                    {
                        this.InvokeSafe(() => screenRegionManager.Dispose());
                    }
                }

                try
                {
                    if (screenRecorder != null)
                    {
                        TrayIcon.Text = "ShareX - Encoding...";
                        TrayIcon.Icon = Resources.camcorder_pencil.ToIcon();

                        string sourceFilePath = path;

                        if (TaskSettings.CaptureSettings.ScreenRecordOutput == ScreenRecordOutput.GIF)
                        {
                            if (TaskSettings.CaptureSettings.RunScreencastCLI)
                            {
                                sourceFilePath = Path.ChangeExtension(Program.ScreenRecorderCacheFilePath, "gif");
                            }
                            else
                            {
                                sourceFilePath = path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, "gif"));
                            }

                            screenRecorder.SaveAsGIF(sourceFilePath, TaskSettings.ImageSettings.ImageGIFQuality);
                        }

                        if (TaskSettings.CaptureSettings.RunScreencastCLI)
                        {
                            VideoEncoder encoder = Program.Settings.VideoEncoders[TaskSettings.CaptureSettings.VideoEncoderSelected];
                            path = Path.Combine(TaskSettings.CaptureFolder, TaskHelpers.GetFilename(TaskSettings, encoder.OutputExtension));
                            screenRecorder.EncodeUsingCommandLine(encoder, sourceFilePath, path);
                        }
                    }
                }
                finally
                {
                    if (screenRecorder != null)
                    {
                        if (TaskSettings.CaptureSettings.RunScreencastCLI && !string.IsNullOrEmpty(screenRecorder.CachePath) && File.Exists(screenRecorder.CachePath))
                        {
                            File.Delete(screenRecorder.CachePath);
                        }

                        screenRecorder.Dispose();
                        screenRecorder = null;
                    }
                }
            },
                       () =>
            {
                if (TrayIcon.Visible)
                {
                    TrayIcon.Visible = false;
                }

                IsRecording = false;

                if (!string.IsNullOrEmpty(path) && File.Exists(path))
                {
                    if (TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.UploadImageToHost))
                    {
                        UploadManager.UploadFile(path, TaskSettings);
                    }
                    else
                    {
                        if (TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.CopyFilePathToClipboard))
                        {
                            ClipboardHelpers.CopyText(path);
                        }

                        TaskHelpers.ShowResultNotifications(path, TaskSettings, path);
                    }
                }
            });
        }
Example #15
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None)
            {
                return;
            }

            TaskSettings taskSettings = TaskSettings.GetSafeTaskSettings(hotkeySetting.TaskSettings);

            switch (hotkeySetting.TaskSettings.Job)
            {
            case HotkeyType.StopUploads:
                TaskManager.StopAllTasks();
                break;

            case HotkeyType.ClipboardUpload:
                UploadManager.ClipboardUpload(taskSettings);
                break;

            case HotkeyType.ClipboardUploadWithContentViewer:
                UploadManager.ClipboardUploadWithContentViewer(taskSettings);
                break;

            case HotkeyType.FileUpload:
                UploadManager.UploadFile(taskSettings);
                break;

            case HotkeyType.DragDropUpload:
                OpenDropWindow();
                break;

            case HotkeyType.PrintScreen:
                CaptureScreenshot(CaptureType.Screen, taskSettings, false);
                break;

            case HotkeyType.ActiveWindow:
                CaptureScreenshot(CaptureType.ActiveWindow, taskSettings, false);
                break;

            case HotkeyType.ActiveMonitor:
                CaptureScreenshot(CaptureType.ActiveMonitor, taskSettings, false);
                break;

            case HotkeyType.RectangleRegion:
                CaptureScreenshot(CaptureType.Rectangle, taskSettings, false);
                break;

            case HotkeyType.WindowRectangle:
                CaptureScreenshot(CaptureType.RectangleWindow, taskSettings, false);
                break;

            case HotkeyType.RoundedRectangleRegion:
                CaptureScreenshot(CaptureType.RoundedRectangle, taskSettings, false);
                break;

            case HotkeyType.EllipseRegion:
                CaptureScreenshot(CaptureType.Ellipse, taskSettings, false);
                break;

            case HotkeyType.TriangleRegion:
                CaptureScreenshot(CaptureType.Triangle, taskSettings, false);
                break;

            case HotkeyType.DiamondRegion:
                CaptureScreenshot(CaptureType.Diamond, taskSettings, false);
                break;

            case HotkeyType.PolygonRegion:
                CaptureScreenshot(CaptureType.Polygon, taskSettings, false);
                break;

            case HotkeyType.FreeHandRegion:
                CaptureScreenshot(CaptureType.Freehand, taskSettings, false);
                break;

            case HotkeyType.LastRegion:
                CaptureScreenshot(CaptureType.LastRegion, taskSettings, false);
                break;

            case HotkeyType.ScreenRecorder:
                DoScreenRecorder(taskSettings);
                break;

            case HotkeyType.AutoCapture:
                OpenAutoCapture();
                break;

            case HotkeyType.ScreenColorPicker:
                OpenScreenColorPicker(taskSettings);
                break;

            case HotkeyType.HashCheck:
                OpenHashCheck();
                break;

            case HotkeyType.IndexFolder:
                OpenIndexFolder();
                break;

            case HotkeyType.ImageEffects:
                OpenImageEffects();
                break;

            case HotkeyType.Ruler:
                OpenRuler();
                break;
            }
        }