diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 771f65818..fc6cbdfd0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,7 @@ steps: - task: DotNetCoreInstaller@0 displayName: 'Install .NET Core SDK 3.0' inputs: - version: '3.0.100-preview8-013280' + version: '3.0.100-preview8-013393' - task: NuGetToolInstaller@0 displayName: 'Use NuGet 5.0.2' diff --git a/src/Greenshot.Addon.Box/BoxAddonModule.cs b/src/Greenshot.Addon.Box/BoxAddonModule.cs index 1fcdacb62..a199b18ab 100644 --- a/src/Greenshot.Addon.Box/BoxAddonModule.cs +++ b/src/Greenshot.Addon.Box/BoxAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Box.Configuration; -using Greenshot.Addon.Box.Configuration.Impl; using Greenshot.Addon.Box.ViewModels; using Greenshot.Addons.Components; @@ -36,13 +35,13 @@ namespace Greenshot.Addon.Box protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Box/BoxDestination.cs b/src/Greenshot.Addon.Box/BoxDestination.cs index b9a0ed8e4..1810e144c 100644 --- a/src/Greenshot.Addon.Box/BoxDestination.cs +++ b/src/Greenshot.Addon.Box/BoxDestination.cs @@ -26,11 +26,11 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Autofac.Features.OwnedInstances; +using Caliburn.Micro; using Dapplo.Addons; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Dapplo.Windows.Clipboard; using Greenshot.Addon.Box.Configuration; using Greenshot.Addon.Box.Entities; @@ -200,7 +200,7 @@ namespace Greenshot.Addon.Box // Use UploadProgress if (progress != null) { - oauthHttpBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100))); }; + oauthHttpBehaviour.UploadProgress = percent => { Execute.OnUIThread(() => progress.Report((int)(percent * 100))); }; } oauthHttpBehaviour.OnHttpMessageHandlerCreated = httpMessageHandler => new OAuth2HttpMessageHandler(_oauth2Settings, oauthHttpBehaviour, httpMessageHandler); diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs deleted file mode 100644 index 8d871a78b..000000000 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxConfigurationImpl.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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 . - -using System; -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Box.Configuration.Impl -{ - internal class BoxConfigurationImpl : IniSectionBase, IBoxConfiguration - { -#pragma warning disable 1591 - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2AccessToken { get; set; } - - public DateTimeOffset OAuth2AccessTokenExpires { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2RefreshToken { get; set; } - - public bool AfterUploadLinkToClipBoard { get; set; } - public bool UseSharedLink { get; set; } - public string FolderId { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - } -} diff --git a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs b/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs deleted file mode 100644 index 8ac9de65f..000000000 --- a/src/Greenshot.Addon.Box/Configuration/Impl/BoxLanguageImpl.cs +++ /dev/null @@ -1,43 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - internal class BoxLanguageImpl : LanguageBase, IBoxLanguage - { -#pragma warning disable 1591 - public string CommunicationWait { get; } - public string Configure { get; } - public string LabelAfterUpload { get; } - public string LabelAfterUploadLinkToClipBoard { get; } - public string LabelUploadFormat { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - } -} diff --git a/src/Greenshot.Addon.Box/FodyWeavers.xml b/src/Greenshot.Addon.Box/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Box/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Box/FodyWeavers.xsd b/src/Greenshot.Addon.Box/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Box/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj index 9522ed335..845ccf5dd 100644 --- a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj +++ b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs deleted file mode 100644 index 026df3262..000000000 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceConfigurationImpl.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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 . - -using Dapplo.Config.Ini; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Confluence.Configuration.Impl -{ - internal class ConfluenceConfigurationImpl : IniSectionBase, IConfluenceConfiguration - { -#pragma warning disable 1591 - public string Url { get; set; } - public int Timeout { get; set; } - public OutputFormats UploadFormat { get; set; } - public int UploadJpegQuality { get; set; } - public bool UploadReduceColors { get; set; } - public string OutputFileFilenamePattern { get; set; } - public bool OpenPageAfterUpload { get; set; } - public bool CopyWikiMarkupForImageToClipboard { get; set; } - public string SearchSpaceKey { get; set; } - public bool IncludePersonSpaces { get; set; } - } -} diff --git a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs b/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs deleted file mode 100644 index 53743106e..000000000 --- a/src/Greenshot.Addon.Confluence/Configuration/Impl/ConfluenceLanguageImpl.cs +++ /dev/null @@ -1,57 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - internal class ConfluenceLanguageImpl : LanguageBase, IConfluenceLanguage - { -#pragma warning disable 1591 - public string PluginSettings { get; } - public string LoginError { get; } - public string LabelUrl { get; } - public string LabelTimeout { get; } - public string LabelUser { get; } - public string LabelPassword { get; } - public string LoginTitle { get; } - public string Ok { get; } - public string Cancel { get; } - public string OpenPageAfterUpload { get; } - public string UploadFormat { get; } - public string CopyWikimarkup { get; } - public string Filename { get; } - public string Upload { get; } - public string UploadMenuItem { get; } - public string OpenPages { get; } - public string SearchPages { get; } - public string BrowsePages { get; } - public string SearchText { get; } - public string Search { get; } - public string Loading { get; } - public string IncludePersonSpaces { get; } - public string CommunicationWait { get; } - } -} diff --git a/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs b/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs index ab62fe052..46862d225 100644 --- a/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs +++ b/src/Greenshot.Addon.Confluence/ConfluenceAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Confluence.Configuration; -using Greenshot.Addon.Confluence.Configuration.Impl; using Greenshot.Addon.Confluence.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Confluence protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Confluence/FodyWeavers.xml b/src/Greenshot.Addon.Confluence/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Confluence/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Confluence/FodyWeavers.xsd b/src/Greenshot.Addon.Confluence/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Confluence/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj index 858108bd1..1d694a30d 100644 --- a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj +++ b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Confluence @@ -24,11 +24,6 @@ - - - - all - runtime; build; native; contentfiles; analyzers - + diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs deleted file mode 100644 index 9e8291037..000000000 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxConfigurationImpl.cs +++ /dev/null @@ -1,62 +0,0 @@ -// 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 -// -// 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 . - -using System; -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Dropbox.Configuration.Impl -{ - /// - /// Implementation of the IDropboxConfiguration - /// - public class DropboxConfigurationImpl : IniSectionBase, IDropboxConfiguration - { -#pragma warning disable 1591 - - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2AccessToken { get; set; } - - public DateTimeOffset OAuth2AccessTokenExpires { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2RefreshToken { get; set; } - - public bool AfterUploadLinkToClipBoard { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - } -} diff --git a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs b/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs deleted file mode 100644 index d4a00c429..000000000 --- a/src/Greenshot.Addon.Dropbox/Configuration/Impl/DropboxLanguageImpl.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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 -// -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string Configure { get; } - public string LabelAfterUpload { get; } - public string LabelAfterUploadLinkToClipBoard { get; } - public string LabelUploadFormat { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - } -} diff --git a/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs b/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs index 6c7ec0351..97856da4b 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Dropbox.Configuration; -using Greenshot.Addon.Dropbox.Configuration.Impl; using Greenshot.Addon.Dropbox.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Dropbox protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs index 555d3e5cd..64bac9531 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs @@ -26,11 +26,11 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Autofac.Features.OwnedInstances; +using Caliburn.Micro; using Dapplo.Addons; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Dapplo.Windows.Clipboard; using Greenshot.Addon.Dropbox.Configuration; using Greenshot.Addon.Dropbox.Entities; @@ -212,7 +212,7 @@ namespace Greenshot.Addon.Dropbox // Use UploadProgress if (progress != null) { - oAuthHttpBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100))); }; + oAuthHttpBehaviour.UploadProgress = percent => { Execute.OnUIThread(() => progress.Report((int)(percent * 100))); }; } oAuthHttpBehaviour.MakeCurrent(); diff --git a/src/Greenshot.Addon.Dropbox/FodyWeavers.xml b/src/Greenshot.Addon.Dropbox/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Dropbox/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Dropbox/FodyWeavers.xsd b/src/Greenshot.Addon.Dropbox/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Dropbox/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj index 6ee14ff26..13b2ff738 100644 --- a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj +++ b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Dropbox @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs deleted file mode 100644 index 467dc09b0..000000000 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandConfigurationImpl.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System.Collections.Generic; -using Dapplo.Config.Ini; -using Greenshot.Addon.ExternalCommand.Entities; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.ExternalCommand.Configuration.Impl -{ - internal class ExternalCommandConfigurationImpl : IniSectionBase, IExternalCommandConfiguration - { - public override void AfterLoad() - { - ExternalCommandConfigurationExtensions.AfterLoad(this); - base.AfterLoad(); - } - - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - public IList Commands { get; set; } - public IDictionary Commandline { get; set; } - public IDictionary Argument { get; set; } - public IDictionary RunInbackground { get; set; } - public IDictionary Behaviors { get; set; } - public IList DeletedBuildInCommands { get; set; } - } -} diff --git a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs b/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs deleted file mode 100644 index e27a5ad90..000000000 --- a/src/Greenshot.Addon.ExternalCommand/Configuration/Impl/ExternalCommandLanguageImpl.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string ContextmenuConfigure { get; } - public string SettingsEdit { get; } - public string SettingsDelete { get; } - public string SettingsNew { get; } - public string SettingsDetailTitle { get; } - public string SettingsTitle { get; } - public string LabelArgument { get; } - public string LabelCommand { get; } - public string LabelInformation { get; } - public string LabelName { get; } - } -} diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs index 5b00dd3b0..75b0b5496 100644 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs +++ b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.ExternalCommand.Configuration; -using Greenshot.Addon.ExternalCommand.Configuration.Impl; using Greenshot.Addon.ExternalCommand.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,21 @@ namespace Greenshot.Addon.ExternalCommand protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => + { + var config = IniSection.Create(); + config.RegisterAfterLoad(iniSection => + { + config.AfterLoad(); + }); + return config; + }) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xml b/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xsd b/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.ExternalCommand/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj index 8242b19c1..71203e0c1 100644 --- a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj +++ b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.ExternalCommand @@ -19,11 +19,6 @@ - - - all - runtime; build; native; contentfiles; analyzers - diff --git a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs deleted file mode 100644 index 8c3f315d6..000000000 --- a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrConfigurationImpl.cs +++ /dev/null @@ -1,63 +0,0 @@ -// 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 . - -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Flickr.Configuration.Impl -{ - internal class FlickrConfigurationImpl : IniSectionBase, IFlickrConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthToken { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthTokenSecret { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthTokenVerifier { get; set; } - - public bool IsPublic { get; set; } - public bool IsFamily { get; set; } - public bool IsFriend { get; set; } - public SafetyLevel SafetyLevel { get; set; } - public bool HiddenFromSearch { get; set; } - public bool AfterUploadLinkToClipBoard { get; set; } - public bool UsePageLink { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - } -} diff --git a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs b/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs deleted file mode 100644 index 72d86d401..000000000 --- a/src/Greenshot.Addon.Flickr/Configuration/Impl/FlickrLanguageImpl.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string Configure { get; } - public string LabelAfterUpload { get; } - public string LabelAfterUploadLinkToClipBoard { get; } - public string LabelHiddenFromSearch { get; } - public string LabelSafetyLevel { get; } - public string LabelUploadFormat { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - public string Public { get; } - public string Family { get; } - public string Friend { get; } - } -} diff --git a/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs b/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs index ddace7428..11a1faa28 100644 --- a/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs +++ b/src/Greenshot.Addon.Flickr/FlickrAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Flickr.Configuration; -using Greenshot.Addon.Flickr.Configuration.Impl; using Greenshot.Addon.Flickr.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Flickr protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Flickr/FodyWeavers.xml b/src/Greenshot.Addon.Flickr/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Flickr/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Flickr/FodyWeavers.xsd b/src/Greenshot.Addon.Flickr/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Flickr/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj index 412a0d356..9602cbe9e 100644 --- a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj +++ b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Flickr @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs deleted file mode 100644 index 279a08bbf..000000000 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosConfigurationImpl.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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 . - -using System; -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.GooglePhotos.Configuration.Impl -{ - internal class GooglePhotosConfigurationImpl : IniSectionBase, IGooglePhotosConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2AccessToken { get; set; } - - public DateTimeOffset OAuth2AccessTokenExpires { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2RefreshToken { get; set; } - - public bool AfterUploadLinkToClipBoard { get; set; } - public bool AddFilename { get; set; } - public string UploadUser { get; set; } - public string UploadAlbum { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - } -} diff --git a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs b/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs deleted file mode 100644 index 4307b470b..000000000 --- a/src/Greenshot.Addon.GooglePhotos/Configuration/Impl/GooglePhotosLanguageImpl.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string Configure { get; } - public string LabelAfterUpload { get; } - public string LabelAfterUploadLinkToClipBoard { get; } - public string LabelUploadFormat { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - } -} diff --git a/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xml b/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xsd b/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.GooglePhotos/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs index b3463e1e0..8bb9f9563 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.GooglePhotos.Configuration; -using Greenshot.Addon.GooglePhotos.Configuration.Impl; using Greenshot.Addon.GooglePhotos.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.GooglePhotos protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs index 578282eb9..a29092f26 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs @@ -26,11 +26,11 @@ using System.Threading.Tasks; using System.Windows.Forms; using System.Xml; using Autofac.Features.OwnedInstances; +using Caliburn.Micro; using Dapplo.Addons; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Dapplo.Windows.Clipboard; using Greenshot.Addon.GooglePhotos.Configuration; using Greenshot.Addons; @@ -177,7 +177,7 @@ namespace Greenshot.Addon.GooglePhotos // Use UploadProgress if (progress != null) { - oAuthHttpBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); }; + oAuthHttpBehaviour.UploadProgress = percent => { Execute.OnUIThread(() => progress.Report((int)(percent * 100))); }; } oAuthHttpBehaviour.OnHttpMessageHandlerCreated = httpMessageHandler => new OAuth2HttpMessageHandler(_oAuth2Settings, oAuthHttpBehaviour, httpMessageHandler); if (_googlePhotosConfiguration.AddFilename) diff --git a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj index 2bb8849c1..410a81740 100644 --- a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj +++ b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.GooglePhotos @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs deleted file mode 100644 index ed587a5d1..000000000 --- a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurConfigurationImpl.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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 . - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Addon.Imgur.Entities; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Imgur.Configuration.Impl -{ - internal class ImgurConfigurationImpl : IniSectionBase, IImgurConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2AccessToken { get; set; } - - public DateTimeOffset OAuth2AccessTokenExpires { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2RefreshToken { get; set; } - - public string ImgurApi3Url { get; set; } - public bool CopyLinkToClipboard { get; set; } - public bool UsePageLink { get; set; } - public bool AnonymousAccess { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - public string ApiUrl { get; set; } - public bool AddTitle { get; set; } - public bool AddFilename { get; set; } - public string FilenamePattern { get; set; } - public bool TrackHistory { get; set; } - public IDictionary ImgurUploadHistory { get; set; } - public int Credits { get; set; } - public IDictionary RuntimeImgurHistory { get; set; } - } -} diff --git a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs b/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs deleted file mode 100644 index 4ed940a5b..000000000 --- a/src/Greenshot.Addon.Imgur/Configuration/Impl/ImgurLanguageImpl.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string Cancel { get; } - public string ClearQuestion { get; } - public string CommunicationWait { get; } - public string Configure { get; } - public string DeleteQuestion { get; } - public string DeleteTitle { get; } - public string History { get; } - public string LabelClear { get; } - public string LabelUploadFormat { get; } - public string LabelUrl { get; } - public string Ok { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - public string UsePageLink { get; } - public string AnonymousAccess { get; } - public string ResetCredentialsButton { get; } - } -} diff --git a/src/Greenshot.Addon.Imgur/FodyWeavers.xml b/src/Greenshot.Addon.Imgur/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Imgur/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Imgur/FodyWeavers.xsd b/src/Greenshot.Addon.Imgur/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Imgur/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj index 33580a72d..9d4a5f12a 100644 --- a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj +++ b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Imgur @@ -23,11 +23,6 @@ - - - all - runtime; build; native; contentfiles; analyzers - - + diff --git a/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs b/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs index 897655326..696b1abf4 100644 --- a/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs +++ b/src/Greenshot.Addon.Imgur/ImgurAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Imgur.Configuration; -using Greenshot.Addon.Imgur.Configuration.Impl; using Greenshot.Addon.Imgur.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Imgur protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Imgur/ImgurApi.cs b/src/Greenshot.Addon.Imgur/ImgurApi.cs index a6c6d8198..85a912175 100644 --- a/src/Greenshot.Addon.Imgur/ImgurApi.cs +++ b/src/Greenshot.Addon.Imgur/ImgurApi.cs @@ -25,12 +25,12 @@ using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; +using Caliburn.Micro; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.Factory; using Dapplo.HttpExtensions.JsonNet; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Greenshot.Addon.Imgur.Configuration; using Greenshot.Addon.Imgur.Entities; using Greenshot.Addons.Core; @@ -101,7 +101,7 @@ namespace Greenshot.Addon.Imgur var localBehaviour = Behaviour.ShallowClone(); if (progress != null) { - localBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); }; + localBehaviour.UploadProgress = percent => Execute.OnUIThread(() => progress.Report((int)(percent * 100))); } using (var imageStream = new MemoryStream()) @@ -132,7 +132,7 @@ namespace Greenshot.Addon.Imgur var localBehaviour = Behaviour.ShallowClone(); if (progress != null) { - localBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); }; + localBehaviour.UploadProgress = percent => Execute.OnUIThread(() => progress.Report((int) (percent * 100))); } var oauthHttpBehaviour = OAuth2HttpBehaviourFactory.Create(oAuth2Settings, localBehaviour); using (var imageStream = new MemoryStream()) diff --git a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj index c1c2c624c..6da44a991 100644 --- a/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj +++ b/src/Greenshot.Addon.InternetExplorer/Greenshot.Addon.InternetExplorer.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs deleted file mode 100644 index b1f0c18da..000000000 --- a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraConfigurationImpl.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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 . - -using Dapplo.Config.Ini; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Jira.Configuration.Impl -{ - internal class JiraConfigurationImpl : IniSectionBase, IJiraConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - public string Url { get; set; } - public int Timeout { get; set; } - public int MaxEntries { get; set; } - } -} diff --git a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs b/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs deleted file mode 100644 index 2e2bd418b..000000000 --- a/src/Greenshot.Addon.Jira/Configuration/Impl/JiraLanguageImpl.cs +++ /dev/null @@ -1,53 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string Cancel { get; } - public string ColumnAssignee { get; } - public string ColumnCreated { get; } - public string ColumnId { get; } - public string ColumnReporter { get; } - public string ColumnSummary { get; } - public string CommunicationWait { get; } - public string LabelComment { get; } - public string LabelFilename { get; } - public string LabelJira { get; } - public string LabelJirafilter { get; } - public string LabelUploadFormat { get; } - public string LabelUrl { get; } - public string LoginError { get; } - public string LoginTitle { get; } - public string Ok { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - } -} diff --git a/src/Greenshot.Addon.Jira/FodyWeavers.xml b/src/Greenshot.Addon.Jira/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Jira/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Jira/FodyWeavers.xsd b/src/Greenshot.Addon.Jira/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Jira/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj index c03ec28f2..9c91a238a 100644 --- a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj +++ b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj @@ -3,14 +3,14 @@ Greenshot.Addon.Jira Greenshot.Addon.Jira - netcoreapp3.0 + netcoreapp3.0 PreserveNewest - + @@ -20,11 +20,7 @@ - - - - all - runtime; build; native; contentfiles; analyzers - + + diff --git a/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs b/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs deleted file mode 100644 index 18b6ab8b7..000000000 --- a/src/Greenshot.Addon.Jira/IssueTypeBitmapCache.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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 . - -using System; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Media.Imaging; -using Dapplo.Jira; -using Dapplo.Jira.Entities; -using Dapplo.Utils; - -namespace Greenshot.Addon.Jira -{ - /// - /// This is the bach for the IssueType bitmaps - /// - public class IssueTypeBitmapCache : AsyncMemoryCache - { - private readonly IJiraClient _jiraClient; - - public IssueTypeBitmapCache(IJiraClient jiraClient) - { - _jiraClient = jiraClient; - // Set the expire timeout to an hour - ExpireTimeSpan = TimeSpan.FromHours(4); - } - - protected override string CreateKey(IssueType keyObject) - { - return keyObject.Name; - } - - protected override async Task CreateAsync(IssueType issueType, CancellationToken cancellationToken = new CancellationToken()) - { - return await _jiraClient.Server.GetUriContentAsync(issueType.IconUri, cancellationToken).ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs b/src/Greenshot.Addon.Jira/IssueTypeIcon.cs similarity index 60% rename from src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs rename to src/Greenshot.Addon.Jira/IssueTypeIcon.cs index 891389e36..4d5a1f028 100644 --- a/src/Greenshot/Configuration/Impl/ConfigTranslationsImpl.cs +++ b/src/Greenshot.Addon.Jira/IssueTypeIcon.cs @@ -1,5 +1,5 @@ // Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 Thomas Braun, Jens Klingen, Robin Krom +// 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 @@ -17,20 +17,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -using System.Diagnostics.CodeAnalysis; -using Dapplo.Config.Language; +using System.Windows.Media.Imaging; +using Dapplo.Jira.Entities; -namespace Greenshot.Configuration.Impl +namespace Greenshot.Addon.Jira { /// - /// This implements IConfigTranslations and takes care of storing, all setters are replaced via AutoProperties.Fody + /// This is a cached item /// - [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] -#pragma warning disable CS1591 - internal class ConfigTranslationsImpl : LanguageBase, IConfigTranslations + public class IssueTypeIcon { - public string Filter { get; } - - public string Theme { get; } + public IssueTypeIcon(IssueType key, BitmapSource icon) + { + Key = key; + Icon = icon; + } + public IssueType Key { get; } + public BitmapSource Icon { get; } } } diff --git a/src/Greenshot.Addon.Jira/JiraAddonModule.cs b/src/Greenshot.Addon.Jira/JiraAddonModule.cs index 7966e376a..2f0aec244 100644 --- a/src/Greenshot.Addon.Jira/JiraAddonModule.cs +++ b/src/Greenshot.Addon.Jira/JiraAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Jira.Configuration; -using Greenshot.Addon.Jira.Configuration.Impl; using Greenshot.Addon.Jira.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Jira protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Jira/JiraConnector.cs b/src/Greenshot.Addon.Jira/JiraConnector.cs index 422f8be0b..38eb707e7 100644 --- a/src/Greenshot.Addon.Jira/JiraConnector.cs +++ b/src/Greenshot.Addon.Jira/JiraConnector.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.IO; +using System.Reactive.Concurrency; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -31,6 +32,7 @@ using Dapplo.Jira; using Dapplo.Jira.Converters; using Dapplo.Jira.Entities; using Dapplo.Log; +using DynamicData; using Greenshot.Addon.Jira.Configuration; using Greenshot.Addons.Core; using Greenshot.Addons.Core.Credentials; @@ -52,7 +54,7 @@ namespace Greenshot.Addon.Jira // Used to remove the wsdl information from the old SOAP Uri public const string DefaultPostfix = "/rpc/soap/jirasoapservice-v2?wsdl"; - private IssueTypeBitmapCache _issueTypeBitmapCache; + private readonly SourceCache _issueTypeBitmapCache = new SourceCache(icon => icon.Key); private readonly IJiraClient _jiraClient; private DateTimeOffset _loggedInTime = DateTimeOffset.MinValue; @@ -110,10 +112,9 @@ namespace Greenshot.Addon.Jira return false; } - _issueTypeBitmapCache = new IssueTypeBitmapCache(_jiraClient); try { - await _jiraClient.Session.StartAsync(user, password, cancellationToken).ConfigureAwait(true); + _jiraClient.SetBasicAuthentication(user, password); await _jiraMonitor.AddJiraInstanceAsync(_jiraClient, cancellationToken).ConfigureAwait(true); var favIconUri = _jiraClient.JiraBaseUri.AppendSegments("favicon.ico"); @@ -187,37 +188,28 @@ namespace Greenshot.Addon.Jira /// /// End the session, if there was one /// - public async Task LogoutAsync(CancellationToken cancellationToken = default) + public Task LogoutAsync(CancellationToken cancellationToken = default) { if (_jiraClient != null && IsLoggedIn) { // TODO: Remove Jira Client? - //_jiraMonitor.Dispose(); - await _jiraClient.Session.EndAsync(cancellationToken); + //_jiraMonitor.Dispose(); IsLoggedIn = false; } - } + + return Task.CompletedTask; + } /// /// check the login credentials, to prevent timeouts of the session, or makes a login /// Do not use ConfigureAwait to call this, as it will move await from the UI thread. /// /// - private async Task CheckCredentialsAsync(CancellationToken cancellationToken = default) + private Task CheckCredentialsAsync(CancellationToken cancellationToken = default) { - if (IsLoggedIn) - { - if (_loggedInTime.AddMinutes(_jiraConfiguration.Timeout - 1).CompareTo(DateTime.Now) < 0) - { - await LogoutAsync(cancellationToken); - await LoginAsync(cancellationToken); - } - } - else - { - await LoginAsync(cancellationToken); - } - } + // TODO: Do we need to do something? + return Task.CompletedTask; + } /// /// Get the favourite filters @@ -304,8 +296,19 @@ namespace Greenshot.Addon.Jira /// CancellationToken /// Bitmap public async Task GetIssueTypeBitmapAsync(Issue issue, CancellationToken cancellationToken = default) - { - return await _issueTypeBitmapCache.GetOrCreateAsync(issue.Fields.IssueType, cancellationToken).ConfigureAwait(false); + { + var result = _issueTypeBitmapCache.Lookup(issue.Fields.IssueType); + if (result.HasValue) + { + return result.Value.Icon; + } + + _issueTypeBitmapCache.ExpireAfter(icon => TimeSpan.FromMinutes(30), Scheduler.Default); + var bitmap = await _jiraClient.Server.GetUriContentAsync(issue.Fields.IssueType.IconUri, cancellationToken).ConfigureAwait(false); + + var item = new IssueTypeIcon(issue.Fields.IssueType, bitmap); + _issueTypeBitmapCache.AddOrUpdate(item); + return bitmap; } } } \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs deleted file mode 100644 index 77d7e159e..000000000 --- a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorConfigurationImpl.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using Dapplo.Config.Ini; -using Dapplo.Windows.Common.Structs; -using Dapplo.Windows.User32.Enums; -using Greenshot.Gfx.Effects; - -namespace Greenshot.Addon.LegacyEditor.Configuration.Impl -{ - internal class EditorConfigurationImpl : IniSectionBase, IEditorConfiguration - { - public IList RecentColors { get; set; } - public IDictionary LastUsedFieldValues { get; set; } - public bool MatchSizeToCapture { get; set; } - public WindowPlacementFlags WindowPlacementFlags { get; set; } - public ShowWindowCommands ShowWindowCommand { get; set; } - public NativePoint WindowMinPosition { get; set; } - public NativePoint WindowMaxPosition { get; set; } - public NativeRect WindowNormalPosition { get; set; } - public bool ReuseEditor { get; set; } - public int FreehandSensitivity { get; set; } - public bool SuppressSaveDialogAtClose { get; set; } - public DropShadowEffect DropShadowEffectSettings { get; set; } - public TornEdgeEffect TornEdgeEffectSettings { get; set; } - } -} diff --git a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs b/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs deleted file mode 100644 index c205adbcc..000000000 --- a/src/Greenshot.Addon.LegacyEditor/Configuration/Impl/EditorLanguageImpl.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -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 - { - public string SettingsDestinationEditor { get; } - public string EditorAlignBottom { get; } - public string EditorAlignCenter { get; } - public string EditorAlignHorizontal { get; } - public string EditorAlignLeft { get; } - public string EditorAlignMiddle { get; } - public string EditorAlignRight { get; } - public string EditorAlignTop { get; } - public string EditorAlignVertical { get; } - public string EditorArrange { get; } - public string EditorArrowheads { get; } - public string EditorArrowheadsBoth { get; } - public string EditorArrowheadsEnd { get; } - public string EditorArrowheadsNone { get; } - public string EditorArrowheadsStart { get; } - public string EditorAutocrop { get; } - public string EditorBackcolor { get; } - public string EditorBlurRadius { get; } - public string EditorBold { get; } - public string EditorBorder { get; } - public string EditorBrightness { get; } - public string EditorCancel { get; } - public string EditorClipboardfailed { get; } - public string EditorClose { get; } - public string EditorCloseOnSave { get; } - public string EditorCloseOnSaveTitle { get; } - public string EditorConfirm { get; } - public string EditorCopyimagetoclipboard { get; } - public string EditorCopypathtoclipboard { get; } - public string EditorCopytoclipboard { get; } - public string EditorCrop { get; } - public string EditorCursortool { get; } - public string EditorCuttoclipboard { get; } - public string EditorDeleteelement { get; } - public string EditorDownonelevel { get; } - public string EditorDowntobottom { get; } - public string EditorDrawarrow { get; } - public string EditorDrawellipse { get; } - public string EditorDrawfreehand { get; } - public string EditorDrawhighlighter { get; } - public string EditorDrawline { get; } - public string EditorDrawrectangle { get; } - public string EditorDrawtextbox { get; } - public string EditorDuplicate { get; } - public string EditorEdit { get; } - public string EditorEffects { get; } - public string EditorEmail { get; } - public string EditorFile { get; } - public string EditorFontsize { get; } - public string EditorForecolor { get; } - public string EditorGrayscale { get; } - public string EditorHighlightArea { get; } - public string EditorHighlightGrayscale { get; } - public string EditorHighlightMagnify { get; } - public string EditorHighlightMode { get; } - public string EditorHighlightText { get; } - public string EditorImagesaved { get; } - public string EditorInsertwindow { get; } - public string EditorItalic { get; } - public string EditorLoadObjects { get; } - public string EditorMagnificationFactor { get; } - public string EditorMatchCaptureSize { get; } - public string EditorObfuscate { get; } - public string EditorObfuscateBlur { get; } - public string EditorObfuscateMode { get; } - public string EditorObfuscatePixelize { get; } - public string EditorObject { get; } - public string EditorOpendirinexplorer { get; } - public string EditorPastefromclipboard { get; } - public string EditorPixelSize { get; } - public string EditorPreviewQuality { get; } - public string EditorPrint { get; } - public string EditorRedo { get; } - public string EditorResetsize { get; } - public string EditorResizePercent { get; } - public string EditorResizePixel { get; } - public string EditorSave { get; } - public string EditorSaveas { get; } - public string EditorSaveObjects { get; } - public string EditorSelectall { get; } - public string EditorSenttoprinter { get; } - public string EditorShadow { get; } - public string EditorStoredtoclipboard { get; } - public string EditorThickness { get; } - public string EditorTitle { get; } - public string EditorTornEdge { get; } - public string EditorUndo { get; } - public string EditorUponelevel { get; } - public string EditorUptotop { get; } - } -} diff --git a/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs b/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs index f5b74f4ba..639f1dbb1 100644 --- a/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs +++ b/src/Greenshot.Addon.LegacyEditor/EditorAddonModule.cs @@ -22,7 +22,6 @@ using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; -using Greenshot.Addon.LegacyEditor.Configuration.Impl; using Greenshot.Addon.LegacyEditor.Controls; using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addon.LegacyEditor.Forms; @@ -38,13 +37,13 @@ namespace Greenshot.Addon.LegacyEditor protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xml b/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xsd b/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.LegacyEditor/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj index 8917c1cfa..3a8f63973 100644 --- a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj +++ b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj @@ -107,12 +107,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs deleted file mode 100644 index 0f88f2674..000000000 --- a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimConfigurationImpl.cs +++ /dev/null @@ -1,49 +0,0 @@ -// 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 . - -using System.Collections.Generic; -using Dapplo.Config.Ini; -using Greenshot.Addon.Lutim.Entities; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Lutim.Configuration.Impl -{ - internal class LutimConfigurationImpl : IniSectionBase, ILutimConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - public string LutimUrl { get; set; } - public bool CopyLinkToClipboard { get; set; } - public IDictionary LutimUploadHistory { get; set; } - public IDictionary RuntimeLutimHistory { get; set; } - } -} diff --git a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs b/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs deleted file mode 100644 index dfc0bb729..000000000 --- a/src/Greenshot.Addon.Lutim/Configuration/Impl/LutimLanguageImpl.cs +++ /dev/null @@ -1,50 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string Cancel { get; } - public string ClearQuestion { get; } - public string CommunicationWait { get; } - public string Configure { get; } - public string DeleteQuestion { get; } - public string DeleteTitle { get; } - public string History { get; } - public string LabelClear { get; } - public string LabelUploadFormat { get; } - public string LabelUrl { get; } - public string Ok { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - public string UsePageLink { get; } - public string AnonymousAccess { get; } - } -} diff --git a/src/Greenshot.Addon.Lutim/FodyWeavers.xml b/src/Greenshot.Addon.Lutim/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Lutim/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Lutim/FodyWeavers.xsd b/src/Greenshot.Addon.Lutim/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Lutim/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj index cd8494545..764525ff0 100644 --- a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj +++ b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Lutim @@ -23,11 +23,6 @@ - - - - all - runtime; build; native; contentfiles; analyzers - + \ No newline at end of file diff --git a/src/Greenshot.Addon.Lutim/LutimAddonModule.cs b/src/Greenshot.Addon.Lutim/LutimAddonModule.cs index 65c127081..e0fc81ea7 100644 --- a/src/Greenshot.Addon.Lutim/LutimAddonModule.cs +++ b/src/Greenshot.Addon.Lutim/LutimAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Lutim.Configuration; -using Greenshot.Addon.Lutim.Configuration.Impl; using Greenshot.Addon.Lutim.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Lutim protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs deleted file mode 100644 index 9da0fb268..000000000 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeConfigurationImpl.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using Dapplo.Config.Ini; -using Greenshot.Addon.Office.OfficeInterop; -using Microsoft.Office.Interop.PowerPoint; - -namespace Greenshot.Addon.Office.Configuration.Impl -{ - /// - /// This implements IOfficeConfiguration and takes care of storing, all setters are replaced via AutoProperties.Fody - /// -#pragma warning disable CS1591 - internal class OfficeConfigurationImpl : IniSectionBase, IOfficeConfiguration - { - public EmailFormat OutlookEmailFormat { get; set; } - public string EmailSubjectPattern { get; set; } - public string EmailTo { get; set; } - public string EmailCC { get; set; } - public string EmailBCC { get; set; } - public bool OutlookAllowExportInMeetings { get; set; } - public bool WordLockAspectRatio { get; set; } - public bool PowerpointLockAspectRatio { get; set; } - public PpSlideLayout PowerpointSlideLayout { get; set; } - } -} diff --git a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs b/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs deleted file mode 100644 index 1d2e5cfb8..000000000 --- a/src/Greenshot.Addon.Office/Configuration/Impl/OfficeLanguageImpl.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System.Diagnostics.CodeAnalysis; -using Dapplo.Config.Language; - -namespace Greenshot.Addon.Office.Configuration.Impl -{ - /// - /// 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 - { - public string SettingsTitle { get; } - public string WordLockaspect { get; } - public string OutlookAllowmeetings { get; } - public string OutlookSubjectPattern { get; } - public string OutlookEmailFormat { get; } - public string OutlookEmailIncludeSignature { get; } - public string OutlookEmailTo { get; } - public string OutlookEmailCc { get; } - public string OutlookEmailBcc { get; } - public string PowerpointSlideLayout { get; } - public string PowerpointLockaspect { get; } - } -} diff --git a/src/Greenshot.Addon.Office/FodyWeavers.xml b/src/Greenshot.Addon.Office/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Office/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/FodyWeavers.xsd b/src/Greenshot.Addon.Office/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Office/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj index 45b8a17a1..33567f36d 100644 --- a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj +++ b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Office @@ -18,7 +18,6 @@ - @@ -28,9 +27,5 @@ True - - all - runtime; build; native; contentfiles; analyzers - diff --git a/src/Greenshot.Addon.Office/OfficeAddonModule.cs b/src/Greenshot.Addon.Office/OfficeAddonModule.cs index f84ab556a..5fecd7ed4 100644 --- a/src/Greenshot.Addon.Office/OfficeAddonModule.cs +++ b/src/Greenshot.Addon.Office/OfficeAddonModule.cs @@ -24,7 +24,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Office.Configuration; -using Greenshot.Addon.Office.Configuration.Impl; using Greenshot.Addon.Office.Destinations; using Greenshot.Addon.Office.OfficeExport; using Greenshot.Addon.Office.ViewModels; @@ -117,14 +116,14 @@ namespace Greenshot.Addon.Office if (hasDestination) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs deleted file mode 100644 index 29c8a4aef..000000000 --- a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveConfigurationImpl.cs +++ /dev/null @@ -1,57 +0,0 @@ -// 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 . - -using System; -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.OneDrive.Configuration.Impl -{ - internal class OneDriveConfigurationImpl : IniSectionBase, IOneDriveConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2AccessToken { get; set; } - - public DateTimeOffset OAuth2AccessTokenExpires { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuth2RefreshToken { get; set; } - - public bool AfterUploadLinkToClipBoard { get; set; } - public OneDriveLinkType LinkType { get; set; } - public string ClientId { get; set; } - } -} diff --git a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs b/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs deleted file mode 100644 index f37111aba..000000000 --- a/src/Greenshot.Addon.OneDrive/Configuration/Impl/OneDriveLanguageImpl.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string LabelUploadFormat { get; } - public string LabelLinkType { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UsePageLink { get; } - public string ResetCredentialsButton { get; } - } -} diff --git a/src/Greenshot.Addon.OneDrive/FodyWeavers.xml b/src/Greenshot.Addon.OneDrive/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.OneDrive/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.OneDrive/FodyWeavers.xsd b/src/Greenshot.Addon.OneDrive/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.OneDrive/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj index 317a4060b..0b5e132fa 100644 --- a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj +++ b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.OneDrive @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs b/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs index b6b77342d..d95a0a32d 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.OneDrive.Configuration; -using Greenshot.Addon.OneDrive.Configuration.Impl; using Greenshot.Addon.OneDrive.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.OneDrive protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs index 7bdbd0827..fdda0ba89 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs @@ -25,12 +25,12 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Autofac.Features.OwnedInstances; +using Caliburn.Micro; using Dapplo.Addons; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.JsonNet; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Dapplo.Windows.Clipboard; using Greenshot.Addon.OneDrive.Configuration; using Greenshot.Addon.OneDrive.Entities; @@ -224,7 +224,7 @@ namespace Greenshot.Addon.OneDrive var localBehaviour = _oneDriveHttpBehaviour.ShallowClone(); if (progress != null) { - localBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); }; + localBehaviour.UploadProgress = percent => { Execute.OnUIThread(() => progress.Report((int)(percent * 100))); }; } var oauthHttpBehaviour = OAuth2HttpBehaviourFactory.Create(oAuth2Settings, localBehaviour); using (var imageStream = new MemoryStream()) diff --git a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs deleted file mode 100644 index b341e07a6..000000000 --- a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketConfigurationImpl.cs +++ /dev/null @@ -1,61 +0,0 @@ -// 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 . - -using System.ComponentModel; -using Dapplo.Config.Ini; -using Dapplo.Config.Ini.Converters; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Photobucket.Configuration.Impl -{ - internal class PhotobucketConfigurationImpl : IniSectionBase, IPhotobucketConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthToken { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthTokenSecret { get; set; } - - [TypeConverter(typeof(StringEncryptionTypeConverter))] - public string OAuthTokenVerifier { get; set; } - - public bool UsePageLink { get; set; } - public string SubDomain { get; set; } - public string Username { get; set; } - public string Album { get; set; } - public int Credits { get; set; } - public string ClientId { get; set; } - public string ClientSecret { get; set; } - } -} diff --git a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs b/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs deleted file mode 100644 index d0338552a..000000000 --- a/src/Greenshot.Addon.Photobucket/Configuration/Impl/PhotobucketLanguageImpl.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string Configure { get; } - public string LabelClear { get; } - public string LabelUploadFormat { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UploadSuccess { get; } - public string UsePageLink { get; } - } -} diff --git a/src/Greenshot.Addon.Photobucket/FodyWeavers.xml b/src/Greenshot.Addon.Photobucket/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Photobucket/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Photobucket/FodyWeavers.xsd b/src/Greenshot.Addon.Photobucket/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Photobucket/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj index a2c1cb4f9..7b1f1dd07 100644 --- a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj +++ b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Photobucket @@ -21,12 +21,4 @@ - - - - - all - runtime; build; native; contentfiles; analyzers - - diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs b/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs index c27cee903..df25dd403 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Photobucket.Configuration; -using Greenshot.Addon.Photobucket.Configuration.Impl; using Greenshot.Addon.Photobucket.ViewModels; using Greenshot.Addons.Components; @@ -35,13 +34,13 @@ namespace Greenshot.Addon.Photobucket protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs index 2f5ef0f74..8cf72d8da 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs @@ -24,12 +24,12 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; +using Caliburn.Micro; using Dapplo.Addons; using Dapplo.HttpExtensions; using Dapplo.HttpExtensions.Extensions; using Dapplo.HttpExtensions.OAuth; using Dapplo.Log; -using Dapplo.Utils; using Greenshot.Addon.Photobucket.Configuration; using Greenshot.Addons; using Greenshot.Addons.Components; @@ -265,7 +265,7 @@ namespace Greenshot.Addon.Photobucket // Use UploadProgress if (progress != null) { - oAuthHttpBehaviour.UploadProgress = percent => { UiContext.RunOn(() => progress.Report((int)(percent * 100)), token); }; + oAuthHttpBehaviour.UploadProgress = percent => { Execute.OnUIThread(() => progress.Report((int)(percent * 100))); }; } _oAuthHttpBehaviour.MakeCurrent(); if (_photobucketConfiguration.Username == null || _photobucketConfiguration.SubDomain == null) diff --git a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs deleted file mode 100644 index b59931509..000000000 --- a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsConfigurationImpl.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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 . - -using System; -using Dapplo.Config.Ini; -using Greenshot.Core.Enums; - -namespace Greenshot.Addon.Tfs.Configuration.Impl -{ - internal class TfsConfigurationImpl : IniSectionBase, ITfsConfiguration - { - public string OutputFilePath { get; set; } - public bool OutputFileAllowOverwrite { get; set; } - public string OutputFileFilenamePattern { get; set; } - public OutputFormats OutputFileFormat { get; set; } - public bool OutputFileReduceColors { get; set; } - public bool OutputFileAutoReduceColors { get; set; } - public int OutputFileReduceColorsTo { get; set; } - public int OutputFileJpegQuality { get; set; } - public bool OutputFilePromptQuality { get; set; } - public uint OutputFileIncrementingNumber { get; set; } - public string OptimizePNGCommand { get; set; } - public string OptimizePNGCommandArguments { get; set; } - - public bool UseOwnSettings { get; set; } - - public bool AfterUploadLinkToClipBoard { get; set; } - public Uri TfsUri { get; set; } - public string ApiKey { get; set; } - } -} diff --git a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs b/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs deleted file mode 100644 index 1e254828c..000000000 --- a/src/Greenshot.Addon.Tfs/Configuration/Impl/TfsLanguageImpl.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string CommunicationWait { get; } - public string LabelUrl { get; } - public string LabelApiKey { get; } - public string SettingsTitle { get; } - public string UploadFailure { get; } - public string UploadMenuItem { get; } - public string UsePageLink { get; } - } -} diff --git a/src/Greenshot.Addon.Tfs/FodyWeavers.xml b/src/Greenshot.Addon.Tfs/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addon.Tfs/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Tfs/FodyWeavers.xsd b/src/Greenshot.Addon.Tfs/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addon.Tfs/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj index 900096628..62a5f60f9 100644 --- a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj +++ b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj @@ -1,4 +1,4 @@ - + Greenshot.Addon.Tfs @@ -22,11 +22,6 @@ - - - - all - runtime; build; native; contentfiles; analyzers - + \ No newline at end of file diff --git a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs index 281aa777f..35e74c871 100644 --- a/src/Greenshot.Addon.Tfs/TfsAddonModule.cs +++ b/src/Greenshot.Addon.Tfs/TfsAddonModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addon.Tfs.Configuration; -using Greenshot.Addon.Tfs.Configuration.Impl; using Greenshot.Addon.Tfs.ViewModels; using Greenshot.Addons.Components; @@ -36,18 +35,17 @@ namespace Greenshot.Addon.Tfs protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); - builder .RegisterType() .As() diff --git a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs index 4609b0a45..c367c7746 100644 --- a/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs +++ b/src/Greenshot.Addon.Tfs/ViewModels/TfsConfigViewModel.cs @@ -105,7 +105,7 @@ namespace Greenshot.Addon.Tfs.ViewModels /// protected override void OnDeactivate(bool close) { - var ignoreTask = TfsClient.UpdateWorkItems(); + _ = TfsClient.UpdateWorkItems(); _disposables.Dispose(); base.OnDeactivate(close); } diff --git a/src/Greenshot.Addons/AddonsModule.cs b/src/Greenshot.Addons/AddonsModule.cs index c87a37824..f2163da22 100644 --- a/src/Greenshot.Addons/AddonsModule.cs +++ b/src/Greenshot.Addons/AddonsModule.cs @@ -23,7 +23,6 @@ using Dapplo.CaliburnMicro.Configuration; using Dapplo.Config.Ini; using Dapplo.Config.Language; using Greenshot.Addons.Components; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Controls; using Greenshot.Addons.Core; using Greenshot.Addons.Resources; @@ -40,7 +39,15 @@ namespace Greenshot.Addons protected override void Load(ContainerBuilder builder) { builder - .RegisterType() + .Register(c => + { + var coreConfiguration = IniSection.Create(); + coreConfiguration.RegisterAfterLoad(iniSection => + { + coreConfiguration.AfterLoad(); + }); + return coreConfiguration; + }) .As() .As() .As() @@ -57,7 +64,7 @@ namespace Greenshot.Addons }); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance() @@ -68,7 +75,7 @@ namespace Greenshot.Addons }); builder - .RegisterType() + .Register(c => IniSection.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs b/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs deleted file mode 100644 index 79efa5d69..000000000 --- a/src/Greenshot.Addons/Config/Impl/CoreConfigurationImpl.cs +++ /dev/null @@ -1,332 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows; -using Dapplo.Config.Ini; -using Dapplo.Windows.Common.Structs; -using Dapplo.Windows.User32.Structs; -using Greenshot.Addons.Core; -using Greenshot.Addons.Core.Enums; -using Greenshot.Core.Enums; - -namespace Greenshot.Addons.Config.Impl -{ - /// - /// Implementation of the ICoreConfiguration - /// - public class CoreConfigurationImpl : IniSectionBase, ICoreConfiguration - { - /// - public override void AfterLoad() - { - CoreConfigurationExtensions.AfterLoad(this); - } - - /// - public string OutputFilePath { get; set; } - - /// - public bool OutputFileAllowOverwrite { get; set; } - - /// - public string OutputFileFilenamePattern { get; set; } - - /// - public OutputFormats OutputFileFormat { get; set; } - - /// - public bool OutputFileReduceColors { get; set; } - - /// - public bool OutputFileAutoReduceColors { get; set; } - - /// - public int OutputFileReduceColorsTo { get; set; } - - /// - public int OutputFileJpegQuality { get; set; } - - /// - public bool OutputFilePromptQuality { get; set; } - - /// - public uint OutputFileIncrementingNumber { get; set; } - - /// - public string OptimizePNGCommand { get; set; } - - /// - public string OptimizePNGCommandArguments { get; set; } - - /// - public NativeSize Win10BorderCrop { get; set; } - - /// - public bool CaptureMousepointer { get; set; } - - /// - public bool CaptureWindowsInteractive { get; set; } - - /// - public int CaptureDelay { get; set; } - - /// - public ScreenCaptureMode ScreenCaptureMode { get; set; } - - /// - public int ScreenToCapture { get; set; } - - /// - public WindowCaptureModes WindowCaptureMode { get; set; } - - /// - public Color DWMBackgroundColor { get; set; } - - /// - public IList NoGDICaptureForProduct { get; set; } - - /// - public IList NoDWMCaptureForProduct { get; set; } - - /// - public bool WindowCaptureRemoveCorners { get; set; } - - /// - public IList WindowCornerCutShape { get; set; } - - /// - public string Language { get; set; } - - /// - public string RegionHotkey { get; set; } - - /// - public string WindowHotkey { get; set; } - - /// - public string FullscreenHotkey { get; set; } - - /// - public string LastregionHotkey { get; set; } - - /// - public string IEHotkey { get; set; } - - /// - public bool IsFirstLaunch { get; set; } - - /// - public IList OutputDestinations { get; set; } - - /// - public IList PickerDestinations { get; set; } - - /// - public IList ClipboardFormats { get; set; } - - /// - public bool WindowCaptureAllChildLocations { get; set; } - - /// - public bool PlayCameraSound { get; set; } - - /// - public bool ShowTrayNotification { get; set; } - - /// - public bool OutputFileCopyPathToClipboard { get; set; } - - /// - public string OutputFileAsFullpath { get; set; } - - /// - public bool OutputPrintPromptOptions { get; set; } - - /// - public bool OutputPrintAllowRotate { get; set; } - - /// - public bool OutputPrintAllowEnlarge { get; set; } - - /// - public bool OutputPrintAllowShrink { get; set; } - - /// - public bool OutputPrintCenter { get; set; } - - /// - public bool OutputPrintInverted { get; set; } - - /// - public bool OutputPrintGrayscale { get; set; } - - /// - public bool OutputPrintMonochrome { get; set; } - - /// - public byte OutputPrintMonochromeThreshold { get; set; } - - /// - public bool OutputPrintFooter { get; set; } - - /// - public string OutputPrintFooterPattern { get; set; } - - /// - public string NotificationSound { get; set; } - - /// - public bool UseProxy { get; set; } - - /// - public bool IECapture { get; set; } - - /// - public bool IEFieldCapture { get; set; } - - /// - public IList WindowClassesToCheckForIE { get; set; } - - /// - public int AutoCropDifference { get; set; } - - /// - public IList IncludePlugins { get; set; } - - /// - public IList ExcludePlugins { get; set; } - - /// - public IList ExcludeDestinations { get; set; } - - /// - public bool CheckForUpdates { get; set; } - - /// - public int UpdateCheckInterval { get; set; } - - /// - public DateTime LastUpdateCheck { get; set; } - - /// - public bool DisableSettings { get; set; } - - /// - public bool DisableQuickSettings { get; set; } - - /// - public bool HideTrayicon { get; set; } - - /// - public bool HideExpertSettings { get; set; } - - /// - public bool ThumnailPreview { get; set; } - - /// - public bool OptimizeForRDP { get; set; } - - /// - public bool DisableRDPOptimizing { get; set; } - - /// - public bool MinimizeWorkingSetSize { get; set; } - - /// - public bool CheckForUnstable { get; set; } - - /// - public IList ActiveTitleFixes { get; set; } - - /// - public IDictionary TitleFixMatcher { get; set; } - - /// - public IDictionary TitleFixReplacer { get; set; } - - /// - public IList ExperimentalFeatures { get; set; } - - /// - public bool EnableSpecialDIBClipboardReader { get; set; } - - /// - public ClickActions LeftClickAction { get; set; } - - /// - public ClickActions DoubleClickAction { get; set; } - - /// - public bool ZoomerEnabled { get; set; } - - /// - public float ZoomerOpacity { get; set; } - - /// - public int MaxMenuItemLength { get; set; } - - /// - public string MailApiTo { get; set; } - - /// - public string MailApiCC { get; set; } - - /// - public string MailApiBCC { get; set; } - - /// - public string LastSaveWithVersion { get; set; } - - /// - public bool ProcessEXIFOrientation { get; set; } - - /// - public NativeRect LastCapturedRegion { get; set; } - - /// - public NativeSize IconSize { get; set; } - - /// - public int WebRequestTimeout { get; set; } - - /// - public int WebRequestReadWriteTimeout { get; set; } - - /// - public bool IsScrollingCaptureEnabled { get; set; } - - /// - public bool IsPortable { get; set; } - - /// - public ISet Permissions { get; set; } - - /// - public WindowStartupLocation DefaultWindowStartupLocation { get; set; } - - /// - public bool AreWindowLocationsStored { get; set; } - - /// - public IDictionary WindowLocations { get; set; } - } -} diff --git a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs b/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs deleted file mode 100644 index 28a45a847..000000000 --- a/src/Greenshot.Addons/Config/Impl/GreenshotLanguageImpl.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System.Diagnostics.CodeAnalysis; -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 - { - public string Cancel { get; } - public string Ok { get; } - - public string None { get; } - public string AboutBugs { get; } - public string AboutDonations { get; } - public string AboutHost { get; } - public string AboutIcons { get; } - public string AboutLicense { get; } - public string AboutTitle { get; } - public string AboutTranslation { get; } - public string ApplicationTitle { get; } - public string BugreportCancel { get; } - public string BugreportInfo { get; } - public string BugreportTitle { get; } - public string ClipboardError { get; } - public string ClipboardInuse { get; } - public string Close { get; } - public string ColorpickerAlpha { get; } - public string ColorpickerApply { get; } - public string ColorpickerBlue { get; } - public string ColorpickerGreen { get; } - public string ColorpickerHtmlcolor { get; } - public string ColorpickerRecentcolors { get; } - public string ColorpickerRed { get; } - public string ColorpickerTitle { get; } - public string ColorpickerTransparent { get; } - public string ConfigUnauthorizedaccessWrite { get; } - public string ContextmenuAbout { get; } - public string ContextmenuCapturearea { get; } - public string ContextmenuCaptureclipboard { get; } - public string ContextmenuCapturefullscreen { get; } - public string ContextmenuCapturefullscreenAll { get; } - public string ContextmenuCapturefullscreenLeft { get; } - public string ContextmenuCapturefullscreenTop { get; } - public string ContextmenuCapturefullscreenRight { get; } - public string ContextmenuCapturefullscreenBottom { get; } - public string ContextmenuCapturelastregion { get; } - public string ContextmenuCapturewindow { get; } - public string ContextmenuDonate { get; } - public string ContextmenuExit { get; } - public string ContextmenuHelp { get; } - public string ContextmenuOpenfile { get; } - public string ContextmenuQuicksettings { get; } - public string ContextmenuSettings { get; } - public string ContextmenuCaptureie { get; } - public string ContextmenuOpenrecentcapture { get; } - public string Error { get; } - public string ErrorMultipleinstances { get; } - public string ErrorNowriteaccess { get; } - public string ErrorOpenfile { get; } - public string ErrorOpenlink { get; } - public string ErrorSave { get; } - public string ErrorSaveInvalidChars { get; } - public string HelpTitle { get; } - public string JpegqualitydialogChoosejpegquality { get; } - public string QualitydialogDontaskagain { get; } - public string QualitydialogTitle { get; } - public string SettingsReducecolors { get; } - public string PrintError { get; } - public string PrintoptionsAllowcenter { get; } - public string PrintoptionsAllowenlarge { get; } - public string PrintoptionsAllowrotate { get; } - public string PrintoptionsAllowshrink { get; } - public string PrintoptionsColors { get; } - public string PrintoptionsDontaskagain { get; } - public string PrintoptionsPagelayout { get; } - public string PrintoptionsPrintcolor { get; } - public string PrintoptionsPrintgrayscale { get; } - public string PrintoptionsPrintmonochrome { get; } - public string PrintoptionsTimestamp { get; } - public string PrintoptionsInverted { get; } - public string PrintoptionsTitle { get; } - public string QuicksettingsDestinationFile { get; } - public string SettingsAlwaysshowqualitydialog { get; } - public string SettingsAlwaysshowprintoptionsdialog { get; } - public string SettingsApplicationsettings { get; } - public string SettingsAutostartshortcut { get; } - public string SettingsCapture { get; } - public string SettingsCaptureMousepointer { get; } - public string SettingsCaptureWindowsInteractive { get; } - public string SettingsCopypathtoclipboard { get; } - public string SettingsDestination { get; } - public string SettingsDestinationClipboard { get; } - public string SettingsDestinationEditor { get; } - public string SettingsDestinationEmail { get; } - public string SettingsDestinationFile { get; } - public string SettingsDestinationFileas { get; } - public string SettingsDestinationPrinter { get; } - public string SettingsDestinationPicker { get; } - public string SettingsEditor { get; } - public string SettingsFilenamepattern { get; } - public string SettingsGeneral { get; } - public string SettingsIecapture { get; } - public string SettingsJpegquality { get; } - public string SettingsQualitysettings { get; } - public string SettingsLanguage { get; } - public string SettingsMessageFilenamepattern { get; } - public string SettingsOutput { get; } - public string SettingsPlaysound { get; } - public string SettingsPlugins { get; } - public string SettingsPluginsName { get; } - public string SettingsPluginsVersion { get; } - public string SettingsPluginsCreatedby { get; } - public string SettingsPluginsDllpath { get; } - public string SettingsPreferredfilesettings { get; } - public string SettingsPrimaryimageformat { get; } - public string SettingsPrinter { get; } - public string SettingsPrintoptions { get; } - public string SettingsRegisterhotkeys { get; } - public string SettingsShowflashlight { get; } - public string SettingsStoragelocation { get; } - public string SettingsTitle { get; } - public string SettingsTooltipFilenamepattern { get; } - public string SettingsTooltipLanguage { get; } - public string SettingsTooltipPrimaryimageformat { get; } - public string SettingsTooltipRegisterhotkeys { get; } - public string SettingsTooltipStoragelocation { get; } - public string SettingsVisualization { get; } - public string SettingsShownotify { get; } - public string SettingsWaittime { get; } - public string SettingsZoom { get; } - public string SettingsWindowscapture { get; } - public string SettingsWindowCaptureMode { get; } - public string SettingsScreenCaptureMode { get; } - public string SettingsNetwork { get; } - public string SettingsCheckperiod { get; } - public string SettingsUsedefaultproxy { get; } - public string TooltipFirststart { get; } - public string Warning { get; } - public string WarningHotkeys { get; } - public string Hotkeys { get; } - public string WaitIeCapture { get; } - public string UpdateFound { get; } - public string ExportedTo { get; } - public string LatestVersion { get; } - public string CurrentVersion { get; } - public string Expert { get; } - public string DestinationExportFailed { get; } - } -} diff --git a/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs b/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs deleted file mode 100644 index 96cb2c562..000000000 --- a/src/Greenshot.Addons/Config/Impl/HttpConfigurationImpl.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using System; -using System.Net; -using System.Net.Cache; -using System.Net.Http; -using System.Net.Security; -using System.Security.Cryptography.X509Certificates; -using System.Security.Principal; -using Dapplo.Config.Ini; -using Dapplo.HttpExtensions; -using Greenshot.Addons.Core; - -namespace Greenshot.Addons.Config.Impl -{ - internal class HttpConfigurationImpl : IniSectionBase, IHttpConfiguration - { - public bool AllowAutoRedirect { get; set; } - public ICredentials Credentials { get; set; } - public ClientCertificateOption ClientCertificateOptions { get; set; } - public DecompressionMethods DefaultDecompressionMethods { get; set; } - public string DefaultUserAgent { get; set; } - public bool Expect100Continue { get; set; } - public int MaxAutomaticRedirections { get; set; } - public long MaxResponseContentBufferSize { get; set; } - public bool PreAuthenticate { get; set; } - public TimeSpan RequestTimeout { get; set; } - public bool UseCookies { get; set; } - public bool UseDefaultCredentials { get; set; } - public AuthenticationLevel AuthenticationLevel { get; set; } - public X509CertificateCollection ClientCertificates { get; set; } - public int MaxConnectionsPerServer { get; set; } - public Uri ProxyUri { get; set; } - public string[] ProxyBypassList { get; set; } - public bool ProxyBypassOnLocal { get; set; } - public ICredentials ProxyCredentials { get; set; } - public long MaxRequestContentBufferSize { get; set; } - public int MaxResponseHeadersLength { get; set; } - public bool UseProxy { get; set; } - public bool IgnoreSslCertificateErrors { get; set; } - public bool UseDefaultCredentialsForProxy { get; set; } - public bool UseDefaultProxy { get; set; } - public TimeSpan ContinueTimeout { get; set; } - public bool AllowPipelining { get; set; } - - public TokenImpersonationLevel ImpersonationLevel { get; set; } - public RequestCacheLevel RequestCacheLevel { get; set; } - public int ReadWriteTimeout { get; set; } - - IHttpSettings IHttpSettings.ShallowClone() - { - return ShallowClone() as IHttpSettings; - } - } -} diff --git a/src/Greenshot.Addons/Controls/GreenshotForm.cs b/src/Greenshot.Addons/Controls/GreenshotForm.cs index 4a35f86c7..fe55bf537 100644 --- a/src/Greenshot.Addons/Controls/GreenshotForm.cs +++ b/src/Greenshot.Addons/Controls/GreenshotForm.cs @@ -23,11 +23,11 @@ using System.ComponentModel; using System.Linq; using System.Reflection; using System.Windows.Forms; +using Dapplo.Config; using Dapplo.Config.Ini; using Dapplo.Config.Interfaces; using Dapplo.Config.Language; using Dapplo.Log; -using Dapplo.Utils; using Dapplo.Windows.Desktop; using Dapplo.Windows.Dpi; using Dapplo.Windows.Dpi.Forms; diff --git a/src/Greenshot.Addons/Core/GdiScreenCapture.cs b/src/Greenshot.Addons/Core/GdiScreenCapture.cs index 011038bd4..917df1262 100644 --- a/src/Greenshot.Addons/Core/GdiScreenCapture.cs +++ b/src/Greenshot.Addons/Core/GdiScreenCapture.cs @@ -42,7 +42,6 @@ namespace Greenshot.Addons.Core private readonly SafeCompatibleDcHandle _safeCompatibleDcHandle; private readonly SafeDibSectionHandle _safeDibSectionHandle; private readonly SafeSelectObjectHandle _safeSelectObjectHandle; - private IntPtr _bits; /// /// Return the source rectangle @@ -83,7 +82,7 @@ namespace Greenshot.Addons.Core // Create BitmapInfoHeader, which is later used in the CreateDIBSection var bitmapInfoHeader = BitmapInfoHeader.Create(DestinationSize.Width, DestinationSize.Height, 32); // Create a DibSection, a device-independent bitmap (DIB) - _safeDibSectionHandle = Gdi32Api.CreateDIBSection(_desktopDcHandle, ref bitmapInfoHeader, DibColors.RgbColors, out _bits, IntPtr.Zero, 0); + _safeDibSectionHandle = Gdi32Api.CreateDIBSection(_desktopDcHandle, ref bitmapInfoHeader, DibColors.RgbColors, out _, IntPtr.Zero, 0); // select the device-independent bitmap in the device context, storing the previous. // This is needed, so every interaction with the DC will go into the DIB. diff --git a/src/Greenshot.Addons/Core/PluginUtils.cs b/src/Greenshot.Addons/Core/PluginUtils.cs index 0428ba6eb..a7a5caaa4 100644 --- a/src/Greenshot.Addons/Core/PluginUtils.cs +++ b/src/Greenshot.Addons/Core/PluginUtils.cs @@ -127,7 +127,7 @@ namespace Greenshot.Addons.Core /// path to the exe or dll /// index of the icon /// true to use the large icon - /// Bitmap with the icon or null if something happended. you are responsible for copying this icon + /// Bitmap with the icon or null if something happened. you are responsible for copying this icon public static IBitmapWithNativeSupport GetCachedExeIcon(string path, int index, bool useLargeIcon = true) { string cacheKey = $"{path}:{index}"; diff --git a/src/Greenshot.Addons/Extensions/LanguageExtensions.cs b/src/Greenshot.Addons/Extensions/LanguageExtensions.cs index 5d12314c2..1dfb83941 100644 --- a/src/Greenshot.Addons/Extensions/LanguageExtensions.cs +++ b/src/Greenshot.Addons/Extensions/LanguageExtensions.cs @@ -20,8 +20,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Dapplo.Config.Extensions; using Dapplo.Config.Language; -using Dapplo.Utils.Extensions; namespace Greenshot.Addons.Extensions { diff --git a/src/Greenshot.Addons/FodyWeavers.xml b/src/Greenshot.Addons/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot.Addons/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot.Addons/FodyWeavers.xsd b/src/Greenshot.Addons/FodyWeavers.xsd deleted file mode 100644 index 6e1ac6983..000000000 --- a/src/Greenshot.Addons/FodyWeavers.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/Greenshot.Addons/Greenshot.Addons.csproj b/src/Greenshot.Addons/Greenshot.Addons.csproj index 3d2fec8f1..932d0fb1c 100644 --- a/src/Greenshot.Addons/Greenshot.Addons.csproj +++ b/src/Greenshot.Addons/Greenshot.Addons.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 @@ -16,24 +16,19 @@ - - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - + + + + + + + + + + + - + diff --git a/src/Greenshot.Core/Greenshot.Core.csproj b/src/Greenshot.Core/Greenshot.Core.csproj index 868bcbfc3..6bfaa2ed7 100644 --- a/src/Greenshot.Core/Greenshot.Core.csproj +++ b/src/Greenshot.Core/Greenshot.Core.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Greenshot.Gfx/Greenshot.Gfx.csproj b/src/Greenshot.Gfx/Greenshot.Gfx.csproj index a2a1698b2..114fcd57e 100644 --- a/src/Greenshot.Gfx/Greenshot.Gfx.csproj +++ b/src/Greenshot.Gfx/Greenshot.Gfx.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj b/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj index 1f8bcf313..696ba9da4 100644 --- a/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj +++ b/src/Greenshot.PerformanceTests/Greenshot.PerformanceTests.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/Greenshot.Tests/CaptureTests.cs b/src/Greenshot.Tests/CaptureTests.cs index de894a783..b1c909671 100644 --- a/src/Greenshot.Tests/CaptureTests.cs +++ b/src/Greenshot.Tests/CaptureTests.cs @@ -19,14 +19,13 @@ using System.Drawing.Imaging; using System.IO; -using System.Linq; using System.Reactive.Linq; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Media.Imaging; using Dapplo.CaliburnMicro.Extensions; +using Dapplo.Config; using Dapplo.Windows.Desktop; -using Greenshot.Addons.Config.Impl; using Greenshot.Addons.Core; using Greenshot.Core; using Greenshot.Core.Enums; @@ -116,7 +115,7 @@ namespace Greenshot.Tests [WpfFact] public async Task Test_CaptureFlow_DwmWindowSource() { - ICoreConfiguration config = new CoreConfigurationImpl(); + var config = DictionaryConfiguration.Create(); var textValue = System.Guid.NewGuid().ToString(); var form = new Form diff --git a/src/Greenshot.Tests/Greenshot.Tests.csproj b/src/Greenshot.Tests/Greenshot.Tests.csproj index 55356c2a1..31f7a7dc9 100644 --- a/src/Greenshot.Tests/Greenshot.Tests.csproj +++ b/src/Greenshot.Tests/Greenshot.Tests.csproj @@ -28,10 +28,10 @@ - + - + diff --git a/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs b/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs deleted file mode 100644 index 08f7225f0..000000000 --- a/src/Greenshot/Configuration/Impl/MetroConfigurationImpl.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2019 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 . - -using Dapplo.CaliburnMicro.Metro; -using Dapplo.Config.Ini; - -namespace Greenshot.Configuration.Impl -{ - internal class MetroConfigurationImpl : IniSectionBase, IMetroConfiguration - { - private readonly MetroThemeManager _metroThemeManager; - public MetroConfigurationImpl(MetroThemeManager metroThemeManager) - { - _metroThemeManager = metroThemeManager; - } - public string Theme { get; set; } - public string ThemeColor { get; set; } - - public override void AfterLoad() - { - if (string.IsNullOrEmpty(Theme)) - { - Theme = null; - } - if (string.IsNullOrEmpty(ThemeColor)) - { - ThemeColor = null; - } - _metroThemeManager.ChangeTheme(Theme, ThemeColor); - - base.AfterLoad(); - } - } -} diff --git a/src/Greenshot/FodyWeavers.xml b/src/Greenshot/FodyWeavers.xml deleted file mode 100644 index 7f5a26669..000000000 --- a/src/Greenshot/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index 446d37310..720b83c3e 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -34,16 +34,11 @@ - - + - - - all - runtime; build; native; contentfiles; analyzers - + diff --git a/src/Greenshot/GreenshotAutofacModule.cs b/src/Greenshot/GreenshotAutofacModule.cs index 487d82b68..f209c105a 100644 --- a/src/Greenshot/GreenshotAutofacModule.cs +++ b/src/Greenshot/GreenshotAutofacModule.cs @@ -24,6 +24,7 @@ using Autofac; using Autofac.Features.AttributeFilters; using Dapplo.Addons; using Dapplo.CaliburnMicro.Configuration; +using Dapplo.CaliburnMicro.Metro; using Dapplo.CaliburnMicro.Security; using Dapplo.Config.Ini; using Dapplo.Config.Language; @@ -31,7 +32,6 @@ using Greenshot.Addons.Components; using Greenshot.Addons.Interfaces; using Greenshot.Components; using Greenshot.Configuration; -using Greenshot.Configuration.Impl; using Greenshot.Forms; using Greenshot.Helpers; using Greenshot.Helpers.Mapi; @@ -64,7 +64,19 @@ namespace Greenshot .SingleInstance(); builder - .RegisterType() + .Register(c => + { + var metroConfiguration = IniSection.Create(); + + // add specific code + var metroThemeManager = c.Resolve(); + + metroConfiguration.RegisterAfterLoad(iniSection => + { + metroThemeManager.ChangeTheme(metroConfiguration.Theme, metroConfiguration.ThemeColor); + }); + return metroConfiguration; + }) .As() .As() .SingleInstance(); @@ -80,7 +92,7 @@ namespace Greenshot }); builder - .RegisterType() + .Register(c => Language.Create()) .As() .As() .SingleInstance(); diff --git a/src/Greenshot/Startup.cs b/src/Greenshot/Startup.cs index 2a1ad78e7..a236ceff6 100644 --- a/src/Greenshot/Startup.cs +++ b/src/Greenshot/Startup.cs @@ -38,7 +38,6 @@ using Dapplo.Log.Loggers; #else using Dapplo.Log.LogFile; #endif -using Dapplo.Utils; using Dapplo.Windows.Common.Structs; using Dapplo.Windows.Dpi.Forms; using Dapplo.Windows.Kernel32; @@ -142,14 +141,7 @@ namespace Greenshot } errorViewModel.Value.SetExceptionToDisplay(exception); - if (!UiContext.HasUiAccess) - { - await UiContext.RunOn(() => windowManager.ShowDialog(errorViewModel.Value)); - } - else - { - windowManager.ShowDialog(errorViewModel.Value); - } + await Execute.OnUIThreadAsync(() => windowManager.ShowDialog(errorViewModel.Value)); } } catch (Exception ex) diff --git a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs index 0a18bd0e7..3357672e3 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/UiConfigViewModel.cs @@ -27,7 +27,6 @@ using Dapplo.CaliburnMicro.Extensions; using Dapplo.CaliburnMicro.Metro; using Dapplo.Config.Intercepting; using Dapplo.Config.Language; -using Dapplo.Utils.Extensions; using Greenshot.Addons; using Greenshot.Addons.Core; using Greenshot.Addons.Core.Enums; @@ -84,6 +83,7 @@ namespace Greenshot.Ui.Configuration.ViewModels /// IConfigTranslations /// IMetroConfiguration /// MetroThemeManager + /// LanguageContainer public UiConfigViewModel( ICoreConfiguration coreConfiguration, IGreenshotLanguage greenshotLanguage, @@ -136,8 +136,15 @@ namespace Greenshot.Ui.Configuration.ViewModels _disposables?.Dispose(); AvailableThemes.Clear(); - MetroThemeManager.AvailableThemes.ForEach(themeBaseColor => AvailableThemes.Add(themeBaseColor)); - MetroThemeManager.AvailableThemeColors.ForEach(colorScheme => AvailableThemeColors.Add(colorScheme)); + + foreach (var theme in MetroThemeManager.AvailableThemes) + { + AvailableThemes.Add(theme); + } + foreach (var themeColor in MetroThemeManager.AvailableThemeColors) + { + AvailableThemeColors.Add(themeColor); + } // Place this under the Ui parent ParentId = nameof(ConfigIds.Ui);