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
+33 -15
+33 -15
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;
@@ -169,26 +170,43 @@ namespace Vocaluxe.Base
foreach (string name in keys) foreach (string name in keys)
{ {
CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty); try
SkinElement sk = _Skins[index].SkinList[name]; {
sk.Value = value; CHelper.GetValueFromXML("//root/Skins/" + name, navigator, ref value, String.Empty);
sk.VideoIndex = -1; SkinElement sk = _Skins[index].SkinList[name];
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value)); sk.Value = value;
_Skins[index].SkinList[name] = sk; sk.VideoIndex = -1;
sk.Texture = CDraw.AddTexture(Path.Combine(_Skins[index].Path, sk.Value));
_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++)
{ {
CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty); try
SkinElement sk = new SkinElement(); {
sk.Name = _Skins[index].VideoList[i].Name; CHelper.GetValueFromXML("//root/Videos/" + _Skins[index].VideoList[i].Name, navigator, ref value, String.Empty);
sk.Value = value; SkinElement sk = new SkinElement();
sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value)); sk.Name = _Skins[index].VideoList[i].Name;
CVideo.VdSetLoop(sk.VideoIndex, true); sk.Value = value;
CVideo.VdPause(sk.VideoIndex); sk.VideoIndex = CVideo.VdLoad(Path.Combine(_Skins[index].Path, sk.Value));
sk.Texture = new STexture(-1); CVideo.VdSetLoop(sk.VideoIndex, true);
_Skins[index].VideoList[i] = sk; CVideo.VdPause(sk.VideoIndex);
sk.Texture = new STexture(-1);
_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