From 56c46e6800c5bc8905a8f905c57fd72d02853394 Mon Sep 17 00:00:00 2001 From: Robin Date: Thu, 15 Nov 2018 14:11:21 +0100 Subject: [PATCH] Just a bunch of code quality changes, still need to reduce another ~2000 warnings. --- .../Configuration/Impl/BoxLanguageImpl.cs | 4 + .../Impl/ConfluenceLanguageImpl.cs | 4 + .../Configuration/Impl/DropboxLanguageImpl.cs | 4 + .../DropboxDestination.cs | 2 +- .../IExternalCommandConfiguration.cs | 4 +- .../Configuration/IExternalCommandLanguage.cs | 2 + .../Impl/ExternalCommandLanguageImpl.cs | 4 + .../Configuration/IFlickrConfiguration.cs | 27 ++++--- .../Configuration/IFlickrLanguage.cs | 4 +- .../Configuration/Impl/FlickrLanguageImpl.cs | 4 + .../Configuration/SafetyLevel.cs | 35 ++++++++ .../ViewModels/FlickrConfigViewModel.cs | 25 +++++- .../IGooglePhotosConfiguration.cs | 4 +- .../Impl/GooglePhotosLanguageImpl.cs | 4 + .../ViewModels/GooglePhotosConfigViewModel.cs | 14 ++++ .../Configuration/Impl/ImgurLanguageImpl.cs | 4 + .../ViewModels/ImgurHistoryViewModel.cs | 28 +++++-- .../AccessibleHelper.cs | 34 +++++++- .../IECaptureHelper.cs | 26 +++--- .../Configuration/Impl/JiraLanguageImpl.cs | 4 + src/Greenshot.Addon.LegacyEditor/Colors.cs | 14 ++++ .../Configuration/Impl/EditorLanguageImpl.cs | 4 + .../CustomToolStripProfessionalRenderer.cs | 2 +- .../Controls/Pipette.cs | 2 +- .../Drawing/DrawableContainerList.cs | 2 +- .../Drawing/Fields/Field.cs | 3 +- .../Drawing/Filters/AbstractFilter.cs | 5 -- .../Drawing/Filters/IFilter.cs | 23 +++++- .../Drawing/FreehandContainer.cs | 8 +- .../Drawing/RectangleContainer.cs | 14 ++-- .../Drawing/SpeechbubbleContainer.cs | 2 +- .../Drawing/Surface.cs | 6 +- .../Drawing/TextContainer.cs | 16 ++-- .../Forms/DropShadowSettingsForm.cs | 6 +- .../Forms/ImageEditorForm.cs | 2 + .../DrawableContainerBoundsChangeMemento.cs | 2 +- .../Configuration/Impl/LutimLanguageImpl.cs | 4 + .../Configuration/IOcrConfiguration.cs | 7 +- .../Configuration/IOcrLanguage.cs | 8 +- .../Configuration/Impl/OcrLanguageImpl.cs | 4 + src/Greenshot.Addon.OCR/OCRDestination.cs | 1 + src/Greenshot.Addon.OCR/OcrAddonModule.cs | 1 + src/Greenshot.Addon.OCR/SettingsForm.cs | 1 + .../Configuration/IOfficeConfiguration.cs | 2 +- .../Configuration/IOfficeLanguage.cs | 5 +- .../Impl/OfficeConfigurationImpl.cs | 30 ++++++- .../Configuration/Impl/OfficeLanguageImpl.cs | 5 +- .../OfficeExport/Entities/OneNotePage.cs | 2 +- .../OfficeExport/ExcelExporter.cs | 2 +- .../OfficeExport/OutlookEmailExporter.cs | 8 +- .../OfficeExport/PowerpointExporter.cs | 2 +- .../OfficeExport/WordExporter.cs | 2 +- .../Impl/OneDriveLanguageImpl.cs | 4 + .../Impl/PhotobucketLanguageImpl.cs | 4 + .../Configuration/Impl/TfsLanguageImpl.cs | 4 + src/Greenshot.Addon.Tfs/TfsClient.cs | 6 +- src/Greenshot.Addons/Animation/EasePower.cs | 18 +++++ .../Config/Impl/GreenshotLanguageImpl.cs | 4 + .../Core/AbstractProcessor.cs | 25 +++--- src/Greenshot.Addons/Core/CaptureDetails.cs | 16 +++- .../Core/CoreConfigurationExtensions.cs | 2 +- src/Greenshot.Addons/Core/ImageOutput.cs | 10 ++- .../Interfaces/Drawing/RenderMode.cs | 13 ++- .../InteropWindowCaptureExtensions.cs | 2 +- src/Greenshot.Gfx/BitmapHelper.cs | 5 +- .../Impl/ConfigTranslationsImpl.cs | 4 + .../Forms/ColorPickerToolStripButton.cs | 79 ------------------- src/Greenshot/Helpers/CaptureHelper.cs | 4 +- 68 files changed, 429 insertions(+), 203 deletions(-) create mode 100644 src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs delete mode 100644 src/Greenshot/Forms/ColorPickerToolStripButton.cs diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs index bf8a9f42f..78d36f31a 100644 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs +++ b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Box.Configuration.Impl { + /// + /// This implements IBoxLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class BoxLanguageImpl : LanguageBase, IBoxLanguage { #region Implementation of IBoxLanguage diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs index 9229ac878..d187a34a7 100644 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs +++ b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Confluence.Configuration.Impl { + /// + /// This implements IConfluenceLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class ConfluenceLanguageImpl : LanguageBase, IConfluenceLanguage { #region Implementation of IConfluenceLanguage diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs index e8f2a11fb..62ffdb1e2 100644 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs +++ b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs @@ -22,6 +22,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Dropbox.Configuration.Impl { + /// + /// This implements IDropboxLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class DropboxLanguageImpl: LanguageBase, IDropboxLanguage { diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs index 6bc1870a4..3ec3bf145 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs @@ -198,7 +198,7 @@ namespace Greenshot.Addon.Dropbox /// IProgress /// CancellationToken /// Url as string - private async Task UploadAsync(string filename, HttpContent content, IProgress progress = null, CancellationToken cancellationToken = default(CancellationToken)) + private async Task UploadAsync(string filename, HttpContent content, IProgress progress = null, CancellationToken cancellationToken = default) { var oAuthHttpBehaviour = _oAuthHttpBehaviour.ShallowClone(); // Use UploadProgress diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs index ff71ec3af..73680e07e 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandConfiguration.cs @@ -25,6 +25,7 @@ using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Ini; using Greenshot.Addon.ExternalCommand.Entities; using Greenshot.Addons.Core; @@ -38,7 +39,8 @@ namespace Greenshot.Addon.ExternalCommand.Configuration /// [IniSection("ExternalCommand")] [Description("Greenshot ExternalCommand Plugin configuration")] - public interface IExternalCommandConfiguration : IIniSection, IDestinationFileConfiguration + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public interface IExternalCommandConfiguration : IIniSection, IDestinationFileConfiguration { [Description("The commands that are available.")] IList Commands { get; set; } diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs index 9f23a612d..66f2b991a 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/IExternalCommandLanguage.cs @@ -21,11 +21,13 @@ #endregion +using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; namespace Greenshot.Addon.ExternalCommand.Configuration { [Language("ExternalCommand")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] public interface IExternalCommandLanguage : ILanguage { string ContextmenuConfigure { get; } diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs index 7a156c3ad..33b59feab 100644 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs +++ b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.ExternalCommand.Configuration.Impl { + /// + /// This implements IExternalCommandLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class ExternalCommandLanguageImpl : LanguageBase, IExternalCommandLanguage { #region Implementation of IExternalCommandLanguage diff --git a/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs b/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs index 43f8b175a..7ea2f7848 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/IFlickrConfiguration.cs @@ -24,6 +24,7 @@ #region Usings using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; @@ -33,19 +34,13 @@ using Greenshot.Addons.Core; namespace Greenshot.Addon.Flickr.Configuration { - public enum SafetyLevel - { - Safe = 1, - Moderate = 2, - Restricted = 3 - } - - /// - /// Description of FlickrConfiguration. + /// + /// This defines the configuration for the Flickr addon /// [IniSection("Flickr")] [Description("Greenshot Flickr Plugin configuration")] - public interface IFlickrConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth1Token + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public interface IFlickrConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth1Token { [Description("IsPublic.")] [DefaultValue(true)] @@ -59,18 +54,30 @@ namespace Greenshot.Addon.Flickr.Configuration [DefaultValue(true)] bool IsFriend { get; set; } + /// + /// + /// [Description("Safety level")] [DefaultValue(SafetyLevel.Safe)] SafetyLevel SafetyLevel { get; set; } + /// + /// Hide the image from the search results in Flickr + /// [Description("Hidden from search")] [DefaultValue(false)] bool HiddenFromSearch { get; set; } + /// + /// Place the link to Flickr onto the clipboard after it's uploaded + /// [Description("After upload send flickr link to clipboard.")] [DefaultValue(true)] bool AfterUploadLinkToClipBoard { get; set; } + /// + /// Defines if we use the pagelink or direct link on the clipboard + /// [Description("Use pagelink instead of direct link on the clipboard")] [DefaultValue(false)] bool UsePageLink { get; set; } diff --git a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs index 9e3af70ec..279e65656 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/IFlickrLanguage.cs @@ -19,6 +19,7 @@ #region Usings +using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; #endregion @@ -26,7 +27,8 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Flickr.Configuration { [Language("Flickr")] - public interface IFlickrLanguage : ILanguage + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public interface IFlickrLanguage : ILanguage { string CommunicationWait { get; } diff --git a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs index c7c9f2c61..d59572fad 100644 --- a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs +++ b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs @@ -26,6 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Flickr.Configuration.Impl { + /// + /// This implements IFlickrLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class FlickrLanguageImpl : LanguageBase, IFlickrLanguage { diff --git a/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs b/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs new file mode 100644 index 000000000..6949bbf7d --- /dev/null +++ b/src/Greenshot.Addon.Flickr/Configuration/SafetyLevel.cs @@ -0,0 +1,35 @@ +#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 + +namespace Greenshot.Addon.Flickr.Configuration +{ + /// + /// The Flickr SafetyLevel + /// + public enum SafetyLevel + { + Safe = 1, + Moderate = 2, + Restricted = 3 + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs b/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs index 5f3f94ec2..d2cca2bcb 100644 --- a/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs +++ b/src/Greenshot.Addon.Flickr/ViewModels/FlickrConfigViewModel.cs @@ -32,6 +32,9 @@ using Greenshot.Addons.ViewModels; namespace Greenshot.Addon.Flickr.ViewModels { + /// + /// This is the ViewModel for the configuration of the Flickr addon + /// public sealed class FlickrConfigViewModel : SimpleConfigScreen { /// @@ -39,10 +42,20 @@ namespace Greenshot.Addon.Flickr.ViewModels /// private CompositeDisposable _disposables; + /// + /// Configuration for the view + /// public IFlickrConfiguration FlickrConfiguration { get; } - + + /// + /// Translations for the view + /// public IFlickrLanguage FlickrLanguage { get; } - + + /// + /// FileConfigPartViewModel is used from the view + /// TODO: Check if this is really true and needed + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } public FlickrConfigViewModel( @@ -55,6 +68,7 @@ namespace Greenshot.Addon.Flickr.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = FlickrConfiguration; @@ -76,12 +90,16 @@ namespace Greenshot.Addon.Flickr.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); base.OnDeactivate(close); } + /// + /// Used in the view for the dropdown + /// public SafetyLevel SelectedSafetyLevel { get => FlickrConfiguration.SafetyLevel; @@ -92,6 +110,9 @@ namespace Greenshot.Addon.Flickr.ViewModels } } + /// + /// Used for a dropdown in the view + /// public IDictionary SafetyLevels => FlickrLanguage.TranslationValuesForEnum(); } } diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs index b5451d7f4..e43f7cd1b 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/IGooglePhotosConfiguration.cs @@ -24,6 +24,7 @@ #region Usings using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Runtime.Serialization; using Dapplo.Config.Ini; using Dapplo.HttpExtensions.OAuth; @@ -38,7 +39,8 @@ namespace Greenshot.Addon.GooglePhotos.Configuration /// [IniSection("GooglePhotos")] [Description("Greenshot Google Photos Plugin configuration")] - public interface IGooglePhotosConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth2Token + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public interface IGooglePhotosConfiguration : IIniSection, IDestinationFileConfiguration, IOAuth2Token { [Description("After upload send Google Photos link to clipboard.")] [DefaultValue(true)] diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs index e2e15bc7c..22059919d 100644 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs +++ b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.GooglePhotos.Configuration.Impl { + /// + /// This implements IGooglePhotosLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class GooglePhotosLanguageImpl : LanguageBase, IGooglePhotosLanguage { #region Implementation of IGooglePhotosLanguage diff --git a/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs b/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs index 42903e014..6288c82d8 100644 --- a/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs +++ b/src/Greenshot.Addon.GooglePhotos/ViewModels/GooglePhotosConfigViewModel.cs @@ -37,8 +37,20 @@ namespace Greenshot.Addon.GooglePhotos.ViewModels /// private CompositeDisposable _disposables; + /// + /// Configuration for the view + /// public IGooglePhotosConfiguration GooglePhotosConfiguration { get; } + + /// + /// Translations for the view + /// public IGooglePhotosLanguage GooglePhotosLanguage { get; } + + /// + /// FileConfigPartViewModel is used from the view + /// TODO: Check if this is really true and needed + /// public FileConfigPartViewModel FileConfigPartViewModel { get; } public GooglePhotosConfigViewModel( @@ -51,6 +63,7 @@ namespace Greenshot.Addon.GooglePhotos.ViewModels FileConfigPartViewModel = fileConfigPartViewModel; } + /// public override void Initialize(IConfig config) { FileConfigPartViewModel.DestinationFileConfiguration = GooglePhotosConfiguration; @@ -72,6 +85,7 @@ namespace Greenshot.Addon.GooglePhotos.ViewModels base.Initialize(config); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); diff --git a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs index 2203e4ecc..1716e7955 100644 --- a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs +++ b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs @@ -26,6 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Imgur.Configuration.Impl { + /// + /// This implements IImgurLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class ImgurLanguageImpl : LanguageBase, IImgurLanguage { diff --git a/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs b/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs index f3b2b6f76..b25e9f508 100644 --- a/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs +++ b/src/Greenshot.Addon.Imgur/ViewModels/ImgurHistoryViewModel.cs @@ -45,16 +45,22 @@ namespace Greenshot.Addon.Imgur.ViewModels public sealed class ImgurHistoryViewModel : Screen { private static readonly LogSource Log = new LogSource(); + private readonly ImgurApi _imgurApi; /// /// Here all disposables are registered, so we can clean the up /// private CompositeDisposable _disposables; + /// + /// The configuration used in the view + /// public IImgurConfiguration ImgurConfiguration { get; } - public ImgurApi ImgurApi { get; } + /// + /// The translations used in the view + /// public IImgurLanguage ImgurLanguage { get; } /// @@ -62,6 +68,13 @@ namespace Greenshot.Addon.Imgur.ViewModels /// public IGreenshotLanguage GreenshotLanguage { get; } + /// + /// Constructor which accepts the dependencies for this class + /// + /// IImgurConfiguration + /// ImgurApi + /// IImgurLanguage + /// IGreenshotLanguage public ImgurHistoryViewModel( IImgurConfiguration imgurConfiguration, ImgurApi imgurApi, @@ -70,7 +83,7 @@ namespace Greenshot.Addon.Imgur.ViewModels ) { ImgurConfiguration = imgurConfiguration; - ImgurApi = imgurApi; + _imgurApi = imgurApi; ImgurLanguage = imgurLanguage; GreenshotLanguage = greenshotLanguage; } @@ -79,6 +92,7 @@ namespace Greenshot.Addon.Imgur.ViewModels /// public ObservableCollection ImgurHistory { get; } = new BindableCollection(); + /// protected override void OnActivate() { // Prepare disposables @@ -91,6 +105,7 @@ namespace Greenshot.Addon.Imgur.ViewModels _ = LoadHistory(); } + /// protected override void OnDeactivate(bool close) { _disposables.Dispose(); @@ -117,10 +132,10 @@ namespace Greenshot.Addon.Imgur.ViewModels } try { - var imgurInfo = await ImgurApi.RetrieveImgurInfoAsync(hash, ImgurConfiguration.ImgurUploadHistory[hash], cancellationToken).ConfigureAwait(true); + var imgurInfo = await _imgurApi.RetrieveImgurInfoAsync(hash, ImgurConfiguration.ImgurUploadHistory[hash], cancellationToken).ConfigureAwait(true); if (imgurInfo != null) { - await ImgurApi.RetrieveImgurThumbnailAsync(imgurInfo, cancellationToken).ConfigureAwait(true); + await _imgurApi.RetrieveImgurThumbnailAsync(imgurInfo, cancellationToken).ConfigureAwait(true); ImgurConfiguration.RuntimeImgurHistory.Add(hash, imgurInfo); // Already loaded, only add it to the view ImgurHistory.Add(imgurInfo); @@ -138,6 +153,9 @@ namespace Greenshot.Addon.Imgur.ViewModels } } + /// + /// The selected Imgur entry + /// public ImgurImage SelectedImgur { get; private set; } /// @@ -150,7 +168,7 @@ namespace Greenshot.Addon.Imgur.ViewModels /// public async Task Delete() { - await ImgurApi.DeleteImgurImageAsync(SelectedImgur).ConfigureAwait(true); + await _imgurApi.DeleteImgurImageAsync(SelectedImgur).ConfigureAwait(true); } /// diff --git a/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs b/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs index b60a391e1..3cafdd2c2 100644 --- a/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs +++ b/src/Greenshot.Addon.InternetExplorer/AccessibleHelper.cs @@ -72,8 +72,7 @@ namespace Greenshot.Addon.InternetExplorer var list = new List(res.Length); foreach (var obj in res) { - var accessible = obj as IAccessible; - if (accessible != null) + if (obj is IAccessible accessible) { list.Add(new Accessible(accessible)); } @@ -92,6 +91,9 @@ namespace Greenshot.Addon.InternetExplorer get { return accessible.accChildCount; } } + /// + /// Returns the URL for the active tab + /// public string IEActiveTabUrl { get @@ -124,6 +126,9 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Get the index of the active tab + /// public int IEActiveTabIndex { get @@ -149,6 +154,9 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Get the caption of the active tab + /// public string IEActiveTabCaption { get @@ -172,6 +180,9 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Get the captions of all tabs + /// public List IETabCaptions { get @@ -199,7 +210,9 @@ namespace Greenshot.Addon.InternetExplorer } } - + /// + /// Get the urls of all tabs + /// public IEnumerable IETabUrls { get @@ -226,6 +239,9 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Count the tabs + /// public int IETabCount { get @@ -244,6 +260,10 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Activate the specified tab + /// + /// string public void ActivateIETab(string tabCaptionToActivate) { foreach (var accessor in Children) @@ -262,6 +282,10 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Close the specified tabs + /// + /// string public void CloseIETab(string tabCaptionToClose) { foreach (var accessor in Children) @@ -283,6 +307,10 @@ namespace Greenshot.Addon.InternetExplorer } } + /// + /// Active the IE tab + /// + /// int public void ActivateIETab(int tabIndexToActivate) { var index = 0; diff --git a/src/Greenshot.Addon.InternetExplorer/IECaptureHelper.cs b/src/Greenshot.Addon.InternetExplorer/IECaptureHelper.cs index 8788a6d1d..14e210269 100644 --- a/src/Greenshot.Addon.InternetExplorer/IECaptureHelper.cs +++ b/src/Greenshot.Addon.InternetExplorer/IECaptureHelper.cs @@ -60,19 +60,25 @@ namespace Greenshot.Addon.InternetExplorer // TODO: Solve, was static reference! private static readonly ICoreConfiguration CoreConfig = new CoreConfigurationImpl(); - // Helper method to activate a certain IE Tab + /// + /// Helper method to activate a certain IE Tab + /// + /// IInteropWindow + /// int public static void ActivateIeTab(IInteropWindow nativeIeWindow, int tabIndex) { var directUiInteropWindow = IEHelper.GetDirectUi(nativeIeWindow); - if (directUiInteropWindow != null) - { - // Bring window to the front - nativeIeWindow.Restore(); - // Get accessible - var ieAccessible = new Accessible(directUiInteropWindow.Handle); - // Activate Tab - ieAccessible.ActivateIETab(tabIndex); - } + if (directUiInteropWindow == null) + { + return; + } + + // Bring window to the front + nativeIeWindow.Restore(); + // Get accessible + var ieAccessible = new Accessible(directUiInteropWindow.Handle); + // Activate Tab + ieAccessible.ActivateIETab(tabIndex); } /// diff --git a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs index 5b17325df..e25c06d9f 100644 --- a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs +++ b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs @@ -26,6 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Jira.Configuration.Impl { + /// + /// This implements IJiraLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class JiraLanguageImpl : LanguageBase, IJiraLanguage { diff --git a/src/Greenshot.Addon.LegacyEditor/Colors.cs b/src/Greenshot.Addon.LegacyEditor/Colors.cs index de90b5f53..c69381185 100644 --- a/src/Greenshot.Addon.LegacyEditor/Colors.cs +++ b/src/Greenshot.Addon.LegacyEditor/Colors.cs @@ -30,13 +30,27 @@ using System.Drawing; namespace Greenshot.Addon.LegacyEditor { + /// + /// Utility class to work with System.Drawing.Colors + /// TODO: should be done differently + /// public static class Colors { + /// + /// Is the specified color visible? + /// + /// Color + /// bool true if visible public static bool IsVisible(Color c) { return !c.Equals(Color.Empty) && !c.Equals(Color.Transparent) && c.A > 0; } + /// + /// Mix all specified colors into one + /// + /// IEnumerable with Color + /// Color public static Color Mix(IEnumerable colors) { var a = 0; diff --git a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs index 006c1aac9..fd6ebc101 100644 --- a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs +++ b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs @@ -3,7 +3,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.LegacyEditor.Configuration.Impl { + /// + /// This implements IEditorLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class EditorLanguageImpl : LanguageBase, IEditorLanguage { #region Implementation of IEditorLanguage diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs b/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs index ff59894e6..fd68d0e34 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/CustomToolStripProfessionalRenderer.cs @@ -63,7 +63,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls { int halfHeight = e.ArrowRectangle.Height / 2; int halfWidth = e.ArrowRectangle.Width / 2; - Point middle = new Point(dropDownRect.Left + halfWidth, dropDownRect.Top + halfHeight); + var middle = new Point(dropDownRect.Left + halfWidth, dropDownRect.Top + halfHeight); Point[] arrow; diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs b/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs index 96e6207ba..48431bfe0 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/Pipette.cs @@ -92,7 +92,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls public event EventHandler PipetteUsed; /// - /// Create a cursor from the supplied bitmap & hotspot coordinates + /// Create a cursor from the supplied bitmap and hotspot coordinates /// /// Bitmap to create an icon from /// Hotspot X coordinate diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs index aa44842d2..2a8b14150 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/DrawableContainerList.cs @@ -521,7 +521,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { continue; } - Size defaultSize = container.DefaultSize; + var defaultSize = container.DefaultSize; container.MakeBoundsChangeUndoable(false); container.Width = defaultSize.Width; container.Height = defaultSize.Height; diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs index e0f028c2e..335b4bd00 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Field.cs @@ -119,8 +119,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields public override bool Equals(object obj) { - var other = obj as Field; - if (other == null) + if (!(obj is Field other)) { return false; } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs index be486e074..b2ae8feed 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/AbstractFilter.cs @@ -75,11 +75,6 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Filters set { parent = value; } } - public DrawableContainer GetParent() - { - return parent; - } - public abstract void Apply(Graphics graphics, Bitmap applyBitmap, NativeRect rect, RenderMode renderMode); protected void OnPropertyChanged(string propertyName) diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs index 6160f0ede..03a322691 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Filters/IFilter.cs @@ -32,11 +32,28 @@ using Greenshot.Addons.Interfaces.Drawing; namespace Greenshot.Addon.LegacyEditor.Drawing.Filters { + /// + /// This defines the interface for all filters + /// public interface IFilter : INotifyPropertyChanged, IFieldHolder { + /// + /// Filters are childen of DrawableContainers, this is the parent + /// DrawableContainer Parent { get; set; } + + /// + /// is the filtered area inverted? + /// bool Invert { get; set; } - void Apply(Graphics graphics, Bitmap bmp, NativeRect rect, RenderMode renderMode); - DrawableContainer GetParent(); - } + + /// + /// Apply this filter + /// + /// Graphics to use + /// Bitmap to apply to + /// NativeRect with the area + /// RenderMode to use + void Apply(Graphics graphics, Bitmap bmp, NativeRect rect, RenderMode renderMode); + } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs index 5e8e71bee..e102a32a5 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/FreehandContainer.cs @@ -184,7 +184,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS); - Color lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR); + var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR); using (var pen = new Pen(lineColor)) { pen.Width = lineThickness; if (!(pen.Width > 0)) @@ -199,7 +199,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { graphics.TranslateTransform(Left, Top); lock (_freehandPathLock) { - if (isRecalculated && Selected && renderMode == RenderMode.EDIT) + if (isRecalculated && Selected && renderMode == RenderMode.Edit) { DrawSelectionBorder(graphics, pen, freehandPath); } @@ -257,8 +257,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { { return false; } - var other = obj as FreehandContainer; - if (other != null && Equals(freehandPath, other.freehandPath)) { + + if (obj is FreehandContainer other && Equals(freehandPath, other.freehandPath)) { ret = true; } return ret; diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/RectangleContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/RectangleContainer.cs index 009fa0e1a..ef54e388d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/RectangleContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/RectangleContainer.cs @@ -63,8 +63,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { public override void Draw(Graphics graphics, RenderMode rm) { int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS); - Color lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR, Color.Red); - Color fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR, Color.Transparent); + var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR, Color.Red); + var fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR, Color.Transparent); bool shadow = GetFieldValueAsBool(FieldTypes.SHADOW); var rect = new NativeRect(Left, Top, Width, Height).Normalize(); @@ -95,7 +95,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { int steps = 5; int currentStep = lineVisible ? 1 : 0; while (currentStep <= steps) { - using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) { + using (var shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) { shadowPen.Width = lineVisible ? lineThickness : 1; var shadowRect = new NativeRect( rect.Left + currentStep, @@ -118,7 +118,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { graphics.SmoothingMode = SmoothingMode.HighSpeed; if (lineVisible) { - using (Pen pen = new Pen(lineColor, lineThickness)) { + using (var pen = new Pen(lineColor, lineThickness)) { graphics.DrawRectangle(pen, rect); } } @@ -127,7 +127,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { public override bool ClickableAt(int x, int y) { var rect = new NativeRect(Left, Top, Width, Height).Normalize(); int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS) + 10; - Color fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR); + var fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR); return RectangleClickableAt(rect, lineThickness, fillColor, x, y); } @@ -144,8 +144,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { // check the rest of the lines if (lineThickness > 0) { - using (Pen pen = new Pen(Color.White, lineThickness)) { - using (GraphicsPath path = new GraphicsPath()) { + using (var pen = new Pen(Color.White, lineThickness)) { + using (var path = new GraphicsPath()) { path.AddRectangle(rect); return path.IsOutlineVisible(x, y, pen); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs index 15fed8338..3064769ba 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/SpeechbubbleContainer.cs @@ -229,7 +229,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing var lineVisible = lineThickness > 0 && Colors.IsVisible(lineColor); var rect = new NativeRect(Left, Top, Width, Height).Normalize(); - if (Selected && renderMode == RenderMode.EDIT) + if (Selected && renderMode == RenderMode.Edit) { DrawSelectionBorder(graphics, rect); } diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs index 388dd65fd..577677fdc 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Surface.cs @@ -597,7 +597,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing /// public Bitmap GetBitmapForExport() { - return GetBitmap(RenderMode.EXPORT); + return GetBitmap(RenderMode.Export); } /// @@ -1646,7 +1646,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing DrawBackground(graphics, clipRectangle); graphics.DrawImage(Screenshot, clipRectangle, clipRectangle, GraphicsUnit.Pixel); graphics.SetClip(targetGraphics); - _elements.Draw(graphics, _buffer, RenderMode.EDIT, clipRectangle); + _elements.Draw(graphics, _buffer, RenderMode.Edit, clipRectangle); } targetGraphics.DrawImage(_buffer, clipRectangle, clipRectangle, GraphicsUnit.Pixel); } @@ -1654,7 +1654,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { DrawBackground(targetGraphics, clipRectangle); targetGraphics.DrawImage(Screenshot, clipRectangle, clipRectangle, GraphicsUnit.Pixel); - _elements.Draw(targetGraphics, null, RenderMode.EDIT, clipRectangle); + _elements.Draw(targetGraphics, null, RenderMode.Edit, clipRectangle); } // No clipping for the adorners diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs index 8b8bad73a..6b494f4c5 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/TextContainer.cs @@ -168,7 +168,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing public void FitToText() { - Size textSize = TextRenderer.MeasureText(text, _font); + var textSize = TextRenderer.MeasureText(text, _font); int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS); Width = textSize.Width + lineThickness; Height = textSize.Height + lineThickness; @@ -288,7 +288,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing { return; } - Color lc = GetFieldValueAsColor(FieldTypes.LINE_COLOR); + var lc = GetFieldValueAsColor(FieldTypes.LINE_COLOR); if (lc.R > 203 && lc.G > 203 && lc.B > 203) { _textBox.BackColor = Color.FromArgb(51, 51, 51); @@ -331,7 +331,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing private Font CreateFont(string fontFamilyName, bool fontBold, bool fontItalic, float fontSize) { - FontStyle fontStyle = FontStyle.Regular; + var fontStyle = FontStyle.Regular; bool hasStyle = false; using (var fontFamily = new FontFamily(fontFamilyName)) @@ -444,7 +444,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing lineWidth = 1; correction = -1; } - NativeRect absRectangle = new NativeRect(Left, Top, Width, Height).Normalize(); + var absRectangle = new NativeRect(Left, Top, Width, Height).Normalize(); _textBox.Left = absRectangle.Left + lineWidth; _textBox.Top = absRectangle.Top + lineWidth; if (lineThickness <= 1) @@ -534,8 +534,8 @@ namespace Greenshot.Addon.LegacyEditor.Drawing graphics.PixelOffsetMode = PixelOffsetMode.None; graphics.TextRenderingHint = TextRenderingHint.SystemDefault; - NativeRect rect = new NativeRect(Left, Top, Width, Height).Normalize(); - if (Selected && rm == RenderMode.EDIT) + var rect = new NativeRect(Left, Top, Width, Height).Normalize(); + if (Selected && rm == RenderMode.Edit) { DrawSelectionBorder(graphics, rect); } @@ -547,9 +547,9 @@ namespace Greenshot.Addon.LegacyEditor.Drawing // we only draw the shadow if there is no background bool shadow = GetFieldValueAsBool(FieldTypes.SHADOW); - Color fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR); + var fillColor = GetFieldValueAsColor(FieldTypes.FILL_COLOR); int lineThickness = GetFieldValueAsInt(FieldTypes.LINE_THICKNESS); - Color lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR); + var lineColor = GetFieldValueAsColor(FieldTypes.LINE_COLOR); bool drawShadow = shadow && (fillColor == Color.Transparent || fillColor == Color.Empty); DrawText(graphics, rect, lineThickness, lineColor, drawShadow, _stringFormat, text, _font); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs index 2303aab85..6e93ec54d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs @@ -34,11 +34,15 @@ using Greenshot.Gfx.Effects; namespace Greenshot.Addon.LegacyEditor.Forms { + /// + /// This form makes it possible to change the settings for a DropShadow effect + /// public partial class DropShadowSettingsForm : GreenshotForm { private readonly DropShadowEffect _effect; - public DropShadowSettingsForm(DropShadowEffect effect, IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage) + /// + public DropShadowSettingsForm(DropShadowEffect effect, IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage) { _effect = effect; InitializeComponent(); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs index b31f5964e..2ccde638a 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs @@ -1703,6 +1703,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms #region key handling + /// protected override bool ProcessKeyPreview(ref Message msg) { // disable default key handling if surface has requested a lock @@ -1714,6 +1715,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms return base.ProcessKeyPreview(ref msg); } + /// protected override bool ProcessCmdKey(ref Message msg, Keys keys) { // disable default key handling if surface has requested a lock diff --git a/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs b/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs index 6906ff64c..eb576873d 100644 --- a/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs +++ b/src/Greenshot.Addon.LegacyEditor/Memento/DrawableContainerBoundsChangeMemento.cs @@ -35,7 +35,7 @@ using Greenshot.Addons.Interfaces.Drawing; namespace Greenshot.Addon.LegacyEditor.Memento { /// - /// The DrawableContainerBoundsChangeMemento makes it possible to undo-redo an IDrawableContainer resize & move + /// The DrawableContainerBoundsChangeMemento makes it possible to undo-redo an IDrawableContainer resize and move /// public class DrawableContainerBoundsChangeMemento : IMemento { diff --git a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs index 4789135bf..59887426f 100644 --- a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs +++ b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Lutim.Configuration.Impl { + /// + /// This implements ILutimLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class LutimLanguageImpl : LanguageBase, ILutimLanguage { #region Implementation of ILutimLanguage diff --git a/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs b/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs index 8edad1465..352f95e5d 100644 --- a/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs +++ b/src/Greenshot.Addon.OCR/Configuration/IOcrConfiguration.cs @@ -24,18 +24,21 @@ #region Usings using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Ini; #endregion -namespace Greenshot.Addon.OCR +namespace Greenshot.Addon.OCR.Configuration { /// /// OCR Configuration. /// [IniSection("OCR")] [Description("Greenshot OCR Plugin configuration")] - public interface IOcrConfiguration : IIniSection + [SuppressMessage("ReSharper", "UnusedMember.Global")] +#pragma warning disable CS1591 + public interface IOcrConfiguration : IIniSection { [Description("Language for OCR")] [DefaultValue ("miLANG_ENGLISH")] diff --git a/src/Greenshot.Addon.OCR/Configuration/IOcrLanguage.cs b/src/Greenshot.Addon.OCR/Configuration/IOcrLanguage.cs index 368db787c..6d436a516 100644 --- a/src/Greenshot.Addon.OCR/Configuration/IOcrLanguage.cs +++ b/src/Greenshot.Addon.OCR/Configuration/IOcrLanguage.cs @@ -17,13 +17,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using Dapplo.Config.Language; -namespace Greenshot.Addon.OCR +namespace Greenshot.Addon.OCR.Configuration { [Language("Ocr")] - public interface IOcrLanguage : ILanguage, INotifyPropertyChanged + [SuppressMessage("ReSharper", "UnusedMember.Global")] +#pragma warning disable CS1591 + public interface IOcrLanguage : ILanguage { string Language { get; } string OrientImage { get; } diff --git a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs index 221ee3604..b3f90b33d 100644 --- a/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs +++ b/src/Greenshot.Addon.OCR/Configuration/Impl/OcrLanguageImpl.cs @@ -26,6 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.OCR.Configuration.Impl { + /// + /// This implements IOcrLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class OcrLanguageImpl : LanguageBase, IOcrLanguage { diff --git a/src/Greenshot.Addon.OCR/OCRDestination.cs b/src/Greenshot.Addon.OCR/OCRDestination.cs index 7c9389668..a96242fae 100644 --- a/src/Greenshot.Addon.OCR/OCRDestination.cs +++ b/src/Greenshot.Addon.OCR/OCRDestination.cs @@ -30,6 +30,7 @@ using System.IO; using System.Reflection; using System.Windows.Forms; using Dapplo.Log; +using Greenshot.Addon.OCR.Configuration; using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Core; diff --git a/src/Greenshot.Addon.OCR/OcrAddonModule.cs b/src/Greenshot.Addon.OCR/OcrAddonModule.cs index 70413f0f2..f8559fc68 100644 --- a/src/Greenshot.Addon.OCR/OcrAddonModule.cs +++ b/src/Greenshot.Addon.OCR/OcrAddonModule.cs @@ -28,6 +28,7 @@ using Dapplo.Addons; using Dapplo.Addons.Bootstrapper.Resolving; using Dapplo.Config.Ini; using Dapplo.Config.Language; +using Greenshot.Addon.OCR.Configuration; using Greenshot.Addon.OCR.Configuration.Impl; using Greenshot.Addons.Components; diff --git a/src/Greenshot.Addon.OCR/SettingsForm.cs b/src/Greenshot.Addon.OCR/SettingsForm.cs index 152fa53a7..f2b6bf18e 100644 --- a/src/Greenshot.Addon.OCR/SettingsForm.cs +++ b/src/Greenshot.Addon.OCR/SettingsForm.cs @@ -24,6 +24,7 @@ #region Usings using System; +using Greenshot.Addon.OCR.Configuration; using Greenshot.Addons.Controls; #endregion diff --git a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs index 2ee48c1dc..48391b1e5 100644 --- a/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs +++ b/src/Greenshot.Addon.Office/Configuration/IOfficeConfiguration.cs @@ -35,7 +35,7 @@ namespace Greenshot.Addon.Office.Configuration /// /// Office configuration /// - #pragma warning disable CS1591 +#pragma warning disable CS1591 [IniSection("Office")] [Description("Greenshot Office configuration")] public interface IOfficeConfiguration : IIniSection diff --git a/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs b/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs index 406ea2301..37b1cf872 100644 --- a/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs +++ b/src/Greenshot.Addon.Office/Configuration/IOfficeLanguage.cs @@ -22,7 +22,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Office.Configuration { - #pragma warning disable CS1591 + /// + /// This implements IOfficeLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [Language("Office")] public interface IOfficeLanguage : ILanguage, INotifyPropertyChanged { diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs index 40de55c24..731d5bdff 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs @@ -1,10 +1,36 @@ -using Dapplo.Config.Ini; +#region Greenshot GNU General 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 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 License for more details. +// +// You should have received a copy of the GNU General License +// along with this program. If not, see . + +#endregion + +using Dapplo.Config.Ini; using Greenshot.Addon.Office.OfficeInterop; using Microsoft.Office.Interop.PowerPoint; namespace Greenshot.Addon.Office.Configuration.Impl { - #pragma warning disable CS1591 + /// + /// This implements IOfficeConfiguration and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 public class OfficeConfigurationImpl : IniSectionBase, IOfficeConfiguration { #region Implementation of IOfficeConfiguration diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs index 42cc6932c..0039d2200 100644 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs +++ b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs @@ -26,7 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Office.Configuration.Impl { - #pragma warning disable CS1591 + /// + /// This implements IOfficeLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class OfficeLanguageImpl : LanguageBase, IOfficeLanguage { diff --git a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs index 7d0a8584e..794835774 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/Entities/OneNotePage.cs @@ -38,7 +38,7 @@ namespace Greenshot.Addon.Office.OfficeExport.Entities { get { - OneNoteNotebook notebook = Parent.Parent; + var notebook = Parent.Parent; if (string.IsNullOrEmpty(notebook.Name)) { return string.Format("{0} / {1}", Parent.Name, Name); diff --git a/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs index 0b586b2dc..9d976e5ee 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/ExcelExporter.cs @@ -76,7 +76,7 @@ namespace Greenshot.Addon.Office.OfficeExport /// ComDisposable for Excel.Application private static IDisposableCom GetOrCreateExcelApplication() { - IDisposableCom excelApplication = GetExcelApplication(); + var excelApplication = GetExcelApplication(); if (excelApplication == null) { excelApplication = DisposableCom.Create(new Application()); diff --git a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs index 3917a510e..ac721e577 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/OutlookEmailExporter.cs @@ -582,7 +582,7 @@ namespace Greenshot.Addon.Office.OfficeExport /// IDisposableCom for Outlook.Application private IDisposableCom GetOrCreateOutlookApplication() { - IDisposableCom outlookApplication = GetOutlookApplication(); + var outlookApplication = GetOutlookApplication(); if (outlookApplication == null) { outlookApplication = DisposableCom.Create(new Application()); @@ -620,7 +620,7 @@ namespace Greenshot.Addon.Office.OfficeExport /// private string GetOutlookSignature(EmailFormat format) { - using (RegistryKey profilesKey = Registry.CurrentUser.OpenSubKey(ProfilesKey, false)) + using (var profilesKey = Registry.CurrentUser.OpenSubKey(ProfilesKey, false)) { if (profilesKey == null) { @@ -628,7 +628,7 @@ namespace Greenshot.Addon.Office.OfficeExport } string defaultProfile = (string)profilesKey.GetValue(DefaultProfileValue); Log.Debug().WriteLine("defaultProfile={0}", defaultProfile); - using (RegistryKey profileKey = profilesKey.OpenSubKey(defaultProfile + @"\" + AccountKey, false)) + using (var profileKey = profilesKey.OpenSubKey(defaultProfile + @"\" + AccountKey, false)) { if (profileKey != null) { @@ -636,7 +636,7 @@ namespace Greenshot.Addon.Office.OfficeExport foreach (string number in numbers) { Log.Debug().WriteLine("Found subkey {0}", number); - using (RegistryKey numberKey = profileKey.OpenSubKey(number, false)) + using (var numberKey = profileKey.OpenSubKey(number, false)) { if (numberKey != null) { diff --git a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs index c506fb4b1..0ef7ff3f5 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/PowerpointExporter.cs @@ -257,7 +257,7 @@ namespace Greenshot.Addon.Office.OfficeExport /// ComDisposable for PowerPoint.Application private IDisposableCom GetOrCreatePowerPointApplication() { - IDisposableCom powerPointApplication = GetPowerPointApplication(); + var powerPointApplication = GetPowerPointApplication(); if (powerPointApplication == null) { powerPointApplication = DisposableCom.Create(new Application()); diff --git a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs index 6a577073b..8e633d15f 100644 --- a/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs +++ b/src/Greenshot.Addon.Office/OfficeExport/WordExporter.cs @@ -79,7 +79,7 @@ namespace Greenshot.Addon.Office.OfficeExport /// ComDisposable for Word.Application private IDisposableCom GetOrCreateWordApplication() { - IDisposableCom wordApplication = GetWordApplication(); + var wordApplication = GetWordApplication(); if (wordApplication == null) { wordApplication = DisposableCom.Create(new Application()); diff --git a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs index fe3ef980d..66a24d894 100644 --- a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs +++ b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.OneDrive.Configuration.Impl { + /// + /// This implements IOneDriveLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class OneDriveLanguageImpl : LanguageBase, IOneDriveLanguage { #region Implementation of IOneDriveLanguage diff --git a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs index a12fd741c..c145ef19d 100644 --- a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs +++ b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs @@ -26,6 +26,10 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Photobucket.Configuration.Impl { + /// + /// This implements IPhotobucketLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// +#pragma warning disable CS1591 [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] public class PhotobucketLanguageImpl : LanguageBase, IPhotobucketLanguage { diff --git a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs index 3c9086273..6ed612ed9 100644 --- a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs +++ b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addon.Tfs.Configuration.Impl { + /// + /// This implements ITfsLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 public class TfsLanguageImpl : LanguageBase, ITfsLanguage { #region Implementation of ITfsLanguage diff --git a/src/Greenshot.Addon.Tfs/TfsClient.cs b/src/Greenshot.Addon.Tfs/TfsClient.cs index 89d3524a7..9554d46b1 100644 --- a/src/Greenshot.Addon.Tfs/TfsClient.cs +++ b/src/Greenshot.Addon.Tfs/TfsClient.cs @@ -94,7 +94,7 @@ namespace Greenshot.Addon.Tfs public async Task GetOwnWorkitems() { _tfsHttpBehaviour.MakeCurrent(); - Uri apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); + var apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); var client = HttpClientFactory.Create(_tfsConfiguration.TfsUri).SetBasicAuthorization("", _tfsConfiguration.ApiKey); var workitemsQueryUri = apiUri.AppendSegments("wit", "wiql"); @@ -127,7 +127,7 @@ namespace Greenshot.Addon.Tfs _tfsHttpBehaviour.MakeCurrent(); var client = HttpClientFactory.Create(_tfsConfiguration.TfsUri).SetBasicAuthorization("", _tfsConfiguration.ApiKey); - Uri apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); + var apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); var filename = surface.GenerateFilename(_coreConfiguration, _tfsConfiguration); var attachmentUri = apiUri.AppendSegments("wit", "attachments").ExtendQuery("fileName", filename); @@ -159,7 +159,7 @@ namespace Greenshot.Addon.Tfs _tfsHttpBehaviour.MakeCurrent(); var client = HttpClientFactory.Create(_tfsConfiguration.TfsUri).SetBasicAuthorization("", _tfsConfiguration.ApiKey); - Uri apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); + var apiUri = _tfsConfiguration.TfsUri.AppendSegments("_apis").ExtendQuery("api-version", "3.0"); // https://docs.microsoft.com/en-us/rest/api/vsts/wit/work%20items/update#add_an_attachment var linkAttachmentUri = apiUri.AppendSegments("wit", "workItems", workItem.Id); var linkAttachmentRequest = new List diff --git a/src/Greenshot.Addons/Animation/EasePower.cs b/src/Greenshot.Addons/Animation/EasePower.cs index 82abe6d93..d13ab152f 100644 --- a/src/Greenshot.Addons/Animation/EasePower.cs +++ b/src/Greenshot.Addons/Animation/EasePower.cs @@ -34,11 +34,23 @@ namespace Greenshot.Addons.Animation /// public static class EasePower { + /// + /// Calculate EaseIn + /// + /// double + /// int + /// double public static double EaseIn(double s, int power) { return Math.Pow(s, power); } + /// + /// Calculate EaseInOut + /// + /// double + /// int + /// double public static double EaseInOut(double s, int power) { s *= 2; @@ -50,6 +62,12 @@ namespace Greenshot.Addons.Animation return sign / 2.0 * (Math.Pow(s - 2, power) + sign * 2); } + /// + /// Calculate EaseOut + /// + /// double + /// int + /// double public static double EaseOut(double s, int power) { var sign = power % 2 == 0 ? -1 : 1; diff --git a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs b/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs index 56caba176..0ec3e58ef 100644 --- a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs +++ b/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs @@ -3,7 +3,11 @@ using Dapplo.Config.Language; namespace Greenshot.Addons.Config.Impl { + /// + /// This implements IGreenshotLanguage and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 internal class GreenshotLanguageImpl : LanguageBase, IGreenshotLanguage { #region Implementation of ICoreTranslations diff --git a/src/Greenshot.Addons/Core/AbstractProcessor.cs b/src/Greenshot.Addons/Core/AbstractProcessor.cs index 1f64a9008..c84b4726d 100644 --- a/src/Greenshot.Addons/Core/AbstractProcessor.cs +++ b/src/Greenshot.Addons/Core/AbstractProcessor.cs @@ -36,12 +36,11 @@ namespace Greenshot.Addons.Core { public virtual int CompareTo(object obj) { - var other = obj as IProcessor; - if (other == null) - { - return 1; - } - if (Priority == other.Priority) + if (!(obj is IProcessor other)) + { + return 1; + } + if (Priority == other.Priority) { return Description.CompareTo(other.Description); } @@ -52,22 +51,16 @@ namespace Greenshot.Addons.Core public abstract string Description { get; } - public virtual int Priority - { - get { return 10; } - } + public virtual int Priority => 10; - public void Dispose() + public void Dispose() { Dispose(true); } - public virtual bool IsActive - { - get { return true; } - } + public virtual bool IsActive => true; - public abstract bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails); + public abstract bool ProcessCapture(ISurface surface, ICaptureDetails captureDetails); protected virtual void Dispose(bool disposing) { diff --git a/src/Greenshot.Addons/Core/CaptureDetails.cs b/src/Greenshot.Addons/Core/CaptureDetails.cs index 69c70aa63..b272cc2ad 100644 --- a/src/Greenshot.Addons/Core/CaptureDetails.cs +++ b/src/Greenshot.Addons/Core/CaptureDetails.cs @@ -38,23 +38,31 @@ namespace Greenshot.Addons.Core /// public class CaptureDetails : ICaptureDetails { + /// public CaptureDetails() { DateTime = DateTime.Now; } - public string Title { get; set; } + /// + public string Title { get; set; } + /// public string Filename { get; set; } + /// public DateTime DateTime { get; set; } + /// public float DpiX { get; set; } + /// public float DpiY { get; set; } + /// public Dictionary MetaData { get; } = new Dictionary(); + /// public void AddMetaData(string key, string value) { if (MetaData.ContainsKey(key)) @@ -67,15 +75,19 @@ namespace Greenshot.Addons.Core } } + /// public CaptureMode CaptureMode { get; set; } + /// public List CaptureDestinations { get; set; } = new List(); + /// public void ClearDestinations() { CaptureDestinations.Clear(); } + /// public void RemoveDestination(IDestination destination) { if (CaptureDestinations.Contains(destination)) @@ -84,6 +96,7 @@ namespace Greenshot.Addons.Core } } + /// public void AddDestination(IDestination captureDestination) { if (!CaptureDestinations.Contains(captureDestination)) @@ -92,6 +105,7 @@ namespace Greenshot.Addons.Core } } + /// public bool HasDestination(string designation) { foreach (var destination in CaptureDestinations) diff --git a/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs b/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs index 763c8c1f1..70e838201 100644 --- a/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs +++ b/src/Greenshot.Addons/Core/CoreConfigurationExtensions.cs @@ -131,7 +131,7 @@ namespace Greenshot.Addons.Core // Make sure we have clipboard formats, otherwise a paste doesn't make sense! if (coreConfiguration.ClipboardFormats == null || coreConfiguration.ClipboardFormats.Count == 0) { - coreConfiguration.ClipboardFormats = new List { Enums.ClipboardFormats.PNG, Enums.ClipboardFormats.HTML, Enums.ClipboardFormats.DIB }; + coreConfiguration.ClipboardFormats = new List { ClipboardFormats.PNG, ClipboardFormats.HTML, ClipboardFormats.DIB }; } // Make sure the lists are lowercase, to speedup the check diff --git a/src/Greenshot.Addons/Core/ImageOutput.cs b/src/Greenshot.Addons/Core/ImageOutput.cs index 10a25580e..eae932b08 100644 --- a/src/Greenshot.Addons/Core/ImageOutput.cs +++ b/src/Greenshot.Addons/Core/ImageOutput.cs @@ -545,10 +545,12 @@ namespace Greenshot.Addons.Core } else if (Equals(imageFormat, ImageFormat.Icon)) { - // FEATURE-916: Added Icon support - IList bitmaps = new List(); - bitmaps.Add(bitmapToSave); - WriteIcon(stream, bitmaps); + // FEATURE-916: Added Icon support + IList bitmaps = new List + { + bitmapToSave + }; + WriteIcon(stream, bitmaps); } else { diff --git a/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs b/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs index 40e12d024..de811c6df 100644 --- a/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs +++ b/src/Greenshot.Addons/Interfaces/Drawing/RenderMode.cs @@ -23,9 +23,18 @@ namespace Greenshot.Addons.Interfaces.Drawing { + /// + /// Specifies how something needs to be rendered, the idea was that export needs more details and no "edit" adorners. + /// public enum RenderMode { - EDIT, - EXPORT + /// + /// Render for editing + /// + Edit, + /// + /// Render for exporting + /// + Export } } \ No newline at end of file diff --git a/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs b/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs index f6220c6f8..38a935c57 100644 --- a/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs +++ b/src/Greenshot.Core/Extensions/InteropWindowCaptureExtensions.cs @@ -75,7 +75,7 @@ namespace Greenshot.Core.Extensions public static ICaptureElement CaptureFromScreen(this IInteropWindow interopWindow, bool clientBounds = false) { var bounds = clientBounds ? interopWindow.GetInfo().ClientBounds: interopWindow.GetInfo().Bounds; - ICaptureElement result = ScreenSource.CaptureRectangle(bounds); + var result = ScreenSource.CaptureRectangle(bounds); return result; } diff --git a/src/Greenshot.Gfx/BitmapHelper.cs b/src/Greenshot.Gfx/BitmapHelper.cs index 11fa1d29d..3c8b6bacc 100644 --- a/src/Greenshot.Gfx/BitmapHelper.cs +++ b/src/Greenshot.Gfx/BitmapHelper.cs @@ -57,8 +57,7 @@ namespace Greenshot.Gfx { using (var tmpImage = Image.FromStream(stream, true, true)) { - var bitmap = tmpImage as Bitmap; - if (bitmap == null) + if (!(tmpImage is Bitmap bitmap)) { return null; } @@ -69,8 +68,6 @@ namespace Greenshot.Gfx static BitmapHelper() { - - // Fallback StreamConverters[""] = FromStreamReader; diff --git a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs b/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs index e7fad1a45..cad8fa563 100644 --- a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs +++ b/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs @@ -26,7 +26,11 @@ using Dapplo.Config.Language; namespace Greenshot.Configuration.Impl { + /// + /// This implements IConfigTranslations and takes care of storing, all setters are replaced via AutoProperties.Fody + /// [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] +#pragma warning disable CS1591 internal class ConfigTranslationsImpl : LanguageBase, IConfigTranslations { public string Filter { get; } diff --git a/src/Greenshot/Forms/ColorPickerToolStripButton.cs b/src/Greenshot/Forms/ColorPickerToolStripButton.cs deleted file mode 100644 index 5d1e156d1..000000000 --- a/src/Greenshot/Forms/ColorPickerToolStripButton.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.Windows.Forms; -using System.Diagnostics; -using Greenshot.Addon.LegacyEditor.Controls; - -namespace GreenShot -{ - public delegate void ColorPickerEventHandler(object o, ColorPickerEventArgs e); - - public class ColorPickerToolStripButton : System.Windows.Forms.ToolStripButton - { - private Color color; - public Point Offset = new Point(0,0); - public event ColorPickerEventHandler ColorPicked; - private Greenshot.Addon.LegacyEditor.Controls.ColorDialog cd; - - - public ColorPickerToolStripButton() - { - cd = null;// Greenshot.Addon.LegacyEditor.Controls.ColorDialog.GetInstance(); - this.Click += new System.EventHandler(this.ToolStripButton1Click); - } - - public Color Color { - set {color = value;this.Invalidate();} - get {return color;} - } - - protected override void OnPaint (PaintEventArgs e) { - base.OnPaint(e); - if(color != null) { - // replace transparent color with selected color - Graphics g = e.Graphics; - //Graphics g = Graphics.FromImage(Image); - ColorMap[] colorMap = new ColorMap[1]; - colorMap[0] = new ColorMap(); - colorMap[0].OldColor = Color.Magenta;//this.ImageTransparentColor; - colorMap[0].NewColor = color; - var attr = new ImageAttributes(); - attr.SetRemapTable(colorMap); - Rectangle rect = new Rectangle(0, 0, Image.Width, Image.Height); - // todo find a way to retrieve transparency offset automatically - // for now, we use the public variable Offset to define this manually - rect.Offset(Offset.X,Offset.Y); - //Image. - Debug.WriteLine("paint!"+this.Text+": "+color); - //ssif(color.Equals(Color.Transparent)) ((Bitmap)Image).MakeTransparent(Color.Magenta); - g.DrawImage(Image, rect, 0, 0, rect.Width, rect.Height, GraphicsUnit.Pixel, attr); - //this.Image.In - - } - } - - void ToolStripButton1Click(object sender, System.EventArgs e) - { - cd.ShowDialog(this.Owner); - Color = cd.Color; - if(ColorPicked != null) { - //ColorPicked(this, new ColorPickerEventArgs(Color, cd.RecentColors)); - } - } - } - - public class ColorPickerEventArgs : System.EventArgs { - public Color Color; - public Color[] RecentColors; - public ColorPickerEventArgs(Color color, Color[] recentColors) { - Color = color; - RecentColors = recentColors; - } - - } - - - - -} diff --git a/src/Greenshot/Helpers/CaptureHelper.cs b/src/Greenshot/Helpers/CaptureHelper.cs index 690d423cf..72208a745 100644 --- a/src/Greenshot/Helpers/CaptureHelper.cs +++ b/src/Greenshot/Helpers/CaptureHelper.cs @@ -723,7 +723,7 @@ namespace Greenshot.Helpers /// WindowDetails with the target Window OR a replacement public static IInteropWindow SelectCaptureWindow(IInteropWindow windowToCapture) { - NativeRect windowRectangle = windowToCapture.GetInfo().Bounds; + var windowRectangle = windowToCapture.GetInfo().Bounds; if (windowRectangle.Width == 0 || windowRectangle.Height == 0) { Log.Warn().WriteLine("Window {0} has nothing to capture, using workaround to find other window of same process.", windowToCapture.Text); @@ -784,7 +784,7 @@ namespace Greenshot.Helpers { captureForWindow = new Capture(); } - NativeRect windowRectangle = windowToCapture.GetInfo().Bounds; + var windowRectangle = windowToCapture.GetInfo().Bounds; // When Vista & DWM (Aero) enabled var dwmEnabled = Dwm.IsDwmEnabled;