BitSharper.PeerAddress.Parse C# (CSharp) Method

Parse() protected method

protected Parse ( ) : void
return void
        protected override void Parse()
        {
            // Format of a serialized address:
            //   uint32 timestamp
            //   uint64 services   (flags determining what the node can do)
            //   16 bytes IP address
            //   2 bytes port num
            if (ProtocolVersion > 31402)
                _time = ReadUint32();
            else
                _time = uint.MaxValue;
            _services = ReadUint64();
            var addrBytes = ReadBytes(16);
            if (new BigInteger(addrBytes, 0, 12).Equals(BigInteger.ValueOf(0xFFFF)))
            {
                var newBytes = new byte[4];
                Array.Copy(addrBytes, 12, newBytes, 0, 4);
                addrBytes = newBytes;
            }
            Addr = new IPAddress(addrBytes);
            Port = (Bytes[Cursor++] << 8) | Bytes[Cursor++];
        }