diff --git a/src/Greenshot.PerformanceTests/Capture/ScreenCapture.cs b/src/Greenshot.PerformanceTests/Capture/ScreenCapture.cs
index 7343ee378..ae1c3d080 100644
--- a/src/Greenshot.PerformanceTests/Capture/ScreenCapture.cs
+++ b/src/Greenshot.PerformanceTests/Capture/ScreenCapture.cs
@@ -24,59 +24,64 @@
#region Usings
using System;
-using System.Collections.Generic;
-using System.Diagnostics;
using System.Drawing;
-using System.Drawing.Imaging;
-using System.Runtime.InteropServices;
using System.Windows;
-using System.Windows.Forms;
using System.Windows.Interop;
using System.Windows.Media.Imaging;
using Dapplo.Log;
-using Dapplo.Windows.Common;
-using Dapplo.Windows.Common.Extensions;
using Dapplo.Windows.Common.Structs;
using Dapplo.Windows.Gdi32;
using Dapplo.Windows.Gdi32.Enums;
using Dapplo.Windows.Gdi32.SafeHandles;
using Dapplo.Windows.Gdi32.Structs;
-using Dapplo.Windows.Icons;
-using Dapplo.Windows.User32;
-using Dapplo.Windows.User32.Enums;
-using Dapplo.Windows.User32.Structs;
-using Greenshot.Addons.Config.Impl;
-using Greenshot.Addons.Interfaces;
-using Greenshot.Gfx;
+using Greenshot.Addons.Core;
#endregion
-namespace Greenshot.Addons.Core
+namespace Greenshot.PerformanceTests.Capture
{
///
/// The screen Capture code
///
public class ScreenCapture : IDisposable
{
- private static readonly LogSource Log = new LogSource();
- private readonly ICoreConfiguration _coreConfiguration;
- private readonly NativeRect _captureBounds;
private readonly SafeWindowDcHandle _desktopDcHandle;
private readonly SafeCompatibleDcHandle _safeCompatibleDcHandle;
- private readonly BitmapInfoHeader _bitmapInfoHeader;
+ private readonly bool _useStretch;
private readonly SafeDibSectionHandle _safeDibSectionHandle;
private readonly SafeSelectObjectHandle _safeSelectObjectHandle;
- public ScreenCapture(ICoreConfiguration coreConfiguration, NativeRect captureBounds)
+ ///
+ /// Return the source rectangle
+ ///
+ public NativeRect SourceRect { get; }
+
+ ///
+ /// Return the source rectangle
+ ///
+ public NativeSize DestinationSize { get; }
+
+ public ScreenCapture(NativeRect sourceCaptureBounds, NativeSize? requestedSize = null)
{
- _coreConfiguration = coreConfiguration;
- _captureBounds = captureBounds;
+ SourceRect = sourceCaptureBounds;
+
+ if (requestedSize.HasValue && requestedSize.Value != SourceRect.Size)
+ {
+ DestinationSize = requestedSize.Value;
+ _useStretch = true;
+ }
+ else
+ {
+ DestinationSize = SourceRect.Size;
+ _useStretch = false;
+ }
+
_desktopDcHandle = SafeWindowDcHandle.FromDesktop();
_safeCompatibleDcHandle = Gdi32Api.CreateCompatibleDC(_desktopDcHandle);
// Create BitmapInfoHeader for CreateDIBSection
- _bitmapInfoHeader = BitmapInfoHeader.Create(captureBounds.Width, captureBounds.Height, 24);
+ var bitmapInfoHeader = BitmapInfoHeader.Create(DestinationSize.Width, DestinationSize.Height, 32);
- _safeDibSectionHandle = Gdi32Api.CreateDIBSection(_desktopDcHandle, ref _bitmapInfoHeader, DibColors.PalColors, out _, IntPtr.Zero, 0);
+ _safeDibSectionHandle = Gdi32Api.CreateDIBSection(_desktopDcHandle, ref bitmapInfoHeader, DibColors.PalColors, out _, IntPtr.Zero, 0);
// select the bitmap object and store the old handle
_safeSelectObjectHandle = _safeCompatibleDcHandle.SelectObject(_safeDibSectionHandle);
@@ -84,12 +89,40 @@ namespace Greenshot.Addons.Core
public void CaptureFrame()
{
- // bit-blt over (make copy)
- // ReSharper disable once BitwiseOperatorOnEnumWithoutFlags
- Gdi32Api.BitBlt(_safeCompatibleDcHandle, 0, 0, _captureBounds.Width, _captureBounds.Height, _desktopDcHandle, _captureBounds.X, _captureBounds.Y,
+ if (_useStretch)
+ {
+ // capture & blt over (make copy)
+ Gdi32Api.StretchBlt(
+ _safeCompatibleDcHandle, 0, 0, DestinationSize.Width, DestinationSize.Height, // Destination
+ _desktopDcHandle, SourceRect.X, SourceRect.Y, SourceRect.Width, SourceRect.Height, // source
RasterOperations.SourceCopy | RasterOperations.CaptureBlt);
+ }
+ else
+ {
+ // capture & blt over (make copy)
+ Gdi32Api.BitBlt(
+ _safeCompatibleDcHandle, 0, 0, DestinationSize.Width, DestinationSize.Height, // Destination
+ _desktopDcHandle, SourceRect.X, SourceRect.Y, // Source
+ RasterOperations.SourceCopy | RasterOperations.CaptureBlt);
+ }
+ }
- //return Imaging.CreateBitmapSourceFromHBitmap(_safeDibSectionHandle.DangerousGetHandle(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
+ ///
+ /// Get the current frame as BitmapSource
+ ///
+ /// BitmapSource
+ public BitmapSource CurrentFrameAsBitmapSource()
+ {
+ return Imaging.CreateBitmapSourceFromHBitmap(_safeDibSectionHandle.DangerousGetHandle(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
+ }
+
+ ///
+ /// Get the current frame as Bitmap
+ ///
+ /// Bitmap
+ public Bitmap CurrentFrameAsBitmap()
+ {
+ return Image.FromHbitmap(_safeDibSectionHandle.DangerousGetHandle());
}
public void Dispose()
diff --git a/src/Greenshot.PerformanceTests/CapturePerformance.cs b/src/Greenshot.PerformanceTests/CapturePerformance.cs
index 11100b64f..ef341917b 100644
--- a/src/Greenshot.PerformanceTests/CapturePerformance.cs
+++ b/src/Greenshot.PerformanceTests/CapturePerformance.cs
@@ -1,7 +1,32 @@
-using System;
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+using System;
using BenchmarkDotNet.Attributes;
+using Dapplo.Windows.Common.Structs;
using Dapplo.Windows.User32;
using Greenshot.Addons.Core;
+using Greenshot.PerformanceTests.Capture;
namespace Greenshot.PerformanceTests
{
@@ -11,9 +36,15 @@ namespace Greenshot.PerformanceTests
[MinColumn, MaxColumn, MemoryDiagnoser]
public class CapturePerformance
{
- private readonly ScreenCapture _screenCapture = new ScreenCapture(null, DisplayInfo.ScreenBounds);
+ // A ScreenCapture which captures the whole screen (multi-monitor)
+ private readonly ScreenCapture _screenCapture = new ScreenCapture(DisplayInfo.ScreenBounds);
+ // A ScreenCapture which captures the whole screen (multi-monitor) but with half the destination size, uses stretch-blt
+ private readonly ScreenCapture _screenCaptureResized = new ScreenCapture(DisplayInfo.ScreenBounds, new NativeSize(DisplayInfo.ScreenBounds.Width / 2, DisplayInfo.ScreenBounds.Height / 2));
- //[Benchmark]
+ ///
+ /// This benchmarks a screen capture which does a lot of additional work
+ ///
+ [Benchmark]
public void Capture()
{
using (var capture = WindowCapture.CaptureScreen())
@@ -28,14 +59,25 @@ namespace Greenshot.PerformanceTests
}
}
}
-
+ ///
+ /// Capture the screen with buffered settings
+ ///
[Benchmark]
public void CaptureBuffered()
{
_screenCapture.CaptureFrame();
}
+ ///
+ /// Capture the screen with buffered settings, but resized (smaller) destination
+ ///
+ [Benchmark]
+ public void CaptureBufferedResized()
+ {
+ _screenCaptureResized.CaptureFrame();
+ }
+
[GlobalCleanup]
public void Cleanup()
{
diff --git a/src/Greenshot.PerformanceTests/Program.cs b/src/Greenshot.PerformanceTests/Program.cs
index 8a3007b75..5dd3e2843 100644
--- a/src/Greenshot.PerformanceTests/Program.cs
+++ b/src/Greenshot.PerformanceTests/Program.cs
@@ -1,4 +1,27 @@
-using System;
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+using System;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
diff --git a/src/Greenshot/Components/CaptureSupportInfo.cs b/src/Greenshot/Components/CaptureSupportInfo.cs
index 1d9720c54..a6e39c60d 100644
--- a/src/Greenshot/Components/CaptureSupportInfo.cs
+++ b/src/Greenshot/Components/CaptureSupportInfo.cs
@@ -6,13 +6,14 @@ using Greenshot.Addons.Interfaces;
namespace Greenshot.Components
{
///
- /// This is the information which is needed for making captures possible.
+ /// This is the bundled information which is needed for making captures possible.
///
public class CaptureSupportInfo
{
///
/// Constructor for DI
///
+ /// ICoreConfiguration
/// InternetExplorerCaptureHelper
/// IEnumerable with IFormEnhancer
public CaptureSupportInfo(
diff --git a/src/Greenshot/Components/GreenshotServer.cs b/src/Greenshot/Components/GreenshotServer.cs
index 129f71a15..64c3f5e3f 100644
--- a/src/Greenshot/Components/GreenshotServer.cs
+++ b/src/Greenshot/Components/GreenshotServer.cs
@@ -26,7 +26,6 @@
#region Usings
using System;
-using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Principal;
diff --git a/src/Greenshot/Components/HotkeyService.cs b/src/Greenshot/Components/HotkeyService.cs
index 226abccdb..8254a5eb4 100644
--- a/src/Greenshot/Components/HotkeyService.cs
+++ b/src/Greenshot/Components/HotkeyService.cs
@@ -22,14 +22,12 @@
#endregion
using System;
-using System.Collections.Generic;
using System.Reactive.Linq;
using Caliburn.Micro;
using Dapplo.Addons;
using Dapplo.Log;
using Dapplo.Windows.Input.Keyboard;
using Greenshot.Addons.Core;
-using Greenshot.Addons.Interfaces;
using Greenshot.Helpers;
namespace Greenshot.Components
diff --git a/src/Greenshot/Components/UpdateService.cs b/src/Greenshot/Components/UpdateService.cs
index c8e73dfe2..08fc8a50d 100644
--- a/src/Greenshot/Components/UpdateService.cs
+++ b/src/Greenshot/Components/UpdateService.cs
@@ -99,7 +99,7 @@ namespace Greenshot.Components
///
public void Startup()
{
- var ignore = BackgroundTask(() => TimeSpan.FromDays(_coreConfiguration.UpdateCheckInterval), UpdateCheck, _cancellationTokenSource.Token);
+ _ = BackgroundTask(() => TimeSpan.FromDays(_coreConfiguration.UpdateCheckInterval), UpdateCheck, _cancellationTokenSource.Token);
}
///
diff --git a/src/Greenshot/Destinations/PickerDestination.cs b/src/Greenshot/Destinations/PickerDestination.cs
index 05f2e8a5c..298deb2f9 100644
--- a/src/Greenshot/Destinations/PickerDestination.cs
+++ b/src/Greenshot/Destinations/PickerDestination.cs
@@ -47,8 +47,7 @@ namespace Greenshot.Destinations
public PickerDestination(
DestinationHolder destinationHolder,
ICoreConfiguration coreConfiguration,
- IGreenshotLanguage greenshotLanguage,
- ExportNotification exportNotification
+ IGreenshotLanguage greenshotLanguage
) : base(coreConfiguration, greenshotLanguage)
{
_destinationHolder = destinationHolder;
diff --git a/src/Greenshot/Forms/CaptureForm.cs b/src/Greenshot/Forms/CaptureForm.cs
index 339329460..91db7c660 100644
--- a/src/Greenshot/Forms/CaptureForm.cs
+++ b/src/Greenshot/Forms/CaptureForm.cs
@@ -95,6 +95,7 @@ namespace Greenshot.Forms
/// ICoreConfiguration
/// ICapture
/// IList of IInteropWindow
+ /// IEnumerable with IFormEnhancer
public CaptureForm(ICoreConfiguration coreConfiguration, ICapture capture, IList windows, IEnumerable formEnhancers) : base(coreConfiguration, null)
{
_isZoomerTransparent = _coreConfiguration.ZoomerOpacity < 1;
diff --git a/src/Greenshot/Forms/MainForm.cs b/src/Greenshot/Forms/MainForm.cs
index 30512fdd4..f81630e9a 100644
--- a/src/Greenshot/Forms/MainForm.cs
+++ b/src/Greenshot/Forms/MainForm.cs
@@ -62,7 +62,6 @@ using Screen = System.Windows.Forms.Screen;
using Dapplo.Config.Ini;
using Dapplo.Windows.User32;
using Greenshot.Addons.Resources;
-using Greenshot.Addons.Interfaces;
using Greenshot.Components;
#endregion
@@ -97,7 +96,6 @@ namespace Greenshot.Forms
IWindowManager windowManager,
IGreenshotLanguage greenshotLanguage,
InternetExplorerCaptureHelper internetExplorerCaptureHelper,
- GreenshotResources greenshotResources,
Func> configViewModelFactory,
Func> aboutFormFactory,
DestinationHolder destinationHolder,
diff --git a/src/Greenshot/Forms/ToolStripMenuSelectList.cs b/src/Greenshot/Forms/ToolStripMenuSelectList.cs
index d4812b86b..e89bf1d7f 100644
--- a/src/Greenshot/Forms/ToolStripMenuSelectList.cs
+++ b/src/Greenshot/Forms/ToolStripMenuSelectList.cs
@@ -30,7 +30,6 @@ using System.Drawing.Imaging;
using System.Windows.Forms;
using Greenshot.Gfx;
using Greenshot.Addons.Core;
-using Greenshot.Addons.Config.Impl;
#endregion
diff --git a/src/Greenshot/Helpers/CaptureHelper.cs b/src/Greenshot/Helpers/CaptureHelper.cs
index 0de2c87f6..57e34a288 100644
--- a/src/Greenshot/Helpers/CaptureHelper.cs
+++ b/src/Greenshot/Helpers/CaptureHelper.cs
@@ -41,7 +41,6 @@ using Dapplo.Windows.Common.Structs;
using Dapplo.Windows.DesktopWindowsManager;
using Dapplo.Windows.Kernel32;
using Dapplo.Windows.User32;
-using Greenshot.Addon.InternetExplorer;
using Greenshot.Addons.Components;
using Greenshot.Addons.Core;
using Greenshot.Addons.Extensions;
@@ -49,7 +48,6 @@ using Greenshot.Addons.Interfaces;
using Greenshot.Components;
using Greenshot.Core.Enums;
using Greenshot.Gfx;
-using Greenshot.Addons.Config.Impl;
#endregion
diff --git a/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs b/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs
index 13eee0adf..3a6eb5d63 100644
--- a/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs
+++ b/src/Greenshot/Helpers/Mapi/InteropRecipientCollection.cs
@@ -58,7 +58,7 @@ namespace Greenshot.Helpers.Mapi
}
// allocate enough memory to hold all recipients
- var size = Marshal.SizeOf(typeof(MapiMailMessage.MapiHelperInterop.MapiRecipDesc));
+ var size = Marshal.SizeOf(typeof(MapiRecipDesc));
Handle = Marshal.AllocHGlobal(_count * size);
// place all interop recipients into the memory just allocated
@@ -90,7 +90,7 @@ namespace Greenshot.Helpers.Mapi
{
if (Handle != IntPtr.Zero)
{
- var type = typeof(MapiMailMessage.MapiHelperInterop.MapiRecipDesc);
+ var type = typeof(MapiRecipDesc);
var size = Marshal.SizeOf(type);
// destroy all the structures in the memory area
diff --git a/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs b/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs
new file mode 100644
index 000000000..0e79a8806
--- /dev/null
+++ b/src/Greenshot/Helpers/Mapi/MapiFileDescriptor.cs
@@ -0,0 +1,43 @@
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+#region Usings
+
+using System;
+using System.Runtime.InteropServices;
+
+#endregion
+
+namespace Greenshot.Helpers.Mapi
+{
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ internal class MapiFileDescriptor
+ {
+ public int flags = 0;
+ public string name;
+ public string path;
+ public int position;
+ public int reserved = 0;
+ public IntPtr type = IntPtr.Zero;
+ }
+}
\ No newline at end of file
diff --git a/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs b/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs
new file mode 100644
index 000000000..e7fea46a1
--- /dev/null
+++ b/src/Greenshot/Helpers/Mapi/MapiHelperInterop.cs
@@ -0,0 +1,54 @@
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+#region Usings
+
+using System;
+using System.Runtime.InteropServices;
+
+#endregion
+
+namespace Greenshot.Helpers.Mapi
+{
+ ///
+ /// Internal class for calling MAPI APIs
+ ///
+ internal class MapiHelperInterop
+ {
+ #region Constructors
+
+ ///
+ /// Private constructor.
+ ///
+ private MapiHelperInterop()
+ {
+ // Intenationally blank
+ }
+
+#endregion Constructors
+
+ [DllImport("MAPI32.DLL", SetLastError = true, CharSet = CharSet.Ansi)]
+ public static extern int MAPISendMail(IntPtr session, IntPtr hwnd, MapiMessage message, int flg, int rsv);
+
+ }
+}
\ No newline at end of file
diff --git a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs
index f09b2bd1e..2b9ecd102 100644
--- a/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs
+++ b/src/Greenshot/Helpers/Mapi/MapiMailMessage.cs
@@ -114,78 +114,6 @@ namespace Greenshot.Helpers.Mapi
}
}
- #region Private MapiFileDescriptor Class
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- private class MapiFileDescriptor
- {
- public int flags = 0;
- public string name;
- public string path;
- public int position;
- public int reserved = 0;
- public IntPtr type = IntPtr.Zero;
- }
-
- #endregion Private MapiFileDescriptor Class
-
- #region Private MAPIHelperInterop Class
-
- ///
- /// Internal class for calling MAPI APIs
- ///
- internal class MapiHelperInterop
- {
- #region Constructors
-
- ///
- /// Private constructor.
- ///
- private MapiHelperInterop()
- {
- // Intenationally blank
- }
-
- #endregion Constructors
-
- #region Structs
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- public class MapiMessage
- {
- public string ConversationID = null;
- public string DateReceived = null;
- public int FileCount;
- public IntPtr Files = IntPtr.Zero;
- public int Flags = 0;
- public string MessageType = null;
- public string NoteText;
- public IntPtr Originator = IntPtr.Zero;
- public int RecipientCount;
- public IntPtr Recipients = IntPtr.Zero;
- public int Reserved = 0;
- public string Subject;
- }
-
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
- public class MapiRecipDesc
- {
- public string Address;
- public int eIDSize = 0;
- public IntPtr EntryID = IntPtr.Zero;
- public string Name;
- public int RecipientClass;
- public int Reserved = 0;
- }
-
- [DllImport("MAPI32.DLL", SetLastError = true, CharSet = CharSet.Ansi)]
- public static extern int MAPISendMail(IntPtr session, IntPtr hwnd, MapiMessage message, int flg, int rsv);
-
- #endregion Structs
- }
-
- #endregion Private MAPIHelperInterop Class
-
#region Constructors
///
@@ -286,7 +214,7 @@ namespace Greenshot.Helpers.Mapi
///
private void _ShowMail()
{
- var message = new MapiHelperInterop.MapiMessage();
+ var message = new MapiMessage();
using (var interopRecipients = Recipients.GetInteropRepresentation())
{
@@ -339,7 +267,7 @@ namespace Greenshot.Helpers.Mapi
/// Deallocates the files in a message.
///
/// The message to deallocate the files from.
- private void _DeallocFiles(MapiHelperInterop.MapiMessage message)
+ private void _DeallocFiles(MapiMessage message)
{
if (message.Files != IntPtr.Zero)
{
diff --git a/src/Greenshot/Helpers/Mapi/MapiMessage.cs b/src/Greenshot/Helpers/Mapi/MapiMessage.cs
new file mode 100644
index 000000000..b46a0d8a6
--- /dev/null
+++ b/src/Greenshot/Helpers/Mapi/MapiMessage.cs
@@ -0,0 +1,49 @@
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+#region Usings
+
+using System;
+using System.Runtime.InteropServices;
+
+#endregion
+
+namespace Greenshot.Helpers.Mapi
+{
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ internal class MapiMessage
+ {
+ public string ConversationID = null;
+ public string DateReceived = null;
+ public int FileCount;
+ public IntPtr Files = IntPtr.Zero;
+ public int Flags = 0;
+ public string MessageType = null;
+ public string NoteText;
+ public IntPtr Originator = IntPtr.Zero;
+ public int RecipientCount;
+ public IntPtr Recipients = IntPtr.Zero;
+ public int Reserved = 0;
+ public string Subject;
+ }
+}
\ No newline at end of file
diff --git a/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs b/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs
new file mode 100644
index 000000000..ebae80e75
--- /dev/null
+++ b/src/Greenshot/Helpers/Mapi/MapiRecipDesc.cs
@@ -0,0 +1,43 @@
+#region Greenshot GNU General Public License
+
+// Greenshot - a free and open source screenshot tool
+// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom
+//
+// For more information see: http://getgreenshot.org/
+// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
+//
+// 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 .
+
+#endregion
+
+#region Usings
+
+using System;
+using System.Runtime.InteropServices;
+
+#endregion
+
+namespace Greenshot.Helpers.Mapi
+{
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+ internal class MapiRecipDesc
+ {
+ public string Address;
+ public int eIDSize = 0;
+ public IntPtr EntryID = IntPtr.Zero;
+ public string Name;
+ public int RecipientClass;
+ public int Reserved = 0;
+ }
+}
\ No newline at end of file
diff --git a/src/Greenshot/Helpers/Mapi/Recipient.cs b/src/Greenshot/Helpers/Mapi/Recipient.cs
index 658b9c4c1..a5c24fce2 100644
--- a/src/Greenshot/Helpers/Mapi/Recipient.cs
+++ b/src/Greenshot/Helpers/Mapi/Recipient.cs
@@ -41,9 +41,9 @@ namespace Greenshot.Helpers.Mapi
/// Returns an interop representation of a recepient.
///
///
- internal MapiMailMessage.MapiHelperInterop.MapiRecipDesc GetInteropRepresentation()
+ internal MapiRecipDesc GetInteropRepresentation()
{
- var interop = new MapiMailMessage.MapiHelperInterop.MapiRecipDesc();
+ var interop = new MapiRecipDesc();
if (DisplayName == null)
{
diff --git a/src/Greenshot/Helpers/Mapi/RecipientCollection.cs b/src/Greenshot/Helpers/Mapi/RecipientCollection.cs
index 221db6536..05d01781b 100644
--- a/src/Greenshot/Helpers/Mapi/RecipientCollection.cs
+++ b/src/Greenshot/Helpers/Mapi/RecipientCollection.cs
@@ -32,7 +32,7 @@ namespace Greenshot.Helpers.Mapi
///
/// Represents a colleciton of recipients for a mail message.
///
- public partial class RecipientCollection : CollectionBase
+ public class RecipientCollection : CollectionBase
{
///
/// Returns the recipient stored in this collection at the specified index.