Merge remote-tracking branch 'remotes/origin/master' into release/1.2.9

This commit is contained in:
Robin 2016-05-24 13:13:48 +02:00
commit 0323705513
276 changed files with 5382 additions and 3666 deletions

View file

@ -31,11 +31,11 @@ namespace Greenshot.IniFile {
/// A container to be able to pass the value from a IniSection around.
/// </summary>
public class IniValue {
private static ILog LOG = LogManager.GetLogger(typeof(IniValue));
private PropertyInfo propertyInfo;
private FieldInfo fieldInfo;
private IniSection containingIniSection;
private IniPropertyAttribute attributes;
private static readonly ILog LOG = LogManager.GetLogger(typeof(IniValue));
private readonly PropertyInfo propertyInfo;
private readonly FieldInfo fieldInfo;
private readonly IniSection containingIniSection;
private readonly IniPropertyAttribute attributes;
public IniValue(IniSection containingIniSection, PropertyInfo propertyInfo, IniPropertyAttribute iniPropertyAttribute) {
this.containingIniSection = containingIniSection;
@ -216,7 +216,7 @@ namespace Greenshot.IniFile {
// Get all the values.
while ((bool)moveNext.Invoke(enumerator, null)) {
var key = current.Invoke(enumerator, null);
var valueObject = item.GetValue(myValue, new object[] { key });
var valueObject = item.GetValue(myValue, new[] { key });
// Write to ini file!
writer.WriteLine("{0}.{1}={2}", attributes.Name, ConvertValueToString(valueType1, key, attributes.Separator), ConvertValueToString(valueType2, valueObject, attributes.Separator));
}
@ -293,7 +293,7 @@ namespace Greenshot.IniFile {
LOG.Warn(ex);
//LOG.Error("Problem converting " + stringValue + " to type " + type2.FullName, e);
}
addMethodInfo.Invoke(dictionary, new object[] { newValue1, newValue2 });
addMethodInfo.Invoke(dictionary, new[] { newValue1, newValue2 });
addedElements = true;
}
}
@ -370,7 +370,7 @@ namespace Greenshot.IniFile {
string arraySeparator = separator;
object list = Activator.CreateInstance(valueType);
// Logic for List<>
string[] arrayValues = valueString.Split(new string[] { arraySeparator }, StringSplitOptions.None);
string[] arrayValues = valueString.Split(new[] { arraySeparator }, StringSplitOptions.None);
if (arrayValues == null || arrayValues.Length == 0) {
return list;
}
@ -385,7 +385,7 @@ namespace Greenshot.IniFile {
LOG.Warn("Problem converting " + arrayValue + " to type " + valueType.FullName, ex);
}
if (newValue != null) {
addMethodInfo.Invoke(list, new object[] { newValue });
addMethodInfo.Invoke(list, new[] { newValue });
}
}
}
@ -394,7 +394,7 @@ namespace Greenshot.IniFile {
//LOG.Debug("No convertor for " + fieldType.ToString());
if (valueType == typeof(object) && valueString.Length > 0) {
//LOG.Debug("Parsing: " + valueString);
string[] values = valueString.Split(new Char[] { ':' });
string[] values = valueString.Split(new[] { ':' });
//LOG.Debug("Type: " + values[0]);
//LOG.Debug("Value: " + values[1]);
Type fieldTypeForValue = Type.GetType(values[0], true);