/// <summary> /// synchronously prepare a youtube-dl command /// </summary> /// <param name="ydl"> /// The client. /// </param> /// <param name="cancellationToken"> /// The cancellation token /// </param> /// <returns> /// The youtube-dl command that will be executed /// </returns> internal static string PrepareDownload(this YoutubeDL ydl, CancellationToken cancellationToken) { if (!ydl.Info.set) { Delegate[] originalDelegates = null; if (ydl.Info.propertyChangedEvent != null) { originalDelegates = ydl.Info.propertyChangedEvent.GetInvocationList(); } ydl.Info = InfoService.GetDownloadInfo(ydl, cancellationToken) ?? new DownloadInfo(); if (originalDelegates != null) { foreach (Delegate del in originalDelegates) { ydl.Info.PropertyChanged += (PropertyChangedEventHandler)del; } } ydl.Info.set = true; } SetupPrepare(ydl); return(ydl.RunCommand); }
/// <summary> /// synchronously prepare a youtube-dl command /// </summary> /// <param name="ydl"> /// The client. /// </param> /// <returns> /// The youtube-dl command that will be executed /// </returns> internal static string PrepareDownload(this YoutubeDL ydl) { if (ydl.Info == null) { ydl.Info = InfoService.GetDownloadInfo(ydl) ?? new DownloadInfo(); } SetupPrepare(ydl); return(ydl.RunCommand); }