diff --git a/Greenshot/Greenshot.csproj b/Greenshot/Greenshot.csproj index 866066d0d..30d5a0210 100644 --- a/Greenshot/Greenshot.csproj +++ b/Greenshot/Greenshot.csproj @@ -379,7 +379,7 @@ - Never + PreserveNewest Never diff --git a/Greenshot/log4net-portable.xml b/Greenshot/log4net-portable.xml index bff2b7fc2..9c54417d6 100644 --- a/Greenshot/log4net-portable.xml +++ b/Greenshot/log4net-portable.xml @@ -1,7 +1,5 @@  - - diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index b426719f4..ee51c4254 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -17,6 +17,7 @@ Fixed: * BUG-1890: Slight cropping around window on Windows 10 * BUG-1892: Greenshot saves blank JPG file with reduce colors * BUG-1898: Specify GPLv3 in the license text +* BUG-1910: Error occurs after adding 10+ text boxes with arrows * BUG-1918: Speechbubble issue: Artifacts appeared when shadow is on and transparency is used * BUG-1933: Greenshot Installer sets bad registry key permission * BUG-1935: Delay when pasting and ShapeShifter from FlameFusion is running @@ -24,20 +25,17 @@ Fixed: * BUG-1945: Failure starting Greenshot at system startup * BUG-1949: Can't delete Imgur upload * BUG-1965: Activation border around window is visible in the capture -* FEATURE-916: Added icon as possible format to save with (image is sized to 256x256) -* FEATURE-919: Allow adding of space around screenshot -* FEATURE-945:Added environment variables resolving to the external command +* BUG-1991: Greenshot portable (PAF) uses wrong log configuration +* FEATURE-916: Added ico file format +* FEATURE-919: Allow adding of space around screenshot (use Ctrl + / Ctrl -) +* FEATURE-945: Added environment variables resolving to the external command * FEATURE-949: Updated to Inno-Setup 5.5.9 for improved installer security Open issues planned for this version: BUG-1872: OneDrive prevents Greenshot hotkeys from working BUG-1908: External Command plugin should check for possible default-commands at startup -BUG-1910: Error occurs after adding 10+ text boxes with arrows FEATURE-912: [Storage Location] Define directory pattern -Known issues: -* TextContainer (the thing in the editor that can add text to your capture) can throw exceptions. - 1.2.8.12-cab854b RELEASE diff --git a/GreenshotPlugin/Core/Language.cs b/GreenshotPlugin/Core/Language.cs index 4a2660c78..501782029 100644 --- a/GreenshotPlugin/Core/Language.cs +++ b/GreenshotPlugin/Core/Language.cs @@ -61,7 +61,7 @@ namespace GreenshotPlugin.Core { LOG.Warn("IniConfig hasn't been initialized yet! (Design mode?)"); IniConfig.Init("greenshot", "greenshot"); } - if (!LogHelper.isInitialized) { + if (!LogHelper.IsInitialized) { LOG.Warn("Log4net hasn't been initialized yet! (Design mode?)"); LogHelper.InitializeLog4NET(); } diff --git a/GreenshotPlugin/Core/LogHelper.cs b/GreenshotPlugin/Core/LogHelper.cs index 20a007da5..b1091f47a 100644 --- a/GreenshotPlugin/Core/LogHelper.cs +++ b/GreenshotPlugin/Core/LogHelper.cs @@ -18,6 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + using System.IO; using System.Reflection; using System.Windows.Forms; @@ -32,47 +33,44 @@ using log4net.Util; namespace GreenshotPlugin.Core { /// - /// Description of LogHelper. + /// Initialize the logger /// public class LogHelper { - private const string LOG4NET_FILE = "log4net.xml"; - private const string LOG4NET_PORTABLE_FILE = "log4net-portable.xml"; - private static bool isLog4NetConfigured; + private static bool _isLog4NetConfigured; private const string INIT_MESSAGE = "Greenshot initialization of log system failed"; - public static bool isInitialized { + + public static bool IsInitialized { get { - return isLog4NetConfigured; + return _isLog4NetConfigured; } } // Initialize Log4J public static string InitializeLog4NET() { // Setup log4j, currently the file is called log4net.xml - string pafLog4NetFilename = Path.Combine(Application.StartupPath, @"App\Greenshot\" + LOG4NET_PORTABLE_FILE); - string log4netFilename = Path.Combine(Application.StartupPath, LOG4NET_FILE); - - if (File.Exists(log4netFilename)) { - try { - XmlConfigurator.Configure(new FileInfo(log4netFilename)); - isLog4NetConfigured = true; - } catch (Exception ex) { - MessageBox.Show(ex.Message, INIT_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Warning); - } - } else if (File.Exists(pafLog4NetFilename)) { - try { - XmlConfigurator.Configure(new FileInfo(pafLog4NetFilename)); - isLog4NetConfigured = true; - } catch (Exception ex) { - MessageBox.Show(ex.Message, INIT_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Warning); + foreach (var logName in new[] { "log4net.xml" , @"App\Greenshot\log4net-portable.xml"}) + { + string log4NetFilename = Path.Combine(Application.StartupPath, logName); + if (File.Exists(log4NetFilename)) + { + try + { + XmlConfigurator.Configure(new FileInfo(log4NetFilename)); + _isLog4NetConfigured = true; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, INIT_MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Warning); + } } } - - if (!isLog4NetConfigured) { + // Fallback + if (!_isLog4NetConfigured) { try { Assembly assembly = typeof(LogHelper).Assembly; using (Stream stream = assembly.GetManifestResourceStream("GreenshotPlugin.log4net-embedded.xml")) { XmlConfigurator.Configure(stream); - isLog4NetConfigured = true; + _isLog4NetConfigured = true; IniConfig.ForceIniInStartupPath(); } } catch (Exception ex){ @@ -80,7 +78,7 @@ namespace GreenshotPlugin.Core { } } - if (isLog4NetConfigured) { + if (_isLog4NetConfigured) { // Get the logfile name try { if (((Hierarchy)LogManager.GetRepository()).Root.Appenders.Count > 0) { @@ -100,7 +98,7 @@ namespace GreenshotPlugin.Core { /// A simple helper class to support the logging to the AppData location /// public class SpecialFolderPatternConverter : PatternConverter { - override protected void Convert(TextWriter writer, object state) { + protected override void Convert(TextWriter writer, object state) { Environment.SpecialFolder specialFolder = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), Option, true); writer.Write(Environment.GetFolderPath(specialFolder)); } diff --git a/GreenshotPlugin/log4net-embedded.xml b/GreenshotPlugin/log4net-embedded.xml index 6be33994a..ccfa902a7 100644 --- a/GreenshotPlugin/log4net-embedded.xml +++ b/GreenshotPlugin/log4net-embedded.xml @@ -1,7 +1,5 @@  - - diff --git a/build.ps1 b/build.ps1 index 856abb4bc..2a5b4fb6c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -104,7 +104,7 @@ Function PackagePortable { "$sourcebase\Greenshot.exe.config", "$sourcebase\GreenshotPlugin.dll", "$sourcebase\log4net.dll", - "$sourcebase\log4net.xml", + "$sourcebase\log4net-portable.xml", "$destbase\additional_files\*.txt" ) | foreach { Copy-Item $_ "$destbase\portabletmp\App\Greenshot\" } Copy-Item -Path "$sourcebase\Languages\help-en-US.html" -Destination "$destbase\portabletmp\help.html" @@ -170,7 +170,6 @@ Function PackageZip { "$sourcebase\Greenshot.exe.config", "$sourcebase\GreenshotPlugin.dll", "$sourcebase\log4net.dll", - "$sourcebase\log4net.xml", "$destbase\additional_files\*.txt" ) | foreach { Copy-Item $_ "$destzip\" } $zipOutput = "$(get-location)\zip"