AddTorrent() public method

public AddTorrent ( Torrent torrent ) : void
torrent Torrent
return void
示例#1
0
        public void Build(object files)
        {
            TorrentXMLHandler data = new TorrentXMLHandler();
            List<Torrent> torrents = new List<Torrent>();
            List<FileInfo> items = null;
            Torrent torrent;
            try { items = (List<FileInfo>)files; }
            catch { DirectoryHandler.LogError("Fatal Error converting object files to items in TorrentBuilder.Build");}

            information[14] = null;
            int filescount = items.Count;
            double progress = 0;
            double count = 0;

            foreach(FileInfo item in items)
            {
                string birth = GetTorrentBirth(item);
                ProcessTorrent(item, birth);

                if (information[14] != "true")
                {
                    if (SettingsHandler.GetDownloadFormatExists(information[2]))
                    {
                        torrent = VerifyTorrent();
                        torrents.Add(torrent);
                        data.AddTorrent(torrent);
                    }
                }

                //Clear out information for this run to avoid misinformation on the next run
                for (int b = 0; b < information.Length; b++)
                    information[b] = null;

                progress = (++count / filescount) * 100;

                if (progress <= 100 && progress >= 0)
                    this.ReportProgress((int)progress);
            }

            ew.ClearApplyToAll();
        }