Use attributes

This commit is contained in:
Flamefire committed 2014-10-23 17:30:56 +02:00
1 parent e01bd5da81
commit 8ac2ab9a03
2 files changed
+7 -7

No files matched your search

+3 -5
View File
@@ -6,9 +6,8 @@
<Author>flokuep</Author>
</Info>
<!--Cover definitions when a category is missing a cover-->
<CoverGenerator1>
<!--Possible types are: Default, Song, Artist, Letter, Edition, Genre, Language, Year, Decade, Date -->
<Type>Default</Type>
<!--Possible types are: Default, Song, Artist, Letter, Edition, Genre, Language, Year, Decade, Date -->
<CoverGenerator1 Type="Default">
<Text>
<!--<Text>: Text to be shown, %TEXT% will be replaced by the category or song name-->
<Text>%TEXT%</Text>
@@ -25,8 +24,7 @@
<R>1</R><G>1</G><B>1</B><A>0.8</A>
</Color>
<!--<Margin>: Spacing of the text from the borders of the image in px-->
<Margin>
<Default>24</Default>
<Margin Default="24">
<Left>24</Left>
</Margin>
<!--<Indent>: Indentation of the text for multiple lines-->
+4 -2
View File
@@ -40,7 +40,8 @@ namespace VocaluxeLib.Xml
{
el = new SMargin();
bool ok = true;
bool defOk = TryGetIntValue(xPath + "/Default", ref el.Default);
string val;
bool defOk = GetAttribute(xPath, "Default", out val) && int.TryParse(val, out el.Default);
ok &= TryGetIntValue(xPath + "/Left", ref el.Left, el.Default);
ok &= TryGetIntValue(xPath + "/Right", ref el.Right, el.Default);
ok &= TryGetIntValue(xPath + "/Top", ref el.Top, el.Default);
@@ -89,7 +90,8 @@ namespace VocaluxeLib.Xml
{
el = new SThemeCoverGenerator();
bool ok = true;
ok &= TryGetEnumValue(xPath + "/Type", ref el.Type);
string val;
ok &= GetAttribute(xPath, "Type", out val) && Enum.TryParse(val, out el.Type);
ok &= Read(xPath + "/Text", out el.Text);
ok &= Read(xPath + "/BackgroundColor", out el.BackgroundColor);
ok &= GetValue(xPath + "/Image", out el.Image);