mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Creating a branch 1.1 where I will try to make the 1.1.7 build available, this means I need to merge some changes from 2.0 to here.
This commit is contained in:
parent
2a8e2475d8
commit
a03bc31aef
247 changed files with 6986 additions and 8233 deletions
|
@ -65,6 +65,42 @@ namespace Greenshot.IniFile {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true when the value is for experts
|
||||
/// </summary>
|
||||
public bool IsExpert {
|
||||
get {
|
||||
if (attributes != null) {
|
||||
return attributes.Expert;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
set {
|
||||
if (attributes != null) {
|
||||
attributes.Expert = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return true when the value is can be changed by the GUI
|
||||
/// </summary>
|
||||
public bool IsEditable {
|
||||
get {
|
||||
return !IsFixed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true when the value is visible in the GUI
|
||||
/// </summary>
|
||||
public bool IsVisible {
|
||||
get {
|
||||
return !IsExpert;
|
||||
}
|
||||
}
|
||||
|
||||
public MemberInfo MemberInfo {
|
||||
get {
|
||||
if (propertyInfo == null) {
|
||||
|
@ -195,14 +231,6 @@ namespace Greenshot.IniFile {
|
|||
public void SetValueFromProperties(Dictionary<string, string> properties) {
|
||||
string propertyName = attributes.Name;
|
||||
string defaultValue = attributes.DefaultValue;
|
||||
|
||||
// Get the value from the ini file, if there is none take the default
|
||||
if (!properties.ContainsKey(propertyName) && defaultValue != null) {
|
||||
// Mark as dirty, we didn't use properties from the file (even defaults from the default file are allowed)
|
||||
containingIniSection.IsDirty = true;
|
||||
//LOG.Debug("Passing default: " + propertyName + "=" + propertyDefaultValue);
|
||||
}
|
||||
|
||||
string propertyValue = null;
|
||||
if (properties.ContainsKey(propertyName) && properties[propertyName] != null) {
|
||||
propertyValue = containingIniSection.PreCheckValue(propertyName, properties[propertyName]);
|
||||
|
@ -308,10 +336,14 @@ namespace Greenshot.IniFile {
|
|||
Value = defaultValueFromConfig;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Value = Activator.CreateInstance(ValueType);
|
||||
} catch (Exception) {
|
||||
LOG.WarnFormat("Couldn't create instance of {0} for {1}, using default value.", ValueType.FullName, attributes.Name);
|
||||
if (ValueType != typeof(string)) {
|
||||
try {
|
||||
Value = Activator.CreateInstance(ValueType);
|
||||
} catch (Exception) {
|
||||
LOG.WarnFormat("Couldn't create instance of {0} for {1}, using default value.", ValueType.FullName, attributes.Name);
|
||||
Value = default(ValueType);
|
||||
}
|
||||
} else {
|
||||
Value = default(ValueType);
|
||||
}
|
||||
}
|
||||
|
@ -329,6 +361,9 @@ namespace Greenshot.IniFile {
|
|||
if (valueType == typeof(string)) {
|
||||
return valueString;
|
||||
}
|
||||
if (string.IsNullOrEmpty(valueString)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(List<>)) {
|
||||
string arraySeparator = separator;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue