From 6a09345649ab36fcc74db305a072597b2009927a Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 20 Jul 2020 00:00:42 +0200 Subject: [PATCH] Fixed a typo Fixed #218 Added JPEG (vs JPG) as a format which can be handled Updated dependencies --- Greenshot/Greenshot.csproj | 2 +- GreenshotJiraPlugin/GreenshotJiraPlugin.csproj | 2 +- GreenshotPlugin/Core/ClipboardHelper.cs | 11 +++++++---- GreenshotPlugin/GreenshotPlugin.csproj | 2 +- GreenshotWin10Plugin/Processors/Win10OcrProcessor.cs | 10 +++++++++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Greenshot/Greenshot.csproj b/Greenshot/Greenshot.csproj index 080651ceb..03b68dc1b 100644 --- a/Greenshot/Greenshot.csproj +++ b/Greenshot/Greenshot.csproj @@ -17,7 +17,7 @@ - + diff --git a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj index 5579b7dac..6901a31c5 100644 --- a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj +++ b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj @@ -12,6 +12,6 @@ - + \ No newline at end of file diff --git a/GreenshotPlugin/Core/ClipboardHelper.cs b/GreenshotPlugin/Core/ClipboardHelper.cs index 272624c26..3933ccf71 100644 --- a/GreenshotPlugin/Core/ClipboardHelper.cs +++ b/GreenshotPlugin/Core/ClipboardHelper.cs @@ -49,6 +49,7 @@ namespace GreenshotPlugin.Core { private static readonly string FORMAT_PNG_OFFICEART = "PNG+Office Art"; private static readonly string FORMAT_17 = "Format17"; private static readonly string FORMAT_JPG = "JPG"; + private static readonly string FORMAT_JPEG = "JPEG"; private static readonly string FORMAT_JFIF = "JFIF"; private static readonly string FORMAT_JFIF_OFFICEART = "JFIF+Office Art"; private static readonly string FORMAT_GIF = "GIF"; @@ -253,7 +254,9 @@ EndSelection:<<<<<<<4 || dataObject.GetDataPresent(FORMAT_PNG) || dataObject.GetDataPresent(FORMAT_17) || dataObject.GetDataPresent(FORMAT_JPG) - || dataObject.GetDataPresent(FORMAT_GIF)) { + || dataObject.GetDataPresent(FORMAT_JFIF) + || dataObject.GetDataPresent(FORMAT_JPEG) + || dataObject.GetDataPresent(FORMAT_GIF)) { return true; } var imageFiles = GetImageFilenames(dataObject); @@ -345,9 +348,9 @@ EndSelection:<<<<<<<4 if (formats != null && formats.Contains(FORMAT_PNG_OFFICEART) && formats.Contains(DataFormats.Dib)) { // Outlook ?? Log.Info("Most likely the current clipboard contents come from Outlook, as this has a problem with PNG and others we place the DIB format to the front..."); - retrieveFormats = new[] { DataFormats.Dib, FORMAT_BITMAP, FORMAT_FILECONTENTS, FORMAT_PNG_OFFICEART, FORMAT_PNG, FORMAT_JFIF_OFFICEART, FORMAT_JPG, FORMAT_JFIF, DataFormats.Tiff, FORMAT_GIF }; + retrieveFormats = new[] { DataFormats.Dib, FORMAT_BITMAP, FORMAT_FILECONTENTS, FORMAT_PNG_OFFICEART, FORMAT_PNG, FORMAT_JFIF_OFFICEART, FORMAT_JPG, FORMAT_JPEG, FORMAT_JFIF, DataFormats.Tiff, FORMAT_GIF }; } else { - retrieveFormats = new[] { FORMAT_PNG_OFFICEART, FORMAT_PNG, FORMAT_17, FORMAT_JFIF_OFFICEART, FORMAT_JPG, FORMAT_JFIF, DataFormats.Tiff, DataFormats.Dib, FORMAT_BITMAP, FORMAT_FILECONTENTS, FORMAT_GIF }; + retrieveFormats = new[] { FORMAT_PNG_OFFICEART, FORMAT_PNG, FORMAT_17, FORMAT_JFIF_OFFICEART, FORMAT_JPG, FORMAT_JPEG, FORMAT_JFIF, DataFormats.Tiff, DataFormats.Dib, FORMAT_BITMAP, FORMAT_FILECONTENTS, FORMAT_GIF }; } foreach (string currentFormat in retrieveFormats) { if (formats != null && formats.Contains(currentFormat)) { @@ -700,7 +703,7 @@ EndSelection:<<<<<<<4 //now copy to clipboard IDataObject dataObj = new DataObject(); dataObj.SetData(format.Name, false, obj); - // Use false to make the object dissapear when the application stops. + // Use false to make the object disappear when the application stops. SetDataObject(dataObj, true); } diff --git a/GreenshotPlugin/GreenshotPlugin.csproj b/GreenshotPlugin/GreenshotPlugin.csproj index 574e0fafc..461aa6c84 100644 --- a/GreenshotPlugin/GreenshotPlugin.csproj +++ b/GreenshotPlugin/GreenshotPlugin.csproj @@ -13,7 +13,7 @@ - + diff --git a/GreenshotWin10Plugin/Processors/Win10OcrProcessor.cs b/GreenshotWin10Plugin/Processors/Win10OcrProcessor.cs index c5b5a8f4f..3ed89b95d 100644 --- a/GreenshotWin10Plugin/Processors/Win10OcrProcessor.cs +++ b/GreenshotWin10Plugin/Processors/Win10OcrProcessor.cs @@ -41,9 +41,17 @@ namespace GreenshotWin10Plugin.Processors { } var ocrProvider = SimpleServiceProvider.Current.GetInstance(); + if (ocrProvider == null) + { + return false; + } + var ocrResult = Task.Run(async () => await ocrProvider.DoOcrAsync(surface)).Result; - if (!ocrResult.HasContent) return false; + if (!ocrResult.HasContent) + { + return false; + } captureDetails.OcrInformation = ocrResult;