diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 22e7286e..7453602d 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -348,8 +348,14 @@ namespace Vocaluxe.Base }; } + private static readonly List _CommentsGot = new List(); + private static string _GetComment(string elName) { + // Avoid multiple comments (e.g. for array entries) + if (_CommentsGot.Contains(elName)) + return null; + _CommentsGot.Add(elName); switch (elName) { case "DebugLevel": @@ -467,6 +473,7 @@ namespace Vocaluxe.Base public static void SaveConfig() { + _CommentsGot.Clear(); var xml = new CXmlSerializer(true, _GetComment); xml.Serialize(_FileConfig, Config); } diff --git a/VocaluxeLib/Xml/CXmlSerializer.cs b/VocaluxeLib/Xml/CXmlSerializer.cs index c8ee2cc4..46b44539 100644 --- a/VocaluxeLib/Xml/CXmlSerializer.cs +++ b/VocaluxeLib/Xml/CXmlSerializer.cs @@ -63,7 +63,7 @@ namespace VocaluxeLib.Xml /// Type of the value /// Object to write /// When true, value will be written as an attribute to the currently open node, otherwhise it will create a new node - /// >Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name + /// Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name /// If set, an attribute 'name' with this value will be written private void _WriteValue(XmlWriter writer, string name, Type type, object value, bool isAttribute, string arrayItemName = null, string nameAttribute = null) {