• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# InfoHash类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中InfoHash的典型用法代码示例。如果您正苦于以下问题:C# InfoHash类的具体用法?C# InfoHash怎么用?C# InfoHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InfoHash类属于命名空间,在下文中一共展示了InfoHash类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InfoHashTrackable

        public InfoHashTrackable(Torrent torrent)
        {
            Check.Torrent(torrent);

            name = torrent.Name;
            infoHash = torrent.InfoHash;
        }
开发者ID:rajkosto,项目名称:DayZeroLauncher,代码行数:7,代码来源:InfoHashTrackable.cs


示例2: MultipleAnnounce

        public void MultipleAnnounce()
        {
            var announceCount = 0;
            var r = new Random();
            var handle = new ManualResetEvent(false);

            for (var i = 0; i < 20; i++)
            {
                var infoHash = new InfoHash(new byte[20]);
                r.NextBytes(infoHash.Hash);
                var tier = new TrackerTier(new[] {uri.ToString()});
                tier.Trackers[0].AnnounceComplete += delegate
                {
                    if (++announceCount == 20)
                        handle.Set();
                };
                var id = new TrackerConnectionID(tier.Trackers[0], false, TorrentEvent.Started,
                    new ManualResetEvent(false));
                MonoTorrent.Client.Tracker.AnnounceParameters parameters;
                parameters = new MonoTorrent.Client.Tracker.AnnounceParameters(0, 0, 0, TorrentEvent.Started,
                    infoHash, false, new string('1', 20), "", 1411);
                tier.Trackers[0].Announce(parameters, id);
            }

            Assert.True(handle.WaitOne(5000, true), "Some of the responses weren't received");
        }
开发者ID:claudiuslollarius,项目名称:monotorrent,代码行数:26,代码来源:TrackerTests.cs


示例3: TorrentBDecoder

 public TorrentBDecoder(Stream stream, Encoding encoding)
 {
     _reader = new BinaryReader(stream);
     _streamEncoding = encoding;
     _infoHash = new InfoHash();
     _indicator = 0;
     _inInfoMap = false;
 }
开发者ID:jvandertil,项目名称:csharp-bencode,代码行数:8,代码来源:TorrentBDecoder.cs


示例4: PeerAEncryption

        public PeerAEncryption(InfoHash InfoHash, EncryptionTypes allowedEncryption)
            : base(allowedEncryption)
        {
            gotVerificationCallback = gotVerification;
            gotPadDCallback = gotPadD;

            SKEY = InfoHash;
        }
开发者ID:JacklEventreur,项目名称:monotorrent,代码行数:8,代码来源:PeerAEncryption.cs


示例5: PeerBEncryption

        public PeerBEncryption(InfoHash[] possibleSKEYs, EncryptionTypes allowedEncryption)
            : base(allowedEncryption)
        {
            this.possibleSKEYs = possibleSKEYs;

            gotVerificationCallback = new AsyncCallback(gotVerification);
            gotPadCCallback = new AsyncCallback(gotPadC);
        }
开发者ID:Cyarix,项目名称:monotorrent,代码行数:8,代码来源:PeerBEncryption.cs


示例6: PeerBEncryption

        public PeerBEncryption(InfoHash[] possibleSkeYs, EncryptionTypes allowedEncryption)
            : base(allowedEncryption)
        {
            _possibleSkeYs = possibleSkeYs;

            _gotVerificationCallback = GotVerification;
            _gotPadCCallback = GotPadC;
        }
开发者ID:haroldma,项目名称:Universal.Torrent,代码行数:8,代码来源:PeerBEncryption.cs


示例7: PeerAEncryption

        public PeerAEncryption(InfoHash infoHash, EncryptionTypes allowedEncryption)
            : base(allowedEncryption)
        {
            _gotVerificationCallback = GotVerification;
            _gotPadDCallback = GotPadD;

            Skey = infoHash;
        }
开发者ID:haroldma,项目名称:Universal.Torrent,代码行数:8,代码来源:PeerAEncryption.cs


示例8: CustomITrackable

 public CustomITrackable(Torrent t)
 {
     // Note: I'm just storing the files, infohash and name. A typical Torrent instance
     // is ~100kB in memory. A typical CustomITrackable will be ~100 bytes.
     files = t.Files;
     infoHash = t.InfoHash;
     name = t.Name;
 }
开发者ID:stojy,项目名称:monotorrent,代码行数:8,代码来源:Main.cs


示例9: PeerAEncryption

        public PeerAEncryption(InfoHash InfoHash, EncryptionTypes allowedEncryption)
            : base(allowedEncryption)
        {
            gotVerificationCallback = new AsyncCallback(gotVerification);
            gotPadDCallback = new AsyncCallback(gotPadD);

            SKEY = InfoHash;
        }
开发者ID:dontnod,项目名称:monotorrent,代码行数:8,代码来源:PeerAEncryption.cs


示例10: BeginCheckEncryption

        internal static IAsyncResult BeginCheckEncryption(PeerId id, int bytesToReceive, AsyncCallback callback,
            object state, InfoHash[] sKeys)
        {
            var result = new EncryptorAsyncResult(id, callback, state) {SKeys = sKeys};

            var c = id.Connection;
            ClientEngine.MainLoop.QueueTimeout(TimeSpan.FromSeconds(10), delegate
            {
                if (id.Encryptor == null || id.Decryptor == null)
                    id.CloseConnection();
                return false;
            });

            try
            {
                // If the connection is incoming, receive the handshake before
                // trying to decide what encryption to use
                if (id.Connection.IsIncoming)
                {
                    result.Buffer = new byte[bytesToReceive];
                    NetworkIO.EnqueueReceive(c, result.Buffer, 0, result.Buffer.Length, null, null, null,
                        HandshakeReceivedCallback, result);
                }
                else
                {
                    var usable = CheckRc4(id);
                    var hasPlainText = Toolbox.HasEncryption(usable, EncryptionTypes.PlainText);
                    var hasRc4 = Toolbox.HasEncryption(usable, EncryptionTypes.RC4Full) ||
                                 Toolbox.HasEncryption(usable, EncryptionTypes.RC4Header);
                    if (id.Engine.Settings.PreferEncryption)
                    {
                        if (hasRc4)
                        {
                            result.EncSocket = new PeerAEncryption(id.TorrentManager.InfoHash, usable);
                            result.EncSocket.BeginHandshake(id.Connection, CompletedEncryptedHandshakeCallback, result);
                        }
                        result.Complete();
                    }
                    else
                    {
                        if (hasPlainText)
                        {
                            result.Complete();
                        }
                        else
                        {
                            result.EncSocket = new PeerAEncryption(id.TorrentManager.InfoHash, usable);
                            result.EncSocket.BeginHandshake(id.Connection, CompletedEncryptedHandshakeCallback, result);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result.Complete(ex);
            }
            return result;
        }
开发者ID:haroldma,项目名称:Universal.Torrent,代码行数:58,代码来源:EncryptorFactory.cs


示例11: FastResume

        public FastResume(InfoHash infoHash, BitField bitfield)
        {
            if (infoHash == null)
                throw new ArgumentNullException("infoHash");
            if (bitfield == null)
                throw new ArgumentNullException("bitfield");

            this.infoHash = infoHash;
            this.bitfield = bitfield;
        }
开发者ID:rajkosto,项目名称:DayZeroLauncher,代码行数:10,代码来源:FastResume.cs


示例12: FastResume

        public FastResume(InfoHash infoHash, BitField bitfield)
        {
            if (infoHash == null)
                throw new ArgumentNullException(nameof(infoHash));
            if (bitfield == null)
                throw new ArgumentNullException(nameof(bitfield));

            Infohash = infoHash;
            Bitfield = bitfield;
        }
开发者ID:haroldma,项目名称:Universal.Torrent,代码行数:10,代码来源:FastResume.cs


示例13: FastResume

        public FastResume(InfoHash infoHash, BitField bitfield, IEnumerable<Priority> priorities)
        {
            if (infoHash==null)
                throw new ArgumentNullException("infoHash");
            if(bitfield == null)
                throw new ArgumentNullException("bitfield");

            this.infoHash = infoHash;
            this.bitfield = bitfield;
            this.priorities = priorities.ToArray();
        }
开发者ID:silvermcd123,项目名称:WoWPrivateServerLauncher,代码行数:11,代码来源:FastResume.cs


示例14: TorrentInfo

 public TorrentInfo(InfoHash hash, string name, int priority, ActiveStates activestate, DownloadStates downloadstate, IEnumerable<string> labels, ulong size, ulong remaining, ulong uploaded)
 {
     Hash = hash;
     Name = name;
     Priority = priority;
     ActiveState = activestate;
     DownloadState = downloadstate;
     Labels = new ReadOnlyCollection<string>(new List<string>(labels));
     Size = size;
     Remaining = remaining;
     Uploaded = uploaded;
 }
开发者ID:deaddog,项目名称:BitTorrent,代码行数:12,代码来源:TorrentInfo.cs


示例15: AnnounceParameters

 public AnnounceParameters(long bytesDownloaded, long bytesUploaded, long bytesLeft,
     TorrentEvent clientEvent, InfoHash infohash, bool requireEncryption,
     string peerId, string ipaddress, int port)
 {
     BytesDownloaded = bytesDownloaded;
     BytesUploaded = bytesUploaded;
     BytesLeft = bytesLeft;
     ClientEvent = clientEvent;
     InfoHash = infohash;
     RequireEncryption = requireEncryption;
     PeerId = peerId;
     Ipaddress = ipaddress;
     Port = port;
 }
开发者ID:haroldma,项目名称:Universal.Torrent,代码行数:14,代码来源:AnnounceParameters.cs


示例16: AnnounceParameters

 public AnnounceParameters(long bytesDownloaded, long bytesUploaded, long bytesLeft,
                           TorrentEvent clientEvent, InfoHash infohash, bool requireEncryption,
                           string peerId, string ipaddress, int port)
 {
     this.bytesDownloaded = bytesDownloaded;
     this.bytesUploaded = bytesUploaded;
     this.bytesLeft = bytesLeft;
     this.clientEvent = clientEvent;
     this.infohash = infohash;
     this.requireEncryption = requireEncryption;
     this.peerId = peerId;
     this.ipaddress = ipaddress;
     this.port = port;
 }
开发者ID:Eskat0n,项目名称:OctoTorrent,代码行数:14,代码来源:AnnounceParameters.cs


示例17: InfoHashTest

        public void InfoHashTest()
        {
            var link = new MagnetLink("magnet:?xt.1=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C");
            Assert.Equal(InfoHash.FromBase32("YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C"), link.InfoHash);

            //base32
            var initial = new InfoHash(Encoding.ASCII.GetBytes("foobafoobafoobafooba"));
            link = new MagnetLink("magnet:?xt=urn:sha1:MZXW6YTBMZXW6YTBMZXW6YTBMZXW6YTB");
            Assert.Equal(initial, link.InfoHash);

            //base40 = hex
            var hash = Create();
            var hex = hash.ToHex();
            link = new MagnetLink("magnet:?xt=urn:btih:" + hex);
            Assert.Equal(hash, link.InfoHash);
        }
开发者ID:claudiuslollarius,项目名称:monotorrent,代码行数:16,代码来源:MagnetLinkTest.cs


示例18: HandshakeMessage

        public HandshakeMessage(InfoHash infoHash, string peerId, string protocolString, bool enableFastPeer,
                                bool enableExtended)
        {
            if (!ClientEngine.SupportsFastPeer && enableFastPeer)
                throw new ProtocolException("The engine does not support fast peer, but fast peer was requested");

            if (!ClientEngine.SupportsExtended && enableExtended)
                throw new ProtocolException("The engine does not support extended, but extended was requested");

            this.InfoHash = infoHash;
            PeerId = peerId;
            ProtocolString = protocolString;
            ProtocolStringLength = protocolString.Length;
            SupportsFastPeer = enableFastPeer;
            SupportsExtendedMessaging = enableExtended;
        }
开发者ID:mrscylla,项目名称:octotorrent,代码行数:16,代码来源:HandshakeMessage.cs


示例19: InfoHashTest

        public void InfoHashTest()
        {
            MagnetLink link = new MagnetLink("magnet:?xt.1=urn:sha1:YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C");
            Assert.AreEqual(InfoHash.FromBase32 ("YNCKHTQCWBTRNJIV4WNAE52SJUQCZO5C"), link.InfoHash , "#1");

            //base32
            InfoHash initial = new InfoHash (System.Text.Encoding.ASCII.GetBytes("foobafoobafoobafooba"));
            link = new MagnetLink("magnet:?xt=urn:sha1:MZXW6YTBMZXW6YTBMZXW6YTBMZXW6YTB");
            Assert.AreEqual(initial, link.InfoHash , "#2");

            //base40 = hex
            InfoHash hash = Create();
            string hex = hash.ToHex();
            link = new MagnetLink("magnet:?xt=urn:btih:" + hex);
            Assert.AreEqual(hash, link.InfoHash , "#3");
        }
开发者ID:JacklEventreur,项目名称:monotorrent,代码行数:16,代码来源:MagnetLinkTest.cs


示例20: DhtBasedSwarm

        public DhtBasedSwarm(InfoHash hash, int port, string nodeSavePath)
            : base(hash,port)
        {
            _nodeSavePath = nodeSavePath;
            _listener = new DhtListener(new IPEndPoint(IPAddress.Any, Port));
            _engine = new DhtEngine(_listener);

            _engine.PeersFound += EnginePeersFound;
            _engine.StateChanged += EngineStateChanged;
            _listener.MessageReceived += ListenerMessageReceived;
            if (!String.IsNullOrWhiteSpace(_nodeSavePath) && File.Exists(_nodeSavePath))
            {
                Log("Node File Found.");
                _nodes = File.ReadAllBytes(_nodeSavePath);
            }
        }
开发者ID:kellyelton,项目名称:PeerSwarm,代码行数:16,代码来源:DHTBasedSwarm.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InfoKind类代码示例发布时间:2022-05-24
下一篇:
C# Info类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap