本文整理汇总了C#中Playlist.LoadPlaylist方法的典型用法代码示例。如果您正苦于以下问题:C# Playlist.LoadPlaylist方法的具体用法?C# Playlist.LoadPlaylist怎么用?C# Playlist.LoadPlaylist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist.LoadPlaylist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public static void Load(ref Playlist playlist)
{
if (File.Exists(_fileName))
{
try
{
_isLoading = true;
playlist.LoadPlaylist(_fileName);
}
finally
{
_isLoading = false;
}
}
}
示例2: ValidateUrl
private static void ValidateUrl(string url, string title, string genre)
{
Console.WriteLine("Trying url: {0}", url);
try
{
Uri uri = new Uri(url);
string hostName = uri.DnsSafeHost;
//if (!QueryDnsWithTimeout(hostName, 300))
//{
// Console.WriteLine("\t -> Url: {0} is not valid (DNS error)", url);
// return;
//}
List<String> urlsToCkeck = new List<string>();
if (IsPlaylist(url))
{
string fileName = Path.GetFileName(uri.LocalPath);
string tempFile = @"c:\temp.pls";
using (WebClientWithTimeout wc = new WebClientWithTimeout())
{
wc.Timeout = 500;
wc.Proxy = AppSettings.GetWebProxy();
wc.DownloadFile(uri, tempFile);
}
if (File.Exists(tempFile))
{
Playlist p = new Playlist();
p.LoadPlaylist(tempFile);
File.Delete(tempFile);
foreach (PlaylistItem item in p.AllItems)
{
urlsToCkeck.Add(item.Path);
}
}
}
else
{
urlsToCkeck.Add(url);
}
foreach(string url2 in urlsToCkeck)
{
//if (!QueryDnsWithTimeout(url2, 300))
// continue;
ShoutcastStream ss = new ShoutcastStream(url2, 500);
if (ss.Connected)
{
RadioStation rs = new RadioStation { Genre = genre, Title = title, Url = url2 };
data.RadioStations.Add(rs);
Console.WriteLine("\t -> Added radio station: {0}", url2);
ss.Close();
ss.Dispose();
ss = null;
}
}
}
catch(Exception ex)
{
Console.WriteLine("\t ->" + ex.Message);
}
Console.WriteLine("\t -> Url: {0} is not valid", url);
}