当前位置: 首页>>代码示例>>C#>>正文


C# Torrent.SetPath方法代码示例

本文整理汇总了C#中Torrent.SetPath方法的典型用法代码示例。如果您正苦于以下问题:C# Torrent.SetPath方法的具体用法?C# Torrent.SetPath怎么用?C# Torrent.SetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Torrent的用法示例。


在下文中一共展示了Torrent.SetPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Build

        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();
        }
开发者ID:joslinm,项目名称:CSL,代码行数:73,代码来源:TorrentBuilder.cs


注:本文中的Torrent.SetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。