Ejemplo n.º 1
0
        public MediaViewModel(string Name = "",
            string ArtistName = "",
            string AlbumName = "",
            Uri Path = null,
            String Length = "00:00:00")
        {
            Dictionary<String, String> tmp = new Dictionary<string, string>();
            if (Path != null)
            {
                try
                {
                    MediaInfo lol = new MediaInfo();
                    if (lol.Open(Uri.UnescapeDataString(Path.AbsolutePath)) == 1)
                    {
                        foreach (string entry in lol.Inform().Split('\n'))
                        {
                            var tokens = entry.Split(':');
                            if (tokens.Length == 2)
                                tmp[tokens[0].Trim()] = tokens[1].Trim();
                        }
                        lol.Close();
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("MediaInfo: "+ e.Message);
                }
            }

            Song = new Media(tmp.ContainsKey("Track name") ? tmp["Track name"] : "",
                            tmp.ContainsKey("Performer") ? tmp["Performer"] : "",
                            tmp.ContainsKey("Album") ? tmp["Album"] : "",
                            Path, tmp.ContainsKey("Duration") ? getLength(tmp["Duration"]) : "");
        }
Ejemplo n.º 2
0
 public MediaViewModel()
 {
     Song = new Media();
 }