public Playlist GetSomething(string some) { List<Playlist> list = new List<Playlist>(); string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); path = Path.Combine(path, "AudioStreamer"); if (Directory.Exists(path)) { var l = Directory.GetFileSystemEntries(path, "*.xml"); foreach (var s in l) { var x = s.Substring(s.LastIndexOf("\\")+1, s.Length - s.LastIndexOf("\\") - 5); Playlist p = new Playlist { FriendlyName = x, Path = s, Songs = new List<Song>()}; DataSet d = new DataSet(); DataTable Playlist = new DataTable(); d.ReadXml(s); if (d.Tables.Contains("BasePlaylist")) { Playlist = d.Tables["BasePlaylist"]; } Playlist.PrimaryKey = new[] { Playlist.Columns["Path"] }; int track; foreach (DataRow row in Playlist.Rows) { p.Songs.Add(new Song { Album = row["Album"].ToString(), Artist = row["Artist"].ToString(), Genre = row["Genre"].ToString(), StringLength = row["Length"].ToString(), Path = row["Path"].ToString().Replace("\\", "|"), Title = row["Title"].ToString(), Track = int.TryParse(row["Track"].ToString(), out track) ? track : 0 }); } list.Add(p); } } list.First().Path = list.First().Path.Replace("\\","|"); return list.First(); }
public List<Playlist> GetAllPlaylists() { List<Playlist> list = new List<Playlist>(); string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); path = Path.Combine(path, "AudioStreamer"); if (Directory.Exists(path)) { var l = Directory.GetFileSystemEntries(path, "*.xml"); foreach (var s in l) { var x = s.Substring(s.LastIndexOf("\\")+1, s.Length - s.LastIndexOf("\\") - 5); Playlist p = new Playlist { FriendlyName = x, Path = s }; list.Add(p); } } return list; }