예제 #1
0
 public TorrentStatus(Core.TorrentStatus ts)
 {
     ActiveTime = ts.active_time;
     AddedTime = ts.added_time;
     AllTimeDownload = ts.all_time_download;
     AllTimeUpload = ts.all_time_upload;
     AnnounceInterval = ts.announce_interval;
     AutoManaged = ts.auto_managed;
     BlockSize = ts.block_size;
     CompletedTime = ts.completed_time;
     ConnectionsLimit = ts.connections_limit;
     ConnectCandidates = ts.connect_candidates;
     CurrentTracker = ts.current_tracker;
     DistributedCopies = ts.distributed_copies;
     DistributedFraction = ts.distributed_fraction;
     DistributedFullCopies = ts.distributed_full_copies;
     DownloadPayloadRate = ts.download_payload_rate;
     DownloadRate = ts.download_rate;
     DownBandwidthQueue = ts.down_bandwidth_queue;
     Error = ts.error;
     FinishedTime = ts.finished_time;
     HasIncoming = ts.has_incoming;
     HasMetadata = ts.has_metadata;
     InfoHash = ts.info_hash.ToString();
     IpFilterApplies = ts.ip_filter_applies;
     IsFinished = ts.is_finished;
     IsSeeding = ts.is_seeding;
     LastScrape = ts.last_scrape;
     LastSeenComplete = ts.last_seen_complete;
     ListPeers = ts.list_peers;
     ListSeeds = ts.list_seeds;
     MovingStorage = ts.moving_storage;
     Name = ts.name;
     NeedSaveResume = ts.need_save_resume;
     NextAnnounce = ts.next_announce;
     NumComplete = ts.num_complete;
     NumConnections = ts.num_connections;
     NumIncomplete = ts.num_incomplete;
     NumPeers = ts.num_peers;
     NumPieces = ts.num_pieces;
     NumSeeds = ts.num_seeds;
     NumUploads = ts.num_uploads;
     Paused = ts.paused;
     Pieces = new BitField(ts.pieces);
     Priority = ts.priority;
     Progress = ts.progress;
     ProgressPpm = ts.progress_ppm;
     QueuePosition = ts.queue_position;
     SavePath = ts.save_path;
     SeedingTime = ts.seeding_time;
     SeedMode = ts.seed_mode;
     SeedRank = ts.seed_rank;
     SequentialDownload = ts.sequential_download;
     ShareMode = ts.share_mode;
     State = Utils.GiveMeStateFromEnum(ts.state);
     StorageMode = Utils.GiveMeStorageModeFromEnum(ts.storage_mode);
     SuperSeeding = ts.super_seeding;
     TimeSinceDownload = ts.time_since_download;
     TimeSinceUpload = ts.time_since_upload;
     TotalDone = ts.total_done;
     TotalDownload = ts.total_download;
     TotalFailedBytes = ts.total_failed_bytes;
     TotalPayloadDownload = ts.total_payload_download;
     TotalPayloadUpload = ts.total_payload_upload;
     TotalReduntantBytes = ts.total_reduntant_bytes;
     TotalUpload = ts.total_upload;
     TotalWanted = ts.total_wanted;
     TotalWantedDone = ts.total_wanted_done;
     UploadsLimit = ts.uploads_limit;
     UploadMode = ts.upload_mode;
     UploadPayloadRate = ts.upload_payload_rate;
     UploadRate = ts.upload_rate;
     UpBandwidthQueue = ts.up_bandwidth_queue;
     VerifiedPieces = new BitField(ts.verified_pieces);
     //this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("InfoHash"));
 }
예제 #2
0
        public void Update(Core.TorrentStatus ts)
        {
            Name = ts.name;
            //Priority = ts.priority;
            //QueuePosition = ts.queue_position;
            TotalWanted  = ts.total_wanted;
            TotalDone    = ts.total_done;
            Progress     = ts.progress;
            DownloadRate = ts.download_rate;
            UploadRate   = ts.upload_rate;

            //ActiveTime = ts.active_time;
            //AddedTime = ts.added_time;
            //AllTimeDownload = ts.all_time_download;
            //AllTimeUpload = ts.all_time_upload;
            //AnnounceInterval = ts.announce_interval;
            //AutoManaged = ts.auto_managed;
            //BlockSize = ts.block_size;
            //CompletedTime = ts.completed_time;
            //ConnectionsLimit = ts.connections_limit;
            //ConnectCandidates = ts.connect_candidates;
            //CurrentTracker = ts.current_tracker;
            //DistributedCopies = ts.distributed_copies;
            //DistributedFraction = ts.distributed_fraction;
            //DistributedFullCopies = ts.distributed_full_copies;
            //DownloadPayloadRate = ts.download_payload_rate;
            //DownBandwidthQueue = ts.down_bandwidth_queue;
            Error = ts.error;
            //FinishedTime = ts.finished_time;
            //HasIncoming = ts.has_incoming;
            //HasMetadata = ts.has_metadata;
            //IpFilterApplies = ts.ip_filter_applies;
            IsFinished = ts.is_finished;
            IsSeeding  = ts.is_seeding;
            //LastScrape = ts.last_scrape;
            //LastSeenComplete = ts.last_seen_complete;
            //ListPeers = ts.list_peers;
            //ListSeeds = ts.list_seeds;
            //MovingStorage = ts.moving_storage;
            NeedSaveResume = ts.need_save_resume;
            //NextAnnounce = ts.next_announce;
            //NumComplete = ts.num_complete;
            //NumIncomplete = ts.num_incomplete;
            //NumPeers = ts.num_peers;
            NumPieces = ts.num_pieces;
            //NumSeeds = ts.num_seeds;
            //NumUploads = ts.num_uploads;
            Paused = ts.paused;
            //using (Core.BitField bf = ts.pieces)
            //{
            //    if (ReferenceEquals(null, Pieces))
            //    {
            //        Pieces = new BitField(bf);
            //    } else
            //    {
            //        Pieces.Update(bf);
            //    }
            //}
            //ProgressPpm = ts.progress_ppm;
            //SavePath = ts.save_path;
            //SeedingTime = ts.seeding_time;
            //SeedMode = ts.seed_mode;
            //SeedRank = ts.seed_rank;
            //SequentialDownload = ts.sequential_download;
            //ShareMode = ts.share_mode;
            State = (ts.paused) ? "Paused" : Classes.Utils.GiveMeStateFromEnum(ts.state);
            //StorageMode = Classes.Utils.GiveMeStorageModeFromEnum(ts.storage_mode);
            //SuperSeeding = ts.super_seeding;
            //TimeSinceDownload = ts.time_since_download;
            //TimeSinceUpload = ts.time_since_upload;
            TotalDownload = ts.total_download;
            //TotalFailedBytes = ts.total_failed_bytes;
            //TotalPayloadDownload = ts.total_payload_download;
            //TotalPayloadUpload = ts.total_payload_upload;
            //TotalReduntantBytes = ts.total_reduntant_bytes;
            TotalUpload     = ts.total_upload;
            TotalWantedDone = ts.total_wanted_done;
            //UploadsLimit = ts.uploads_limit;
            //UploadMode = ts.upload_mode;
            //UploadPayloadRate = ts.upload_payload_rate;
            //UpBandwidthQueue = ts.up_bandwidth_queue;
            //using (Core.BitField vp = ts.verified_pieces)
            //{
            //    if (ReferenceEquals(null, VerifiedPieces))
            //    {
            //        VerifiedPieces = new BitField(vp);
            //    }
            //    else
            //    {
            //        VerifiedPieces.Update(vp);
            //    }
            //}

            using (Core.BitField bf = ts.pieces)
            {
                if (ReferenceEquals(null, Pieces))
                {
                    Pieces = new BitField(bf);
                }
                else
                {
                    Pieces.Update(bf);
                }

                foreach (Models.FileEntry item in FileList)
                {
                    foreach (Models.Part part in item.Pieces.Where(x => x.Downloaded == false))
                    {
                        bool sub = bf.op_Subscript(part.Id);
                        part.Downloaded = sub;
                        Pieces.Parts[part.Id].Downloaded = sub;
                    }
                }
            }
        }