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


C# List.Remove方法代码示例

本文整理汇总了C#中Library.List.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# List.Remove方法的具体用法?C# List.Remove怎么用?C# List.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library.List的用法示例。


在下文中一共展示了List.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveUri

        private bool RemoveUri(string uri)
        {
            lock (_thisLock)
            {
                lock (_amoebaManager.ThisLock)
                {
                    var baseNode = _amoebaManager.BaseNode;

                    var uris = new List<string>(baseNode.Uris);
                    if (!uris.Remove(uri)) return false;

                    _amoebaManager.SetBaseNode(new Node(baseNode.Id, uris));
                }
            }

            return true;
        }
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:17,代码来源:OverlayNetworkManager.cs

示例2: PlayMovie

        public bool PlayMovie()
        {
            _info = _source.DVDDiskInfo;

            string videoFile = FindMPeg(_source);
            if (videoFile == null && _info != null)
            {
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] PlayMovie: DVD Disk info: '{0}'", _info);
                DVDTitle dvdTitle = _source.DVDTitle;
                if (dvdTitle != null)
                {
                    string videoTSDir = _source.VIDEO_TS;
                    int fileID = int.Parse(dvdTitle.File.Substring(4));
                    OMLApplication.DebugLine("[MoviePlayerExtenderDVD] PlayMovie: main title fileID={1} found for '{0}'", _source, fileID);
                    string vts = string.Format("VTS_{0:D2}_", fileID);
                    List<string> vobs = new List<string>(Directory.GetFiles(videoTSDir, vts + "*.VOB"));
                    vobs.Remove(Path.Combine(videoTSDir, vts + "0.VOB"));

                    if (vobs.Count < 1)
                    {
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] PlayMovie: no VOB files found for '{0}'", _source);
                        return false;
                    }

                    string mpegFolder = Path.Combine(FileSystemWalker.ExtenderCacheDirectory, Guid.NewGuid().ToString());
                    if (Directory.Exists(mpegFolder) == false)
                    {
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] PlayMovie: creating folder '{0}'", mpegFolder);
                        Directory.CreateDirectory(mpegFolder);
                    }

                    if (vobs.Count == 1)
                    {
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Single VOB file, trying to use a hard-link approach and direct playback");
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Calling MakeMPEGLink on WCF Transcoder Service");
                        string mpegFile = transcoder.MakeMPEGLink(mpegFolder, vobs[0]);
                        if (File.Exists(mpegFile))
                        {
                            OMLApplication.DebugLine("[MoviePlayerExtenderDVD] directly use MPEG");
                            videoFile = mpegFile;
                        }
                    }
                    else if (OMLSettings.Extender_MergeVOB)
                    {
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Multiple VOB files, and Extender_MergeVOB == true, trying to use a hard-link and auto-merge into single large .VOB file approach ");
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Calling MakeMPEGLink on WCF Transcoder Service");
                        string mpegFile = transcoder.MakeMPEGLink(mpegFolder, vobs[0]);
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Merge VOB's, use first VOB to play and merge into");

                        if (File.Exists(mpegFile) == false)
                            return false;

                        videoFile = mpegFile;

                        Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(delegate
                        {
                            FileStream writer = null;
                            try
                            {
                                writer = File.Open(vobs[0], FileMode.Append, FileAccess.Write, FileShare.Read);
                                for (int i = 1; i < vobs.Count; ++i)
                                    MergeFile(writer, vobs[0], vobs[i]);

                                for (int i = 1; i < vobs.Count; ++i)
                                {
                                    OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Deleting '{0}'", vobs[i]);
                                    File.Delete(vobs[i]);
                                }
                            }
                            finally
                            {
                                if (writer != null)
                                {
                                    OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Done merging into '{0}'", vobs[0]);
                                    writer.Close();
                                }
                            }
                        }, delegate
                        {
                            Utilities.DebugLine("[MoviePlayerExtenderDVD] Merging done, restart play, and reset posision");
                            if (AddInHost.Current.MediaCenterEnvironment.MediaExperience != null)
                            {
                                TimeSpan cur = AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.Position;
                                Utilities.DebugLine("[MoviePlayerExtenderDVD] Current position: {0}", cur);
                                if (AddInHost.Current.MediaCenterEnvironment.PlayMedia(MediaType.Video, videoFile, false))
                                {
                                    AddInHost.Current.MediaCenterEnvironment.MediaExperience.Transport.Position = cur;
                                    Utilities.DebugLine("[MoviePlayerExtenderDVD] Done starting over, resetting position: {0}", cur);
                                }
                            }
                        }, null);
                    }
                    //else if (OMLSettings.Extender_UseAsx)
                    else
                    {
                        OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Multiple VOB files, and Extender_UseAsx == true, trying to use a hard-link and asx playlist approach ");
                        foreach (string vob in vobs) {
                            OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Calling MakeMPEGLink on WCF Transcoder Service");
                            transcoder.MakeMPEGLink(mpegFolder, vob);
                        }
//.........这里部分代码省略.........
开发者ID:peeboo,项目名称:open-media-library,代码行数:101,代码来源:MoviePlayerExtenderDVD.cs

示例3: FindMPeg

        public static string FindMPeg(MediaSource source)
        {
            DVDTitle dvdTitle = source.DVDTitle;
            if (dvdTitle == null)
                return null;

            // ensure DVD's with DTS audio get transcoded, since extenders don't support DTS audio playback
            if (dvdTitle.AudioTracks.Count > 0 && dvdTitle.AudioTracks[0].Format == AudioEncoding.DTS)
                return null;

            string videoTSDir = source.VIDEO_TS;
            int fileID = int.Parse(dvdTitle.File.Substring(4));
            string vts = string.Format("VTS_{0:D2}_", fileID);
            List<string> vobs = new List<string>(Directory.GetFiles(videoTSDir, vts + "*.VOB"));
            vobs.Remove(Path.Combine(videoTSDir, vts + "0.VOB"));

            // don't direct play unmerged .VOB files
            if (vobs.Count < 1 || vobs.Count > 1)
                return null;

            if (IsNTFS(videoTSDir))
            {
                string mpegFolder = Path.Combine(FileSystemWalker.ExtenderCacheDirectory, Guid.NewGuid().ToString());

                if (Directory.Exists(mpegFolder) == false)
                    Directory.CreateDirectory(mpegFolder);
                if (Directory.Exists(mpegFolder) == false)
                    return null;

                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Attempting to connect to WCF Transcoder Service");
                TranscodingAPI transcoder = new TranscodingAPI(source, null);
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Calling MakeMPEGLink on WCF Transcoder Service");
                string mpegFile = transcoder.MakeMPEGLink(mpegFolder, vobs[0]);
                if (File.Exists(mpegFile))
                    return mpegFile;
            }
            else if (videoTSDir.StartsWith("\\\\"))
            {
                string mpegFile = Path.ChangeExtension(source.GetTranscodingFileName(), ".MPEG");
                if (File.Exists(mpegFile))
                {
                    OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Found '{0}' as pre-existing .MPEG soft-link", mpegFile);
                    return mpegFile;
                }

                string vob = Path.Combine(videoTSDir, vobs[0]);
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Trying to create '{0}' soft-link to '{1}'", mpegFile, vob);

                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Attempting to connect to WCF Transcoder Service");
                TranscodingAPI transcoder = new TranscodingAPI(source, null);
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Calling CreateSymbolicLink on WCF Transcoder Service");
                bool ret = transcoder.CreateSymbolicLink(mpegFile, vob);
                string retMsg = ret ? "success" : "Sym-Link failed: " + new Win32Exception(Marshal.GetLastWin32Error()).Message;

                if (File.Exists(mpegFile))
                    return mpegFile;
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Soft-link creation failed! {0}", retMsg);
            }
            else
            {
                OMLApplication.DebugLine("[MoviePlayerExtenderDVD] Media not on a network drive nor on a NTFS compatible drive, no supported");
            }

            return null;
        }
开发者ID:peeboo,项目名称:open-media-library,代码行数:65,代码来源:MoviePlayerExtenderDVD.cs

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