Add checking for required elements

This commit is contained in:
Flamefire committed 2014-10-10 02:03:07 +02:00
1 parent 4efd670747
commit c1866c0ad5
6 files changed
+132 -16

No files matched your search

+15 -1
View File
@@ -1,4 +1,7 @@
using System.Linq;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace VocaluxeLib.Xml
{
@@ -88,6 +91,17 @@ namespace VocaluxeLib.Xml
return result;
}
public bool Read(string xPath, List<string> value)
{
Debug.Assert(value != null);
string val;
if (!GetValue(xPath, out val))
return false;
string[] entries = val.Split(new string[] {"\r\n", "\n"}, StringSplitOptions.RemoveEmptyEntries);
value.AddRange(entries.Select(s => s.Trim()).Where(s => !string.IsNullOrEmpty(s)));
return true;
}
public bool CheckVersion(string xPath, int reqVersion)
{
int version = 0;