diff --git a/Vocaluxe/Base/Fonts/CFonts.cs b/Vocaluxe/Base/Fonts/CFonts.cs index 5b9c3e34..b824d071 100644 --- a/Vocaluxe/Base/Fonts/CFonts.cs +++ b/Vocaluxe/Base/Fonts/CFonts.cs @@ -338,7 +338,7 @@ namespace Vocaluxe.Base.Fonts ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBold", out sf.FileBold); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileBoldItalic", out sf.FileBoldItalic); ok &= xmlReader.TryGetNormalizedFloatValue("//root/Fonts/Font" + i + "/Outline", ref sf.Outline); - ok &= xmlReader.TryGetColorFromRGBA("//root/Fonts/Font" + i + "/OutlineColor", out sf.OutlineColor); + ok &= xmlReader.Read("//root/Fonts/Font" + i + "/OutlineColor", out sf.OutlineColor); if (ok) { diff --git a/Vocaluxe/Base/ThemeSystem/CSkin.cs b/Vocaluxe/Base/ThemeSystem/CSkin.cs index f048821c..f4e64ac4 100644 --- a/Vocaluxe/Base/ThemeSystem/CSkin.cs +++ b/Vocaluxe/Base/ThemeSystem/CSkin.cs @@ -140,7 +140,7 @@ namespace Vocaluxe.Base.ThemeSystem for (int i = 0; i < CSettings.MaxNumPlayer; i++) { SColorF color; - if (!xmlReader.TryGetColorFromRGBA("//root/Colors/Player" + (i + 1), out color)) + if (!xmlReader.Read("//root/Colors/Player" + (i + 1), out color)) return false; _PlayerColors[i] = color; } @@ -150,7 +150,7 @@ namespace Vocaluxe.Base.ThemeSystem foreach (string str in names) { SColorF color; - if (!xmlReader.TryGetColorFromRGBA("//root/ColorSchemes/" + str, out color)) + if (!xmlReader.Read("//root/ColorSchemes/" + str, out color)) return false; _ColorSchemes.Add(str, color); } diff --git a/Vocaluxe/Base/ThemeSystem/CTheme.cs b/Vocaluxe/Base/ThemeSystem/CTheme.cs index 5aa8a0db..42e37879 100644 --- a/Vocaluxe/Base/ThemeSystem/CTheme.cs +++ b/Vocaluxe/Base/ThemeSystem/CTheme.cs @@ -151,7 +151,7 @@ namespace Vocaluxe.Base.ThemeSystem ok &= xmlReader.TryGetFloatValue("//root/Cursor/H", ref CursorTheme.H); if (!xmlReader.GetValue("//root/Cursor/Color/Name", out CursorTheme.Color.Name)) - ok &= xmlReader.TryGetColorFromRGBA("//root/Cursor/Color/Color", out CursorTheme.Color.Color); + ok &= xmlReader.Read("//root/Cursor/Color/Color", out CursorTheme.Color.Color); return ok; } diff --git a/VocaluxeLib/Xml/CXMLReader.cs b/VocaluxeLib/Xml/CXMLReader.cs index 917881da..bd58fc2e 100644 --- a/VocaluxeLib/Xml/CXMLReader.cs +++ b/VocaluxeLib/Xml/CXMLReader.cs @@ -57,17 +57,6 @@ namespace VocaluxeLib.Xml } } - public bool TryGetColorFromRGBA(string xPath, out SColorF value) - { - value = new SColorF(); - bool result = true; - result &= TryGetNormalizedFloatValue(xPath + "/R", ref value.R); - result &= TryGetNormalizedFloatValue(xPath + "/G", ref value.G); - result &= TryGetNormalizedFloatValue(xPath + "/B", ref value.B); - result &= TryGetNormalizedFloatValue(xPath + "/A", ref value.A); - return result; - } - public override bool GetValue(string xPath, out string value, string defaultValue = "") { int resultCt = 0; diff --git a/VocaluxeLib/Xml/CXmlDeserializer.cs b/VocaluxeLib/Xml/CXmlDeserializer.cs index 478bcadc..11a80d87 100644 --- a/VocaluxeLib/Xml/CXmlDeserializer.cs +++ b/VocaluxeLib/Xml/CXmlDeserializer.cs @@ -5,7 +5,7 @@ namespace VocaluxeLib.Xml public abstract class CXmlDeserializer : CXmlReaderBase { public abstract string FilePath { get; } - + public bool Read(string xPath, out SThemeFont el) { el = new SThemeFont(); @@ -69,17 +69,28 @@ namespace VocaluxeLib.Xml public bool Read(string xPath, out SInfo el) { - el=new SInfo(); - bool ok = GetValue(xPath+"/Name", out el.Name); + el = new SInfo(); + bool ok = GetValue(xPath + "/Name", out el.Name); ok &= GetValue(xPath + "/Author", out el.Author); ok &= TryGetIntValue(xPath + "/VersionMajor", ref el.VersionMajor); ok &= TryGetIntValue(xPath + "/VersionMinor", ref el.VersionMinor); return ok; } + public bool Read(string xPath, out SColorF value) + { + value = new SColorF(); + bool result = true; + result &= TryGetNormalizedFloatValue(xPath + "/R", ref value.R); + result &= TryGetNormalizedFloatValue(xPath + "/G", ref value.G); + result &= TryGetNormalizedFloatValue(xPath + "/B", ref value.B); + result &= TryGetNormalizedFloatValue(xPath + "/A", ref value.A); + return result; + } + public bool CheckVersion(string xPath, int reqVersion) { - int version=0; + int version = 0; string errorMsg; if (!TryGetIntValue(xPath, ref version)) errorMsg = "Version missing"; @@ -90,7 +101,7 @@ namespace VocaluxeLib.Xml } else return true; - CBase.Log.LogError("Cannot load "+FilePath+": "+errorMsg); + CBase.Log.LogError("Cannot load " + FilePath + ": " + errorMsg); return false; } }