Some small changes for a dirty flag in the configuration

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@811 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2010-08-18 05:39:10 +00:00
parent afc764aa41
commit 09f5dda19f
2 changed files with 8 additions and 3 deletions

View file

@ -21,7 +21,7 @@
using System;
using System.Collections.Generic;
namespace GreenshotCore.Configuration {
namespace Greenshot.Core {
public enum Destinations {Editor=1, FileDefault=2, FileWithDialog=4, Clipboard=8, Printer=16, EMail=32}
/// <summary>
/// Description of CoreConfiguration.

View file

@ -25,7 +25,7 @@ using System.Reflection;
using System.Text;
using System.Windows.Forms;
namespace GreenshotCore.Configuration {
namespace Greenshot.Core {
/// <summary>
/// Attribute for telling that this class is linked to a section in the ini-configuration
@ -61,7 +61,9 @@ namespace GreenshotCore.Configuration {
}
// Interface for
public interface IniSection {
public class IniSection {
// Flag to specify if values have been changed
public bool IsDirty = false;
}
public class IniConfig {
@ -184,6 +186,8 @@ namespace GreenshotCore.Configuration {
if (properties != null && properties.ContainsKey(propertyName)) {
propertyValue = properties[propertyName];
} 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);
}
@ -376,6 +380,7 @@ namespace GreenshotCore.Configuration {
}
}
writer.WriteLine();
section.IsDirty = false;
}
// Write left over properties