当前位置: 首页>>代码示例>>C#>>正文


C# List.ToList方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:suphero,项目名称:PDownloader,代码行数:32,代码来源:VideoDownloader.cs

示例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);
        }
开发者ID:suphero,项目名称:PDownloader,代码行数:27,代码来源:VideoDownloader.cs


注:本文中的Library.List.ToList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。