当前位置: 首页>>代码示例>>C#>>正文


C# InfoHash类代码示例

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


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


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