public static UnknownPayload FromStream(Stream s, UInt32 len, Byte[] command) { UnknownPayload x = new UnknownPayload(len, command); x.Read(s); return(x); }
public void Read(Stream s) { BinaryReader br = new BinaryReader(s); magic = br.ReadUInt32(); command = br.ReadBytes(12); length = br.ReadUInt32(); checksum = br.ReadBytes(4); switch (strcmd) { case "addr": payload = Addr.FromStream(s); break; case "alert": payload = Alert.FromStream(s); break; case "block": payload = Block.FromStream(s); break; case "getaddr": payload = GetAddr.FromStream(s); break; case "getblocks": payload = GetBlocks.FromStream(s); break; case "getdata": payload = GetData.FromStream(s); break; case "getheaders": payload = GetHeaders.FromStream(s); break; case "headers": payload = Headers.FromStream(s); break; case "inv": payload = Inv.FromStream(s); break; case "ping": payload = Ping.FromStream(s); break; case "tx": payload = Tx.FromStream(s); break; case "verack": payload = VerAck.FromStream(s); break; case "version": payload = Version.FromStream(s); break; default: payload = UnknownPayload.FromStream(s, length, command); break; } }