mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
More work on removing static references to DI classes.
This commit is contained in:
parent
e76e82741f
commit
505e4d7be5
35 changed files with 232 additions and 120 deletions
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Box</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Box</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Greenshot.Addon.Confluence
|
|||
var pages = new List<Content>();
|
||||
var pageIdRegex = new Regex(@"pageId=(\d+)");
|
||||
var spacePageRegex = new Regex(@"\/display\/([^\/]+)\/([^#]+)");
|
||||
foreach (var browserurl in IEHelper.GetIEUrls().Distinct())
|
||||
foreach (var browserurl in InternetExplorerHelper.GetIEUrls().Distinct())
|
||||
{
|
||||
string url;
|
||||
try
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Confluence</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Confluence</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Dropbox</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Dropbox</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.ExternalCommand</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.ExternalCommand</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Flickr</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Flickr</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.GooglePhotos</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.GooglePhotos</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Imgur</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Imgur</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using Autofac;
|
||||
using Dapplo.Addons;
|
||||
|
||||
namespace Greenshot.Addon.InternetExplorer
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class InternetExplorerAddonModulenModule : AddonModule
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
builder
|
||||
.RegisterType<InternetExplorerCaptureHelper>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
base.Load(builder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ using Dapplo.Windows.Common.Structs;
|
|||
using Dapplo.Windows.Desktop;
|
||||
using Dapplo.Windows.Messages;
|
||||
using Dapplo.Windows.User32;
|
||||
using Greenshot.Addon.InternetExplorer.IEInterop;
|
||||
using Greenshot.Addon.InternetExplorer.InternetExplorerInterop;
|
||||
using Greenshot.Addons.Config.Impl;
|
||||
using Greenshot.Addons.Controls;
|
||||
using Greenshot.Addons.Core;
|
||||
|
@ -54,20 +54,24 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// On top I modified it to use the already available code in Greenshot.
|
||||
/// Many thanks to all the people who contributed here!
|
||||
/// </summary>
|
||||
public static class IeCaptureHelper
|
||||
public class InternetExplorerCaptureHelper
|
||||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
// TODO: Solve, was static reference!
|
||||
private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl();
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
|
||||
public InternetExplorerCaptureHelper(ICoreConfiguration coreConfiguration)
|
||||
{
|
||||
_coreConfiguration = coreConfiguration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to activate a certain IE Tab
|
||||
/// </summary>
|
||||
/// <param name="nativeIeWindow">IInteropWindow</param>
|
||||
/// <param name="tabIndex">int</param>
|
||||
public static void ActivateIeTab(IInteropWindow nativeIeWindow, int tabIndex)
|
||||
public void ActivateIeTab(IInteropWindow nativeIeWindow, int tabIndex)
|
||||
{
|
||||
var directUiInteropWindow = IEHelper.GetDirectUi(nativeIeWindow);
|
||||
var directUiInteropWindow = InternetExplorerHelper.GetDirectUi(nativeIeWindow);
|
||||
if (directUiInteropWindow == null)
|
||||
{
|
||||
return;
|
||||
|
@ -87,7 +91,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// <param name="someWindow">InteropWindow to check</param>
|
||||
/// <param name="minimumPercentage">min percentage</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMostlyIeWindow(IInteropWindow someWindow, int minimumPercentage)
|
||||
public bool IsMostlyIeWindow(IInteropWindow someWindow, int minimumPercentage)
|
||||
{
|
||||
var ieWindow = someWindow.GetChildren().FirstOrDefault(window => window.GetClassname() == "Internet Explorer_Server");
|
||||
if (ieWindow == null)
|
||||
|
@ -106,13 +110,13 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// </summary>
|
||||
/// <param name="someWindow"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsIeWindow(IInteropWindow someWindow)
|
||||
public bool IsIeWindow(IInteropWindow someWindow)
|
||||
{
|
||||
if ("IEFrame".Equals(someWindow.GetClassname()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (CoreConfig.WindowClassesToCheckForIE != null && CoreConfig.WindowClassesToCheckForIE.Contains(someWindow.Classname))
|
||||
if (_coreConfiguration.WindowClassesToCheckForIE != null && _coreConfiguration.WindowClassesToCheckForIE.Contains(someWindow.Classname))
|
||||
{
|
||||
return someWindow.GetChildren().Any(window => window.GetClassname() == "Internet Explorer_Server");
|
||||
}
|
||||
|
@ -123,7 +127,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// Get Windows displaying an IE
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable IInteropWindow</returns>
|
||||
public static IEnumerable<IInteropWindow> GetIeWindows()
|
||||
public IEnumerable<IInteropWindow> GetIeWindows()
|
||||
{
|
||||
return WindowsEnumerator.EnumerateWindows().Where(IsIeWindow);
|
||||
}
|
||||
|
@ -132,7 +136,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// Simple check if IE is running
|
||||
/// </summary>
|
||||
/// <returns>bool</returns>
|
||||
public static bool IsIeRunning()
|
||||
public bool IsIeRunning()
|
||||
{
|
||||
return GetIeWindows().Any();
|
||||
}
|
||||
|
@ -141,7 +145,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// Gets a list of all IE Windows & tabs with the captions of the instances
|
||||
/// </summary>
|
||||
/// <returns>List with KeyValuePair of InteropWindow and string</returns>
|
||||
public static IList<KeyValuePair<IInteropWindow, string>> GetBrowserTabs()
|
||||
public IList<KeyValuePair<IInteropWindow, string>> GetBrowserTabs()
|
||||
{
|
||||
var ieHandleList = new List<IntPtr>();
|
||||
var browserWindows = new Dictionary<IInteropWindow, List<string>>();
|
||||
|
@ -157,14 +161,14 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
}
|
||||
if ("IEFrame".Equals(ieWindow.GetClassname()))
|
||||
{
|
||||
var directUiwd = IEHelper.GetDirectUi(ieWindow);
|
||||
var directUiwd = InternetExplorerHelper.GetDirectUi(ieWindow);
|
||||
if (directUiwd != null)
|
||||
{
|
||||
var accessible = new Accessible(directUiwd.Handle);
|
||||
browserWindows.Add(ieWindow, accessible.IETabCaptions);
|
||||
}
|
||||
}
|
||||
else if (CoreConfig.WindowClassesToCheckForIE != null && CoreConfig.WindowClassesToCheckForIE.Contains(ieWindow.Classname))
|
||||
else if (_coreConfiguration.WindowClassesToCheckForIE != null && _coreConfiguration.WindowClassesToCheckForIE.Contains(ieWindow.Classname))
|
||||
{
|
||||
var singleWindowText = new List<string>();
|
||||
try
|
||||
|
@ -211,7 +215,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// </summary>
|
||||
/// <param name="mainWindow"></param>
|
||||
/// <returns></returns>
|
||||
private static IHTMLDocument2 GetHtmlDocument(IInteropWindow mainWindow)
|
||||
private IHTMLDocument2 GetHtmlDocument(IInteropWindow mainWindow)
|
||||
{
|
||||
var ieServer = "Internet Explorer_Server".Equals(mainWindow.GetClassname())
|
||||
? mainWindow
|
||||
|
@ -250,7 +254,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// </summary>
|
||||
/// <param name="browserWindow">The InteropWindow to get the IHTMLDocument2 for</param>
|
||||
/// <returns>DocumentContainer</returns>
|
||||
private static DocumentContainer CreateDocumentContainer(IInteropWindow browserWindow)
|
||||
private DocumentContainer CreateDocumentContainer(IInteropWindow browserWindow)
|
||||
{
|
||||
DocumentContainer returnDocumentContainer = null;
|
||||
InteropWindow returnWindow = null;
|
||||
|
@ -265,7 +269,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
Log.Debug().WriteLine("Processing {0} - {1}", ieWindow.Classname, ieWindow.Text);
|
||||
|
||||
Accessible ieAccessible = null;
|
||||
var directUiwd = IEHelper.GetDirectUi(ieWindow);
|
||||
var directUiwd = InternetExplorerHelper.GetDirectUi(ieWindow);
|
||||
if (directUiwd != null)
|
||||
{
|
||||
ieAccessible = new Accessible(directUiwd.Handle);
|
||||
|
@ -390,7 +394,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// <param name="capture">ICapture where the capture needs to be stored</param>
|
||||
/// <param name="windowToCapture">window to use</param>
|
||||
/// <returns>ICapture with the content (if any)</returns>
|
||||
public static ICapture CaptureIe(ICapture capture, IInteropWindow windowToCapture = null)
|
||||
public ICapture CaptureIe(ICapture capture, IInteropWindow windowToCapture = null)
|
||||
{
|
||||
if (windowToCapture == null)
|
||||
{
|
||||
|
@ -542,7 +546,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// <param name="documentContainer"></param>
|
||||
/// <param name="capture"></param>
|
||||
/// <returns>Size of the complete page</returns>
|
||||
private static Size PrepareCapture(DocumentContainer documentContainer, ICapture capture)
|
||||
private Size PrepareCapture(DocumentContainer documentContainer, ICapture capture)
|
||||
{
|
||||
// Calculate the page size
|
||||
var pageWidth = documentContainer.ScrollWidth;
|
||||
|
@ -645,7 +649,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// <param name="documentContainer">The document wrapped in a container</param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns>Bitmap with the page content as an image</returns>
|
||||
private static Bitmap CapturePage(DocumentContainer documentContainer, Size pageSize)
|
||||
private Bitmap CapturePage(DocumentContainer documentContainer, Size pageSize)
|
||||
{
|
||||
var contentWindowDetails = documentContainer.ContentWindow;
|
||||
|
||||
|
@ -685,7 +689,7 @@ namespace Greenshot.Addon.InternetExplorer
|
|||
/// <param name="contentWindowDetails">Needed for referencing the location of the frame</param>
|
||||
/// <param name="graphicsTarget">Graphics</param>
|
||||
/// <returns>Bitmap with the capture</returns>
|
||||
private static void DrawDocument(DocumentContainer documentContainer, IInteropWindow contentWindowDetails, Graphics graphicsTarget)
|
||||
private void DrawDocument(DocumentContainer documentContainer, IInteropWindow contentWindowDetails, Graphics graphicsTarget)
|
||||
{
|
||||
documentContainer.SetAttribute("scroll", 1);
|
||||
|
|
@ -27,10 +27,10 @@ using Dapplo.Windows.Desktop;
|
|||
using Microsoft.Win32;
|
||||
|
||||
namespace Greenshot.Addon.InternetExplorer {
|
||||
/// <summary>
|
||||
/// Description of IEHelper.
|
||||
/// </summary>
|
||||
public static class IEHelper {
|
||||
/// <summary>
|
||||
/// Util code for Internet Explorer
|
||||
/// </summary>
|
||||
public class InternetExplorerHelper {
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
|
||||
// Internet explorer Registry key
|
|
@ -37,7 +37,7 @@ using IServiceProvider = Greenshot.Addons.Interop.IServiceProvider;
|
|||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.InternetExplorer.IEInterop
|
||||
namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
|
||||
{
|
||||
public class DocumentContainer
|
||||
{
|
|
@ -27,7 +27,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
#endregion
|
||||
|
||||
namespace Greenshot.Addon.InternetExplorer.IEInterop
|
||||
namespace Greenshot.Addon.InternetExplorer.InternetExplorerInterop
|
||||
{
|
||||
// IWebBrowser: EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B
|
||||
// [ComVisible(true), ComImport(), Guid("D30C1661-CDAF-11D0-8A3E-00C04FC9E26E"),
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.LegacyEditor</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.LegacyEditor</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Lutim</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Lutim</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.OCR</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.OCR</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Office</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Office</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.OneDrive</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.OneDrive</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Photobucket</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Photobucket</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Tfs</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Tfs</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
<PropertyGroup>
|
||||
<RootNamespace>Greenshot.Addon.Win10</RootNamespace>
|
||||
<AssemblyName>Greenshot.Addon.Win10</AssemblyName>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -21,6 +22,8 @@
|
|||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net471'">
|
||||
<!-- Light up Windows 10 features -->
|
||||
<PackageReference Include="Microsoft.Toolkit.Forms.UI.Controls" Version="5.0.1" />
|
||||
<!--PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0-preview1-27018-01" />-->
|
||||
<Reference Include="System.Runtime.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll</HintPath>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
<RootNamespace>Greenshot.PerformanceTests</RootNamespace>
|
||||
<AssemblyName>Greenshot.PerformanceTests</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
30
src/Greenshot/Components/CaptureSupportInfo.cs
Normal file
30
src/Greenshot/Components/CaptureSupportInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections.Generic;
|
||||
using Greenshot.Addon.InternetExplorer;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
|
||||
namespace Greenshot.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the information which is needed for making captures possible.
|
||||
/// </summary>
|
||||
public class CaptureSupportInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="internetExplorerCaptureHelper">InternetExplorerCaptureHelper</param>
|
||||
/// <param name="formEnhancers">IEnumerable with IFormEnhancer</param>
|
||||
public CaptureSupportInfo(
|
||||
InternetExplorerCaptureHelper internetExplorerCaptureHelper,
|
||||
IEnumerable<IFormEnhancer> formEnhancers = null
|
||||
)
|
||||
{
|
||||
InternetExplorerCaptureHelper = internetExplorerCaptureHelper;
|
||||
FormEnhancers = formEnhancers;
|
||||
}
|
||||
|
||||
public InternetExplorerCaptureHelper InternetExplorerCaptureHelper { get; }
|
||||
|
||||
public IEnumerable<IFormEnhancer> FormEnhancers { get; }
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ namespace Greenshot.Components
|
|||
private readonly HotkeyService _hotkeyService;
|
||||
private readonly DestinationHolder _destinationHolder;
|
||||
private ServiceHost _host;
|
||||
private IEnumerable<IFormEnhancer> _formEnhancers;
|
||||
private CaptureSupportInfo _captureSupportInfo;
|
||||
|
||||
public static string Identity
|
||||
{
|
||||
|
@ -78,9 +78,9 @@ namespace Greenshot.Components
|
|||
MainForm mainForm,
|
||||
HotkeyService hotkeyService,
|
||||
DestinationHolder destinationHolder,
|
||||
IEnumerable<IFormEnhancer> formEnhancers = null)
|
||||
CaptureSupportInfo captureSupportInfo)
|
||||
{
|
||||
_formEnhancers = formEnhancers;
|
||||
_captureSupportInfo = captureSupportInfo;
|
||||
_coreConfiguration = coreConfiguration;
|
||||
_mainForm = mainForm;
|
||||
_hotkeyService = hotkeyService;
|
||||
|
@ -141,7 +141,7 @@ namespace Greenshot.Components
|
|||
Log.Debug().WriteLine("Open file requested: {0}", filename);
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
CaptureHelper.CaptureFile(_formEnhancers, filename);
|
||||
CaptureHelper.CaptureFile(_captureSupportInfo, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -171,13 +171,13 @@ namespace Greenshot.Components
|
|||
switch (captureMode.ToLower())
|
||||
{
|
||||
case "region":
|
||||
CaptureHelper.CaptureRegion(_formEnhancers, false, destination);
|
||||
CaptureHelper.CaptureRegion(_captureSupportInfo, false, destination);
|
||||
break;
|
||||
case "window":
|
||||
CaptureHelper.CaptureWindow(_formEnhancers, false, destination);
|
||||
CaptureHelper.CaptureWindow(_captureSupportInfo, false, destination);
|
||||
break;
|
||||
case "fullscreen":
|
||||
CaptureHelper.CaptureFullscreen(_formEnhancers, false, ScreenCaptureMode.FullScreen, destination);
|
||||
CaptureHelper.CaptureFullscreen(_captureSupportInfo, false, ScreenCaptureMode.FullScreen, destination);
|
||||
break;
|
||||
default:
|
||||
Log.Warn().WriteLine("Unknown capture option");
|
||||
|
|
|
@ -42,13 +42,13 @@ namespace Greenshot.Components
|
|||
{
|
||||
private static readonly LogSource Log = new LogSource();
|
||||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
private readonly IEnumerable<IFormEnhancer> _formEnhancers;
|
||||
private readonly CaptureSupportInfo _captureSupportInfo;
|
||||
private IDisposable _subscriptions;
|
||||
|
||||
public HotkeyService(ICoreConfiguration coreConfiguration, IEnumerable<IFormEnhancer> formEnhancers = null)
|
||||
public HotkeyService(ICoreConfiguration coreConfiguration, CaptureSupportInfo captureSupportInfo)
|
||||
{
|
||||
_coreConfiguration = coreConfiguration;
|
||||
_formEnhancers = formEnhancers;
|
||||
_captureSupportInfo = captureSupportInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -120,36 +120,36 @@ namespace Greenshot.Components
|
|||
|
||||
private void CaptureRegion(KeyboardHookEventArgs keyboardHookEventArgs)
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureRegion(_formEnhancers, true));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureRegion(_captureSupportInfo, true));
|
||||
}
|
||||
|
||||
private void CaptureWindow(KeyboardHookEventArgs keyboardHookEventArgs)
|
||||
{
|
||||
if (_coreConfiguration.CaptureWindowsInteractive)
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureWindowInteractive(_formEnhancers, true));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureWindowInteractive(_captureSupportInfo, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureWindow(_formEnhancers, true));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureWindow(_captureSupportInfo, true));
|
||||
}
|
||||
}
|
||||
|
||||
private void CaptureFullscreen(KeyboardHookEventArgs keyboardHookEventArgs)
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureFullscreen(_formEnhancers, true, _coreConfiguration.ScreenCaptureMode));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureFullscreen(_captureSupportInfo, true, _coreConfiguration.ScreenCaptureMode));
|
||||
}
|
||||
|
||||
private void CaptureLast(KeyboardHookEventArgs keyboardHookEventArgs)
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureLastRegion(_formEnhancers, true));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureLastRegion(_captureSupportInfo, true));
|
||||
}
|
||||
|
||||
private void CaptureIe(KeyboardHookEventArgs keyboardHookEventArgs)
|
||||
{
|
||||
if (_coreConfiguration.IECapture)
|
||||
{
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureIe(_formEnhancers, true, null));
|
||||
Execute.BeginOnUIThread(() => CaptureHelper.CaptureIe(_captureSupportInfo, true, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ using Dapplo.Config.Ini;
|
|||
using Dapplo.Windows.User32;
|
||||
using Greenshot.Addons.Resources;
|
||||
using Greenshot.Addons.Interfaces;
|
||||
using Greenshot.Components;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -77,6 +78,7 @@ namespace Greenshot.Forms
|
|||
private readonly ICoreConfiguration _coreConfiguration;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IGreenshotLanguage _greenshotLanguage;
|
||||
private readonly InternetExplorerCaptureHelper _internetExplorerCaptureHelper;
|
||||
private readonly Func<Owned<ConfigViewModel>> _configViewModelFactory;
|
||||
private readonly Func<Owned<AboutForm>> _aboutFormFactory;
|
||||
|
||||
|
@ -84,7 +86,7 @@ namespace Greenshot.Forms
|
|||
private readonly Timer _doubleClickTimer = new Timer();
|
||||
|
||||
private readonly DestinationHolder _destinationHolder;
|
||||
private readonly IEnumerable<IFormEnhancer> _formEnhancers;
|
||||
private readonly CaptureSupportInfo _captureSupportInfo;
|
||||
|
||||
// Thumbnail preview
|
||||
private ThumbnailForm _thumbnailForm;
|
||||
|
@ -94,20 +96,22 @@ namespace Greenshot.Forms
|
|||
public MainForm(ICoreConfiguration coreConfiguration,
|
||||
IWindowManager windowManager,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
InternetExplorerCaptureHelper internetExplorerCaptureHelper,
|
||||
GreenshotResources greenshotResources,
|
||||
Func<Owned<ConfigViewModel>> configViewModelFactory,
|
||||
Func<Owned<AboutForm>> aboutFormFactory,
|
||||
DestinationHolder destinationHolder,
|
||||
IEnumerable<IFormEnhancer> formEnhancers = null
|
||||
CaptureSupportInfo captureSupportInfo
|
||||
) : base(greenshotLanguage)
|
||||
{
|
||||
_coreConfiguration = coreConfiguration;
|
||||
_windowManager = windowManager;
|
||||
_greenshotLanguage = greenshotLanguage;
|
||||
_internetExplorerCaptureHelper = internetExplorerCaptureHelper;
|
||||
_configViewModelFactory = configViewModelFactory;
|
||||
_aboutFormFactory = aboutFormFactory;
|
||||
_destinationHolder = destinationHolder;
|
||||
_formEnhancers = formEnhancers;
|
||||
_captureSupportInfo = captureSupportInfo;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
|
@ -287,7 +291,7 @@ namespace Greenshot.Forms
|
|||
|
||||
if (File.Exists(_coreConfiguration.OutputFileAsFullpath))
|
||||
{
|
||||
CaptureHelper.CaptureFile(_formEnhancers, _coreConfiguration.OutputFileAsFullpath, _destinationHolder.SortedActiveDestinations.Find("Editor"));
|
||||
CaptureHelper.CaptureFile(_captureSupportInfo, _coreConfiguration.OutputFileAsFullpath, _destinationHolder.SortedActiveDestinations.Find("Editor"));
|
||||
}
|
||||
break;
|
||||
case ClickActions.OPEN_SETTINGS:
|
||||
|
@ -459,7 +463,7 @@ namespace Greenshot.Forms
|
|||
|
||||
if (File.Exists(openFileDialog.FileName))
|
||||
{
|
||||
CaptureHelper.CaptureFile(_formEnhancers, openFileDialog.FileName);
|
||||
CaptureHelper.CaptureFile(_captureSupportInfo, openFileDialog.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,7 +471,7 @@ namespace Greenshot.Forms
|
|||
{
|
||||
if (_coreConfiguration.IECapture)
|
||||
{
|
||||
CaptureHelper.CaptureIe(_formEnhancers, true, null);
|
||||
CaptureHelper.CaptureIe(_captureSupportInfo, true, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,7 +490,7 @@ namespace Greenshot.Forms
|
|||
// IE context menu code
|
||||
try
|
||||
{
|
||||
if (_coreConfiguration.IECapture && IeCaptureHelper.IsIeRunning())
|
||||
if (_coreConfiguration.IECapture && _internetExplorerCaptureHelper.IsIeRunning())
|
||||
{
|
||||
contextmenu_captureie.Enabled = true;
|
||||
contextmenu_captureiefromlist.Enabled = true;
|
||||
|
@ -543,7 +547,7 @@ namespace Greenshot.Forms
|
|||
}
|
||||
try
|
||||
{
|
||||
var tabs = IeCaptureHelper.GetBrowserTabs();
|
||||
var tabs = _internetExplorerCaptureHelper.GetBrowserTabs();
|
||||
contextmenu_captureiefromlist.DropDownItems.Clear();
|
||||
if (tabs.Count > 0)
|
||||
{
|
||||
|
@ -606,7 +610,7 @@ namespace Greenshot.Forms
|
|||
var allScreensBounds = DisplayInfo.ScreenBounds;
|
||||
|
||||
var captureScreenItem = new ToolStripMenuItem(_greenshotLanguage.ContextmenuCapturefullscreenAll);
|
||||
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureFullscreen(_formEnhancers, false, ScreenCaptureMode.FullScreen)));
|
||||
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureFullscreen(_captureSupportInfo, false, ScreenCaptureMode.FullScreen)));
|
||||
captureScreenMenuItem.DropDownItems.Add(captureScreenItem);
|
||||
foreach (var displayInfo in DisplayInfo.AllDisplayInfos)
|
||||
{
|
||||
|
@ -629,7 +633,7 @@ namespace Greenshot.Forms
|
|||
deviceAlignment += " " + _greenshotLanguage.ContextmenuCapturefullscreenRight;
|
||||
}
|
||||
captureScreenItem = new ToolStripMenuItem(deviceAlignment);
|
||||
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureRegion(_formEnhancers, false, screenToCapture.Bounds)));
|
||||
captureScreenItem.Click += (o, args) => BeginInvoke((MethodInvoker) (() => CaptureHelper.CaptureRegion(_captureSupportInfo, false, screenToCapture.Bounds)));
|
||||
captureScreenMenuItem.DropDownItems.Add(captureScreenItem);
|
||||
}
|
||||
}
|
||||
|
@ -724,12 +728,12 @@ namespace Greenshot.Forms
|
|||
|
||||
private void CaptureAreaToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureRegion(_formEnhancers, false); });
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureRegion(_captureSupportInfo, false); });
|
||||
}
|
||||
|
||||
private void CaptureClipboardToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke(new System.Action(() => CaptureHelper.CaptureClipboard(_formEnhancers)));
|
||||
BeginInvoke(new System.Action(() => CaptureHelper.CaptureClipboard(_captureSupportInfo)));
|
||||
}
|
||||
|
||||
private void OpenFileToolStripMenuItemClick(object sender, EventArgs e)
|
||||
|
@ -739,17 +743,17 @@ namespace Greenshot.Forms
|
|||
|
||||
private void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureFullscreen(_formEnhancers, false, _coreConfiguration.ScreenCaptureMode); });
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureFullscreen(_captureSupportInfo, false, _coreConfiguration.ScreenCaptureMode); });
|
||||
}
|
||||
|
||||
private void Contextmenu_capturelastregionClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureLastRegion(_formEnhancers, false); });
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureLastRegion(_captureSupportInfo, false); });
|
||||
}
|
||||
|
||||
private void Contextmenu_capturewindow_Click(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureWindowInteractive(_formEnhancers, false); });
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureWindowInteractive(_captureSupportInfo, false); });
|
||||
}
|
||||
|
||||
private void Contextmenu_capturewindowfromlist_Click(object sender, EventArgs e)
|
||||
|
@ -760,7 +764,7 @@ namespace Greenshot.Forms
|
|||
try
|
||||
{
|
||||
var windowToCapture = (InteropWindow) clickedItem.Tag;
|
||||
CaptureHelper.CaptureWindow(_formEnhancers, windowToCapture);
|
||||
CaptureHelper.CaptureWindow(_captureSupportInfo, windowToCapture);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -792,7 +796,7 @@ namespace Greenshot.Forms
|
|||
}
|
||||
try
|
||||
{
|
||||
IeCaptureHelper.ActivateIeTab(ieWindowToCapture, tabData.Value);
|
||||
_internetExplorerCaptureHelper.ActivateIeTab(ieWindowToCapture, tabData.Value);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -800,7 +804,7 @@ namespace Greenshot.Forms
|
|||
}
|
||||
try
|
||||
{
|
||||
CaptureHelper.CaptureIe(_formEnhancers, false, ieWindowToCapture);
|
||||
CaptureHelper.CaptureIe(_captureSupportInfo, false, ieWindowToCapture);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks>
|
||||
<!--TargetFrameworks>net471;netcoreapp3.0</TargetFrameworks-->
|
||||
<TargetFrameworks>net471</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ApplicationIcon>icons\applicationIcon\icon.ico</ApplicationIcon>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<ApplicationManifest>greenshot.manifest</ApplicationManifest>
|
||||
<AssemblyTitle>Greenshot</AssemblyTitle>
|
||||
<AssemblyName>Greenshot</AssemblyName>
|
||||
<!--RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>true</SelfContained-->
|
||||
<Platforms>AnyCPU;x86</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -72,6 +72,11 @@ namespace Greenshot
|
|||
.As<IIniSection>()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<CaptureSupportInfo>()
|
||||
.AsSelf()
|
||||
.SingleInstance();
|
||||
|
||||
builder
|
||||
.RegisterType<ConfigTranslationsImpl>()
|
||||
.As<IConfigTranslations>()
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace Greenshot.Helpers
|
|||
private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl();
|
||||
private readonly bool _captureMouseCursor;
|
||||
private ICapture _capture;
|
||||
private readonly CaptureSupportInfo _captureSupportInfo;
|
||||
private CaptureMode _captureMode;
|
||||
private readonly IEnumerable<IFormEnhancer> _formEnhancers;
|
||||
private NativeRect _captureRect = NativeRect.Empty;
|
||||
private ScreenCaptureMode _screenCaptureMode = ScreenCaptureMode.Auto;
|
||||
// TODO: when we get the screen capture code working correctly, this needs to be enabled
|
||||
|
@ -75,28 +75,28 @@ namespace Greenshot.Helpers
|
|||
private readonly DestinationHolder _destinationHolder;
|
||||
private readonly IEnumerable<IProcessor> _processors;
|
||||
|
||||
public CaptureHelper(IEnumerable<IFormEnhancer> formEnhancers, CaptureMode captureMode)
|
||||
public CaptureHelper(CaptureSupportInfo captureSupportInfo, CaptureMode captureMode)
|
||||
{
|
||||
_captureSupportInfo = captureSupportInfo;
|
||||
_captureMode = captureMode;
|
||||
_formEnhancers = formEnhancers;
|
||||
_capture = new Capture();
|
||||
_destinationHolder = DestinationHolder.Instance;
|
||||
// TODO: Fix this
|
||||
_processors = Enumerable.Empty<IProcessor>();
|
||||
}
|
||||
|
||||
public CaptureHelper(IEnumerable<IFormEnhancer> formEnhancers, CaptureMode captureMode, bool captureMouseCursor) : this(formEnhancers, captureMode)
|
||||
public CaptureHelper(CaptureSupportInfo captureSupportInfo, CaptureMode captureMode, bool captureMouseCursor) : this(captureSupportInfo, captureMode)
|
||||
{
|
||||
_captureMouseCursor = captureMouseCursor;
|
||||
}
|
||||
|
||||
public CaptureHelper(IEnumerable<IFormEnhancer> formEnhancers, CaptureMode captureMode, bool captureMouseCursor, ScreenCaptureMode screenCaptureMode) : this(formEnhancers, captureMode)
|
||||
public CaptureHelper(CaptureSupportInfo captureSupportInfo, CaptureMode captureMode, bool captureMouseCursor, ScreenCaptureMode screenCaptureMode) : this(captureSupportInfo, captureMode)
|
||||
{
|
||||
_captureMouseCursor = captureMouseCursor;
|
||||
_screenCaptureMode = screenCaptureMode;
|
||||
}
|
||||
|
||||
public CaptureHelper(IEnumerable<IFormEnhancer> formEnhancers, CaptureMode captureMode, bool captureMouseCursor, IDestination destination) : this(formEnhancers, captureMode, captureMouseCursor)
|
||||
public CaptureHelper(CaptureSupportInfo captureSupportInfo, CaptureMode captureMode, bool captureMouseCursor, IDestination destination) : this(captureSupportInfo, captureMode, captureMouseCursor)
|
||||
{
|
||||
if (destination != null)
|
||||
{
|
||||
|
@ -140,100 +140,100 @@ namespace Greenshot.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
public static void CaptureClipboard(IEnumerable<IFormEnhancer> formEnhancers, IDestination destination = null)
|
||||
public static void CaptureClipboard(CaptureSupportInfo captureSupportInfo, IDestination destination = null)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.Clipboard, false, destination))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.Clipboard, false, destination))
|
||||
{
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureRegion(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse, IDestination destination = null)
|
||||
public static void CaptureRegion(CaptureSupportInfo captureSupportInfo, bool captureMouse, IDestination destination = null)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.Region, captureMouse, destination))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.Region, captureMouse, destination))
|
||||
{
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureRegion(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse, NativeRect region)
|
||||
public static void CaptureRegion(CaptureSupportInfo captureSupportInfo, bool captureMouse, NativeRect region)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.Region, captureMouse))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.Region, captureMouse))
|
||||
{
|
||||
captureHelper.MakeCapture(region);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureFullscreen(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse, ScreenCaptureMode screenCaptureMode, IDestination destination = null)
|
||||
public static void CaptureFullscreen(CaptureSupportInfo captureSupportInfo, bool captureMouse, ScreenCaptureMode screenCaptureMode, IDestination destination = null)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.FullScreen, captureMouse, destination))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.FullScreen, captureMouse, destination))
|
||||
{
|
||||
captureHelper._screenCaptureMode = screenCaptureMode;
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureLastRegion(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse)
|
||||
public static void CaptureLastRegion(CaptureSupportInfo captureSupportInfo, bool captureMouse)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.LastRegion, captureMouse))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.LastRegion, captureMouse))
|
||||
{
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureIe(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse, IInteropWindow windowToCapture)
|
||||
public static void CaptureIe(CaptureSupportInfo captureSupportInfo, bool captureMouse, IInteropWindow windowToCapture)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.IE, captureMouse))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.IE, captureMouse))
|
||||
{
|
||||
captureHelper.SelectedCaptureWindow = windowToCapture;
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureWindow(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse, IDestination destination = null)
|
||||
public static void CaptureWindow(CaptureSupportInfo captureSupportInfo, bool captureMouse, IDestination destination = null)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.ActiveWindow, captureMouse, destination))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.ActiveWindow, captureMouse, destination))
|
||||
{
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureWindow(IEnumerable<IFormEnhancer> formEnhancers, IInteropWindow windowToCapture)
|
||||
public static void CaptureWindow(CaptureSupportInfo captureSupportInfo, IInteropWindow windowToCapture)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.ActiveWindow))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.ActiveWindow))
|
||||
{
|
||||
captureHelper.SelectedCaptureWindow = windowToCapture;
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureWindowInteractive(IEnumerable<IFormEnhancer> formEnhancers, bool captureMouse)
|
||||
public static void CaptureWindowInteractive(CaptureSupportInfo captureSupportInfo, bool captureMouse)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.Window))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.Window))
|
||||
{
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureFile(IEnumerable<IFormEnhancer> formEnhancers, string filename)
|
||||
public static void CaptureFile(CaptureSupportInfo captureSupportInfo, string filename)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.File))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.File))
|
||||
{
|
||||
captureHelper.MakeCapture(filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CaptureFile(IEnumerable<IFormEnhancer> formEnhancers, string filename, IDestination destination)
|
||||
public static void CaptureFile(CaptureSupportInfo captureSupportInfo, string filename, IDestination destination)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.File))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.File))
|
||||
{
|
||||
captureHelper.AddDestination(destination).MakeCapture(filename);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ImportCapture(IEnumerable<IFormEnhancer> formEnhancers, ICapture captureToImport)
|
||||
public static void ImportCapture(CaptureSupportInfo captureSupportInfo, ICapture captureToImport)
|
||||
{
|
||||
using (var captureHelper = new CaptureHelper(formEnhancers, CaptureMode.File))
|
||||
using (var captureHelper = new CaptureHelper(captureSupportInfo, CaptureMode.File))
|
||||
{
|
||||
captureHelper._capture = captureToImport;
|
||||
captureHelper.HandleCapture();
|
||||
|
@ -355,7 +355,7 @@ namespace Greenshot.Helpers
|
|||
HandleCapture();
|
||||
break;
|
||||
case CaptureMode.IE:
|
||||
if (IeCaptureHelper.CaptureIe(_capture, SelectedCaptureWindow) != null)
|
||||
if (_captureSupportInfo.InternetExplorerCaptureHelper.CaptureIe(_capture, SelectedCaptureWindow) != null)
|
||||
{
|
||||
_capture.CaptureDetails.AddMetaData("source", "Internet Explorer");
|
||||
SetDpi();
|
||||
|
@ -782,7 +782,7 @@ namespace Greenshot.Helpers
|
|||
/// <param name="captureForWindow">The capture to store the details</param>
|
||||
/// <param name="windowCaptureMode">What WindowCaptureModes to use</param>
|
||||
/// <returns>ICapture</returns>
|
||||
public static ICapture CaptureWindow(IInteropWindow windowToCapture, ICapture captureForWindow, WindowCaptureModes windowCaptureMode)
|
||||
public ICapture CaptureWindow(IInteropWindow windowToCapture, ICapture captureForWindow, WindowCaptureModes windowCaptureMode)
|
||||
{
|
||||
if (captureForWindow == null)
|
||||
{
|
||||
|
@ -802,11 +802,11 @@ namespace Greenshot.Helpers
|
|||
// 3) Otherwise use GDI (Screen might be also okay but might lose content)
|
||||
if (isAutoMode)
|
||||
{
|
||||
if (CoreConfig.IECapture && IeCaptureHelper.IsIeWindow(windowToCapture))
|
||||
if (CoreConfig.IECapture && _captureSupportInfo.InternetExplorerCaptureHelper.IsIeWindow(windowToCapture))
|
||||
{
|
||||
try
|
||||
{
|
||||
var ieCapture = IeCaptureHelper.CaptureIe(captureForWindow, windowToCapture);
|
||||
var ieCapture = _captureSupportInfo.InternetExplorerCaptureHelper.CaptureIe(captureForWindow, windowToCapture);
|
||||
if (ieCapture != null)
|
||||
{
|
||||
return ieCapture;
|
||||
|
@ -1032,7 +1032,7 @@ namespace Greenshot.Helpers
|
|||
// }
|
||||
//}
|
||||
|
||||
using (var captureForm = new CaptureForm(CoreConfig, _capture, _windows, _formEnhancers))
|
||||
using (var captureForm = new CaptureForm(CoreConfig, _capture, _windows, _captureSupportInfo.FormEnhancers))
|
||||
{
|
||||
// Make sure the form is hidden after showing, even if an exception occurs, so all errors will be shown
|
||||
DialogResult result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue