public DetailsModel(Torrent torrent) : base(torrent) { if (torrent.Files == null) Files = new List<File>(); else Files = torrent.Files.ToList(); }
public TorrentModel(Torrent fromTorrent) { this.Availability = fromTorrent.Availability; this.DownloadedInBytes = fromTorrent.DownloadedBytes; this.DownloadSpeedInBytes = fromTorrent.DownloadBytesPerSec; this.EstimatedTime = TimeSpan.FromSeconds(fromTorrent.EtaInSecs); this.EstimatedTimeSeconds = fromTorrent.EtaInSecs; this.Hash = fromTorrent.Hash; this.Label = fromTorrent.Label; this.Name = fromTorrent.Name; this.PeersConnected = fromTorrent.PeersConnected; this.PeersInSwarm = fromTorrent.PeersInSwarm; this.Percentage = fromTorrent.ProgressInMils / 10d; this.QueueOrder = fromTorrent.QueueOrder; this.Ratio = fromTorrent.RatioInMils / 1000d; this.RemainingInBytes = fromTorrent.RemainingBytes; this.SeedsConnected = fromTorrent.SeedsConnected; this.SeedsInSwarm = fromTorrent.SeedsInSwarm; this.SizeInBytes = fromTorrent.SizeInBytes; this.Status = fromTorrent.Status; this.UploadedInBytes = fromTorrent.UploadedBytes; this.UploadSpeedInBytes = fromTorrent.UploadBytesPerSec; }
private static string GetEta(Torrent x) { if( x.EtaInSecs == -1 && (x.ProgressInMils * 0.1m) == 100) { return "Complete"; } return TimeSpan.FromSeconds(x.EtaInSecs).ToString(); }