Added additional guards and a configuration for the Win10 plugin, which disables the OCR by default.

This commit is contained in:
Robin Krom 2020-07-21 12:56:02 +02:00
parent 6a09345649
commit d602433c53
3 changed files with 19 additions and 8 deletions

View file

@ -1,19 +1,19 @@
/*
* A Picasa Plugin for Greenshot
* Copyright (C) 2011 Francis Noel
*
*
* For more information see: http://getgreenshot.org/
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -42,13 +42,13 @@ namespace GreenshotPicasaPlugin {
set;
}
[IniProperty("UploadUser", Description = "The picasa user to upload to", DefaultValue = "default")]
[IniProperty("UploadUser", Description = "The Picasa user to upload to", DefaultValue = "default")]
public string UploadUser {
get;
set;
}
[IniProperty("UploadAlbum", Description = "The picasa album to upload to", DefaultValue = "default")]
[IniProperty("UploadAlbum", Description = "The Picasa album to upload to", DefaultValue = "default")]
public string UploadAlbum {
get;
set;

View file

@ -32,7 +32,7 @@ namespace GreenshotPlugin.Core {
return 1;
}
if (Priority == other.Priority) {
return Description.CompareTo(other.Description);
return string.Compare(Description, other.Description, StringComparison.Ordinal);
}
return Priority - other.Priority;
}

View file

@ -21,6 +21,7 @@
using System.Threading.Tasks;
using GreenshotPlugin.Core;
using GreenshotPlugin.IniFile;
using GreenshotPlugin.Interfaces;
using GreenshotPlugin.Interfaces.Ocr;
@ -29,13 +30,23 @@ namespace GreenshotWin10Plugin.Processors {
/// This processor processes a capture to see if there is text on it
/// </summary>
public class Win10OcrProcessor : AbstractProcessor {
private static readonly Win10Configuration Win10Configuration = IniConfig.GetIniSection<Win10Configuration>();
public override string Designation => "Windows10OcrProcessor";
public override string Description => Designation;
public override bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails)
{
if (captureDetails.OcrInformation != null)
if (!Win10Configuration.AlwaysRunOCROnCapture)
{
return false;
}
if (surface == null)
{
return false;
}
if (captureDetails == null || captureDetails.OcrInformation != null)
{
return false;
}