Esempio n. 1
0
        public async Task <Download.Download> AddNew(Download.Download download)
        {
            if (download is UriDownload uriDownload)
            {
                var response = await _aria2Serivce.AddUri(uriDownload.Uris);

                uriDownload.Status.Gid = response.Result;
                return(uriDownload);
            }

            if (download is TorrentDownload torrentDownload)
            {
                var response = await _aria2Serivce.AddUri(null);

                torrentDownload.Status.Gid = response.Result;
                return(torrentDownload);
            }

            if (download is MetalinkDownload metalinkDownload)
            {
                var response = await _aria2Serivce.AddUri(null);

                metalinkDownload.Status.Gid = response.Result;
                return(metalinkDownload);
            }
            throw new ArgumentOutOfRangeException();
        }
Esempio n. 2
0
        public async Task <Download.Download> UpdateStatus(Download.Download download)
        {
            var response = await _aria2Serivce.TellStatus(download.Status.Gid);

            download.Status = response.Result;
            return(download);
        }
Esempio n. 3
0
        public async Task <Download.Download> Resume(Download.Download download)
        {
            var response = await _aria2Serivce.Unpause(download.Status.Gid);

            if (response.Result == "OK")
            {
                return(download);
            }
            return(null);
        }