Avoid multiple comments in xml for array entries
This commit is contained in:
1 parent
c64d7c5bab
commit
cd4c010f99
2 files changed
+8
-1
No files matched your search
@@ -348,8 +348,14 @@ namespace Vocaluxe.Base
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly List<string> _CommentsGot = new List<string>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace VocaluxeLib.Xml
|
||||
/// <param name="type">Type of the value</param>
|
||||
/// <param name="value">Object to write</param>
|
||||
/// <param name="isAttribute">When true, value will be written as an attribute to the currently open node, otherwhise it will create a new node</param>
|
||||
/// <param name="arrayItemName">>Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name</param>
|
||||
/// <param name="arrayItemName">Name of the sub nodes for array types(Array,List,Dictionary), can be set by XmlArrayItemAttribute and defaults to the type name</param>
|
||||
/// <param name="nameAttribute">If set, an attribute 'name' with this value will be written</param>
|
||||
private void _WriteValue(XmlWriter writer, string name, Type type, object value, bool isAttribute, string arrayItemName = null, string nameAttribute = null)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user