From 09f5dda19f87518aaf31f122d264926167f49333 Mon Sep 17 00:00:00 2001 From: RKrom Date: Wed, 18 Aug 2010 05:39:10 +0000 Subject: [PATCH] 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 --- GreenshotCore/Configuration/CoreConfiguration.cs | 2 +- GreenshotCore/Core/ConfigHelper.cs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/GreenshotCore/Configuration/CoreConfiguration.cs b/GreenshotCore/Configuration/CoreConfiguration.cs index 7beaddd7a..a4845e475 100644 --- a/GreenshotCore/Configuration/CoreConfiguration.cs +++ b/GreenshotCore/Configuration/CoreConfiguration.cs @@ -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} /// /// Description of CoreConfiguration. diff --git a/GreenshotCore/Core/ConfigHelper.cs b/GreenshotCore/Core/ConfigHelper.cs index 645befacd..541f8e112 100644 --- a/GreenshotCore/Core/ConfigHelper.cs +++ b/GreenshotCore/Core/ConfigHelper.cs @@ -25,7 +25,7 @@ using System.Reflection; using System.Text; using System.Windows.Forms; -namespace GreenshotCore.Configuration { +namespace Greenshot.Core { /// /// 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