예제 #1
0
 public Song(string name, string author, CustomTimeSpan duration, string path)
 {
     Name     = name;
     Author   = author;
     Duration = duration;
     Path     = path;
 }
예제 #2
0
        public List <Song> GetSongs()
        {
            List <Song> songList = new List <Song>();

            foreach (FileInfo sf in SongFiles)
            {
                if (!sf.Exists)
                {
                    continue;
                }
                string fullPath = sf.FullName;
                var    tfile    = TagLib.File.Create(@$ "{fullPath}");
                string title    = tfile.Tag.Title != null ?
                                  tfile.Tag.Title : sf.Name;
                string author = tfile.Tag.FirstPerformer != null ?
                                tfile.Tag.FirstPerformer : "Unknown";
                CustomTimeSpan duration = new CustomTimeSpan(tfile.Properties.Duration);
                songList.Add(new Song(title, author, duration, fullPath));
            }
            return(songList);
        }