Made CXMLReader.OpenFile private so factory method has to be used

This commit is contained in:
Flamefire committed 2013-02-25 20:15:24 +01:00
1 parent 78870ae26d
commit 13e856db16
9 files changed
+33 -131

No files matched your search

+5 -16
View File
@@ -172,27 +172,16 @@ namespace Vocaluxe.Menu
{
string file = Path.Combine(XmlPath, _ThemeName + ".xml");
CXMLReader xmlReader = null;
try
{
xmlReader = new CXMLReader(file);
}
catch (Exception e)
{
if (xmlReader != null)
xmlReader = null;
CBase.Log.LogError("Error loading theme file " + file + ": " + e.Message);
}
CXMLReader xmlReader = CXMLReader.OpenFile(file);
if (xmlReader == null)
return;
bool VersionCheck = false;
if (xmlReader != null)
VersionCheck = CheckVersion(_ScreenVersion, xmlReader);
VersionCheck = CheckVersion(_ScreenVersion, xmlReader);
int SkinIndex = CBase.Theme.GetSkinIndex(_PartyModeID);
if (xmlReader != null && VersionCheck && SkinIndex != -1)
if (VersionCheck && SkinIndex != -1)
{
_ThemePath = XmlPath;
LoadThemeBasics(xmlReader, SkinIndex);
+4 -3
View File
@@ -9,7 +9,8 @@ namespace Vocaluxe.Menu
{
private XPathNavigator _Navigator;
public CXMLReader(string uri)
//Private method. Use OpenFile factory method to get an instance
private CXMLReader(string uri)
{
XPathDocument xPathDoc = new XPathDocument(uri);
_Navigator = xPathDoc.CreateNavigator();
@@ -26,9 +27,9 @@ namespace Vocaluxe.Menu
{
return new CXMLReader(sUri);
}
catch (Exception)
catch (Exception e)
{
CBase.Log.LogError("Can't open XML file: " + sUri);
CBase.Log.LogError("Can't open XML file: " + sUri + ": " + e.Message);
return null;
}
}