diff -r b489c2756a13 -r 8af72b302e0a src/FingersDance.Control.ListVideo/ListVideo.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.ListVideo/ListVideo.cs Fri Sep 25 03:38:22 2009 +0200 @@ -0,0 +1,51 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.Serialization; +using System.Reflection; + +namespace FingersDance.Control.ListVideo +{ + public class ListVideo + { + static Dictionary _Videos; + + public ListVideo() + { } + + public Dictionary GetVideos() + { + if (_Videos == null) + { + _Videos = new Dictionary(); + LoadList(); + } + return _Videos; + } + + void LoadList() + { + _Videos.Clear(); + StreamReader reader = null; + FileInfo assemblyPath = new FileInfo(Assembly.GetExecutingAssembly().Location); + DirectoryInfo info = assemblyPath.Directory; + try + { + reader = new StreamReader(info.FullName.ToString() + "\\Resources\\videos.xml"); + XmlSerializer serializer = new XmlSerializer(typeof(List)); + List temp = (List)serializer.Deserialize(reader); + foreach (ListVideoItem elt in temp) + if (!elt.Preview.Equals("") && !_Videos.ContainsKey(elt.Path)) + _Videos.Add(elt.Path, elt); + reader.Close(); + } + catch (Exception e) + { + if (reader != null) + reader.Close(); + } + } + } +}