// Media File // // Douglas Thrift // // $Id$ using Shell32; using System.IO; public class MediaFile { public string artist { get { return artist_; } } public string title { get { return title_; } } public string album { get { return album_; } } public string genre { get { return genre_; } } public MediaFile(FileInfo file) { file_ = file; Shell shell = new ShellClass(); Folder folder = shell.NameSpace(file.DirectoryName); FolderItem item = folder.ParseName(file.Name); if (item != null) { artist_ = folder.GetDetailsOf(item, 9); title_ = folder.GetDetailsOf(item, 10); album_ = folder.GetDetailsOf(item, 17); genre_ = folder.GetDetailsOf(item, 20); } } public long Get(out Stream stream) { stream = file_.OpenRead(); return file_.Length; } private FileInfo file_; private string artist_, title_, album_, genre_; }