本文整理汇总了C#中Library.List.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToList方法的具体用法?C# List.ToList怎么用?C# List.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library.List
的用法示例。
在下文中一共展示了List.ToList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadAllVideos
public void DownloadAllVideos(PDownload pDownload)
{
Broadcasts broadcasts = GetBroadcasts(pDownload.User);
broadcasts.broadcasts = broadcasts.broadcasts.Where(b => b.available_for_replay || b.state == "RUNNING").ToList();
if (pDownload.IsReverseOrder) broadcasts.broadcasts.Reverse();
#region Selected Videos
List<int> selectedVideos = pDownload.SelectedVideos;
if (selectedVideos.Any())
{
List<Broadcast> selectedBroadcasts = new List<Broadcast>();
selectedBroadcasts.AddRange(selectedVideos.Select(selectedVideo => broadcasts.broadcasts[selectedVideo]));
broadcasts.broadcasts = selectedBroadcasts.ToList();
}
#endregion
#region Selected Broadcasts
List<string> selectedBroadcastsText = pDownload.SelectedBroadcasts;
if (selectedBroadcastsText.Any())
{
broadcasts.broadcasts =
selectedBroadcastsText.Select(
selectedBroadcast => broadcasts.broadcasts.First(b => b.id == selectedBroadcast)).ToList();
}
#endregion
Console.WriteLine(broadcasts.broadcasts.Count + " broadcasts found.");
foreach (var broadcast in broadcasts.broadcasts)
{
DownloadVideos(broadcast, pDownload.DownloadLiveStream);
}
}
示例2: DownloadLiveStream
private void DownloadLiveStream(Broadcast broadcast, AccessPublic accessPublic)
{
List<string> chunklist = new List<string>();
Uri httpsHlsUrl = new Uri(accessPublic.https_hls_url);
string baseUrl = httpsHlsUrl.Scheme + "://" + httpsHlsUrl.DnsSafeHost + httpsHlsUrl.Segments[0] + httpsHlsUrl.Segments[1] + httpsHlsUrl.Segments[2] + httpsHlsUrl.Segments[3];
bool liveStream = true;
while (liveStream)
{
UpdateChunklist(broadcast, baseUrl, ref chunklist, ref liveStream);
foreach (var chunk in chunklist.ToList())
{
string message;
chunklist.Remove(chunk);
DownloadChunk(broadcast, baseUrl, chunk, out message);
Console.WriteLine(message);
}
}
var pDownload = new PDownload
{
User = broadcast.username,
Broadcast = broadcast.id,
DownloadLiveStream = false
};
DownloadVideos(pDownload);
}