DecodeBase58StringChecked() public static method

public static DecodeBase58StringChecked ( string encoded ) : byte[]
encoded string
return byte[]
コード例 #1
0
        public void NodeDiscovered(string node)
        {
            byte[] decoded = Utils.DecodeBase58StringChecked(node.Substring(1));
            if (decoded == null)
            {
                return;
            }

            MemoryStream ms = new MemoryStream(decoded);
            BinaryReader br = new BinaryReader(ms);

            byte[] addrBytes = br.ReadBytes(4);
            string address   = "";

            for (int i = 0; i < 4; i++)
            {
                //byte b = addrBytes[3 - i];
                byte b = addrBytes[i];
                address += b.ToString();
                if (i < 3)
                {
                    address += ".";
                }
            }
            ushort port = Utils.Byteswap(br.ReadUInt16());

            AddNode(address, port);
            br.Close();
        }