Added CXMLReader for all XML-reading operations
Added GetIntValueRange to force a value to be in a specific range
This commit is contained in:
1 parent
1a644ab22c
commit
506d98bd3c
30 files changed
+1107
-1302
No files matched your search
@@ -4,7 +4,6 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Vocaluxe.Menu
|
||||
{
|
||||
@@ -55,28 +54,28 @@ namespace Vocaluxe.Menu
|
||||
#endregion Constructors
|
||||
|
||||
#region public
|
||||
public bool LoadTheme(string XmlPath, string ElementName, XPathNavigator navigator, int SkinIndex)
|
||||
public bool LoadTheme(string XmlPath, string ElementName, CXMLReader xPathHelper, int SkinIndex)
|
||||
{
|
||||
string item = XmlPath + "/" + ElementName;
|
||||
_ThemeLoaded = true;
|
||||
|
||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EBackgroundTypes>(item + "/Type", navigator, ref _Theme.Type);
|
||||
_ThemeLoaded &= xPathHelper.TryGetEnumValue<EBackgroundTypes>(item + "/Type", ref _Theme.Type);
|
||||
|
||||
bool vid = CHelper.GetValueFromXML(item + "/Video", navigator, ref _Theme.VideoName, String.Empty);
|
||||
bool tex = CHelper.GetValueFromXML(item + "/Skin", navigator, ref _Theme.TextureName, String.Empty);
|
||||
bool vid = xPathHelper.GetValue(item + "/Video", ref _Theme.VideoName, String.Empty);
|
||||
bool tex = xPathHelper.GetValue(item + "/Skin", ref _Theme.TextureName, String.Empty);
|
||||
_ThemeLoaded &= vid || tex || _Theme.Type == EBackgroundTypes.None;
|
||||
|
||||
if (CHelper.GetValueFromXML(item + "/Color", navigator, ref _Theme.ColorName, String.Empty))
|
||||
if (xPathHelper.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
|
||||
{
|
||||
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = true;
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/R", navigator, ref Color.R);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/G", navigator, ref Color.G);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/B", navigator, ref Color.B);
|
||||
success &= CHelper.TryGetFloatValueFromXML(item + "/A", navigator, ref Color.A);
|
||||
success &= xPathHelper.TryGetFloatValue(item + "/R", ref Color.R);
|
||||
success &= xPathHelper.TryGetFloatValue(item + "/G", ref Color.G);
|
||||
success &= xPathHelper.TryGetFloatValue(item + "/B", ref Color.B);
|
||||
success &= xPathHelper.TryGetFloatValue(item + "/A", ref Color.A);
|
||||
|
||||
if (_Theme.Type != EBackgroundTypes.None)
|
||||
_ThemeLoaded &= success;
|
||||
|
||||
Reference in new issue
Block a user