Ejemplo n.º 1
0
        public void DoStatsUpdate(Ragnar.TorrentStatus stats)
        {
            var previous = this.StatusData;

            this.StatusData = stats;
            previous.Dispose();
            Update();
            UpdateGraphData();
        }
Ejemplo n.º 2
0
        public async Task <Torrent> SetStatus(string id, TorrentStatus status)
        {
            var torrent = await DataService.GetTorrent(id);

            torrent.Status = status;
            await DataService.UpdateTorrent(torrent);

            return(torrent);
        }
Ejemplo n.º 3
0
 /// <summary>Checks the integrity of the current file, or if it does not exists creates it. This must be called before
 /// each torrent is started</summary>
 /// <param name="callback">Delegate which is called every time a piece is checked</param>
 public void CheckFileIntegrity(bool forced)
 {
     this.status = TorrentStatus.Checking;
     if (this.StatusChanged != null)
     {
         this.StatusChanged(this, this.status);
     }
     this.downloadFile.CheckIntegrity(forced, new CheckIntegrityCallback(OnIntegrityCallback));
 }
Ejemplo n.º 4
0
        public async Task UpdateStatus(Guid torrentId, TorrentStatus status)
        {
            var dbTorrent = await _dataContext.Torrents.FirstOrDefaultAsync(m => m.TorrentId == torrentId);

            if (dbTorrent == null)
            {
                return;
            }

            dbTorrent.Status = status;

            await _dataContext.SaveChangesAsync();
        }
Ejemplo n.º 5
0
        public TorrentInfo(TorrentHandle t)
        {
            RanCommand      = false;
            this.Torrent    = t;
            this.StatusData = t.QueryStatus();

            this.MainAppWindow   = (App.Current.MainWindow as MainWindow);
            this.PickedMovieData = new IMDBSRSerializeable <IMovieDBSearchResult>();
            this.Trackers        = new ObservableCollection <TrackerInfo>();

            if (t.HasMetadata)
            {
                SetupTorrent();
            }

            PopulateTrackerList();
        }
Ejemplo n.º 6
0
 public TorrentInfo(
     string id,
     string name,
     float size,
     int percentDone,
     TorrentStatus status,
     TorrentPriority priority,
     TimeSpan timeRemaining)
 {
     Id            = id ?? throw new ArgumentNullException(nameof(id));
     Name          = name ?? throw new ArgumentNullException(nameof(name));
     SizeMegabytes = size;
     PercentDone   = percentDone;
     Status        = status;
     Priority      = priority;
     TimeRemaining = timeRemaining;
 }
Ejemplo n.º 7
0
        public TorrentDetail(
            long id, string hash, string name, TorrentStatus statusCode,
            string locationDir, int rateDownload, int rateUpload,
            int peersGettingFromUs, int peersSendingToUs,
            int peersConnected, int peersKnown, int eta,
            long downloadedEver, long uploadedEver, long totalSize,
            float partDone, float available, string label,
            DateTime dateAdded, string error)
        {
            this.id          = id;
            this.hash        = hash;
            this.name        = name;
            this.statusCode  = statusCode;
            this.locationDir = locationDir;

            this.rateDownload       = rateDownload;
            this.rateUpload         = rateUpload;
            this.peersGettingFromUs = peersGettingFromUs;
            this.peersSendingToUs   = peersSendingToUs;
            this.peersConnected     = peersConnected;
            this.peersKnown         = peersKnown;
            this.eta = eta;

            this.downloadedEver = downloadedEver;
            this.uploadedEver   = uploadedEver;
            this.totalSize      = totalSize;
            this.partDone       = partDone;
            this.available      = available;
            this.label          = label;

            this.dateAdded = dateAdded;
            DateTime dt;

            if (eta == -1 || eta == -2)
            {
                dt = new DateTime(9999, 12, 31);
            }
            else
            {
                dt = DateTime.Now.AddSeconds(eta);
            }
            this.dateDone = dt;
            this.error    = error;
        }
Ejemplo n.º 8
0
        /// <summary>Starts the torrent</summary>
        public void Start()
        {
            this.status = TorrentStatus.Working;
            if (this.StatusChanged != null)
            {
                this.StatusChanged(this, this.status);
            }

            // scrape the tracker to find out info
            TrackerProtocol.Scrape(this.infofile, out this.seedCount, out this.leecherCount, out this.finishedCount);

            DefaultDownloadStrategy defaultStrategy = new DefaultDownloadStrategy(this.mDownloadStrategy);

            this.mDownloadStrategy.AddNewStrategy(defaultStrategy);
            this.mDownloadStrategy.SetActiveStrategy(defaultStrategy);

            // then tell the tracker we are starting/resuming a download
            this.tp.Initiate();
        }
Ejemplo n.º 9
0
        public bool DownloadingOrQueued(TorrentStatus status, bool finished)
        {
            if (finished)
            {
                return(false);
            }

            if ((status & TorrentStatus.Started) != 0)
            {
                if ((status & TorrentStatus.Paused) == 0)
                {
                    return(true);
                }
            }
            else if ((status & TorrentStatus.Queued) != 0)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 10
0
        public void AddTorrentFromFile()
        {
            try
            {
                if (!IsDisposed)
                {
                    byte[] bytes = File.ReadAllBytes(torrentFilePath);
                    ti = new TorrentInfo(bytes);
                    using (cMainForm.session)
                    {
                        cMainForm.session.ListenOn(6881, 6889);

                        #region Torrent Parameters
                        AddTorrentParams addParams = new AddTorrentParams();

                        if (unlimitedDownloadSpeed == false)
                        {
                            addParams.DownloadLimit = maxDownloadSpeed * 1024;//Transform byte to kB
                        }
                        if (unlimitedUploadSpeed == false)
                        {
                            addParams.UploadLimit = maxUploadSpeed * 1024;
                        }

                        addParams.TorrentInfo = ti;
                        addParams.SavePath    = string.Concat(saveFilePath, @"\", ti.Name); //This is weird, check it out later

                        string resumeFile = Path.ChangeExtension(torrentFilePath, "resume");
                        if (File.Exists(resumeFile))
                        {
                            addParams.ResumeData = File.ReadAllBytes(resumeFile);// Loading the resume data will load all torrents settings
                        }
                        #endregion

                        // Add a torrent to the session and get a `TorrentHandle` in return. There is only one session that contains many handles.
                        handle = cMainForm.session.AddTorrent(addParams);
                        handle.SetPriority(128);

                        if (handle.NeedSaveResumeData() == true)
                        {
                            SaveResumeData();
                        }

                        SetLimitString();

                        cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.AddToMainList(ti.Name, ti.TotalSize, torrentIndex));

                        while (true)
                        {
                            if (pause == true)
                            {
                                PauseHandle();
                            }
                            else if (handle.IsPaused == true && pause == false)
                            {
                                ResumeHandle();
                            }

                            // Get a `TorrentStatus` instance from the handle.
                            TorrentStatus          status = handle.QueryStatus();
                            IEnumerable <PeerInfo> connectedPeers;
                            connectedPeers = handle.GetPeerInfo();

                            if (status.IsSeeding)
                            {
                                break;
                            }

                            elapsedTime   = status.ActiveTime;
                            downloaded    = status.Progress * 100;
                            uploaded      = status.TotalUpload * 100;
                            uploadSpeed   = status.UploadRate;
                            downloadSpeed = status.DownloadRate;
                            currentStatus = status.State.ToString();

                            UpdateProgressBar(downloaded);
                            if (connectedPeers.Count() > 0 && cMainForm.mainForm.mainToolStripBottom.SelectedIndex == 2)//2 is client tab
                            {
                                cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.AddToClientList(connectedPeers, torrentIndex));
                            }

                            if (cMainForm.mainForm.mainToolStripBottom.SelectedIndex == 0)//0 is info tab
                            {
                                cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.UpdateInfoTabData(downloaded.ToString(), uploaded.ToString(), uploadSpeed, downloadSpeed, formattedDownLimit, formattedUpLimit, currentStatus, elapsedTime.ToString(), torrentIndex));
                            }
                            ;

                            cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.EditMainList(downloaded.ToString(), uploadSpeed, downloadSpeed, currentStatus, torrentIndex));
                            Thread.Sleep(100);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "AddTorrentFromFile -- " + ex, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Download a movie
        /// </summary>
        /// <param name="movie">The movie to download</param>
        private async Task DownloadMovie(MovieFullDetails movie)
        {
            using (Session session = new Session())
            {
                IsDownloadingMovie = true;

                // Inform subscribers we're actually loading a movie
                OnDownloadingMovie(new EventArgs());

                // Listening to a port which is randomly between 6881 and 6889
                session.ListenOn(6881, 6889);

                var addParams = new AddTorrentParams
                {
                    // Where do we save the video file
                    SavePath = Constants.MovieDownloads,
                    // At this time, no quality selection is available in the interface, so we take the lowest
                    Url = movie.Torrents.Aggregate((i1, i2) => (i1.SizeBytes < i2.SizeBytes ? i1 : i2)).Url
                };

                TorrentHandle handle = session.AddTorrent(addParams);
                // We have to download sequentially, so that we're able to play the movie without waiting
                handle.SequentialDownload = true;

                bool alreadyBuffered = false;

                while (IsDownloadingMovie)
                {
                    TorrentStatus status   = handle.QueryStatus();
                    double        progress = status.Progress * 100.0;

                    // Inform subscribers of our progress
                    OnLoadingMovieProgress(new MovieLoadingProgressEventArgs(progress, status.DownloadRate / 1024));

                    // We consider 2% of progress is enough to start playing
                    if (progress >= Constants.MinimumBufferingBeforeMoviePlaying && !alreadyBuffered)
                    {
                        try
                        {
                            // We're looking for video file
                            foreach (string directory in Directory.GetDirectories(Constants.MovieDownloads))
                            {
                                foreach (
                                    string filePath in
                                    Directory.GetFiles(directory, "*" + Constants.VideoFileExtension)
                                    )
                                {
                                    // Inform subscribers we have finished buffering the movie
                                    OnBufferedMovie(new MovieBufferedEventArgs(filePath));
                                    alreadyBuffered = true;
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.Message);
                        }
                    }
                    // Let sleep for a second before updating the torrent status
                    await Task.Delay(1000, CancellationDownloadingToken.Token).ContinueWith(_ =>
                    {
                        if (CancellationDownloadingToken.IsCancellationRequested && session != null)
                        {
                            OnStoppedDownloadingMovie(new EventArgs());
                            IsDownloadingMovie = false;
                            session.RemoveTorrent(handle, true);
                        }
                    }).ConfigureAwait(false);
                }
            }
        }
Ejemplo n.º 12
0
        private bool UpdateValuesFromStringArray(string[] InputValues, bool NewTorrent)
        {
            bool ReturnChanged           = false;
            bool CallFinishedDownloading = false;
            bool CallStarted             = false;
            bool CallStopped             = false;
            bool CallPaused   = false;
            bool CallUnPaused = false;

            if (InputValues.Length < 19)
            {
                throw new FormatException("The array of torrent data was not in the expected format, it contains less than 19 elements.");
            }
            if (Hash != InputValues[0])
            {
                Hash          = InputValues[0];
                ReturnChanged = true;
            }
            if (StatusCode != int.Parse(InputValues[1]))
            {
                TorrentStatus NewStatus = (TorrentStatus)int.Parse(InputValues[1]);
                if (((NewStatus & TorrentStatus.Paused) == TorrentStatus.Paused) && ((Status & TorrentStatus.Paused) != TorrentStatus.Paused) && !NewTorrent)
                {
                    CallPaused = true;
                }
                if (((NewStatus & TorrentStatus.Paused) != TorrentStatus.Paused) && ((Status & TorrentStatus.Paused) == TorrentStatus.Paused) && !NewTorrent)
                {
                    CallUnPaused = true;
                }
                if (((NewStatus & TorrentStatus.Started) == TorrentStatus.Started) && ((Status & TorrentStatus.Started) != TorrentStatus.Started) && !NewTorrent)
                {
                    CallStarted = true;
                }
                if (((NewStatus & TorrentStatus.Started) != TorrentStatus.Started) && ((Status & TorrentStatus.Started) == TorrentStatus.Started) && !NewTorrent)
                {
                    CallStopped = true;
                }
                StatusCode    = int.Parse(InputValues[1]);
                ReturnChanged = true;
            }
            if (Name != InputValues[2])
            {
                Name          = InputValues[2];
                ReturnChanged = true;
            }
            if (SizeTotalBytes != long.Parse(InputValues[3]))
            {
                SizeTotalBytes = long.Parse(InputValues[3]);
                ReturnChanged  = true;
            }
            if (ProgressTenthsPercent != int.Parse(InputValues[4]))
            {
                ProgressTenthsPercent = int.Parse(InputValues[4]);
                if (ProgressTenthsPercent < 1000 && int.Parse(InputValues[4]) == 1000 && !NewTorrent)
                {
                    CallFinishedDownloading = true;
                }
                ReturnChanged = true;
            }
            if (SizeDownloadedBytes != long.Parse(InputValues[5]))
            {
                SizeDownloadedBytes = long.Parse(InputValues[5]);
                ReturnChanged       = true;
            }
            if (SizeUploadedBytes != long.Parse(InputValues[6]))
            {
                SizeUploadedBytes = long.Parse(InputValues[6]);
                ReturnChanged     = true;
            }
            if (SeedRatioTenthsPercent != int.Parse(InputValues[7]))
            {
                SeedRatioTenthsPercent = int.Parse(InputValues[7]);
                ReturnChanged          = true;
            }
            if (SpeedUploadBytes != long.Parse(InputValues[8]))
            {
                SpeedUploadBytes = long.Parse(InputValues[8]);
                ReturnChanged    = true;
            }
            if (SpeedDownloadBytes != long.Parse(InputValues[9]))
            {
                SpeedDownloadBytes = long.Parse(InputValues[9]);
                ReturnChanged      = true;
            }
            if (TimeEstimateSeconds != long.Parse(InputValues[10]))
            {
                TimeEstimateSeconds = long.Parse(InputValues[10]);
                ReturnChanged       = true;
            }
            if (Label != InputValues[11])
            {
                Label         = InputValues[11];
                ReturnChanged = true;
            }
            if (PeersConnected != int.Parse(InputValues[12]))
            {
                PeersConnected = int.Parse(InputValues[12]);
                ReturnChanged  = true;
            }
            if (PeersTotal != int.Parse(InputValues[13]))
            {
                PeersTotal    = int.Parse(InputValues[13]);
                ReturnChanged = true;
            }
            if (SeedsConnected != int.Parse(InputValues[14]))
            {
                SeedsConnected = int.Parse(InputValues[14]);
                ReturnChanged  = true;
            }
            if (SeedsTotal != int.Parse(InputValues[15]))
            {
                SeedsTotal    = int.Parse(InputValues[15]);
                ReturnChanged = true;
            }
            if (AvailabilityFraction != long.Parse(InputValues[16]))
            {
                AvailabilityFraction = long.Parse(InputValues[16]);
                ReturnChanged        = true;
            }
            if (QueueOrder != int.Parse(InputValues[17]))
            {
                QueueOrder    = int.Parse(InputValues[17]);
                ReturnChanged = true;
            }
            if (SizeRemainingBytes != long.Parse(InputValues[18]))
            {
                SizeRemainingBytes = long.Parse(InputValues[18]);
                ReturnChanged      = true;
            }
            if (CallFinishedDownloading)
            {
                ParentCollection.ParentClient.CallEvent(UTorrentWebClient.EventType.FinishedDownloading, this);
            }
            if (CallPaused)
            {
                ParentCollection.ParentClient.CallEvent(UTorrentWebClient.EventType.Paused, this);
            }
            if (CallUnPaused)
            {
                ParentCollection.ParentClient.CallEvent(UTorrentWebClient.EventType.UnPaused, this);
            }
            if (CallStarted)
            {
                ParentCollection.ParentClient.CallEvent(UTorrentWebClient.EventType.Started, this);
            }
            if (CallStopped)
            {
                ParentCollection.ParentClient.CallEvent(UTorrentWebClient.EventType.Stopped, this);
            }
            return(ReturnChanged);
        }
Ejemplo n.º 13
0
		/// <summary>Starts the torrent</summary>
		public void Start()
		{
			this.status = TorrentStatus.Working;
			if (this.StatusChanged != null)
				this.StatusChanged(this, this.status);

			// scrape the tracker to find out info
			TrackerProtocol.Scrape(this.infofile, out this.seedCount, out this.leecherCount, out this.finishedCount);

			DefaultDownloadStrategy defaultStrategy = new DefaultDownloadStrategy( this.mDownloadStrategy );
			this.mDownloadStrategy.AddNewStrategy( defaultStrategy );
			this.mDownloadStrategy.SetActiveStrategy( defaultStrategy );

			// then tell the tracker we are starting/resuming a download
			this.tp.Initiate();
		}
Ejemplo n.º 14
0
		/// <summary>Checks the integrity of the current file, or if it does not exists creates it. This must be called before
		/// each torrent is started</summary>
		/// <param name="callback">Delegate which is called every time a piece is checked</param>
		public void CheckFileIntegrity( bool forced )
		{
			this.status = TorrentStatus.Checking;
			if (this.StatusChanged != null)
				this.StatusChanged(this, this.status);
			this.downloadFile.CheckIntegrity( forced, new CheckIntegrityCallback( OnIntegrityCallback ) );
		}
Ejemplo n.º 15
0
        /// <summary>
        /// Updates the torrent stats.
        /// </summary>
        /// <param name="torrent">The torrent.</param>
        /// <param name="status">The status.</param>
        private void UpdateTorrentStats(TorrentEntity torrent, TorrentStatus status)
        {
            torrent.DownSpeed = GeneralMethods.NumberToSpeed(status.DownloadRate);
            torrent.UpSpeed   = GeneralMethods.NumberToSpeed(status.UploadRate);
            torrent.Progress  = status.Progress * 100;
            torrent.Seeds     = status.NumSeeds;
            torrent.Peers     = status.NumPeers;

            switch (status.State)
            {
            case TorrentState.Downloading:
                torrent.State = string.Format(NumberFormatInfo.InvariantInfo, " {0} {1:0.0} %",
                                              "Downloading", torrent.Progress);
                break;

            case TorrentState.CheckingFiles:
                torrent.State = "Checking files";
                break;

            case TorrentState.CheckingResumeData:
                torrent.State = "Checking resume data";
                break;

            case TorrentState.DownloadingMetadata:
                torrent.State = "Downloading metadata";
                break;

            case TorrentState.QueuedForChecking:
                torrent.State = "Queued for checking";
                break;

            default:
                torrent.State = status.State.ToString();
                break;
            }

            if (status.DownloadRate > 0)
            {
                var timeSpan = new TimeSpan(0, 0,
                                            (int)((status.TotalWanted - status.TotalDone) / status.DownloadRate));
                if (timeSpan.TotalDays > 1)
                {
                    torrent.Eta = $"{timeSpan.TotalDays:0} days {timeSpan.Hours:0} hours";
                }
                else if (timeSpan.TotalHours > 1)
                {
                    torrent.Eta = $"{timeSpan.TotalHours:0} hours {timeSpan.Minutes:0} minutes";
                }
                else if (timeSpan.TotalMinutes > 1)
                {
                    torrent.Eta = $"{timeSpan.TotalMinutes:0} minutes {timeSpan.Seconds:0} seconds";
                }
                else if (timeSpan.TotalSeconds > 1)
                {
                    torrent.Eta = $"{timeSpan.TotalSeconds:0} seconds";
                }
            }

            if (status.IsFinished && !torrent.HasFinishedOnce)
            {
                PerformTorrentFinishedActivities(torrent);
            }
        }
Ejemplo n.º 16
0
 public void ChangeSavePath(string newpath, TorrentHandle.MoveFlags flags = TorrentHandle.MoveFlags.DontReplace)
 {
     this.Torrent.MoveStorage(newpath, flags);
     this.StatusData = this.Torrent.QueryStatus();
 }
Ejemplo n.º 17
0
        public void AddTorrentFromMagnet()
        {
            try
            {
                if (!IsDisposed)
                {
                    using (cMainForm.session)
                    {
                        MagnetLink magnet = null;
                        try { magnet = new MagnetLink(magnetLink); }
                        catch { MessageBox.Show("Invalid magnet link", "Error"); return; }

                        cMainForm.session.ListenOn(6881, 6889);

                        #region Torrent Parameters
                        AddTorrentParams addParams = new AddTorrentParams();

                        if (unlimitedDownloadSpeed == false)
                        {
                            addParams.DownloadLimit = maxDownloadSpeed * 1024;//Transform byte to kB
                        }
                        if (unlimitedUploadSpeed == false)
                        {
                            addParams.UploadLimit = maxUploadSpeed * 1024;
                        }

                        if (magnet.Name != null)
                        {
                            addParams.Name = magnet.Name;
                        }

                        addParams.Url      = magnetLink;
                        addParams.SavePath = saveFilePath; //This is weird, check it out later
                        #endregion

                        // Add a torrent to the session and get a `TorrentHandle` in return. There is only one session that contains many handles.
                        handle = cMainForm.session.AddTorrent(addParams);
                        handle.SetPriority(128);
                        SetLimitString();

                        cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.AddToMainList(magnet.Name, handle.QueryStatus().TotalPayloadDownload, torrentIndex)); //ti doesn't exist here, you need to use info hash to get the name and size
                        while (true)
                        {
                            if (pause == true)
                            {
                                PauseHandle();
                            }
                            else if (handle.IsPaused == true && pause == false)
                            {
                                ResumeHandle();
                            }

                            // Get a `TorrentStatus` instance from the handle.
                            TorrentStatus          status = handle.QueryStatus();
                            IEnumerable <PeerInfo> connectedPeers;
                            connectedPeers = handle.GetPeerInfo();

                            if (status.IsSeeding) //If download is finished
                            {
                                break;
                            }

                            elapsedTime   = status.ActiveTime;
                            downloaded    = status.Progress * 100;
                            uploadSpeed   = status.UploadRate;
                            downloadSpeed = status.DownloadRate;
                            currentStatus = status.State.ToString();

                            UpdateProgressBar(downloaded);

                            if (connectedPeers.Count() > 0 && cMainForm.mainForm.mainToolStripBottom.SelectedIndex == 2)//2 is client tab
                            {
                                cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.AddToClientList(connectedPeers, torrentIndex));
                            }

                            if (cMainForm.mainForm.mainToolStripBottom.SelectedIndex == 0)//0 is info tab
                            {
                                cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.UpdateInfoTabData(downloaded.ToString(), uploaded.ToString(), uploadSpeed, downloadSpeed, formattedDownLimit, formattedUpLimit, currentStatus, elapsedTime.ToString(), torrentIndex));
                            }

                            if (cMainForm.mainForm.mainToolStripBottom.SelectedIndex == 1)                                                    //1 is file tab
                            {
                                cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.AddFilesToList(GetFilePriorities(), torrentIndex)); //Should send list of files instead of priorities but i don't know how to get the files :(
                            }
                            cMainForm.mainForm.RunOnUIThread(() => cMainForm.mainForm.EditMainList(downloaded.ToString(), uploadSpeed, downloadSpeed, currentStatus, torrentIndex));
                            Thread.Sleep(1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "AddTorrentFromMagnet -- " + ex, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 18
0
        public bool DownloadingOrQueued(TorrentStatus status, bool finished)
        {
            if (finished)
                return false;

            if ((status & TorrentStatus.Started) != 0)
            {
                if ((status & TorrentStatus.Paused) == 0)
                    return true;
            }
            else if ((status & TorrentStatus.Queued) != 0)
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 19
0
        public async Task <IActionResult> Disable(string id, TorrentStatus status)
        {
            await this.TorrentRepository.SetStatus(id, status);

            return(Redirect("/Torrents"));
        }
Ejemplo n.º 20
0
 public async Task <IEnumerable <Torrent> > GetTorrentsForStatus(TorrentStatus status)
 {
     return(await DataService.GetTorrents(t => t.Status == status));
 }
Ejemplo n.º 21
0
 public async Task UpdateStatus(Guid torrentId, TorrentStatus status)
 {
     await _torrentData.UpdateStatus(torrentId, status);
 }