diff --git a/src/Greenshot.Addon.Box/BoxDestination.cs b/src/Greenshot.Addon.Box/BoxDestination.cs index 446a7fe94..dada3ca26 100644 --- a/src/Greenshot.Addon.Box/BoxDestination.cs +++ b/src/Greenshot.Addon.Box/BoxDestination.cs @@ -103,7 +103,7 @@ namespace Greenshot.Addon.Box get { // TODO: Optimize this - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "box.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "box.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj index 714affbdd..2610a945d 100644 --- a/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj +++ b/src/Greenshot.Addon.Box/Greenshot.Addon.Box.csproj @@ -204,12 +204,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj index 922f5506e..e7be645af 100644 --- a/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj +++ b/src/Greenshot.Addon.Confluence/Greenshot.Addon.Confluence.csproj @@ -224,11 +224,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs index 8e6c04b3d..9dd804a92 100644 --- a/src/Greenshot.Addon.Dropbox/DropboxDestination.cs +++ b/src/Greenshot.Addon.Dropbox/DropboxDestination.cs @@ -108,7 +108,7 @@ namespace Greenshot.Addon.Dropbox get { // TODO: Optimize this by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Dropbox.gif")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "Dropbox.gif")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj index 5deb1186c..a1a1f65ed 100644 --- a/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj +++ b/src/Greenshot.Addon.Dropbox/Greenshot.Addon.Dropbox.csproj @@ -220,12 +220,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandForm.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandForm.cs deleted file mode 100644 index b3bceafa1..000000000 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandForm.cs +++ /dev/null @@ -1,38 +0,0 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#endregion - -#region Usings - -using Greenshot.Addons.Controls; - -#endregion - -namespace Greenshot.Addon.ExternalCommand -{ - /// - /// This class is needed for design-time resolving of the language files - /// - public class ExternalCommandForm : GreenshotForm - { - } -} \ 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 015f114b4..b1567e2de 100644 --- a/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj +++ b/src/Greenshot.Addon.ExternalCommand/Greenshot.Addon.ExternalCommand.csproj @@ -149,9 +149,6 @@ - - Form - @@ -212,11 +209,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" False diff --git a/src/Greenshot.Addon.ExternalCommand/SettingsForm.cs b/src/Greenshot.Addon.ExternalCommand/SettingsForm.cs index 8b290e433..fc2a131fe 100644 --- a/src/Greenshot.Addon.ExternalCommand/SettingsForm.cs +++ b/src/Greenshot.Addon.ExternalCommand/SettingsForm.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; -using Dapplo.Ini; +using Greenshot.Addons.Controls; using Greenshot.Gfx; #endregion @@ -37,13 +37,16 @@ namespace Greenshot.Addon.ExternalCommand /// /// External Command settings form /// - public partial class SettingsForm : ExternalCommandForm + public partial class SettingsForm : GreenshotForm { - private static readonly IExternalCommandConfiguration ExternalCommandConfig = IniConfig.Current.Get(); + private readonly IExternalCommandLanguage _externalCommandLanguage; + private readonly IExternalCommandConfiguration _externalCommandConfiguration; private readonly IList _images = new List(); - public SettingsForm() + public SettingsForm(IExternalCommandConfiguration externalCommandConfiguration, IExternalCommandLanguage externalCommandLanguage) : base(externalCommandLanguage) { - // + _externalCommandConfiguration = externalCommandConfiguration; + _externalCommandLanguage = externalCommandLanguage; + // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); @@ -59,7 +62,7 @@ namespace Greenshot.Addon.ExternalCommand private void ButtonAddClick(object sender, EventArgs e) { - var form = new SettingsFormDetail(null); + var form = new SettingsFormDetail(null, _externalCommandLanguage); form.ShowDialog(); UpdateView(); @@ -71,7 +74,7 @@ namespace Greenshot.Addon.ExternalCommand { var commando = item.Tag as string; - ExternalCommandConfig.Delete(commando); + _externalCommandConfiguration.Delete(commando); } UpdateView(); } @@ -90,13 +93,13 @@ namespace Greenshot.Addon.ExternalCommand { listView.Items.Clear(); DisposeImages(); - if (ExternalCommandConfig.Commands != null) + if (_externalCommandConfiguration.Commands != null) { listView.ListViewItemSorter = new ListviewComparer(); var imageList = new ImageList(); listView.SmallImageList = imageList; var imageNr = 0; - foreach (var commando in ExternalCommandConfig.Commands) + foreach (var commando in _externalCommandConfiguration.Commands) { ListViewItem item; var iconForExe = IconCache.IconForCommand(commando, DpiHandler.Dpi > 100); @@ -143,7 +146,7 @@ namespace Greenshot.Addon.ExternalCommand } var commando = listView.SelectedItems[0].Tag as string; - var form = new SettingsFormDetail(commando); + var form = new SettingsFormDetail(commando, _externalCommandLanguage); form.ShowDialog(); UpdateView(); diff --git a/src/Greenshot.Addon.ExternalCommand/SettingsFormDetail.cs b/src/Greenshot.Addon.ExternalCommand/SettingsFormDetail.cs index f3f31ef20..d45a5fde5 100644 --- a/src/Greenshot.Addon.ExternalCommand/SettingsFormDetail.cs +++ b/src/Greenshot.Addon.ExternalCommand/SettingsFormDetail.cs @@ -30,6 +30,7 @@ using System.Linq; using System.Windows.Forms; using Dapplo.Ini; using Dapplo.Log; +using Greenshot.Addons.Controls; using Greenshot.Addons.Core; #endregion @@ -39,7 +40,7 @@ namespace Greenshot.Addon.ExternalCommand /// /// Description of SettingsFormDetail. /// - public partial class SettingsFormDetail : ExternalCommandForm + public partial class SettingsFormDetail : GreenshotForm { private static readonly LogSource Log = new LogSource(); private static readonly IExternalCommandConfiguration ExternalCommandConfig = IniConfig.Current.Get(); @@ -47,7 +48,7 @@ namespace Greenshot.Addon.ExternalCommand private readonly string _commando; - public SettingsFormDetail(string commando) + public SettingsFormDetail(string commando, IExternalCommandLanguage externalCommandLanguage): base(externalCommandLanguage) { InitializeComponent(); AcceptButton = buttonOk; diff --git a/src/Greenshot.Addon.Flickr/FlickrDestination.cs b/src/Greenshot.Addon.Flickr/FlickrDestination.cs index 47f052dde..173ece189 100644 --- a/src/Greenshot.Addon.Flickr/FlickrDestination.cs +++ b/src/Greenshot.Addon.Flickr/FlickrDestination.cs @@ -122,7 +122,7 @@ namespace Greenshot.Addon.Flickr get { // TODO: Optimize this by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "flickr.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "flickr.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj index 44f708995..bdb0053e1 100644 --- a/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj +++ b/src/Greenshot.Addon.Flickr/Greenshot.Addon.Flickr.csproj @@ -209,11 +209,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs index 1b6c24027..5c7e68dec 100644 --- a/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs +++ b/src/Greenshot.Addon.GooglePhotos/GooglePhotosDestination.cs @@ -101,7 +101,7 @@ namespace Greenshot.Addon.GooglePhotos get { // TODO: Optimize this by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "GooglePhotos.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "GooglePhotos.png")) { return BitmapHelper.FromStream(bitmapStream); } @@ -148,7 +148,7 @@ namespace Greenshot.Addon.GooglePhotos catch (Exception e) { Log.Error().WriteLine(e, "Error uploading."); - MessageBox.Show(_googlePhotosLanguage.UploadFailure + " " + e.Message); + MessageBox.Show(_googlePhotosLanguage.UploadFailure + @" " + e.Message); } return null; } diff --git a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj index dc37a1f64..e34c11721 100644 --- a/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj +++ b/src/Greenshot.Addon.GooglePhotos/Greenshot.Addon.GooglePhotos.csproj @@ -186,12 +186,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj index c3de95d57..9b6402dec 100644 --- a/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj +++ b/src/Greenshot.Addon.Imgur/Greenshot.Addon.Imgur.csproj @@ -221,11 +221,10 @@ - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ No newline at end of file diff --git a/src/Greenshot.Addon.Imgur/ImgurDestination.cs b/src/Greenshot.Addon.Imgur/ImgurDestination.cs index a0a53faa9..1042a3bf2 100644 --- a/src/Greenshot.Addon.Imgur/ImgurDestination.cs +++ b/src/Greenshot.Addon.Imgur/ImgurDestination.cs @@ -80,7 +80,7 @@ namespace Greenshot.Addon.Imgur get { // TODO: Optimize this, by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Imgur.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "Imgur.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj index 43a5525d5..69681287d 100644 --- a/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj +++ b/src/Greenshot.Addon.Jira/Greenshot.Addon.Jira.csproj @@ -248,19 +248,13 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -del /q /s "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"\* - -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - -if "$(ConfigurationName)" == "Debug" ( - copy "$(ProjectDir)bin\$(Configuration)\Dapplo.*" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - copy "$(ProjectDir)bin\$(Configuration)\Svg.dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -) - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\Svg.dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" + False diff --git a/src/Greenshot.Addon.Jira/JiraDestination.cs b/src/Greenshot.Addon.Jira/JiraDestination.cs index 7b9b5eb11..717bf839e 100644 --- a/src/Greenshot.Addon.Jira/JiraDestination.cs +++ b/src/Greenshot.Addon.Jira/JiraDestination.cs @@ -137,7 +137,7 @@ namespace Greenshot.Addon.Jira } if (displayIcon == null) { - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "jira.svgz")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "jira.svgz")) { using (var gzStream = new GZipStream(bitmapStream, CompressionMode.Decompress)) { diff --git a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs index 3da153016..af022b30f 100644 --- a/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs +++ b/src/Greenshot.Addon.LegacyEditor/Controls/ToolStripColorButton.cs @@ -28,6 +28,7 @@ using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; +using Greenshot.Addons; using Greenshot.Addons.Controls; using ColorDialog = Greenshot.Addons.Controls.ColorDialog; @@ -37,11 +38,13 @@ namespace Greenshot.Addon.LegacyEditor.Controls { public class ToolStripColorButton : ToolStripButton, INotifyPropertyChanged, IGreenshotLanguageBindable { - private Color _selectedColor = Color.Transparent; + private readonly IGreenshotLanguage _greenshotLanguage; + private Color _selectedColor = Color.Transparent; - public ToolStripColorButton() + public ToolStripColorButton(IGreenshotLanguage greenshotLanguage) { - Click += ColorButtonClick; + _greenshotLanguage = greenshotLanguage; + Click += ColorButtonClick; } public Color SelectedColor @@ -86,7 +89,7 @@ namespace Greenshot.Addon.LegacyEditor.Controls private void ColorButtonClick(object sender, EventArgs e) { - var colorDialog = new ColorDialog + var colorDialog = new ColorDialog(_greenshotLanguage) { Color = SelectedColor }; diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs index e3b125831..2303aab85 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/DropShadowSettingsForm.cs @@ -26,6 +26,7 @@ using System; using System.Drawing; using System.Windows.Forms; +using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; @@ -33,11 +34,11 @@ using Greenshot.Gfx.Effects; namespace Greenshot.Addon.LegacyEditor.Forms { - public partial class DropShadowSettingsForm : BaseForm + public partial class DropShadowSettingsForm : GreenshotForm { private readonly DropShadowEffect _effect; - public DropShadowSettingsForm(DropShadowEffect effect) + public DropShadowSettingsForm(DropShadowEffect effect, IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage) { _effect = effect; InitializeComponent(); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs index 720ad51bd..5568159e6 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.Designer.cs @@ -153,8 +153,8 @@ namespace Greenshot.Addon.LegacyEditor.Forms { this.areaHighlightMenuItem = new GreenshotToolStripMenuItem(); this.grayscaleHighlightMenuItem = new GreenshotToolStripMenuItem(); this.magnifyMenuItem = new GreenshotToolStripMenuItem(); - this.btnFillColor = new ToolStripColorButton(); - this.btnLineColor = new ToolStripColorButton(); + this.btnFillColor = new ToolStripColorButton(_greenshotLanguage); + this.btnLineColor = new ToolStripColorButton(_greenshotLanguage); this.lineThicknessLabel = new GreenshotToolStripLabel(); this.lineThicknessUpDown = new ToolStripNumericUpDown(); this.counterLabel = new GreenshotToolStripLabel(); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs index af78ba510..ad244112a 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ImageEditorForm.cs @@ -46,6 +46,7 @@ using Greenshot.Addon.LegacyEditor.Controls; using Greenshot.Addon.LegacyEditor.Drawing; using Greenshot.Addon.LegacyEditor.Drawing.Fields; using Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding; +using Greenshot.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.Controls; using Greenshot.Addons.Core; @@ -63,13 +64,15 @@ namespace Greenshot.Addon.LegacyEditor.Forms /// /// Description of ImageEditorForm. /// - public partial class ImageEditorForm : BaseForm, IImageEditor + public partial class ImageEditorForm : GreenshotForm, IImageEditor { private static readonly LogSource Log = new LogSource(); private static readonly List IgnoreDestinations = new List { "Picker", "Editor"}; private static readonly string[] SupportedClipboardFormats = { typeof(string).FullName, "Text", typeof(IDrawableContainerList).FullName }; private readonly IEditorConfiguration _editorConfiguration; private readonly IEditorLanguage _editorLanguage; + private readonly ICoreConfiguration _coreConfiguration; + private readonly IGreenshotLanguage _greenshotLanguage; // whether part of the editor controls are disabled depending on selected item(s) private bool _controlsDisabledDueToConfirmable; @@ -89,15 +92,19 @@ namespace Greenshot.Addon.LegacyEditor.Forms public ImageEditorForm( IEditorConfiguration editorConfiguration, IEditorLanguage editorLanguage, + ICoreConfiguration coreConfiguration, + IGreenshotLanguage greenshotLanguage, EditorFactory editorFactory, DestinationHolder destinationHolder, Func> resizeSettingsFormFactory, Func> tornEdgeSettingsFormFactory, Func> dropShadowSettingsFormFactory - ) + ) : base(editorLanguage) { _editorConfiguration = editorConfiguration; _editorLanguage = editorLanguage; + _coreConfiguration = coreConfiguration; + _greenshotLanguage = greenshotLanguage; _editorFactory = editorFactory; _destinationHolder = destinationHolder; _resizeSettingsFormFactory = resizeSettingsFormFactory; @@ -152,7 +159,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms { case DpiChangeEventTypes.Before: // Change the ImageScalingSize before setting the bitmaps - var width = DpiHandler.ScaleWithDpi(coreConfiguration.IconSize.Width, info.NewDpi); + var width = DpiHandler.ScaleWithDpi(_coreConfiguration.IconSize.Width, info.NewDpi); var size = new Size(width, width); SuspendLayout(); toolsToolStrip.ImageScalingSize = size; @@ -321,10 +328,10 @@ namespace Greenshot.Addon.LegacyEditor.Forms private void UpdateUi() { // Disable access to the settings, for feature #3521446 - preferencesToolStripMenuItem.Visible = !coreConfiguration.DisableSettings; - toolStripSeparator12.Visible = !coreConfiguration.DisableSettings; - toolStripSeparator11.Visible = !coreConfiguration.DisableSettings; - btnSettings.Visible = !coreConfiguration.DisableSettings; + preferencesToolStripMenuItem.Visible = !_coreConfiguration.DisableSettings; + toolStripSeparator12.Visible = !_coreConfiguration.DisableSettings; + toolStripSeparator11.Visible = !_coreConfiguration.DisableSettings; + btnSettings.Visible = !_coreConfiguration.DisableSettings; // Make sure Double-buffer is enabled SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true); @@ -904,7 +911,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms var saveFileDialog = new SaveFileDialog { Filter = "Greenshot templates (*.gst)|*.gst", - FileName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(coreConfiguration.OutputFileFilenamePattern, _surface.CaptureDetails) + FileName = FilenameHelper.GetFilenameWithoutExtensionFromPattern(_coreConfiguration.OutputFileFilenamePattern, _surface.CaptureDetails) }; var dialogResult = saveFileDialog.ShowDialog(); if (!dialogResult.Equals(DialogResult.OK)) @@ -1064,7 +1071,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms NativeRect cropRectangle; using (var tmpImage = GetImageForExport()) { - cropRectangle = tmpImage.FindAutoCropRectangle(coreConfiguration.AutoCropDifference); + cropRectangle = tmpImage.FindAutoCropRectangle(_coreConfiguration.AutoCropDifference); } if (!_surface.IsCropPossible(ref cropRectangle)) { @@ -1592,7 +1599,7 @@ namespace Greenshot.Addon.LegacyEditor.Forms _surface.Dispose(); GC.Collect(); - if (coreConfiguration.MinimizeWorkingSetSize) + if (_coreConfiguration.MinimizeWorkingSetSize) { PsApi.EmptyWorkingSet(); } diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs index a1a0d009c..ca3ded5f4 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/ResizeSettingsForm.cs @@ -27,6 +27,7 @@ using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; +using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; @@ -37,13 +38,13 @@ namespace Greenshot.Addon.LegacyEditor.Forms /// /// A form to set the resize settings /// - public partial class ResizeSettingsForm : BaseForm + public partial class ResizeSettingsForm : GreenshotForm { private readonly ResizeEffect _effect; private readonly string _valuePercent; private double _newWidth, _newHeight; - public ResizeSettingsForm(ResizeEffect effect, IEditorLanguage editorLanguage) + public ResizeSettingsForm(ResizeEffect effect, IEditorLanguage editorLanguage, IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage) { _effect = effect; InitializeComponent(); diff --git a/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs b/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs index 833fe5e89..ed5ab61f3 100644 --- a/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs +++ b/src/Greenshot.Addon.LegacyEditor/Forms/TornEdgeSettingsForm.cs @@ -26,6 +26,7 @@ using System; using System.Drawing; using System.Windows.Forms; +using Greenshot.Addons; using Greenshot.Addons.Controls; using Greenshot.Gfx.Effects; @@ -33,11 +34,11 @@ using Greenshot.Gfx.Effects; namespace Greenshot.Addon.LegacyEditor.Forms { - public partial class TornEdgeSettingsForm : BaseForm + public partial class TornEdgeSettingsForm : GreenshotForm { private readonly TornEdgeEffect _effect; - public TornEdgeSettingsForm(TornEdgeEffect effect) + public TornEdgeSettingsForm(TornEdgeEffect effect, IGreenshotLanguage greenshotLanguage) : base(greenshotLanguage) { _effect = effect; InitializeComponent(); diff --git a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj index 5b7c10c60..ec26e2730 100644 --- a/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj +++ b/src/Greenshot.Addon.LegacyEditor/Greenshot.Addon.LegacyEditor.csproj @@ -279,12 +279,10 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -del /q /s "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)"\* - -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ 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 ec2667a4e..3ddadbb17 100644 --- a/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj +++ b/src/Greenshot.Addon.Lutim/Greenshot.Addon.Lutim.csproj @@ -233,14 +233,10 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" - -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" - -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ No newline at end of file diff --git a/src/Greenshot.Addon.Lutim/LutimDestination.cs b/src/Greenshot.Addon.Lutim/LutimDestination.cs index 1b29a73fa..0f98cf05a 100644 --- a/src/Greenshot.Addon.Lutim/LutimDestination.cs +++ b/src/Greenshot.Addon.Lutim/LutimDestination.cs @@ -66,7 +66,7 @@ namespace Greenshot.Addon.Lutim { public override Bitmap DisplayIcon { get { // TODO: Optimize this by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "Lutim.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "Lutim.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj b/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj index b6dd175c0..d7137e59a 100644 --- a/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj +++ b/src/Greenshot.Addon.OCR/Greenshot.Addon.OCR.csproj @@ -146,12 +146,10 @@ + - - Form - @@ -187,11 +185,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" False diff --git a/src/Greenshot.Addon.OCR/IOcrLanguage.cs b/src/Greenshot.Addon.OCR/IOcrLanguage.cs new file mode 100644 index 000000000..7aa37cf84 --- /dev/null +++ b/src/Greenshot.Addon.OCR/IOcrLanguage.cs @@ -0,0 +1,33 @@ +// Greenshot - a free and open source screenshot tool +// Copyright (C) 2007-2017 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.ComponentModel; +using Dapplo.Language; + +namespace Greenshot.Addon.OCR +{ + [Language("Ocr")] + public interface IOcrLanguage : ILanguage, INotifyPropertyChanged + { + string Language { get; } + string OrientImage { get; } + string StraightenImage { get; } + + } +} \ No newline at end of file diff --git a/src/Greenshot.Addon.OCR/OCRForm.cs b/src/Greenshot.Addon.OCR/OCRForm.cs deleted file mode 100644 index 5207d950f..000000000 --- a/src/Greenshot.Addon.OCR/OCRForm.cs +++ /dev/null @@ -1,38 +0,0 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#endregion - -#region Usings - -using Greenshot.Addons.Controls; - -#endregion - -namespace Greenshot.Addon.OCR -{ - /// - /// This class is needed for design-time resolving of the language files - /// - public class OcrForm : GreenshotForm - { - } -} \ No newline at end of file diff --git a/src/Greenshot.Addon.OCR/OcrAddonModule.cs b/src/Greenshot.Addon.OCR/OcrAddonModule.cs index 3b7907aec..fba096b91 100644 --- a/src/Greenshot.Addon.OCR/OcrAddonModule.cs +++ b/src/Greenshot.Addon.OCR/OcrAddonModule.cs @@ -35,7 +35,7 @@ namespace Greenshot.Addon.OCR { private bool HasModi() { - var ocrCommand = Path.Combine(FileTools.NormalizeDirectory("."), "greenshotocrcommand.exe"); + var ocrCommand = Path.Combine(FileTools.NormalizeDirectory(Path.GetDirectoryName(GetType().Assembly.Location)), "greenshotocrcommand.exe"); try { using (var process = Process.Start(ocrCommand, "-c")) diff --git a/src/Greenshot.Addon.OCR/SettingsForm.cs b/src/Greenshot.Addon.OCR/SettingsForm.cs index 9725b6f6c..37b09b7d0 100644 --- a/src/Greenshot.Addon.OCR/SettingsForm.cs +++ b/src/Greenshot.Addon.OCR/SettingsForm.cs @@ -24,6 +24,7 @@ #region Usings using System; +using Greenshot.Addons.Controls; #endregion @@ -32,11 +33,11 @@ namespace Greenshot.Addon.OCR /// /// Description of SettingsForm. /// - public partial class SettingsForm : OcrForm + public partial class SettingsForm : GreenshotForm { private readonly IOCRConfiguration config; - public SettingsForm(string[] languages, IOCRConfiguration config) + public SettingsForm(string[] languages, IOcrLanguage ocrLanguage, IOCRConfiguration config) : base(ocrLanguage) { // // The InitializeComponent() call is required for Windows Forms designer support. diff --git a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj index 766e959a8..daa5b1425 100644 --- a/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj +++ b/src/Greenshot.Addon.Office/Greenshot.Addon.Office.csproj @@ -243,12 +243,11 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" diff --git a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj index 34bf17403..a6f8b1c8a 100644 --- a/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj +++ b/src/Greenshot.Addon.OneDrive/Greenshot.Addon.OneDrive.csproj @@ -187,12 +187,10 @@ - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ No newline at end of file diff --git a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs index 8f0cb0429..6df749e5f 100644 --- a/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs +++ b/src/Greenshot.Addon.OneDrive/OneDriveDestination.cs @@ -113,7 +113,7 @@ namespace Greenshot.Addon.OneDrive get { // TODO: Optimize this by caching - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "onedrive.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "onedrive.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj index 05b2b284f..4ce2e0a5d 100644 --- a/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj +++ b/src/Greenshot.Addon.Photobucket/Greenshot.Addon.Photobucket.csproj @@ -217,11 +217,10 @@ - mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ No newline at end of file diff --git a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs index 27107f9bd..d1e0a14d0 100644 --- a/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs +++ b/src/Greenshot.Addon.Photobucket/PhotobucketDestination.cs @@ -168,7 +168,7 @@ namespace Greenshot.Addon.Photobucket get { // TODO: Optimize this - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "photobucket-logo.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "photobucket-logo.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj index 9b9686caf..6d08b7618 100644 --- a/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj +++ b/src/Greenshot.Addon.Tfs/Greenshot.Addon.Tfs.csproj @@ -190,12 +190,10 @@ - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(TargetFileName)" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)" -copy "$(ProjectDir)Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" +copy "$(ProjectDir)\Languages\*.xml" "$(SolutionDir)Greenshot\bin\$(Configuration)\Languages\$(ProjectName)" \ No newline at end of file diff --git a/src/Greenshot.Addon.Tfs/TfsDestination.cs b/src/Greenshot.Addon.Tfs/TfsDestination.cs index 24639c3ee..9797809f5 100644 --- a/src/Greenshot.Addon.Tfs/TfsDestination.cs +++ b/src/Greenshot.Addon.Tfs/TfsDestination.cs @@ -131,7 +131,7 @@ namespace Greenshot.Addon.Tfs get { // TODO: Optimize this by using a cache - using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType(), "vsts.png")) + using (var bitmapStream = _resourceProvider.ResourceAsStream(GetType().Assembly, "vsts.png")) { return BitmapHelper.FromStream(bitmapStream); } diff --git a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj index d175c4bd7..89c9fc6dc 100644 --- a/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj +++ b/src/Greenshot.Addon.Win10/Greenshot.Addon.Win10.csproj @@ -171,10 +171,9 @@ - -mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\*.gsp" -copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Plugins\$(ProjectName)\" - + mkdir "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).dll" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" +copy "$(ProjectDir)bin\$(Configuration)\$(ProjectName).pdb" "$(SolutionDir)Greenshot\bin\$(Configuration)\Addons\" + \ No newline at end of file diff --git a/src/Greenshot.Addons/AddonsModule.cs b/src/Greenshot.Addons/AddonsModule.cs index 4f2653def..610791775 100644 --- a/src/Greenshot.Addons/AddonsModule.cs +++ b/src/Greenshot.Addons/AddonsModule.cs @@ -25,6 +25,7 @@ using Autofac; using Dapplo.Addons; using Greenshot.Addons.Components; using Greenshot.Addons.ViewModels; +using Greenshot.Addons.Controls; namespace Greenshot.Addons { @@ -39,7 +40,10 @@ namespace Greenshot.Addons builder .RegisterType() .AsSelf(); - + builder + .RegisterType() + .AsSelf(); + base.Load(builder); } } diff --git a/src/Greenshot.Addons/Controls/AnimatingForm.cs b/src/Greenshot.Addons/Controls/AnimatingForm.cs index 73b6e3b3d..ea82bff00 100644 --- a/src/Greenshot.Addons/Controls/AnimatingForm.cs +++ b/src/Greenshot.Addons/Controls/AnimatingForm.cs @@ -25,10 +25,12 @@ using System; using System.Windows.Forms; +using Dapplo.Language; using Dapplo.Log; using Dapplo.Windows.Gdi32; using Dapplo.Windows.Gdi32.Enums; using Dapplo.Windows.Gdi32.SafeHandles; +using Greenshot.Addons.Core; #endregion @@ -39,7 +41,8 @@ namespace Greenshot.Addons.Controls /// public class AnimatingForm : GreenshotForm { - private const int DefaultVerticalRefresh = 60; + private readonly ICoreConfiguration _coreConfiguration; + private const int DefaultVerticalRefresh = 60; private static readonly LogSource Log = new LogSource(); private Timer _timer; private int _vRefresh; @@ -47,9 +50,10 @@ namespace Greenshot.Addons.Controls /// /// Initialize the animation /// - protected AnimatingForm() + protected AnimatingForm(ICoreConfiguration coreConfiguration, ILanguage language) : base(language) { - Load += (sender, args) => + _coreConfiguration = coreConfiguration; + Load += (sender, args) => { DoubleBuffered = true; if (!EnableAnimation) @@ -102,7 +106,7 @@ namespace Greenshot.Addons.Controls /// /// Check if we are in a Terminal Server session OR need to optimize for RDP / remote desktop connections /// - protected bool IsTerminalServerSession => !coreConfiguration.DisableRDPOptimizing && (coreConfiguration.OptimizeForRDP || SystemInformation.TerminalServerSession); + protected bool IsTerminalServerSession => !_coreConfiguration.DisableRDPOptimizing && (_coreConfiguration.OptimizeForRDP || SystemInformation.TerminalServerSession); /// /// Calculate the amount of frames that an animation takes diff --git a/src/Greenshot.Addons/Controls/BaseForm.cs b/src/Greenshot.Addons/Controls/BaseForm.cs deleted file mode 100644 index 0534c4281..000000000 --- a/src/Greenshot.Addons/Controls/BaseForm.cs +++ /dev/null @@ -1,36 +0,0 @@ -#region Greenshot GNU General Public License - -// Greenshot - a free and open source screenshot tool -// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom -// -// For more information see: http://getgreenshot.org/ -// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 1 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#endregion - -#region Usings - -#endregion - -namespace Greenshot.Addons.Controls -{ - /// - /// This class is only here to help in the Designer mode, so it's clear where the language files are - /// - public class BaseForm : GreenshotForm - { - } -} \ No newline at end of file diff --git a/src/Greenshot.Addons/Controls/ColorButton.cs b/src/Greenshot.Addons/Controls/ColorButton.cs index a706bcf7a..39731ae4d 100644 --- a/src/Greenshot.Addons/Controls/ColorButton.cs +++ b/src/Greenshot.Addons/Controls/ColorButton.cs @@ -28,6 +28,7 @@ using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; +using Autofac.Features.OwnedInstances; #endregion @@ -38,11 +39,13 @@ namespace Greenshot.Addons.Controls /// public class ColorButton : Button, IGreenshotLanguageBindable { - private Color _selectedColor = Color.White; + private readonly Func> _colorDialogFactory; + private Color _selectedColor = Color.White; - public ColorButton() + public ColorButton(Func> colorDialogFactory) { - Click += ColorButtonClick; + _colorDialogFactory = colorDialogFactory; + Click += ColorButtonClick; } /// @@ -82,22 +85,23 @@ namespace Greenshot.Addons.Controls private void ColorButtonClick(object sender, EventArgs e) { - var colorDialog = new ColorDialog - { - Color = SelectedColor - }; - // Using the parent to make sure the dialog doesn't show on another window - colorDialog.ShowDialog(Parent.Parent); - if (colorDialog.DialogResult == DialogResult.Cancel) - { - return; - } - if (colorDialog.Color.Equals(SelectedColor)) - { - return; - } - SelectedColor = colorDialog.Color; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedColor")); + using (var ownedColorDialog = _colorDialogFactory()) + { + var colorDialog = ownedColorDialog.Value; + colorDialog.Color = SelectedColor; + // Using the parent to make sure the dialog doesn't show on another window + colorDialog.ShowDialog(Parent.Parent); + if (colorDialog.DialogResult == DialogResult.Cancel) + { + return; + } + if (colorDialog.Color.Equals(SelectedColor)) + { + return; + } + SelectedColor = colorDialog.Color; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SelectedColor")); + }; } } } \ No newline at end of file diff --git a/src/Greenshot.Addons/Controls/ColorDialog.cs b/src/Greenshot.Addons/Controls/ColorDialog.cs index 6aba62b16..86d767a2a 100644 --- a/src/Greenshot.Addons/Controls/ColorDialog.cs +++ b/src/Greenshot.Addons/Controls/ColorDialog.cs @@ -38,7 +38,7 @@ namespace Greenshot.Addons.Controls /// /// Description of ColorDialog. /// - public partial class ColorDialog : BaseForm + public partial class ColorDialog : GreenshotForm { private readonly IList