diff --git a/ShareX/OCR/OCRForm.cs b/ShareX/OCR/OCRForm.cs index 6074c4eab..c0ec33e62 100644 --- a/ShareX/OCR/OCRForm.cs +++ b/ShareX/OCR/OCRForm.cs @@ -83,7 +83,12 @@ public OCRForm(Bitmap bmp, OCROptions options) nudScaleFactor.SetValue((decimal)Options.ScaleFactor); - if (Options.ServiceLinks != null && Options.ServiceLinks.Count > 0) + if (Options.ServiceLinks == null || Options.IsDefaultServiceLinks()) + { + Options.ServiceLinks = OCROptions.DefaultServiceLinks; + } + + if (Options.ServiceLinks.Count > 0) { cbServices.Items.AddRange(Options.ServiceLinks.ToArray()); cbServices.SelectedIndex = Options.SelectedServiceLink; diff --git a/ShareX/OCR/OCROptions.cs b/ShareX/OCR/OCROptions.cs index 3f36d8d38..32504732e 100644 --- a/ShareX/OCR/OCROptions.cs +++ b/ShareX/OCR/OCROptions.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License #endregion License Information (GPL v3) using System.Collections.Generic; +using System.Linq; namespace ShareX { @@ -36,6 +37,17 @@ public class OCROptions public List ServiceLinks { get; set; } = DefaultServiceLinks; public int SelectedServiceLink { get; set; } = 0; + public bool IsDefaultServiceLinks() + { + if (ServiceLinks != null && ServiceLinks.Count > 0) + { + List defaultServiceLinks = DefaultServiceLinks; + return ServiceLinks.All(x => defaultServiceLinks.Any(y => x.Name == y.Name)); + } + + return false; + } + public static List DefaultServiceLinks => new List() { new ServiceLink("Google Translate", "https://translate.google.com/?sl=auto&tl=en&text={0}&op=translate"),