public static DownloadController Create(DownloadControllerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.DownloadPath == null)
            {
                throw new ArgumentNullException(nameof(options.DownloadPath));
            }
            options.DownloadingPath ??= options.DownloadPath + options.DownloadingExtension;
            options.DownloadingInfoPath ??= options.DownloadPath + options.DownloadingInfoExtension;

            var downloadData = Load(options);

            options.Uri ??= downloadData.Uri ?? throw new ArgumentNullException(nameof(options.Uri));
            var ret = new DownloadController(options, downloadData);

            if (!options.IsStopped)
            {
                ret.Init().GetAwaiter();
            }
            return(ret);
        }
示例#2
0
 public DownloadStateChangedEventArgs(DownloadController sender)
 {
     DownloadController = sender;
 }