some error handling for theme loading

This commit is contained in:
Alexander Eckart committed 2012-04-07 14:26:37 +02:00
1 parent 8fd6594e19
commit 85055dfd20
1 file changed
+18
+18
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.XPath; using System.Xml.XPath;
@@ -168,6 +169,8 @@ namespace Vocaluxe.Base
List<string> keys = new List<string>(_Skins[index].SkinList.Keys); List<string> keys = new List<string>(_Skins[index].SkinList.Keys);
foreach (string name in keys) foreach (string name in keys)
{
try
{ {
CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty); CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty);
SkinElement sk = _Skins[index].SkinList[name]; SkinElement sk = _Skins[index].SkinList[name];
@@ -176,9 +179,18 @@ namespace Vocaluxe.Base
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value)); sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
_Skins[index].SkinList[name] = sk; _Skins[index].SkinList[name] = sk;
} }
catch (Exception e)
{
MessageBox.Show("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
CLog.LogError("Error on loading texture \"" + name + "\": " + e.Message + e.StackTrace);
}
}
// load videos // load videos
for (int i = 0; i < _Skins[index].VideoList.Count; i++) for (int i = 0; i < _Skins[index].VideoList.Count; i++)
{
try
{ {
CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty); CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
SkinElement sk = new SkinElement(); SkinElement sk = new SkinElement();
@@ -190,6 +202,12 @@ namespace Vocaluxe.Base
sk.Texture = new STexture(-1); sk.Texture = new STexture(-1);
_Skins[index].VideoList[i] = sk; _Skins[index].VideoList[i] = sk;
} }
catch (Exception e)
{
MessageBox.Show("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
CLog.LogError("Error on loading video \"" + _Skins[index].VideoList[i].Name + "\": " + e.Message + e.StackTrace);
}
}
// load colors // load colors
LoadColors(navigator, index); LoadColors(navigator, index);