Esempio n. 1
0
            /// <summary>
            /// Opens properties window
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void PropertiesToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Torrent           t = (Torrent)dataGridView.SelectedRows[0].Tag;
                TorrentProperties f = new TorrentProperties(t, false);

                f.ShowDialog();
            }
Esempio n. 2
0
 public AddRSSFeed()
 {
     InitializeComponent();
     this.Filters      = new ObservableCollection <Services.RSS.RssFilter>();
     this.RemoveEvent  = new RoutedEventHandler(this.Filters_Remove);
     this.DownloadPath = App.Settings.DefaultDownloadPath;
     this.ManualUpdateIntervalSeconds = "120";
     this.DefaultTorrentProperties    = Utility.CloneObject(TorrentProperties.DefaultTorrentProperties);
     this.DataContext = new NiceDataContext <AddRSSFeed>(this);
 }
Esempio n. 3
0
        public async Task <TorrentProperties> TorrentProperties(String hash)
        {
            var savePath = await AppDefaultSavePath();

            var torrent = await _torrents.GetByHash(hash);

            if (torrent == null)
            {
                return(null);
            }

            var result = new TorrentProperties
            {
                AdditionDate           = torrent.RdAdded.ToUnixTimeSeconds(),
                Comment                = "RealDebridClient <https://github.com/rogerfar/rdt-client>",
                CompletionDate         = torrent.RdEnded?.ToUnixTimeSeconds() ?? -1,
                CreatedBy              = "RealDebridClient <https://github.com/rogerfar/rdt-client>",
                CreationDate           = torrent.RdAdded.ToUnixTimeSeconds(),
                DlLimit                = -1,
                DlSpeed                = torrent.RdSpeed ?? 0,
                DlSpeedAvg             = torrent.RdSpeed ?? 0,
                Eta                    = 0,
                LastSeen               = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                NbConnections          = 0,
                NbConnectionsLimit     = 100,
                Peers                  = 0,
                PeersTotal             = 2,
                PieceSize              = torrent.Files.Count > 0 ? torrent.RdSize / torrent.Files.Count : 0,
                PiecesHave             = torrent.Downloads.Count(m => m.Status == DownloadStatus.Finished),
                PiecesNum              = torrent.Files.Count,
                Reannounce             = 0,
                SavePath               = savePath,
                SeedingTime            = 1,
                Seeds                  = 100,
                SeedsTotal             = 100,
                ShareRatio             = 9999,
                TimeElapsed            = (Int64)(torrent.RdAdded - DateTimeOffset.UtcNow).TotalMinutes,
                TotalDownloaded        = (Int64)(torrent.RdSize * (torrent.RdProgress / 100.0)),
                TotalDownloadedSession = (Int64)(torrent.RdSize * (torrent.RdProgress / 100.0)),
                TotalSize              = torrent.RdSize,
                TotalUploaded          = (Int64)(torrent.RdSize * (torrent.RdProgress / 100.0)),
                TotalUploadedSession   = (Int64)(torrent.RdSize * (torrent.RdProgress / 100.0)),
                TotalWasted            = 0,
                UpLimit                = -1,
                UpSpeed                = torrent.RdSpeed ?? 0,
                UpSpeedAvg             = torrent.RdSpeed ?? 0
            };

            return(result);
        }
 public TorrentPropertiesViewModel(TorrentProperties wrappedObject)
 {
     _wrappedObject = wrappedObject ?? throw new ArgumentNullException(nameof(wrappedObject));
 }
Esempio n. 5
0
        public async Task <TorrentProperties> TorrentProperties(String hash)
        {
            var savePath = await AppDefaultSavePath();

            var torrent = await _torrents.GetByHash(hash);

            if (torrent == null)
            {
                return(null);
            }

            if (!String.IsNullOrWhiteSpace(torrent.Category))
            {
                savePath = Path.Combine(savePath, torrent.Category);
            }

            var bytesDone  = torrent.RdProgress;
            var bytesTotal = torrent.RdSize;
            var speed      = torrent.RdSpeed ?? 0;

            if (torrent.Downloads.Count > 0)
            {
                bytesDone  = torrent.Downloads.Sum(m => m.BytesDone);
                bytesTotal = torrent.Downloads.Sum(m => m.BytesTotal);
                speed      = (Int32)torrent.Downloads.Average(m => m.Speed);
            }

            var result = new TorrentProperties
            {
                AdditionDate           = torrent.Added.ToUnixTimeSeconds(),
                Comment                = "RealDebridClient <https://github.com/rogerfar/rdt-client>",
                CompletionDate         = torrent.Completed?.ToUnixTimeSeconds() ?? -1,
                CreatedBy              = "RealDebridClient <https://github.com/rogerfar/rdt-client>",
                CreationDate           = torrent.Added.ToUnixTimeSeconds(),
                DlLimit                = -1,
                DlSpeed                = speed,
                DlSpeedAvg             = speed,
                Eta                    = 0,
                LastSeen               = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
                NbConnections          = 0,
                NbConnectionsLimit     = 100,
                Peers                  = 0,
                PeersTotal             = 2,
                PieceSize              = bytesTotal,
                PiecesHave             = torrent.Downloads.Count(m => m.Completed.HasValue),
                PiecesNum              = torrent.Downloads.Count,
                Reannounce             = 0,
                SavePath               = savePath,
                SeedingTime            = 1,
                Seeds                  = 100,
                SeedsTotal             = 100,
                ShareRatio             = 9999,
                TimeElapsed            = (Int64)(DateTimeOffset.UtcNow - torrent.Added).TotalSeconds,
                TotalDownloaded        = bytesTotal,
                TotalDownloadedSession = bytesTotal,
                TotalSize              = bytesTotal,
                TotalUploaded          = bytesTotal,
                TotalUploadedSession   = bytesTotal,
                TotalWasted            = 0,
                UpLimit                = -1,
                UpSpeed                = speed,
                UpSpeedAvg             = speed
            };

            return(result);
        }
 public TorrentShareViewModel(TorrentProperties properties, TorrentPartialInfo wrappedObject)
 {
     _properties  = properties ?? throw new ArgumentNullException(nameof(properties));
     _partialInfo = wrappedObject ?? throw new ArgumentNullException(nameof(wrappedObject));
 }