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