Merge branch 'release/1.2.9' into feature/backport_win10_OCR_share

This commit is contained in:
Robin 2016-09-30 21:48:54 +02:00
commit a27a55ae79
5 changed files with 57 additions and 46 deletions

View file

@ -34,12 +34,12 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup> <ItemGroup>
<Reference Include="Dapplo.HttpExtensions, Version=0.5.36.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Dapplo.HttpExtensions, Version=0.5.43.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.HttpExtensions.0.5.36\lib\net45\Dapplo.HttpExtensions.dll</HintPath> <HintPath>..\packages\Dapplo.HttpExtensions.0.5.43\lib\net45\Dapplo.HttpExtensions.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Dapplo.Jira, Version=0.1.61.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Dapplo.Jira, Version=0.1.65.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapplo.Jira.0.1.61\lib\net45\Dapplo.Jira.dll</HintPath> <HintPath>..\packages\Dapplo.Jira.0.1.65\lib\net45\Dapplo.Jira.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Dapplo.Log.Facade, Version=0.5.4.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Dapplo.Log.Facade, Version=0.5.4.0, Culture=neutral, processorArchitecture=MSIL">

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Dapplo.HttpExtensions" version="0.5.36" targetFramework="net45" /> <package id="Dapplo.HttpExtensions" version="0.5.43" targetFramework="net45" />
<package id="Dapplo.Jira" version="0.1.61" targetFramework="net45" /> <package id="Dapplo.Jira" version="0.1.65" targetFramework="net45" />
<package id="Dapplo.Log.Facade" version="0.5.4" targetFramework="net45" /> <package id="Dapplo.Log.Facade" version="0.5.4" targetFramework="net45" />
<package id="LibZ.Tool" version="1.2.0.0" targetFramework="net45" /> <package id="LibZ.Tool" version="1.2.0.0" targetFramework="net45" />
<package id="Svg" version="2.2.1" targetFramework="net45" /> <package id="Svg" version="2.2.1" targetFramework="net45" />

View file

@ -51,17 +51,17 @@ namespace Greenshot.IniFile {
/// <summary> /// <summary>
/// A Dictionary with all the sections stored by section name /// A Dictionary with all the sections stored by section name
/// </summary> /// </summary>
private static readonly Dictionary<string, IniSection> SectionMap = new Dictionary<string, IniSection>(); private static readonly IDictionary<string, IniSection> SectionMap = new Dictionary<string, IniSection>();
/// <summary> /// <summary>
/// A Dictionary with the properties for a section stored by section name /// A Dictionary with the properties for a section stored by section name
/// </summary> /// </summary>
private static Dictionary<string, Dictionary<string, string>> _sections = new Dictionary<string, Dictionary<string, string>>(); private static IDictionary<string, IDictionary<string, string>> _sections = new Dictionary<string, IDictionary<string, string>>();
/// <summary> /// <summary>
/// A Dictionary with the fixed-properties for a section stored by section name /// A Dictionary with the fixed-properties for a section stored by section name
/// </summary> /// </summary>
private static Dictionary<string, Dictionary<string, string>> _fixedProperties; private static IDictionary<string, IDictionary<string, string>> _fixedProperties;
/// <summary> /// <summary>
/// Stores if we checked for portable /// Stores if we checked for portable
@ -231,7 +231,7 @@ namespace Greenshot.IniFile {
/// </summary> /// </summary>
public static void Reload() { public static void Reload() {
// Clear the current properties // Clear the current properties
_sections = new Dictionary<string, Dictionary<string, string>>(); _sections = new Dictionary<string, IDictionary<string, string>>();
// Load the defaults // Load the defaults
Read(CreateIniLocation(_configName + DefaultsPostfix + IniExtension, true)); Read(CreateIniLocation(_configName + DefaultsPostfix + IniExtension, true));
// Load the normal // Load the normal
@ -264,7 +264,7 @@ namespace Greenshot.IniFile {
{ {
return; return;
} }
Dictionary<string, string> fixedPropertiesForSection; IDictionary<string, string> fixedPropertiesForSection;
if (!_fixedProperties.TryGetValue(section.IniSectionAttribute.Name, out fixedPropertiesForSection)) if (!_fixedProperties.TryGetValue(section.IniSectionAttribute.Name, out fixedPropertiesForSection))
{ {
return; return;
@ -280,23 +280,23 @@ namespace Greenshot.IniFile {
/// Read the ini file into the Dictionary /// Read the ini file into the Dictionary
/// </summary> /// </summary>
/// <param name="iniLocation">Path & Filename of ini file</param> /// <param name="iniLocation">Path & Filename of ini file</param>
private static Dictionary<string, Dictionary<string, string>> Read(string iniLocation) { private static IDictionary<string, IDictionary<string, string>> Read(string iniLocation) {
if (!File.Exists(iniLocation)) { if (!File.Exists(iniLocation)) {
Log.Info("Can't find file: " + iniLocation); Log.Info("Can't find file: " + iniLocation);
return null; return null;
} }
Log.InfoFormat("Loading ini-file: {0}", iniLocation); Log.InfoFormat("Loading ini-file: {0}", iniLocation);
//LOG.Info("Reading ini-properties from file: " + iniLocation); //LOG.Info("Reading ini-properties from file: " + iniLocation);
Dictionary<string, Dictionary<string, string>> newSections = IniReader.read(iniLocation, Encoding.UTF8); var newSections = IniReader.Read(iniLocation, Encoding.UTF8);
// Merge the newly loaded properties to the already available // Merge the newly loaded properties to the already available
foreach(string section in newSections.Keys) { foreach(string section in newSections.Keys) {
Dictionary<string, string> newProperties = newSections[section]; IDictionary<string, string> newProperties = newSections[section];
if (!_sections.ContainsKey(section)) { if (!_sections.ContainsKey(section)) {
// This section is not yet loaded, simply add the complete section // This section is not yet loaded, simply add the complete section
_sections.Add(section, newProperties); _sections.Add(section, newProperties);
} else { } else {
// Overwrite or add every property from the newly loaded section to the available one // Overwrite or add every property from the newly loaded section to the available one
Dictionary<string, string> currentProperties = _sections[section]; var currentProperties = _sections[section];
foreach(string propertyName in newProperties.Keys) { foreach(string propertyName in newProperties.Keys) {
string propertyValue = newProperties[propertyName]; string propertyValue = newProperties[propertyName];
if (currentProperties.ContainsKey(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); 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 // Write section name
writer.WriteLine("[{0}]", sectionName); writer.WriteLine("[{0}]", sectionName);
Dictionary<string, string> properties = _sections[sectionName]; var properties = _sections[sectionName];
// Loop and write properties // Loop and write properties
foreach (string propertyName in properties.Keys) { foreach (string propertyName in properties.Keys) {
writer.WriteLine("{0}={1}", propertyName, properties[propertyName]); writer.WriteLine("{0}={1}", propertyName, properties[propertyName]);

View file

@ -24,33 +24,45 @@ using System.IO;
using System.Text; using System.Text;
namespace Greenshot.IniFile { namespace Greenshot.IniFile {
/// <summary>
///
/// </summary>
public static class IniReader { public static class IniReader {
private const string SECTION_START = "["; private const string SectionStart = "[";
private const string SECTION_END = "]"; private const string SectionEnd = "]";
private const string COMMENT = ";"; private const string Comment = ";";
private static readonly char[] ASSIGNMENT = new[] { '=' }; private static readonly char[] Assignment = { '=' };
/** /// <summary>
* Read an ini file to a Dictionary, each key is a section and the value is a Dictionary with name and values. /// Read an ini file to a Dictionary, each key is a section and the value is a Dictionary with name and values.
*/ /// </summary>
public static Dictionary<string, Dictionary<string, string>> read(string path, Encoding encoding) { /// <param name="path"></param>
Dictionary<string, Dictionary<string, string>> ini = new Dictionary<string, Dictionary<string, string>>(); /// <param name="encoding"></param>
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024)) { /// <returns></returns>
using (StreamReader reader = new StreamReader(fileStream, encoding)) { public static IDictionary<string, IDictionary<string, string>> Read(string path, Encoding encoding) {
Dictionary<string, string> nameValues = new Dictionary<string, string>(); var ini = new Dictionary<string, IDictionary<string, string>>();
while (!reader.EndOfStream) { using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 1024)) {
string line = reader.ReadLine(); using (var streamReader = new StreamReader(fileStream, encoding)) {
if (line != null) { IDictionary<string, string> nameValues = new Dictionary<string, string>();
string cleanLine = line.Trim(); while (!streamReader.EndOfStream) {
if (cleanLine.Length == 0 || cleanLine.StartsWith(COMMENT)) { string line = streamReader.ReadLine();
if (line == null)
{
continue; continue;
} }
if (cleanLine.StartsWith(SECTION_START)) { string cleanLine = line.Trim();
string section = line.Replace(SECTION_START, "").Replace(SECTION_END, "").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<string, string>(); nameValues = new Dictionary<string, string>();
ini.Add(section, nameValues); ini.Add(section, nameValues);
}
} else { } else {
string[] keyvalueSplitter = line.Split(ASSIGNMENT, 2); string[] keyvalueSplitter = line.Split(Assignment, 2);
string name = keyvalueSplitter[0]; string name = keyvalueSplitter[0];
string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null; string inivalue = keyvalueSplitter.Length > 1 ? keyvalueSplitter[1] : null;
if (nameValues.ContainsKey(name)) { if (nameValues.ContainsKey(name)) {
@ -62,7 +74,6 @@ namespace Greenshot.IniFile {
} }
} }
} }
}
return ini; return ini;
} }
} }

View file

@ -369,7 +369,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
bV5GreenMask = (uint)255 << 8; bV5GreenMask = (uint)255 << 8;
bV5BlueMask = 255; bV5BlueMask = 255;
bV5AlphaMask = (uint)255 << 24; bV5AlphaMask = (uint)255 << 24;
bV5CSType = 1934772034; // sRGB bV5CSType = 0x73524742; // LCS_sRGB
bV5Endpoints = new CIEXYZTRIPLE bV5Endpoints = new CIEXYZTRIPLE
{ {
ciexyzBlue = new CIEXYZ(0), ciexyzBlue = new CIEXYZ(0),