當前位置: 首頁>>代碼示例>>C#>>正文


C# BEncodedList.AddRange方法代碼示例

本文整理匯總了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);
        }
開發者ID:pilhlip,項目名稱:bitsharp-0.90,代碼行數:28,代碼來源:TorrentCreator.cs

示例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);
        }
開發者ID:claudiuslollarius,項目名稱:monotorrent,代碼行數:16,代碼來源:TorrentCreator.cs

示例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);
        }
開發者ID:SamirHafez,項目名稱:MonoTorrent.PCL,代碼行數:14,代碼來源:TorrentCreator.cs


注:本文中的BEncodedList.AddRange方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。