本文整理汇总了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();
}