1 |
// Media File |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
using Shell32; |
8 |
using System.IO; |
9 |
|
10 |
public class MediaFile |
11 |
{ |
12 |
public string artist { get { return artist_; } } |
13 |
public string title { get { return title_; } } |
14 |
public string album { get { return album_; } } |
15 |
public string genre { get { return genre_; } } |
16 |
|
17 |
public MediaFile(FileInfo file) |
18 |
{ |
19 |
file_ = file; |
20 |
|
21 |
Shell shell = new ShellClass(); |
22 |
Folder folder = shell.NameSpace(file.DirectoryName); |
23 |
FolderItem item = folder.ParseName(file.Name); |
24 |
|
25 |
if (item != null) |
26 |
{ |
27 |
artist_ = folder.GetDetailsOf(item, 9); |
28 |
title_ = folder.GetDetailsOf(item, 10); |
29 |
album_ = folder.GetDetailsOf(item, 17); |
30 |
genre_ = folder.GetDetailsOf(item, 20); |
31 |
} |
32 |
} |
33 |
|
34 |
public long Get(out Stream stream) |
35 |
{ |
36 |
stream = file_.OpenRead(); |
37 |
|
38 |
return file_.Length; |
39 |
} |
40 |
|
41 |
private FileInfo file_; |
42 |
private string artist_, title_, album_, genre_; |
43 |
} |