3
using System.Collections.Generic;
7
namespace Transmission {
9
public class TorrentItem: Item {
12
private string _comment;
13
private string _hash_string;
15
private TransmissionAPI.TorrentStatus _status;
16
private int _download_speed_limit, _upload_speed_limit;
17
private TorrentDirectoryItem _root;
19
public TorrentItem(TransmissionAPI.TorrentInfo info) {
20
_hash_string = info.HashString;
22
_comment = info.Comment;
23
_status = info.Status;
24
_size = info.TotalSize;
25
_download_speed_limit = info.DownloadLimit;
26
_upload_speed_limit = info.UploadLimit;
27
_root = new TorrentDirectoryItem(this, null, info.DownloadDir);
30
public override string Name {
34
public override string Description {
36
string status_text = "";
38
case TransmissionAPI.TorrentStatus.CheckWait: status_text = "Waiting for check"; break;
39
case TransmissionAPI.TorrentStatus.Check: status_text = "Checking"; break;
40
case TransmissionAPI.TorrentStatus.Download: status_text = "Downloading"; break;
41
case TransmissionAPI.TorrentStatus.Seed: status_text = "Seeding"; break;
42
case TransmissionAPI.TorrentStatus.Stopped: status_text = "Stopped"; break;
45
return string.Format("{0}, {1}", Utils.FormatSize(_size), status_text);
49
public override string Icon {
50
get { return "transmission"; }
53
public string HashString {
54
get { return _hash_string; }
57
public TorrentDirectoryItem Root {
61
public int DownloadSpeedLimit {
62
get { return _download_speed_limit; }
63
set { _download_speed_limit = value; }
66
public int UploadSpeedLimit {
67
get { return _upload_speed_limit; }
68
set { _upload_speed_limit = value; }