ADBaseLibrary.DownloadManager.Add C# (CSharp) Method

Add() public method

public Add ( EpisodeWithDownloadSettings ep, string template, string downloadpath, DownloadStatus status = DownloadStatus.Queue ) : DownloadItem
ep EpisodeWithDownloadSettings
template string
downloadpath string
status DownloadStatus
return DownloadItem
        public DownloadItem Add(EpisodeWithDownloadSettings ep, string template, string downloadpath,DownloadStatus status=DownloadStatus.Queue)
        {
            DownloadItem dinfo = null;
            lock (_downloadslock)
            {
                dinfo = new DownloadItem(ep, template, downloadpath, this, status);
                dinfo.Index = cnt++;
                dinfo.OnProgress += ((a) =>
                {
                    if (OnProgress != null)
                        OnProgress(a);
                });

                dinfo.OnFinish += ((a) =>
                {
                    Save();
                    CheckForDownload();
                });
                lock (_downloadslock)
                {
                    _downloads.Add(dinfo);
                }
            }
            CheckForDownload();
            return dinfo;
        }