From b0c942c5963f0c39fe6db4fa139af85a04f5c3a5 Mon Sep 17 00:00:00 2001 From: RKrom Date: Mon, 12 Mar 2012 08:54:11 +0000 Subject: [PATCH] Commit of missing files. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1691 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotInterop/Interop/Base.cs | 11 +++ GreenshotInterop/Interop/IDispatch.cs | 14 ++++ .../RemedyInterop/RemedyExporter.cs | 39 +++++++++ .../RemedyInterop/RemedyInterop.cs | 79 +++++++++++++++++++ 4 files changed, 143 insertions(+) create mode 100644 GreenshotInterop/Interop/Base.cs create mode 100644 GreenshotInterop/Interop/IDispatch.cs create mode 100644 GreenshotInterop/RemedyInterop/RemedyExporter.cs create mode 100644 GreenshotInterop/RemedyInterop/RemedyInterop.cs diff --git a/GreenshotInterop/Interop/Base.cs b/GreenshotInterop/Interop/Base.cs new file mode 100644 index 000000000..b985c83b6 --- /dev/null +++ b/GreenshotInterop/Interop/Base.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Greenshot.Interop { + /// + /// Common properties that has appreared in almost all objects + /// + public interface Common : IDisposable { + } +} diff --git a/GreenshotInterop/Interop/IDispatch.cs b/GreenshotInterop/Interop/IDispatch.cs new file mode 100644 index 000000000..a9f53a6c0 --- /dev/null +++ b/GreenshotInterop/Interop/IDispatch.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Runtime.InteropServices; +using System.Runtime.InteropServices.CustomMarshalers; + +namespace Greenshot.Interop { + [ComImport, Guid("00020400-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] + public interface IDispatch { + void Reserved(); + [PreserveSig] + int GetTypeInfo(uint nInfo, int lcid, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(TypeToTypeInfoMarshaler))] out Type typeInfo); + } +} diff --git a/GreenshotInterop/RemedyInterop/RemedyExporter.cs b/GreenshotInterop/RemedyInterop/RemedyExporter.cs new file mode 100644 index 000000000..03db9a199 --- /dev/null +++ b/GreenshotInterop/RemedyInterop/RemedyExporter.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Greenshot.Interop.Remedy { + public class RemedyExporter { + private const string HELP_DESK = "HPD:Help Desk"; + private const string INCIDENT_INTERFACE = "HPD:IncidentInterface_Create"; + private const string INCIDENT_MANAGEMENT_CONSOLE = "HPD:Incident Management Console"; + private const int FIELD_INCIDENT = 1000000161; + private const int FIELD_ATTACH = 536880912; + + private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(RemedyExporter)); + public static void Info() { + try { + using (IRemedyUserApplication remedyApplication = COMWrapper.GetInstance()) { + if (remedyApplication != null) { + //COMWrapper.DumpTypeInfo(remedyApplication); + + ICOMFormWnd2 form = remedyApplication.GetActiveForm(); + //COMWrapper.DumpTypeInfo(form); + LOG.InfoFormat("Server name {0}", form.GetServerName()); + LOG.InfoFormat("Form name {0}", form.GetFormName()); + if (HELP_DESK.Equals(form.GetFormName())) { + ICOMField4 field = form.GetFieldById(FIELD_INCIDENT); + //COMWrapper.DumpTypeInfo(field); + LOG.InfoFormat("Incident {0}", field.Value); + ICOMField4 fieldAttach = form.GetFieldById(FIELD_ATTACH); + LOG.InfoFormat("Attachment {0}", fieldAttach.Value); + + } + } + } + } catch (Exception ex) { + LOG.Error(ex); + } + } + } +} diff --git a/GreenshotInterop/RemedyInterop/RemedyInterop.cs b/GreenshotInterop/RemedyInterop/RemedyInterop.cs new file mode 100644 index 000000000..0a68c8226 --- /dev/null +++ b/GreenshotInterop/RemedyInterop/RemedyInterop.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Greenshot.Interop; + +namespace Greenshot.Interop.Remedy { + // "Remedy.User.1" is the active remedy, if any + [ComProgId("Remedy.User.1")] + public interface IRemedyUserApplication : Common { + int Login(string a, string b, int c); + void Logout(int a); + ICOMFormWnd2 OpenForm(int a, string b, string c, OpenMode d, int e); + ICOMFormWnd2 GetActiveForm(); + ICOMFormWnd2 LoadForm(int a, string b, string c, string d, OpenMode e, int f); + object GetServerList(int a); + object GetFormList(int a, string b); + int HasDefaultSession(); + void OpenGuide(int a, string b, string c); + void RunMacro(int a, string b, int c, ref object d); + object QueryForm(int a, string b, string c, string d, string e, OpenMode f, int g); + IRemedyUser GetUser(ref string a); + int Login2(int a); + void OpenAlertList(string a, string b); + int Login3(string a, string b, string c, int d); + } + + public interface IRemedyUser : Common { + } + + public interface ICOMFormWnd2 : Common { + string Submit(); + void Modify(); + void Close(); + void MakeVisible(); + ICOMField4 GetField(string a); + void GiveFieldFocus(string a); + ICOMField4 GetFieldById(int a); + void GiveFieldFocusById(int a); + object Query(string a); + string GetServerName(); + string GetFormName(); + int HasFieldFocus(string a); + int HasFieldFocusById(int a); + int GetVUIId(); + void GetFieldList(ref object a, ref object b); + } + + public interface ICOMField4 : Common { + void MakeVisible(int a); + void MakeReadWrite(int a); + void Disable(); + int IsVisible(); + int IsHidden(); + int IsReadOnly(); + int IsReadWrite(); + int IsDisabled(); + object GetARDBProp(uint a); + object GetCurrencyPart(NCOMField3CurrencyPartEnum a); + void SetCurrencyValue(string a); + object GetDiaryHistoryList(NCOMField3DiaryHistoryFlagsEnum a); + string GetFieldLabel(); + string GetFieldFont(); + string GetFieldColor(); + string Value { + get; + set; + } + } + + public enum NCOMField3CurrencyPartEnum { + } + public enum NCOMField3DiaryHistoryFlagsEnum { + } + + public enum OpenMode { + ARQuery, + ARModify + } +}