diff --git a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj index bb3f82676..af2e4453c 100644 --- a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj +++ b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj @@ -34,12 +34,12 @@ - - ..\packages\Dapplo.HttpExtensions.0.5.36\lib\net45\Dapplo.HttpExtensions.dll + + ..\packages\Dapplo.HttpExtensions.0.5.43\lib\net45\Dapplo.HttpExtensions.dll True - - ..\packages\Dapplo.Jira.0.1.61\lib\net45\Dapplo.Jira.dll + + ..\packages\Dapplo.Jira.0.1.65\lib\net45\Dapplo.Jira.dll True diff --git a/GreenshotJiraPlugin/packages.config b/GreenshotJiraPlugin/packages.config index bd1287f70..bfe2a551d 100644 --- a/GreenshotJiraPlugin/packages.config +++ b/GreenshotJiraPlugin/packages.config @@ -1,7 +1,7 @@  - - + + diff --git a/GreenshotPlugin/IniFile/IniConfig.cs b/GreenshotPlugin/IniFile/IniConfig.cs index 3869640f0..8ac27deca 100644 --- a/GreenshotPlugin/IniFile/IniConfig.cs +++ b/GreenshotPlugin/IniFile/IniConfig.cs @@ -51,17 +51,17 @@ namespace Greenshot.IniFile { /// /// A Dictionary with all the sections stored by section name /// - private static readonly Dictionary SectionMap = new Dictionary(); + private static readonly IDictionary SectionMap = new Dictionary(); /// /// A Dictionary with the properties for a section stored by section name /// - private static Dictionary> _sections = new Dictionary>(); + private static IDictionary> _sections = new Dictionary>(); /// /// A Dictionary with the fixed-properties for a section stored by section name /// - private static Dictionary> _fixedProperties; + private static IDictionary> _fixedProperties; /// /// Stores if we checked for portable @@ -231,7 +231,7 @@ namespace Greenshot.IniFile { /// public static void Reload() { // Clear the current properties - _sections = new Dictionary>(); + _sections = new Dictionary>(); // Load the defaults Read(CreateIniLocation(_configName + DefaultsPostfix + IniExtension, true)); // Load the normal @@ -264,7 +264,7 @@ namespace Greenshot.IniFile { { return; } - Dictionary fixedPropertiesForSection; + IDictionary fixedPropertiesForSection; if (!_fixedProperties.TryGetValue(section.IniSectionAttribute.Name, out fixedPropertiesForSection)) { return; @@ -280,23 +280,23 @@ namespace Greenshot.IniFile { /// Read the ini file into the Dictionary /// /// Path & Filename of ini file - private static Dictionary> Read(string iniLocation) { + private static IDictionary> Read(string iniLocation) { if (!File.Exists(iniLocation)) { Log.Info("Can't find file: " + iniLocation); return null; } Log.InfoFormat("Loading ini-file: {0}", iniLocation); //LOG.Info("Reading ini-properties from file: " + iniLocation); - Dictionary> newSections = IniReader.read(iniLocation, Encoding.UTF8); + var newSections = IniReader.Read(iniLocation, Encoding.UTF8); // Merge the newly loaded properties to the already available foreach(string section in newSections.Keys) { - Dictionary newProperties = newSections[section]; + IDictionary newProperties = newSections[section]; if (!_sections.ContainsKey(section)) { // This section is not yet loaded, simply add the complete section _sections.Add(section, newProperties); } else { // Overwrite or add every property from the newly loaded section to the available one - Dictionary currentProperties = _sections[section]; + var currentProperties = _sections[section]; foreach(string propertyName in newProperties.Keys) { string propertyValue = newProperties[propertyName]; if (currentProperties.ContainsKey(propertyName)) { @@ -446,7 +446,7 @@ namespace Greenshot.IniFile { writer.WriteLine("; The reason could be that the section {0} just hasn't been used, a plugin has an error and can't claim it or maybe the whole section {0} is obsolete.", sectionName); // Write section name writer.WriteLine("[{0}]", sectionName); - Dictionary properties = _sections[sectionName]; + var properties = _sections[sectionName]; // Loop and write properties foreach (string propertyName in properties.Keys) { writer.WriteLine("{0}={1}", propertyName, properties[propertyName]); diff --git a/GreenshotPlugin/IniFile/IniReader.cs b/GreenshotPlugin/IniFile/IniReader.cs index 23346f605..96db00760 100644 --- a/GreenshotPlugin/IniFile/IniReader.cs +++ b/GreenshotPlugin/IniFile/IniReader.cs @@ -24,40 +24,51 @@ using System.IO; using System.Text; namespace Greenshot.IniFile { + /// + /// + /// public static class IniReader { - private const string SECTION_START = "["; - private const string SECTION_END = "]"; - private const string COMMENT = ";"; - private static readonly char[] ASSIGNMENT = new[] { '=' }; + private const string SectionStart = "["; + private const string SectionEnd = "]"; + private const string Comment = ";"; + private static readonly char[] Assignment = { '=' }; - /** - * Read an ini file to a Dictionary, each key is a section and the value is a Dictionary with name and values. - */ - public static Dictionary> read(string path, Encoding encoding) { - Dictionary> ini = new Dictionary>(); - using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024)) { - using (StreamReader reader = new StreamReader(fileStream, encoding)) { - Dictionary nameValues = new Dictionary(); - while (!reader.EndOfStream) { - string line = reader.ReadLine(); - if (line != null) { - string cleanLine = line.Trim(); - if (cleanLine.Length == 0 || cleanLine.StartsWith(COMMENT)) { - continue; - } - if (cleanLine.StartsWith(SECTION_START)) { - string section = line.Replace(SECTION_START, "").Replace(SECTION_END, "").Trim(); + /// + /// Read an ini file to a Dictionary, each key is a section and the value is a Dictionary with name and values. + /// + /// + /// + /// + public static IDictionary> Read(string path, Encoding encoding) { + var ini = new Dictionary>(); + using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024)) { + using (var streamReader = new StreamReader(fileStream, encoding)) { + IDictionary nameValues = new Dictionary(); + while (!streamReader.EndOfStream) { + string line = streamReader.ReadLine(); + if (line == null) + { + continue; + } + string cleanLine = line.Trim(); + if (cleanLine.Length == 0 || cleanLine.StartsWith(Comment)) { + continue; + } + if (cleanLine.StartsWith(SectionStart)) { + string section = line.Replace(SectionStart, string.Empty).Replace(SectionEnd, string.Empty).Trim(); + if (!ini.TryGetValue(section, out nameValues)) + { nameValues = new Dictionary(); ini.Add(section, nameValues); + } + } else { + string[] keyvalueSplitter = line.Split(Assignment, 2); + string name = keyvalueSplitter[0]; + string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null; + if (nameValues.ContainsKey(name)) { + nameValues[name] = inivalue; } else { - string[] keyvalueSplitter = line.Split(ASSIGNMENT, 2); - string name = keyvalueSplitter[0]; - string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null; - if (nameValues.ContainsKey(name)) { - nameValues[name] = inivalue; - } else { - nameValues.Add(name, inivalue); - } + nameValues.Add(name, inivalue); } } } diff --git a/GreenshotPlugin/UnmanagedHelpers/GDI32.cs b/GreenshotPlugin/UnmanagedHelpers/GDI32.cs index f3411e245..9176b21df 100644 --- a/GreenshotPlugin/UnmanagedHelpers/GDI32.cs +++ b/GreenshotPlugin/UnmanagedHelpers/GDI32.cs @@ -369,7 +369,7 @@ namespace GreenshotPlugin.UnmanagedHelpers { bV5GreenMask = (uint)255 << 8; bV5BlueMask = 255; bV5AlphaMask = (uint)255 << 24; - bV5CSType = 1934772034; // sRGB + bV5CSType = 0x73524742; // LCS_sRGB bV5Endpoints = new CIEXYZTRIPLE { ciexyzBlue = new CIEXYZ(0),