예제 #1
0
        public List <File> GetFiles(string torrentHash)
        {
            Dictionary <string, DelugeFile> files = new Dictionary <string, DelugeFile>();
            List <File>   filelist = new List <File>();
            string        response = GetResponse("web.get_torrent_files", new string [] { torrentHash });
            DelugeContent file     = js.Deserialize <DelugeContent>(response);

            if (file.contents.Values.First().type == "dir")
            {
                string rep = js.Serialize(file.contents.Values.First().contents);
                files = js.Deserialize <Dictionary <string, DelugeFile> >(rep);
            }
            else
            {
                files = file.contents;
            }
            foreach (KeyValuePair <string, DelugeFile> df in files)
            {
                File f = new File(this);
                f.Filename   = df.Key;
                f.Filesize   = df.Value.size;
                f.Downloaded = (long)Math.Round(df.Value.size * df.Value.progress);
                f.Priority   = df.Value.priority;
                filelist.Add(f);
            }
            return(filelist);
        }
예제 #2
0
        public List <File> GetFiles(string torrentHash)
        {
            List <File> files = new List <File>();

            if (!torrentMapping.ContainsKey(torrentHash))
            {
                return(null);
            }
            Download dl = torrentMapping[torrentHash];

            Sohvaperuna.TorrentEngine.Torrent tor = toUtorrent(dl);
            File file = new File(this);

            file.Filename   = tor.Name;
            file.Filesize   = tor.Size;
            file.Downloaded = tor.Downloaded;
            file.Priority   = dl.Rank;

            files.Add(file);

            return(files);
        }