AddMovieTorrent() публичный Метод

public AddMovieTorrent ( Movie m ) : void
m Movie
Результат void
Пример #1
0
        public void Build(object files)
        {
            TorrentDataHandler data = new TorrentDataHandler();
            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);
                if (birth == null)
                {
                    string savefolder = null;
                    string announce = null;

                    try
                    {
                        object torrentdata = BEncoding.Decode(item);
                        savefolder = (string)(((ListDictionary)((ListDictionary)torrentdata)["info"])["name"]); //Torrentdata is a LD containing LD, which contains name
                        announce = (string)(((ListDictionary)torrentdata)["announce"]);
                        announce = announce.Replace("http://", "");
                        announce = announce.Substring(0, announce.IndexOf(":"));
                    }
                    catch { savefolder = item.Name; }
                    information[12] = (announce == null) ? "???" : announce;
                    information[11] = item.Name;
                    information[10] = item.FullName;
                    information[13] = SettingsHandler.GetOtherDownloadDirectory() + savefolder;
                    torrent = new Torrent(information);
                    torrent.SetPath(DirectoryHandler.MoveTorrentFile(torrent));
                    data.AddOtherTorrent(torrent);
                }
                else if (birth == "ptp")
                {
                    ProcessMovieTorrent(item, birth);
                    Movie tm = new Movie(information);
                    tm.SetPath(DirectoryHandler.MoveTorrentFile(tm));
                    data.AddMovieTorrent(tm);
                }
                else if (birth.Equals("waffles") || birth.Equals("what"))
                {
                    ProcessMusicTorrent(item, birth);

                    if (information[14] != "true")
                    {
                        if (SettingsHandler.GetDownloadFormatExists(information[2]))
                        {
                            torrent = VerifyMusicTorrent();
                            torrents.Add(torrent);
                            torrent.SetPath(DirectoryHandler.MoveTorrentFile(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();
        }