changed CXMLReader.cs load method to static,

removed the try catch blocks
This commit is contained in:
Alexander Eckart committed 2013-02-22 20:39:48 +01:00
1 parent 9c78bbe45f
commit a29f4fb0d6
2 files changed
+4 -41

No files matched your search

+2 -2
View File
@@ -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)
{ {
+2 -39
View File
@@ -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,8 +84,6 @@ namespace Vocaluxe.Menu
int results = 0; int results = 0;
string val = string.Empty; string val = string.Empty;
try
{
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
iterator = _Navigator.Select(Cast); iterator = _Navigator.Select(Cast);
@@ -94,11 +92,7 @@ namespace Vocaluxe.Menu
val = iterator.Current.Value; val = iterator.Current.Value;
results++; results++;
} }
}
catch (Exception)
{
results = 0;
}
if ((results == 0) || (results > 1)) if ((results == 0) || (results > 1))
{ {
@@ -117,8 +111,6 @@ namespace Vocaluxe.Menu
{ {
List<string> values = new List<string>(); List<string> values = new List<string>();
try
{
_Navigator.MoveToRoot(); _Navigator.MoveToRoot();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
@@ -132,12 +124,6 @@ namespace Vocaluxe.Menu
while (_Navigator.MoveToNext()) while (_Navigator.MoveToNext())
values.Add(_Navigator.LocalName); values.Add(_Navigator.LocalName);
}
catch (Exception)
{
}
return values; return values;
} }
@@ -145,8 +131,6 @@ namespace Vocaluxe.Menu
{ {
List<string> values = new List<string>(); List<string> values = new List<string>();
try
{
_Navigator.MoveToRoot(); _Navigator.MoveToRoot();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
@@ -159,18 +143,10 @@ namespace Vocaluxe.Menu
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.MoveToRoot();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
@@ -185,12 +161,6 @@ namespace Vocaluxe.Menu
while (_Navigator.MoveToNext()) while (_Navigator.MoveToNext())
Values.Add(_Navigator.Value); 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(); _Navigator.MoveToFirstChild();
iterator = _Navigator.Select(Cast); 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;