本文整理匯總了C#中BEncodedList.AddRange方法的典型用法代碼示例。如果您正苦於以下問題:C# BEncodedList.AddRange方法的具體用法?C# BEncodedList.AddRange怎麽用?C# BEncodedList.AddRange使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BEncodedList
的用法示例。
在下文中一共展示了BEncodedList.AddRange方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddCommonStuff
void AddCommonStuff (BEncodedDictionary torrent)
{
if (announces.Count > 0 && announces [0].Count > 0)
torrent.Add ("announce", new BEncodedString (announces [0] [0]));
// If there is more than one tier or the first tier has more than 1 tracker
if (announces.Count > 1 || (announces.Count > 0 && announces [0].Count > 1)) {
BEncodedList announceList = new BEncodedList ();
for (int i = 0; i < this.announces.Count; i++) {
BEncodedList tier = new BEncodedList ();
for (int j = 0; j < this.announces [i].Count; j++)
tier.Add (new BEncodedString (this.announces [i] [j]));
announceList.Add (tier);
}
torrent.Add ("announce-list", announceList);
}
if (getrightHttpSeeds.Count > 0) {
BEncodedList seedlist = new BEncodedList ();
seedlist.AddRange (getrightHttpSeeds.ConvertAll<BEncodedValue> (delegate (string s) { return (BEncodedString) s; }));
torrent ["url-list"] = seedlist;
}
TimeSpan span = DateTime.Now - new DateTime (1970, 1, 1);
torrent ["creation date"] = new BEncodedNumber ((long) span.TotalSeconds);
}
示例2: AddCommonStuff
private void AddCommonStuff(BEncodedDictionary torrent)
{
if (Announces.Count > 0 && Announces[0].Count > 0)
Announce = Announces[0][0];
if (GetrightHttpSeeds.Count > 0)
{
var seedlist = new BEncodedList();
seedlist.AddRange(
GetrightHttpSeeds.ConvertAll<BEncodedValue>(delegate(string s) { return (BEncodedString) s; }));
torrent["url-list"] = seedlist;
}
var span = DateTime.Now - new DateTime(1970, 1, 1);
torrent["creation date"] = new BEncodedNumber((long) span.TotalSeconds);
}
示例3: AddCommonStuff
void AddCommonStuff (BEncodedDictionary torrent)
{
if (Announces.Count > 0 && Announces [0].Count > 0)
Announce = Announces [0] [0];
if (getrightHttpSeeds.Count > 0) {
BEncodedList seedlist = new BEncodedList ();
seedlist.AddRange (getrightHttpSeeds.Cast<BEncodedString>());
torrent ["url-list"] = seedlist;
}
TimeSpan span = DateTime.Now - new DateTime (1970, 1, 1);
torrent ["creation date"] = new BEncodedNumber ((long) span.TotalSeconds);
}