Changed some more properties, now I have a way so supply "defaults" which aren't constants

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@856 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-08-24 10:49:48 +00:00
parent 8eafe91ce0
commit 2a1ef29b84
8 changed files with 53 additions and 19 deletions

View file

@ -61,10 +61,21 @@ namespace Greenshot.Core {
}
}
// Interface for
public class IniSection {
// Flag to specify if values have been changed
/// <summary>
/// Base class for all IniSections
/// </summary>
public abstract class IniSection {
/// Flag to specify if values have been changed
public bool IsDirty = false;
/// <summary>
/// Supply values we can't put as defaults
/// </summary>
/// <param name="property">The property to return a default for</param>
/// <returns>string with the default value for the supplied property</returns>
public virtual string GetDefault(string property) {
return null;
}
}
public class IniConfig {
@ -179,8 +190,12 @@ namespace Greenshot.Core {
} else {
// Mark as dirty, we didn't use properties from the file (even defaults from the default file are allowed)
section.IsDirty = true;
propertyValue = iniPropertyAttribute.DefaultValue;
LOG.Debug("Using default property for " + propertyName + " : " + propertyValue);
if (iniPropertyAttribute.DefaultValue != null) {
propertyValue = iniPropertyAttribute.DefaultValue;
} else {
propertyValue = section.GetDefault(propertyName);
}
LOG.Debug("Using default: " + propertyName + "=" + propertyValue);
}
// Get the type, or the underlying type for nullables