private static void ClipboardMonitor_OnClipboardChange(object sender)
        {
            // 0. Clipboard owner white-black list
            Process proc = Process.GetProcessById(Convert.ToInt32(sender));

            CommandLine.Info("[Monitor] Clipboard Owner: " + proc.ProcessName + " - Process Id:" + proc.Id);

            if (ApplicationHelper.GetCurrentProcessName() == proc.ProcessName)
            {
                return;
            }
            if (!applicationCopyFilter.Bypass(proc.ProcessName))
            {
                CommandLine.Warning("[Monitor] Intercept: " + proc.ProcessName);
                return;
            }

            if (!Properties.Settings.Default.autoImageToFileEnabled)
            {
                return;
            }

            // 1. Analyze
            monitorModeData.Reload();
            string[] exts = monitorModeData.Analyze();
            if (exts == null || exts.Length == 0)
            {
                return;
            }

            // 2. Save image data to disk
            if (ImageProcessor.imageExt.Contains(exts[0]))
            {
                if (monitorModeData.Storage.GetDataPresent(DataFormats.Bitmap))
                {
                    if (Properties.Settings.Default.autoImageToFileEnabled)
                    {
                        // Append FileDrop type data into clipboard
                        string filePath = PathGenerator.GenerateMonitorAppendFilePath(exts[0]);
                        CommandLine.Info("[Monitor] Paste pictures into files: " + filePath);

                        AppendFileToClipboard(filePath);

                        monitorModeData.SaveAsync(filePath, exts[0]);
                    }
                }
                else if (monitorModeData.Storage.GetDataPresent(DataFormats.FileDrop))
                {
                    if (Properties.Settings.Default.monitorAutoSaveEnabled)
                    {
                        // Append FileDrop type data into clipboard
                        string filePath = PathGenerator.GenerateMonitorAppendFilePath(exts[0]);
                        CommandLine.Info("[Monitor] Copy pictures file into: " + filePath);

                        monitorModeData.SaveAsync(filePath, exts[0]);
                    }
                }
            }
        }
Exemple #2
0
        private static void ClipboardMonitor_OnClipboardChange()
        {
            if (!Properties.Settings.Default.autoImageToFileEnabled)
            {
                return;
            }

            // 1. Analyze
            monitorModeData.Reload();
            string[] exts = monitorModeData.Analyze();
            if (exts == null || exts.Length == 0)
            {
                return;
            }

            // 2. Save image data to disk
            if (ImageProcessor.imageExt.Contains(exts[0]))
            {
                if (Properties.Settings.Default.autoImageToFileEnabled)
                {
                    // Append FileDrop type data into clipboard
                    string filePath = PathGenerator.GenerateMonitorAppendFilePath(exts[0]);

                    AppendFileToClipboard(filePath);

                    monitorModeData.SaveAsync(filePath, exts[0]);
                }
            }
        }
Exemple #3
0
        private static void ClipboardMonitor_OnClipboardChange(object sender)
        {
            // 0. Clipboard owner white-black list
            Process proc = Process.GetProcessById(Convert.ToInt32(sender));

            Debug.WriteLine("ClipboardOwner: " + proc.ProcessName + " - " + proc.Id);

            if (ApplicationHelper.GetCurrentProcessName() == proc.ProcessName)
            {
                return;
            }

            if (!Properties.Settings.Default.autoImageToFileEnabled)
            {
                return;
            }

            // 1. Analyze
            monitorModeData.Reload();
            string[] exts = monitorModeData.Analyze();
            if (exts == null || exts.Length == 0)
            {
                return;
            }

            // 2. Save image data to disk
            if (ImageProcessor.imageExt.Contains(exts[0]) && monitorModeData.Storage.GetDataPresent(DataFormats.Bitmap))
            {
                if (Properties.Settings.Default.autoImageToFileEnabled)
                {
                    // Append FileDrop type data into clipboard
                    string filePath = PathGenerator.GenerateMonitorAppendFilePath(exts[0]);

                    AppendFileToClipboard(filePath);

                    monitorModeData.SaveAsync(filePath, exts[0]);
                }
            }
        }