changed CXMLReader.cs load method to static,
removed the try catch blocks
This commit is contained in:
1 parent
9c78bbe45f
commit
a29f4fb0d6
2 files changed
+37
-74
No files matched your search
@@ -163,7 +163,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
CXMLReader xmlReader = new CXMLReader((Path.Combine(path, file)));
|
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(path, file)));
|
||||||
|
|
||||||
if (xmlReader != null)
|
if (xmlReader != null)
|
||||||
{
|
{
|
||||||
@@ -194,7 +194,7 @@ namespace Vocaluxe.Base
|
|||||||
if (coverTheme.Name != String.Empty)
|
if (coverTheme.Name != String.Empty)
|
||||||
{
|
{
|
||||||
|
|
||||||
CXMLReader xmlReader = new CXMLReader((Path.Combine(CSettings.sFolderCover, coverTheme.File)));
|
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(CSettings.sFolderCover, coverTheme.File)));
|
||||||
|
|
||||||
if (xmlReader != null)
|
if (xmlReader != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Vocaluxe.Menu
|
|||||||
get { return _Navigator; }
|
get { return _Navigator; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public CXMLReader OpenFile(string sUri)
|
public static CXMLReader OpenFile(string sUri)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -84,22 +84,16 @@ namespace Vocaluxe.Menu
|
|||||||
int results = 0;
|
int results = 0;
|
||||||
string val = string.Empty;
|
string val = string.Empty;
|
||||||
|
|
||||||
try
|
_Navigator.MoveToFirstChild();
|
||||||
{
|
iterator = _Navigator.Select(Cast);
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
iterator = _Navigator.Select(Cast);
|
|
||||||
|
|
||||||
while (iterator.MoveNext())
|
while (iterator.MoveNext())
|
||||||
{
|
|
||||||
val = iterator.Current.Value;
|
|
||||||
results++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
{
|
||||||
results = 0;
|
val = iterator.Current.Value;
|
||||||
|
results++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((results == 0) || (results > 1))
|
if ((results == 0) || (results > 1))
|
||||||
{
|
{
|
||||||
Value = DefaultValue;
|
Value = DefaultValue;
|
||||||
@@ -117,26 +111,18 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
List<string> values = new List<string>();
|
List<string> values = new List<string>();
|
||||||
|
|
||||||
try
|
_Navigator.MoveToRoot();
|
||||||
{
|
_Navigator.MoveToFirstChild();
|
||||||
_Navigator.MoveToRoot();
|
_Navigator.MoveToFirstChild();
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
|
|
||||||
while (_Navigator.Name != Cast)
|
while (_Navigator.Name != Cast)
|
||||||
_Navigator.MoveToNext();
|
_Navigator.MoveToNext();
|
||||||
|
|
||||||
_Navigator.MoveToFirstChild();
|
_Navigator.MoveToFirstChild();
|
||||||
|
|
||||||
|
values.Add(_Navigator.LocalName);
|
||||||
|
while (_Navigator.MoveToNext())
|
||||||
values.Add(_Navigator.LocalName);
|
values.Add(_Navigator.LocalName);
|
||||||
while (_Navigator.MoveToNext())
|
|
||||||
values.Add(_Navigator.LocalName);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
@@ -145,51 +131,35 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
List<string> values = new List<string>();
|
List<string> values = new List<string>();
|
||||||
|
|
||||||
try
|
_Navigator.MoveToRoot();
|
||||||
{
|
_Navigator.MoveToFirstChild();
|
||||||
_Navigator.MoveToRoot();
|
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
|
|
||||||
while (_Navigator.Name != Cast)
|
while (_Navigator.Name != Cast)
|
||||||
_Navigator.MoveToNext();
|
_Navigator.MoveToNext();
|
||||||
|
|
||||||
_Navigator.MoveToFirstChild();
|
_Navigator.MoveToFirstChild();
|
||||||
|
|
||||||
values.Add(_Navigator.LocalName);
|
values.Add(_Navigator.LocalName);
|
||||||
while (_Navigator.MoveToNext())
|
while (_Navigator.MoveToNext())
|
||||||
values.Add(_Navigator.GetAttribute(attribute, ""));
|
values.Add(_Navigator.GetAttribute(attribute, ""));
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetInnerValues(string Cast, ref List<string> Values)
|
public bool GetInnerValues(string Cast, ref List<string> Values)
|
||||||
{
|
{
|
||||||
try
|
_Navigator.MoveToRoot();
|
||||||
{
|
_Navigator.MoveToFirstChild();
|
||||||
_Navigator.MoveToRoot();
|
_Navigator.MoveToFirstChild();
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
|
|
||||||
while (_Navigator.Name != Cast)
|
while (_Navigator.Name != Cast)
|
||||||
_Navigator.MoveToNext();
|
_Navigator.MoveToNext();
|
||||||
|
|
||||||
_Navigator.MoveToFirstChild();
|
_Navigator.MoveToFirstChild();
|
||||||
|
|
||||||
|
Values.Add(_Navigator.Value);
|
||||||
|
while (_Navigator.MoveToNext())
|
||||||
Values.Add(_Navigator.Value);
|
Values.Add(_Navigator.Value);
|
||||||
while (_Navigator.MoveToNext())
|
|
||||||
Values.Add(_Navigator.Value);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -199,18 +169,11 @@ namespace Vocaluxe.Menu
|
|||||||
XPathNodeIterator iterator;
|
XPathNodeIterator iterator;
|
||||||
int results = 0;
|
int results = 0;
|
||||||
|
|
||||||
try
|
_Navigator.MoveToFirstChild();
|
||||||
{
|
iterator = _Navigator.Select(Cast);
|
||||||
_Navigator.MoveToFirstChild();
|
|
||||||
iterator = _Navigator.Select(Cast);
|
|
||||||
|
|
||||||
while (iterator.MoveNext())
|
while (iterator.MoveNext())
|
||||||
results++;
|
results++;
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
results = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (results == 0)
|
if (results == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in new issue
Block a user