1
0
mirror of https://github.com/greenshot/greenshot.git synced 2025-03-12 05:25:25 -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:
RKrom 2012-03-06 17:45:50 +00:00
parent 0aa8e43478
commit 5f9deb2f06
67 changed files with 564 additions and 502 deletions
Greenshot-OCR-Plugin
Greenshot
GreenshotConfluencePlugin
GreenshotExternalCommandPlugin
GreenshotImgurPlugin
GreenshotInterop
GreenshotJiraPlugin
GreenshotNetworkImportPlugin
GreenshotTest/Test
PluginExample

@ -78,6 +78,10 @@
<None Include="Properties\AssemblyInfo.cs.template" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GreenshotInterop\GreenshotInterop.csproj">
<Project>{ADD4E400-56E1-4E31-A5C2-070BEB238A0F}</Project>
<Name>GreenshotInterop</Name>
</ProjectReference>
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
<Name>GreenshotPlugin</Name>

@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotOCR {
/// <summary>

@ -23,11 +23,10 @@ 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;
namespace GreenshotOCR {
/// <summary>

@ -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);
}

@ -29,7 +29,7 @@ using System.Windows.Forms;
using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Configuration {
public enum ScreenshotDestinations {Editor=1, FileDefault=2, FileWithDialog=4, Clipboard=8, Printer=16, EMail=32}

@ -24,7 +24,7 @@ using System.Drawing;
using Greenshot.Drawing.Fields;
using GreenshotPlugin.UnmanagedHelpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Configuration {
/// <summary>

@ -20,7 +20,7 @@
*/
using System;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Configuration {
/// <summary>

@ -28,7 +28,7 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -30,7 +30,7 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -27,10 +27,10 @@ using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Helpers;
using Greenshot.Helpers.OfficeInterop;
using Greenshot.Interop.Office;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>
@ -168,7 +168,7 @@ namespace Greenshot.Destinations {
if (!isOutlookUsed) {
yield break;
}
Dictionary<string, OlObjectClass> inspectorCaptions = OutlookExporter.RetrievePossibleTargets();
Dictionary<string, OlObjectClass> inspectorCaptions = OutlookEmailExporter.RetrievePossibleTargets(conf.OutlookAllowExportInMeetings);
if (inspectorCaptions != null) {
foreach (string inspectorCaption in inspectorCaptions.Keys) {
yield return new EmailDestination(inspectorCaption, inspectorCaptions[inspectorCaption]);
@ -206,9 +206,9 @@ namespace Greenshot.Destinations {
attachmentName = Regex.Replace(attachmentName, @"[^\x20\d\w]", "");
if (outlookInspectorCaption != null) {
OutlookExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName);
OutlookEmailExporter.ExportToInspector(outlookInspectorCaption, tmpFile, attachmentName);
} else {
OutlookExporter.ExportToOutlook(tmpFile, captureDetails.Title, attachmentName);
OutlookEmailExporter.ExportToOutlook(conf.OutlookEmailFormat, tmpFile, captureDetails.Title, attachmentName);
}
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, lang.GetFormattedString(LangKey.exported_to, Description));
surface.Modified = false;

@ -28,8 +28,8 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using Greenshot.Helpers.OfficeInterop;
using IniFile;
using Greenshot.Interop.Office;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -28,7 +28,7 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -28,7 +28,7 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -29,7 +29,7 @@ using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using Greenshot.Forms;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -28,8 +28,8 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using Greenshot.Helpers.OfficeInterop;
using IniFile;
using Greenshot.Interop.Office;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>
@ -121,9 +121,9 @@ namespace Greenshot.Destinations {
}
}
if (presentationName != null) {
PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails);
PowerpointExporter.ExportToPresentation(presentationName, tmpFile, imageSize, captureDetails.Title);
} else {
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails);
PowerpointExporter.InsertIntoNewPresentation(tmpFile, imageSize, captureDetails.Title);
}
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, lang.GetFormattedString(LangKey.exported_to, Description));
surface.Modified = false;

@ -29,7 +29,7 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -29,8 +29,8 @@ using Greenshot.Configuration;
using GreenshotPlugin.Core;
using Greenshot.Plugin;
using Greenshot.Helpers;
using Greenshot.Helpers.OfficeInterop;
using IniFile;
using Greenshot.Interop.Office;
using Greenshot.IniFile;
namespace Greenshot.Destinations {
/// <summary>

@ -32,6 +32,7 @@ using Greenshot.Plugin;
using GreenshotPlugin.Core;
using Greenshot.Plugin.Drawing;
using Greenshot.Memento;
using System.Drawing.Drawing2D;
namespace Greenshot.Drawing {
/// <summary>
@ -597,6 +598,17 @@ namespace Greenshot.Drawing {
if (RotateFlipType.Rotate90FlipNone == rotateFlipType) {
angle = 270;
}
Rectangle beforeBounds = new Rectangle(Left, Top, Width, Height);
LOG.DebugFormat("Bounds before: {0}", beforeBounds);
GraphicsPath translatePath = new GraphicsPath();
translatePath.AddRectangle(beforeBounds);
Matrix rotateMatrix = new Matrix();
rotateMatrix.RotateAt(angle, new PointF(parent.Width >> 1, parent.Height >> 1));
translatePath.Transform(rotateMatrix);
RectangleF newBounds = translatePath.GetBounds();
LOG.DebugFormat("New bounds by using graphics path: {0}", newBounds);
int ox = 0;
int oy = 0;
int centerX = parent.Width >> 1;
@ -632,6 +644,7 @@ namespace Greenshot.Drawing {
(float)newHeight
);
ApplyBounds(newRectangle);
LOG.DebugFormat("New bounds by using old method: {0}", newRectangle);
}
protected virtual ScaleHelper.IDoubleProcessor GetAngleRoundProcessor() {

@ -27,7 +27,7 @@ using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Greenshot.Configuration;
using Greenshot.Helpers;

@ -24,7 +24,7 @@ using System.Drawing;
using System.Runtime.Serialization;
using Greenshot.Configuration;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Drawing.Fields {
/// <summary>

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Greenshot.Configuration;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Drawing.Fields {
/// <summary>

@ -34,6 +34,7 @@ namespace Greenshot.Drawing {
/// </summary>
[Serializable()]
public class FreehandContainer : DrawableContainer {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(FreehandContainer));
private static readonly float [] POINT_OFFSET = new float[]{0.5f, 0.25f, 0.75f};
[NonSerialized]
@ -168,6 +169,27 @@ namespace Greenshot.Drawing {
myBounds = Rectangle.Round(freehandPath.GetBounds());
}
public override void Rotate(RotateFlipType rotateFlipType) {
int angle = 270;
if (rotateFlipType == RotateFlipType.Rotate90FlipNone) {
angle = 90;
}
LOG.DebugFormat("Bounds before: {0} - {1}", Bounds, freehandPath.GetBounds());
Matrix rotateMatrix = new Matrix();
rotateMatrix.Translate(-(parent.Width >> 1), -(parent.Height >> 1));
freehandPath.Transform(rotateMatrix);
rotateMatrix = new Matrix();
rotateMatrix.Rotate(360 - angle);
freehandPath.Transform(rotateMatrix);
rotateMatrix = new Matrix();
rotateMatrix.Translate(parent.Height >> 1, parent.Width >> 1);
freehandPath.Transform(rotateMatrix);
LOG.DebugFormat("Bounds after: {0} - {1}", Bounds, freehandPath.GetBounds());
//base.Rotate(rotateFlipType);
}
/// <summary>
/// Do the drawing of the freehand "stroke"
/// </summary>

@ -33,7 +33,7 @@ using Greenshot.Plugin;
using Greenshot.Plugin.Drawing;
using GreenshotPlugin.Core;
using Greenshot.Memento;
using IniFile;
using Greenshot.IniFile;
using Greenshot.Drawing.Filters;
using System.Drawing.Drawing2D;
using GreenshotPlugin.Controls;

@ -26,7 +26,7 @@ using System.IO;
using Greenshot.Helpers;
using Greenshot.Configuration;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot {
/// <summary>
@ -43,7 +43,7 @@ namespace Greenshot {
Version v = Assembly.GetExecutingAssembly().GetName().Version;
// Format is like this: AssemblyVersion("Major.Minor.Build.Revision")]
lblTitle.Text = "Greenshot " + v.Major + "." + v.Minor + "." + v.Build + " Build " + v.Revision + (IniConfig.IsPortable?" Portable":"") + (" (" + OSInfo.Bits +" bit)");
lblTitle.Text = "Greenshot DiBa " + v.Major + "." + v.Minor + "." + v.Build + " Build " + v.Revision + (IniConfig.IsPortable?" Portable":"") + (" (" + OSInfo.Bits +" bit)");
lang = Language.GetInstance();
updateUI();
}

@ -33,7 +33,7 @@ using Greenshot.Helpers;
using Greenshot.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Forms {
/// <summary>

@ -26,7 +26,7 @@ using System.Windows.Forms;
using Greenshot.Configuration;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot {
/// <summary>

@ -36,7 +36,7 @@ using Greenshot.Help;
using Greenshot.Helpers;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using System.Threading;
using System.Drawing.Imaging;
@ -412,6 +412,19 @@ namespace Greenshot {
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
effectSubItem = new ToolStripMenuItem("Rotate 90");
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Rotate90);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
effectSubItem = new ToolStripMenuItem("Rotate 270");
effectSubItem.Click += delegate {
surface.ApplyBitmapEffect(Effects.Rotate270);
updateUndoRedoSurfaceDependencies();
};
effectItem.DropDownItems.Add(effectSubItem);
}
this.editToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());
this.editToolStripMenuItem.DropDownItems.Add(insert_window_toolstripmenuitem);

@ -22,7 +22,7 @@ using System;
using System.Windows.Forms;
using Greenshot.Configuration;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot {
/// <summary>

@ -39,7 +39,7 @@ using Greenshot.Plugin;
using GreenshotPlugin.UnmanagedHelpers;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot {
/// <summary>

@ -22,7 +22,7 @@ using System;
using System.Windows.Forms;
using Greenshot.Configuration;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Forms {
/// <summary>

@ -25,7 +25,7 @@ using System.Windows.Forms;
using Greenshot.Helpers;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Forms {
/// <summary>

@ -30,7 +30,7 @@ using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using GreenshotPlugin.UnmanagedHelpers;
using Greenshot.Plugin;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot {
/// <summary>

@ -74,6 +74,7 @@
<Compile Include="Destinations\ExcelDestination.cs" />
<Compile Include="Destinations\FileDestination.cs" />
<Compile Include="Destinations\FileWithDialogDestination.cs" />
<Compile Include="Destinations\OneNoteDestination.cs" />
<Compile Include="Destinations\PickerDestination.cs" />
<Compile Include="Destinations\PowerpointDestination.cs" />
<Compile Include="Destinations\PrinterDestination.cs" />
@ -167,37 +168,11 @@
<Compile Include="Helpers\DestinationHelper.cs" />
<Compile Include="Helpers\IECaptureHelper.cs" />
<Compile Include="Helpers\IEInterop\IEContainer.cs" />
<Compile Include="Helpers\IEInterop\IHTMLBodyElement.cs" />
<Compile Include="Helpers\IEInterop\IHTMLCurrentStyle.cs" />
<Compile Include="Helpers\IEInterop\IHTMLElement2.cs" />
<Compile Include="Helpers\IEInterop\IHTMLFrameBase.cs" />
<Compile Include="Helpers\IEInterop\IHTMLFramesCollection2.cs" />
<Compile Include="Helpers\IEInterop\IHTMLRect.cs" />
<Compile Include="Helpers\IEInterop\IHTMLSelectionObject.cs" />
<Compile Include="Helpers\IEInterop\IHTMLStyle.cs" />
<Compile Include="Helpers\IEInterop\IHTMLTxtRange.cs" />
<Compile Include="Helpers\IEInterop\IHTMLWindow4.cs" />
<Compile Include="Helpers\IEInterop\IOleWindow.cs" />
<Compile Include="Helpers\IEInterop\IServiceProvider.cs" />
<Compile Include="Helpers\IEInterop\IHTMLDocument.cs" />
<Compile Include="Helpers\IEInterop\IHTMLDocument2.cs" />
<Compile Include="Helpers\IEInterop\IHTMLDocument3.cs" />
<Compile Include="Helpers\IEInterop\IHTMLDocument4.cs" />
<Compile Include="Helpers\IEInterop\IHTMLDocument5.cs" />
<Compile Include="Helpers\IEInterop\IHTMLElement.cs" />
<Compile Include="Helpers\IEInterop\IHTMLElementCollection.cs" />
<Compile Include="Helpers\IEInterop\IHTMLScreen.cs" />
<Compile Include="Helpers\IEInterop\IHTMLScreen2.cs" />
<Compile Include="Helpers\IEInterop\IHTMLWindow2.cs" />
<Compile Include="Helpers\IEInterop\IHTMLWindow3.cs" />
<Compile Include="Helpers\IEInterop\IWebBrowser2.cs" />
<Compile Include="Helpers\OfficeInterop\ExcelWrapper.cs" />
<Compile Include="Helpers\ProcessorHelper.cs" />
<Compile Include="Processors\TitleFixProcessor.cs" />
<None Include="Greenshot.exe.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Helpers\OfficeInterop\OutlookUtils.cs" />
<Compile Include="Helpers\WindowWrapper.cs" />
<Compile Include="Memento\AddElementMemento.cs" />
<Compile Include="Memento\ChangeFieldHolderMemento.cs" />
@ -206,10 +181,6 @@
<Compile Include="Memento\IMemento.cs" />
<Compile Include="Memento\DrawableContainerBoundsChangeMemento.cs" />
<Compile Include="Memento\SurfaceBackgroundChangeMemento.cs" />
<Compile Include="Helpers\OfficeInterop\OfficeWrappers.cs" />
<Compile Include="Helpers\OfficeInterop\OutlookWrapper.cs" />
<Compile Include="Helpers\OfficeInterop\PowerpointWrapper.cs" />
<Compile Include="Helpers\OfficeInterop\WordWrapper.cs" />
<Compile Include="Helpers\QuantizerHelper.cs" />
<Compile Include="Helpers\ScreenCaptureHelper.cs" />
<Compile Include="Helpers\UpdateHelper.cs" />
@ -382,6 +353,10 @@
<Folder Include="Help" />
<Folder Include="Destinations" />
<Folder Include="Processors" />
<ProjectReference Include="..\GreenshotInterop\GreenshotInterop.csproj">
<Project>{ADD4E400-56E1-4E31-A5C2-070BEB238A0F}</Project>
<Name>GreenshotInterop</Name>
</ProjectReference>
<ProjectReference Include="..\GreenshotPlugin\GreenshotPlugin.csproj">
<Project>{5B924697-4DCD-4F98-85F1-105CB84B7341}</Project>
<Name>GreenshotPlugin</Name>

@ -24,7 +24,7 @@ using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Greenshot.Processors {
/// <summary>

@ -25,7 +25,7 @@ using System.Windows.Forms;
using GreenshotConfluencePlugin;
using GreenshotConfluencePlugin.confluence;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
/// <summary>
/// For details see the Confluence API site

@ -20,7 +20,7 @@
*/
using System;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotConfluencePlugin {
/// <summary>

@ -29,7 +29,7 @@ using System.Windows;
using Confluence;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotConfluencePlugin {
/// <summary>

@ -28,7 +28,7 @@ using System.Windows;
using Confluence;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using TranslationByMarkupExtension;
namespace GreenshotConfluencePlugin {

@ -25,7 +25,7 @@ using System.Windows;
using Confluence;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotConfluencePlugin {
public partial class ConfluenceSearch : System.Windows.Controls.Page {

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.IO;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace ExternalCommand {
/// <summary>

@ -27,7 +27,7 @@ using System.Threading;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace ExternalCommand {
/// <summary>

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Greenshot.Plugin;
using IniFile;
using Greenshot.IniFile;
namespace ExternalCommand {
/// <summary>

@ -24,7 +24,7 @@ using System.IO;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace ExternalCommand {
/// <summary>

@ -25,7 +25,7 @@ using System.Windows.Forms;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotImgurPlugin.Forms {
/// <summary>

@ -24,7 +24,7 @@ using System.Windows.Forms;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotImgurPlugin {
/// <summary>

@ -28,7 +28,7 @@ using System.Windows;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotImgurPlugin {
/// <summary>

@ -30,7 +30,7 @@ using Greenshot.Plugin;
using GreenshotImgurPlugin.Forms;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotImgurPlugin {
/// <summary>

@ -28,7 +28,7 @@ using System.Text;
using System.Web;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotImgurPlugin {
/// <summary>

@ -32,6 +32,8 @@ namespace Greenshot.Interop {
public sealed class COMWrapper : RealProxy, IDisposable, IRemotingTypeInfo {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(COMWrapper));
private const int MK_E_UNAVAILABLE = -2147221021;
private const int CO_E_CLASSSTRING = -2147221005;
#region Private Data
/// <summary>
@ -50,6 +52,8 @@ namespace Greenshot.Interop {
private Type _InterceptType;
#endregion
[DllImport("ole32.dll")]
static extern int ProgIDFromCLSID([In] ref Guid clsid, [MarshalAs(UnmanagedType.LPWStr)] out string lplpszProgID);
#region Construction
@ -68,23 +72,36 @@ namespace Greenshot.Interop {
throw new ArgumentException("The specified type must be an interface.", "type");
}
ComProgIdAttribute progID = ComProgIdAttribute.GetAttribute(type);
if (null == progID || null == progID.Value || 0 == progID.Value.Length) {
ComProgIdAttribute progIDAttribute = ComProgIdAttribute.GetAttribute(type);
if (null == progIDAttribute || null == progIDAttribute.Value || 0 == progIDAttribute.Value.Length) {
throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
}
string progId = progIDAttribute.Value;
// Convert from clsid to Prog ID, if needed
if (progId.StartsWith("clsid:")) {
Guid guid = new Guid(progId.Substring(6));
int result = ProgIDFromCLSID(ref guid, out progId);
if (result != 0) {
LOG.WarnFormat("Error {0} getting progId {1}", result, progIDAttribute.Value);
} else {
LOG.InfoFormat("Mapped {0} to progId {1}", progIDAttribute.Value, progId);
}
}
object comObject = null;
Type comType = Type.GetTypeFromProgID(progID.Value, true);
try {
comObject = Marshal.GetActiveObject(progID.Value);
comObject = Marshal.GetActiveObject(progId);
} catch (COMException comE) {
if (comE.ErrorCode == MK_E_UNAVAILABLE) {
LOG.DebugFormat("No current instance of {0} object available.", progID.Value);
LOG.DebugFormat("No current instance of {0} object available.", progId);
} else if (comE.ErrorCode == CO_E_CLASSSTRING) {
LOG.WarnFormat("Unknown progId {0}", progId);
} else {
LOG.Warn("Error getting active object for " + progID.Value, comE);
LOG.Warn("Error getting active object for " + progId, comE);
}
} catch (Exception e) {
LOG.Warn("Error getting active object for " + progID.Value, e);
LOG.Warn("Error getting active object for " + progId, e);
}
if (comObject != null) {
@ -110,46 +127,63 @@ namespace Greenshot.Interop {
throw new ArgumentException("The specified type must be an interface.", "type");
}
ComProgIdAttribute progID = ComProgIdAttribute.GetAttribute(type);
if (null == progID || null == progID.Value || 0 == progID.Value.Length) {
ComProgIdAttribute progIDAttribute = ComProgIdAttribute.GetAttribute(type);
if (null == progIDAttribute || null == progIDAttribute.Value || 0 == progIDAttribute.Value.Length) {
throw new ArgumentException("The specified type must define a ComProgId attribute.", "type");
}
object comObject = null;
Type comType = null;
if (progID.Value.StartsWith("clsid:")) {
Guid guid = new Guid(progID.Value.Substring(6));
comType = Type.GetTypeFromCLSID(guid, true);
} else {
comType = Type.GetTypeFromProgID(progID.Value, true);
string progId = progIDAttribute.Value;
// Convert from clsid to Prog ID, if needed
if (progId.StartsWith("clsid:")) {
Guid guid = new Guid(progId.Substring(6));
int result = ProgIDFromCLSID(ref guid, out progId);
if (result != 0) {
LOG.WarnFormat("Error {0} getting progId {1}", result, progIDAttribute.Value);
} else {
LOG.InfoFormat("Mapped {0} to progId {1}", progIDAttribute.Value, progId);
}
}
try {
comObject = Marshal.GetActiveObject(progID.Value);
comObject = Marshal.GetActiveObject(progId);
} catch (COMException comE) {
if (comE.ErrorCode == MK_E_UNAVAILABLE) {
LOG.DebugFormat("No current instance of {0} object available.", progID.Value);
LOG.DebugFormat("No current instance of {0} object available.", progId);
} else if (comE.ErrorCode == CO_E_CLASSSTRING) {
LOG.WarnFormat("Unknown progId {0} (application not installed)", progId);
return default(T);
} else {
LOG.Warn("Error getting active object for " + progID.Value, comE);
LOG.Warn("Error getting active object for " + progId, comE);
}
} catch (Exception e) {
LOG.Warn("Error getting active object for " + progID.Value, e);
LOG.Warn("Error getting active object for " + progId, e);
}
// Did we get the current instance? If not, try to create a new
if (comObject == null) {
try {
comObject = Activator.CreateInstance(comType);
if (comObject != null) {
LOG.DebugFormat("Created new instance of {0} object.", progID.Value);
comType = Type.GetTypeFromProgID(progId, true);
} catch (Exception ex) {
LOG.Warn("Error type for " + progId, ex);
}
if (comType != null) {
try {
comObject = Activator.CreateInstance(comType);
if (comObject != null) {
LOG.DebugFormat("Created new instance of {0} object.", progId);
}
} catch (Exception e) {
LOG.Warn("Error creating object for " + progId, e);
}
} catch (Exception e) {
LOG.Warn("Error creating object for " + progID.Value, e);
}
}
if (comObject != null) {
COMWrapper wrapper = new COMWrapper(comObject, type);
return (T)wrapper.GetTransparentProxy();
}
throw new TypeLoadException(string.Format("Unable to get or create an instance of the specified COM server \"{0}\".", progID.Value));
return default(T);
}
/// <summary>

@ -29,370 +29,4 @@ namespace Greenshot.Interop.Office {
int Count { get; }
void Remove(int index);
}
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx
/// </summary>
public interface Items : Collection, IEnumerable {
Item this[object index] { get; }
Item GetFirst();
Item GetNext();
Item GetLast();
Item GetPrevious();
bool IncludeRecurrences {
get;
set;
}
Items Restrict(string filter);
void Sort(string property, object descending);
// Actual definition is "object Add( object )", just making it convenient
object Add(OlItemType type);
}
// Common attributes of all the Items (MailItem, AppointmentItem)
// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
public interface Item : Common {
Attachments Attachments { get; }
string Body { get; set; }
OlObjectClass Class { get; }
DateTime CreationTime { get; }
string EntryID { get; }
DateTime LastModificationTime { get; }
string MessageClass { get; set; }
bool NoAging { get; set; }
int OutlookInternalVersion { get; }
string OutlookVersion { get; }
bool Saved { get; }
OlSensitivity Sensitivity { get; set; }
int Size { get; }
string Subject { get; set; }
bool UnRead { get; set; }
object Copy();
void Display(bool Modal);
void Save();
PropertyAccessor PropertyAccessor { get; }
Inspector GetInspector();
}
// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem.aspx
public interface MailItem : Item, Common {
bool Sent { get; }
object MAPIOBJECT { get; }
string HTMLBody { get; set; }
DateTime ExpiryTime { get; set; }
DateTime ReceivedTime { get; }
string SenderName { get; }
DateTime SentOn { get; }
OlBodyFormat BodyFormat { get; set; }
}
// See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx
public interface AppointmentItem : Item, Common {
string Organizer { get; set; }
string SendUsingAccount { get; }
string Categories { get; }
DateTime Start { get; }
DateTime End { get; }
OlReoccurenceState RecurrenceState { get; }
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.contactitem.aspx
public interface ContactItem : Item, Common {
bool HasPicture {
get;
}
void SaveBusinessCardImage(string path);
void AddPicture(string path);
void RemovePicture();
string FirstName {
get;
set;
}
string LastName {
get;
set;
}
}
public interface Attachments : Collection {
Attachment Add(object source, object type, object position, object displayName);
// Use index+1!!!!
Attachment this[object index] { get; }
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx
public interface Attachment : Common {
string DisplayName { get; set; }
string FileName { get; }
OlAttachmentType Type { get; }
PropertyAccessor PropertyAccessor { get; }
object MAPIOBJECT { get; }
void SaveAsFile(string path);
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.propertyaccessor_members.aspx
public interface PropertyAccessor : Common {
void SetProperty(string SchemaName, Object Value);
Object GetProperty(string SchemaName);
}
public enum OlBodyFormat {
// Fields
olFormatHTML = 2,
olFormatPlain = 1,
olFormatRichText = 3,
olFormatUnspecified = 0
}
public enum OlAttachmentType {
// Fields
olByReference = 4,
olByValue = 1,
olEmbeddeditem = 5,
olOLE = 6
}
public enum OlSensitivity {
// Fields
olConfidential = 3,
olNormal = 0,
olPersonal = 1,
olPrivate = 2
}
// See: http://msdn.microsoft.com/en-us/library/ff863329.aspx
public enum OlObjectClass {
olAccount = 105, // Represents an Account object.
olAccountRuleCondition = 135, // Represents an AccountRuleCondition object.
olAccounts = 106, // Represents an Accounts object.
olAction = 32, // Represents an Action object.
olActions = 33, // Represents an Actions object.
olAddressEntries = 21, // Represents an AddressEntries object.
olAddressEntry = 8, // Represents an AddressEntry object.
olAddressList = 7, // Represents an AddressList object.
olAddressLists = 20, // Represents an AddressLists object.
olAddressRuleCondition = 170, // Represents an AddressRuleCondition object.
olApplication = 0, // Represents an Application object.
olAppointment = 26, // Represents an AppointmentItem object.
olAssignToCategoryRuleAction = 122, // Represents an AssignToCategoryRuleAction object.
olAttachment = 5, // Represents an Attachment object.
olAttachments = 18, // Represents an Attachments object.
olAttachmentSelection = 169, // Represents an AttachmentSelection object.
olAutoFormatRule = 147, // Represents an AutoFormatRule object.
olAutoFormatRules = 148, // Represents an AutoFormatRules object.
olCalendarModule = 159, // Represents a CalendarModule object.
olCalendarSharing = 151, // Represents a CalendarSharing object.
olCategories = 153, // Represents a Categories object.
olCategory = 152, // Represents a Category object.
olCategoryRuleCondition = 130, // Represents a CategoryRuleCondition object.
olClassBusinessCardView = 168, // Represents a BusinessCardView object.
olClassCalendarView = 139, // Represents a CalendarView object.
olClassCardView = 138, // Represents a CardView object.
olClassIconView = 137, // Represents a IconView object.
olClassNavigationPane = 155, // Represents a NavigationPane object.
olClassTableView = 136, // Represents a TableView object.
olClassTimeLineView = 140, // Represents a TimelineView object.
olClassTimeZone = 174, // Represents a TimeZone object.
olClassTimeZones = 175, // Represents a TimeZones object.
olColumn = 154, // Represents a Column object.
olColumnFormat = 149, // Represents a ColumnFormat object.
olColumns = 150, // Represents a Columns object.
olConflict = 102, // Represents a Conflict object.
olConflicts = 103, // Represents a Conflicts object.
olContact = 40, // Represents a ContactItem object.
olContactsModule = 160, // Represents a ContactsModule object.
olDistributionList = 69, // Represents a ExchangeDistributionList object.
olDocument = 41, // Represents a DocumentItem object.
olException = 30, // Represents an Exception object.
olExceptions = 29, // Represents an Exceptions object.
olExchangeDistributionList = 111, // Represents an ExchangeDistributionList object.
olExchangeUser = 110, // Represents an ExchangeUser object.
olExplorer = 34, // Represents an Explorer object.
olExplorers = 60, // Represents an Explorers object.
olFolder = 2, // Represents a Folder object.
olFolders = 15, // Represents a Folders object.
olFolderUserProperties = 172, // Represents a UserDefinedProperties object.
olFolderUserProperty = 171, // Represents a UserDefinedProperty object.
olFormDescription = 37, // Represents a FormDescription object.
olFormNameRuleCondition = 131, // Represents a FormNameRuleCondition object.
olFormRegion = 129, // Represents a FormRegion object.
olFromRssFeedRuleCondition = 173, // Represents a FromRssFeedRuleCondition object.
olFromRuleCondition = 132, // Represents a ToOrFromRuleCondition object.
olImportanceRuleCondition = 128, // Represents an ImportanceRuleCondition object.
olInspector = 35, // Represents an Inspector object.
olInspectors = 61, // Represents an Inspectors object.
olItemProperties = 98, // Represents an ItemProperties object.
olItemProperty = 99, // Represents an ItemProperty object.
olItems = 16, // Represents an Items object.
olJournal = 42, // Represents a JournalItem object.
olJournalModule = 162, // Represents a JournalModule object.
olLink = 75, // Represents a Link object.
olLinks = 76, // Represents a Links object.
olMail = 43, // Represents a MailItem object.
olMailModule = 158, // Represents a MailModule object.
olMarkAsTaskRuleAction = 124, // Represents a MarkAsTaskRuleAction object.
olMeetingCancellation = 54, // Represents a MeetingItem object that is a meeting cancellation notice.
olMeetingRequest = 53, // Represents a MeetingItem object that is a meeting request.
olMeetingResponseNegative = 55, // Represents a MeetingItem object that is a refusal of a meeting request.
olMeetingResponsePositive = 56, // Represents a MeetingItem object that is an acceptance of a meeting request.
olMeetingResponseTentative = 57, // Represents a MeetingItem object that is a tentative acceptance of a meeting request.
olMoveOrCopyRuleAction = 118, // Represents a MoveOrCopyRuleAction object.
olNamespace = 1, // Represents a NameSpace object.
olNavigationFolder = 167, // Represents a NavigationFolder object.
olNavigationFolders = 166, // Represents a NavigationFolders object.
olNavigationGroup = 165, // Represents a NavigationGroup object.
olNavigationGroups = 164, // Represents a NavigationGroups object.
olNavigationModule = 157, // Represents a NavigationModule object.
olNavigationModules = 156, // Represents a NavigationModules object.
olNewItemAlertRuleAction = 125, // Represents a NewItemAlertRuleAction object.
olNote = 44, // Represents a NoteItem object.
olNotesModule = 163, // Represents a NotesModule object.
olOrderField = 144, // Represents an OrderField object.
olOrderFields = 145, // Represents an OrderFields object.
olOutlookBarGroup = 66, // Represents an OutlookBarGroup object.
olOutlookBarGroups = 65, // Represents an OutlookBarGroups object.
olOutlookBarPane = 63, // Represents an OutlookBarPane object.
olOutlookBarShortcut = 68, // Represents an OutlookBarShortcut object.
olOutlookBarShortcuts = 67, // Represents an OutlookBarShortcuts object.
olOutlookBarStorage = 64, // Represents an OutlookBarStorage object.
olPages = 36, // Represents a Pages object.
olPanes = 62, // Represents a Panes object.
olPlaySoundRuleAction = 123, // Represents a PlaySoundRuleAction object.
olPost = 45, // Represents a PostItem object.
olPropertyAccessor = 112, // Represents a PropertyAccessor object.
olPropertyPages = 71, // Represents a PropertyPages object.
olPropertyPageSite = 70, // Represents a PropertyPageSite object.
olRecipient = 4, // Represents a Recipient object.
olRecipients = 17, // Represents a Recipients object.
olRecurrencePattern = 28, // Represents a RecurrencePattern object.
olReminder = 101, // Represents a Reminder object.
olReminders = 100, // Represents a Reminders object.
olRemote = 47, // Represents a RemoteItem object.
olReport = 46, // Represents a ReportItem object.
olResults = 78, // Represents a Results object.
olRow = 121, // Represents a Row object.
olRule = 115, // Represents a Rule object.
olRuleAction = 117, // Represents a RuleAction object.
olRuleActions = 116, // Represents a RuleAction object.
olRuleCondition = 127, // Represents a RuleCondition object.
olRuleConditions = 126, // Represents a RuleConditions object.
olRules = 114, // Represents a Rules object.
olSearch = 77, // Represents a Search object.
olSelection = 74, // Represents a Selection object.
olSelectNamesDialog = 109, // Represents a SelectNamesDialog object.
olSenderInAddressListRuleCondition = 133, // Represents a SenderInAddressListRuleCondition object.
olSendRuleAction = 119, // Represents a SendRuleAction object.
olSharing = 104, // Represents a SharingItem object.
olStorageItem = 113, // Represents a StorageItem object.
olStore = 107, // Represents a Store object.
olStores = 108, // Represents a Stores object.
olSyncObject = 72, // Represents a SyncObject object.
olSyncObjects = 73, // Represents a SyncObject object.
olTable = 120, // Represents a Table object.
olTask = 48, // Represents a TaskItem object.
olTaskRequest = 49, // Represents a TaskRequestItem object.
olTaskRequestAccept = 51, // Represents a TaskRequestAcceptItem object.
olTaskRequestDecline = 52, // Represents a TaskRequestDeclineItem object.
olTaskRequestUpdate = 50, // Represents a TaskRequestUpdateItem object.
olTasksModule = 161, // Represents a TasksModule object.
olTextRuleCondition = 134, // Represents a TextRuleCondition object.
olUserDefinedProperties = 172, // Represents a UserDefinedProperties object.
olUserDefinedProperty = 171, // Represents a UserDefinedProperty object.
olUserProperties = 38, // Represents a UserProperties object.
olUserProperty = 39, // Represents a UserProperty object.
olView = 80, // Represents a View object.
olViewField = 142, // Represents a ViewField object.
olViewFields = 141, // Represents a ViewFields object.
olViewFont = 146, // Represents a ViewFont object.
olViews = 79 // Represents a Views object.
}
public enum OlDefaultFolders {
olFolderCalendar = 9, // The Calendar folder.
olFolderConflicts = 19, // The Conflicts folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderContacts = 10, // The Contacts folder.
olFolderDeletedItems = 3, // The Deleted Items folder.
olFolderDrafts = 16, // The Drafts folder.
olFolderInbox = 6, // The Inbox folder.
olFolderJournal = 11, // The Journal folder.
olFolderJunk = 23, // The Junk E-Mail folder.
olFolderLocalFailures = 21, // The Local Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderManagedEmail = 29, // The top-level folder in the Managed Folders group. For more information on Managed Folders, see Help in Microsoft Outlook. Only available for an Exchange account.
olFolderNotes = 12, // The Notes folder.
olFolderOutbox = 4, // The Outbox folder.
olFolderSentMail = 5, // The Sent Mail folder.
olFolderServerFailures = 22, // The Server Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderSyncIssues = 20, // The Sync Issues folder. Only available for an Exchange account.
olFolderTasks = 13, // The Tasks folder.
olFolderToDo = 28, // The To Do folder.
olPublicFoldersAllPublicFolders = 18, // The All Public Folders folder in the Exchange Public Folders store. Only available for an Exchange account.
olFolderRssFeeds = 25 // The RSS Feeds folder.
}
public enum OlItemType {
// Fields
olAppointmentItem = 1,
olContactItem = 2,
olDistributionListItem = 7,
olJournalItem = 4,
olMailItem = 0,
olNoteItem = 5,
olPostItem = 6,
olTaskItem = 3
}
public enum OlEditorType {
// Fields
olEditorHTML = 2,
olEditorRTF = 3,
olEditorText = 1,
olEditorWord = 4
}
public enum OlWindowState {
// Fields
olMaximized = 0,
olMinimized = 1,
olNormalWindow = 2
}
public enum OlInspectorClose {
// Fields
olDiscard = 1,
olPromptForSave = 2,
olSave = 0
}
public enum MsoTriState {
msoTrue = -1,
msoFalse = 0,
msoCTrue = 1,
msoTriStateToggle = -3,
msoTriStateMixed = -2
}
public enum OlReoccurenceState {
olApptException,
olApptMaster,
olApptNotRecurring,
olApptOccurrence
}
public enum MsoScaleFrom {
msoScaleFromTopLeft = 0,
msoScaleFromMiddle = 1,
msoScaleFromBottomRight = 2
}
// Schema definitions for the MAPI properties
// See: http://msdn.microsoft.com/en-us/library/aa454438.aspx
// and see: http://msdn.microsoft.com/en-us/library/bb446117.aspx
public static class PropTag {
public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
}
}

@ -27,6 +27,123 @@ using System.Collections.Generic;
/// But this somehow doesn't work yet
/// </summary>
namespace Greenshot.Interop.Office {
/// <summary>
/// See: http://msdn.microsoft.com/en-us/library/bb208387%28v=office.12%29.aspx
/// </summary>
public interface Items : Collection, IEnumerable {
Item this[object index] { get; }
Item GetFirst();
Item GetNext();
Item GetLast();
Item GetPrevious();
bool IncludeRecurrences {
get;
set;
}
Items Restrict(string filter);
void Sort(string property, object descending);
// Actual definition is "object Add( object )", just making it convenient
object Add(OlItemType type);
}
// Common attributes of all the Items (MailItem, AppointmentItem)
// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
public interface Item : Common {
Attachments Attachments { get; }
string Body { get; set; }
OlObjectClass Class { get; }
DateTime CreationTime { get; }
string EntryID { get; }
DateTime LastModificationTime { get; }
string MessageClass { get; set; }
bool NoAging { get; set; }
int OutlookInternalVersion { get; }
string OutlookVersion { get; }
bool Saved { get; }
OlSensitivity Sensitivity { get; set; }
int Size { get; }
string Subject { get; set; }
bool UnRead { get; set; }
object Copy();
void Display(bool Modal);
void Save();
PropertyAccessor PropertyAccessor { get; }
Inspector GetInspector();
}
// See: http://msdn.microsoft.com/en-us/library/ff861252.aspx
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem.aspx
public interface MailItem : Item, Common {
bool Sent { get; }
object MAPIOBJECT { get; }
string HTMLBody { get; set; }
DateTime ExpiryTime { get; set; }
DateTime ReceivedTime { get; }
string SenderName { get; }
DateTime SentOn { get; }
OlBodyFormat BodyFormat { get; set; }
}
// See: http://msdn.microsoft.com/en-us/library/ff869026.aspx
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.appointmentitem.aspx
public interface AppointmentItem : Item, Common {
string Organizer { get; set; }
string SendUsingAccount { get; }
string Categories { get; }
DateTime Start { get; }
DateTime End { get; }
OlReoccurenceState RecurrenceState { get; }
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.contactitem.aspx
public interface ContactItem : Item, Common {
bool HasPicture {
get;
}
void SaveBusinessCardImage(string path);
void AddPicture(string path);
void RemovePicture();
string FirstName {
get;
set;
}
string LastName {
get;
set;
}
}
public interface Attachments : Collection {
Attachment Add(object source, object type, object position, object displayName);
// Use index+1!!!!
Attachment this[object index] { get; }
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.attachment_members.aspx
public interface Attachment : Common {
string DisplayName { get; set; }
string FileName { get; }
OlAttachmentType Type { get; }
PropertyAccessor PropertyAccessor { get; }
object MAPIOBJECT { get; }
void SaveAsFile(string path);
}
// See: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.propertyaccessor_members.aspx
public interface PropertyAccessor : Common {
void SetProperty(string SchemaName, Object Value);
Object GetProperty(string SchemaName);
}
// Schema definitions for the MAPI properties
// See: http://msdn.microsoft.com/en-us/library/aa454438.aspx
// and see: http://msdn.microsoft.com/en-us/library/bb446117.aspx
public static class PropTag {
public const string ATTACHMENT_CONTENT_ID = @"http://schemas.microsoft.com/mapi/proptag/0x3712001E";
}
/// <summary>
/// Wrapper for Outlook.Application, see: http://msdn.microsoft.com/en-us/library/aa210897%28v=office.11%29.aspx
/// </summary>
@ -96,4 +213,251 @@ namespace Greenshot.Interop.Office {
public enum EmailFormat {
Text, HTML
}
public enum OlBodyFormat {
// Fields
olFormatHTML = 2,
olFormatPlain = 1,
olFormatRichText = 3,
olFormatUnspecified = 0
}
public enum OlAttachmentType {
// Fields
olByReference = 4,
olByValue = 1,
olEmbeddeditem = 5,
olOLE = 6
}
public enum OlSensitivity {
// Fields
olConfidential = 3,
olNormal = 0,
olPersonal = 1,
olPrivate = 2
}
// See: http://msdn.microsoft.com/en-us/library/ff863329.aspx
public enum OlObjectClass {
olAccount = 105, // Represents an Account object.
olAccountRuleCondition = 135, // Represents an AccountRuleCondition object.
olAccounts = 106, // Represents an Accounts object.
olAction = 32, // Represents an Action object.
olActions = 33, // Represents an Actions object.
olAddressEntries = 21, // Represents an AddressEntries object.
olAddressEntry = 8, // Represents an AddressEntry object.
olAddressList = 7, // Represents an AddressList object.
olAddressLists = 20, // Represents an AddressLists object.
olAddressRuleCondition = 170, // Represents an AddressRuleCondition object.
olApplication = 0, // Represents an Application object.
olAppointment = 26, // Represents an AppointmentItem object.
olAssignToCategoryRuleAction = 122, // Represents an AssignToCategoryRuleAction object.
olAttachment = 5, // Represents an Attachment object.
olAttachments = 18, // Represents an Attachments object.
olAttachmentSelection = 169, // Represents an AttachmentSelection object.
olAutoFormatRule = 147, // Represents an AutoFormatRule object.
olAutoFormatRules = 148, // Represents an AutoFormatRules object.
olCalendarModule = 159, // Represents a CalendarModule object.
olCalendarSharing = 151, // Represents a CalendarSharing object.
olCategories = 153, // Represents a Categories object.
olCategory = 152, // Represents a Category object.
olCategoryRuleCondition = 130, // Represents a CategoryRuleCondition object.
olClassBusinessCardView = 168, // Represents a BusinessCardView object.
olClassCalendarView = 139, // Represents a CalendarView object.
olClassCardView = 138, // Represents a CardView object.
olClassIconView = 137, // Represents a IconView object.
olClassNavigationPane = 155, // Represents a NavigationPane object.
olClassTableView = 136, // Represents a TableView object.
olClassTimeLineView = 140, // Represents a TimelineView object.
olClassTimeZone = 174, // Represents a TimeZone object.
olClassTimeZones = 175, // Represents a TimeZones object.
olColumn = 154, // Represents a Column object.
olColumnFormat = 149, // Represents a ColumnFormat object.
olColumns = 150, // Represents a Columns object.
olConflict = 102, // Represents a Conflict object.
olConflicts = 103, // Represents a Conflicts object.
olContact = 40, // Represents a ContactItem object.
olContactsModule = 160, // Represents a ContactsModule object.
olDistributionList = 69, // Represents a ExchangeDistributionList object.
olDocument = 41, // Represents a DocumentItem object.
olException = 30, // Represents an Exception object.
olExceptions = 29, // Represents an Exceptions object.
olExchangeDistributionList = 111, // Represents an ExchangeDistributionList object.
olExchangeUser = 110, // Represents an ExchangeUser object.
olExplorer = 34, // Represents an Explorer object.
olExplorers = 60, // Represents an Explorers object.
olFolder = 2, // Represents a Folder object.
olFolders = 15, // Represents a Folders object.
olFolderUserProperties = 172, // Represents a UserDefinedProperties object.
olFolderUserProperty = 171, // Represents a UserDefinedProperty object.
olFormDescription = 37, // Represents a FormDescription object.
olFormNameRuleCondition = 131, // Represents a FormNameRuleCondition object.
olFormRegion = 129, // Represents a FormRegion object.
olFromRssFeedRuleCondition = 173, // Represents a FromRssFeedRuleCondition object.
olFromRuleCondition = 132, // Represents a ToOrFromRuleCondition object.
olImportanceRuleCondition = 128, // Represents an ImportanceRuleCondition object.
olInspector = 35, // Represents an Inspector object.
olInspectors = 61, // Represents an Inspectors object.
olItemProperties = 98, // Represents an ItemProperties object.
olItemProperty = 99, // Represents an ItemProperty object.
olItems = 16, // Represents an Items object.
olJournal = 42, // Represents a JournalItem object.
olJournalModule = 162, // Represents a JournalModule object.
olLink = 75, // Represents a Link object.
olLinks = 76, // Represents a Links object.
olMail = 43, // Represents a MailItem object.
olMailModule = 158, // Represents a MailModule object.
olMarkAsTaskRuleAction = 124, // Represents a MarkAsTaskRuleAction object.
olMeetingCancellation = 54, // Represents a MeetingItem object that is a meeting cancellation notice.
olMeetingRequest = 53, // Represents a MeetingItem object that is a meeting request.
olMeetingResponseNegative = 55, // Represents a MeetingItem object that is a refusal of a meeting request.
olMeetingResponsePositive = 56, // Represents a MeetingItem object that is an acceptance of a meeting request.
olMeetingResponseTentative = 57, // Represents a MeetingItem object that is a tentative acceptance of a meeting request.
olMoveOrCopyRuleAction = 118, // Represents a MoveOrCopyRuleAction object.
olNamespace = 1, // Represents a NameSpace object.
olNavigationFolder = 167, // Represents a NavigationFolder object.
olNavigationFolders = 166, // Represents a NavigationFolders object.
olNavigationGroup = 165, // Represents a NavigationGroup object.
olNavigationGroups = 164, // Represents a NavigationGroups object.
olNavigationModule = 157, // Represents a NavigationModule object.
olNavigationModules = 156, // Represents a NavigationModules object.
olNewItemAlertRuleAction = 125, // Represents a NewItemAlertRuleAction object.
olNote = 44, // Represents a NoteItem object.
olNotesModule = 163, // Represents a NotesModule object.
olOrderField = 144, // Represents an OrderField object.
olOrderFields = 145, // Represents an OrderFields object.
olOutlookBarGroup = 66, // Represents an OutlookBarGroup object.
olOutlookBarGroups = 65, // Represents an OutlookBarGroups object.
olOutlookBarPane = 63, // Represents an OutlookBarPane object.
olOutlookBarShortcut = 68, // Represents an OutlookBarShortcut object.
olOutlookBarShortcuts = 67, // Represents an OutlookBarShortcuts object.
olOutlookBarStorage = 64, // Represents an OutlookBarStorage object.
olPages = 36, // Represents a Pages object.
olPanes = 62, // Represents a Panes object.
olPlaySoundRuleAction = 123, // Represents a PlaySoundRuleAction object.
olPost = 45, // Represents a PostItem object.
olPropertyAccessor = 112, // Represents a PropertyAccessor object.
olPropertyPages = 71, // Represents a PropertyPages object.
olPropertyPageSite = 70, // Represents a PropertyPageSite object.
olRecipient = 4, // Represents a Recipient object.
olRecipients = 17, // Represents a Recipients object.
olRecurrencePattern = 28, // Represents a RecurrencePattern object.
olReminder = 101, // Represents a Reminder object.
olReminders = 100, // Represents a Reminders object.
olRemote = 47, // Represents a RemoteItem object.
olReport = 46, // Represents a ReportItem object.
olResults = 78, // Represents a Results object.
olRow = 121, // Represents a Row object.
olRule = 115, // Represents a Rule object.
olRuleAction = 117, // Represents a RuleAction object.
olRuleActions = 116, // Represents a RuleAction object.
olRuleCondition = 127, // Represents a RuleCondition object.
olRuleConditions = 126, // Represents a RuleConditions object.
olRules = 114, // Represents a Rules object.
olSearch = 77, // Represents a Search object.
olSelection = 74, // Represents a Selection object.
olSelectNamesDialog = 109, // Represents a SelectNamesDialog object.
olSenderInAddressListRuleCondition = 133, // Represents a SenderInAddressListRuleCondition object.
olSendRuleAction = 119, // Represents a SendRuleAction object.
olSharing = 104, // Represents a SharingItem object.
olStorageItem = 113, // Represents a StorageItem object.
olStore = 107, // Represents a Store object.
olStores = 108, // Represents a Stores object.
olSyncObject = 72, // Represents a SyncObject object.
olSyncObjects = 73, // Represents a SyncObject object.
olTable = 120, // Represents a Table object.
olTask = 48, // Represents a TaskItem object.
olTaskRequest = 49, // Represents a TaskRequestItem object.
olTaskRequestAccept = 51, // Represents a TaskRequestAcceptItem object.
olTaskRequestDecline = 52, // Represents a TaskRequestDeclineItem object.
olTaskRequestUpdate = 50, // Represents a TaskRequestUpdateItem object.
olTasksModule = 161, // Represents a TasksModule object.
olTextRuleCondition = 134, // Represents a TextRuleCondition object.
olUserDefinedProperties = 172, // Represents a UserDefinedProperties object.
olUserDefinedProperty = 171, // Represents a UserDefinedProperty object.
olUserProperties = 38, // Represents a UserProperties object.
olUserProperty = 39, // Represents a UserProperty object.
olView = 80, // Represents a View object.
olViewField = 142, // Represents a ViewField object.
olViewFields = 141, // Represents a ViewFields object.
olViewFont = 146, // Represents a ViewFont object.
olViews = 79 // Represents a Views object.
}
public enum OlDefaultFolders {
olFolderCalendar = 9, // The Calendar folder.
olFolderConflicts = 19, // The Conflicts folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderContacts = 10, // The Contacts folder.
olFolderDeletedItems = 3, // The Deleted Items folder.
olFolderDrafts = 16, // The Drafts folder.
olFolderInbox = 6, // The Inbox folder.
olFolderJournal = 11, // The Journal folder.
olFolderJunk = 23, // The Junk E-Mail folder.
olFolderLocalFailures = 21, // The Local Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderManagedEmail = 29, // The top-level folder in the Managed Folders group. For more information on Managed Folders, see Help in Microsoft Outlook. Only available for an Exchange account.
olFolderNotes = 12, // The Notes folder.
olFolderOutbox = 4, // The Outbox folder.
olFolderSentMail = 5, // The Sent Mail folder.
olFolderServerFailures = 22, // The Server Failures folder (subfolder of Sync Issues folder). Only available for an Exchange account.
olFolderSyncIssues = 20, // The Sync Issues folder. Only available for an Exchange account.
olFolderTasks = 13, // The Tasks folder.
olFolderToDo = 28, // The To Do folder.
olPublicFoldersAllPublicFolders = 18, // The All Public Folders folder in the Exchange Public Folders store. Only available for an Exchange account.
olFolderRssFeeds = 25 // The RSS Feeds folder.
}
public enum OlItemType {
// Fields
olAppointmentItem = 1,
olContactItem = 2,
olDistributionListItem = 7,
olJournalItem = 4,
olMailItem = 0,
olNoteItem = 5,
olPostItem = 6,
olTaskItem = 3
}
public enum OlEditorType {
// Fields
olEditorHTML = 2,
olEditorRTF = 3,
olEditorText = 1,
olEditorWord = 4
}
public enum OlWindowState {
// Fields
olMaximized = 0,
olMinimized = 1,
olNormalWindow = 2
}
public enum OlInspectorClose {
// Fields
olDiscard = 1,
olPromptForSave = 2,
olSave = 0
}
public enum MsoTriState {
msoTrue = -1,
msoFalse = 0,
msoCTrue = 1,
msoTriStateToggle = -3,
msoTriStateMixed = -2
}
public enum OlReoccurenceState {
olApptException,
olApptMaster,
olApptNotRecurring,
olApptOccurrence
}
public enum MsoScaleFrom {
msoScaleFromTopLeft = 0,
msoScaleFromMiddle = 1,
msoScaleFromBottomRight = 2
}
}

@ -24,7 +24,7 @@ using System.Windows.Forms;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Jira;
namespace GreenshotJiraPlugin {

@ -27,7 +27,7 @@ using System.Windows.Forms;
using GreenshotJiraPlugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace Jira {
#region transport classes

@ -21,7 +21,7 @@
using System;
using System.Windows.Forms;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotJiraPlugin {
/// <summary>

@ -29,7 +29,7 @@ using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Jira;
namespace GreenshotJiraPlugin {

@ -28,7 +28,7 @@ using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Jira;
namespace GreenshotJiraPlugin {

@ -29,7 +29,7 @@ using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using Jira;
namespace GreenshotJiraPlugin {

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.IO;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotNetworkImportPlugin {
/// <summary>

@ -21,7 +21,7 @@
using System;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace GreenshotNetworkImportPlugin {
/// <summary>

@ -26,7 +26,7 @@ using Greenshot.Drawing;
using Greenshot.Forms;
using Greenshot.Helpers;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using NUnit.Framework;
namespace Greenshot.Test

@ -23,7 +23,7 @@ using System.Windows.Forms;
using Greenshot.Configuration;
using Greenshot.Forms;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
using NUnit.Framework;
namespace Greenshot.Test

@ -24,7 +24,7 @@ using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>

@ -24,7 +24,7 @@ using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>

@ -28,7 +28,7 @@ using System.Windows.Forms;
using Greenshot.Plugin;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>

@ -23,7 +23,7 @@ using System.Collections.Generic;
using System.IO;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>

@ -22,7 +22,7 @@ using System;
using System.Drawing;
using System.Windows.Forms;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>

@ -29,7 +29,7 @@ using System.Text.RegularExpressions;
using Greenshot.Plugin;
using GreenshotPlugin.Controls;
using GreenshotPlugin.Core;
using IniFile;
using Greenshot.IniFile;
namespace PluginExample {
/// <summary>