mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Refactoring the interop code to a separate project. Still need to add the interop DLL to the final exe... or maybe I want to use references inside the projects...
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1690 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
0aa8e43478
commit
5f9deb2f06
67 changed files with 564 additions and 502 deletions
|
@ -24,11 +24,11 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Greenshot.Interop;
|
||||
using Greenshot.Plugin;
|
||||
using GreenshotPlugin.Controls;
|
||||
using GreenshotPlugin.Core;
|
||||
using IniFile;
|
||||
using Greenshot.IniFile;
|
||||
using Greenshot.Interop;
|
||||
|
||||
//using Microsoft.Win32;
|
||||
|
||||
|
@ -174,13 +174,15 @@ namespace GreenshotOCR {
|
|||
|
||||
string text = "";
|
||||
try {
|
||||
using (ModiDocu modiDocument = (ModiDocu)COMWrapper.GetOrCreateInstance(typeof(ModiDocu))) {
|
||||
modiDocument.Create(filePath);
|
||||
modiDocument.OCR((ModiLanguage)Enum.Parse(typeof(ModiLanguage), config.Language), config.Orientimage, config.StraightenImage);
|
||||
IImage modiImage = modiDocument.Images[0];
|
||||
ILayout layout = modiImage.Layout;
|
||||
text = layout.Text;
|
||||
modiDocument.Close(false);
|
||||
using (ModiDocu modiDocument = COMWrapper.GetOrCreateInstance<ModiDocu>()) {
|
||||
if (modiDocument != null) {
|
||||
modiDocument.Create(filePath);
|
||||
modiDocument.OCR((ModiLanguage)Enum.Parse(typeof(ModiLanguage), config.Language), config.Orientimage, config.StraightenImage);
|
||||
IImage modiImage = modiDocument.Images[0];
|
||||
ILayout layout = modiImage.Layout;
|
||||
text = layout.Text;
|
||||
modiDocument.Close(false);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.Error("Error while calling Microsoft Office Document Imaging (MODI) to OCR: ", e);
|
||||
|
@ -207,10 +209,12 @@ namespace GreenshotOCR {
|
|||
|
||||
private bool HasMODI() {
|
||||
try {
|
||||
using (ModiDocu modiDocument = (ModiDocu)COMWrapper.GetOrCreateInstance(typeof(ModiDocu))) {
|
||||
modiDocument.Close(false);
|
||||
using (ModiDocu modiDocument = COMWrapper.GetOrCreateInstance<ModiDocu>()) {
|
||||
if (modiDocument != null) {
|
||||
modiDocument.Close(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch(Exception e) {
|
||||
LOG.DebugFormat("Error trying to initiate MODI: {0}", e.Message);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue