本文整理汇总了C#中Playlist.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Playlist.Add方法的具体用法?C# Playlist.Add怎么用?C# Playlist.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public void Test()
{
var song1 = "song1";
var song2 = "song2";
var song3 = "song3";
var song4 = "song4";
_songs = new MusicInfo[] {
new MusicInfo() { FullPath = song1 },
new MusicInfo() { FullPath = song2 },
new MusicInfo() { FullPath = song3 },
new MusicInfo() { FullPath = song4 }
};
var library = new MemoryLibraryRepository();
library.ClearLibrary();
library.AddMusicToLibrary(_songs);
var loopingWatcher = new RandomSongPlaylistWatcher(2);
_playlist = new Playlist(loopingWatcher);
_dummyAudio = new DummyAudioInteractor();
var player = new Player(_playlist, _dummyAudio, library);
_playlist.Add(_songs[0]);
_playlist.Add(_songs[1]);
loopingWatcher.AttachToPlaylist(_playlist, library);
player.MaxPlayCount = 3;
player.Play();
}
示例2: normalize
protected override Playlist normalize(List<String> raw)
{
Playlist normalized = new Playlist();
for(int i = 0; i < raw.Count; i++)
{
string line = raw[i];
if (!line.StartsWith("#"))
{
if (File.Exists(Path.GetFullPath(pathPrefix + Path.DirectorySeparatorChar + raw[i])))
{
PlaylistItem item = new PlaylistItem(raw[i], pathPrefix);
normalized.Add(item);
}
}
}
return normalized;
}