public static AlertPayload DecodeAlertPayload(BinaryReader reader) { return new AlertPayload ( Payload: reader.ReadVarString(), Signature: reader.ReadVarString() ); }
public static AlertPayload DecodeAlertPayload(Stream stream) { using (var reader = new BinaryReader(stream, Encoding.ASCII, leaveOpen: true)) { return new AlertPayload ( Payload: reader.ReadVarString(), Signature: reader.ReadVarString() ); } }
void ISerializable.Deserialize(BinaryReader reader) { Version = reader.ReadUInt32(); Services = reader.ReadUInt64(); Timestamp = reader.ReadUInt32(); Port = reader.ReadUInt16(); UserAgent = reader.ReadVarString(); StartHeight = reader.ReadUInt32(); }
protected override void DeserializeExclusiveData(BinaryReader reader) { this.AssetType = (AssetType)reader.ReadByte(); if (!Enum.IsDefined(typeof(AssetType), AssetType)) throw new FormatException(); this.Name = reader.ReadVarString(); this.Amount = reader.ReadSerializable<Fixed8>(); if (Amount == Fixed8.Zero || Amount < -Fixed8.Satoshi) throw new FormatException(); if (AssetType == AssetType.Share && Amount <= Fixed8.Zero) throw new FormatException(); if (AssetType == AssetType.Currency && Amount != -Fixed8.Satoshi) throw new FormatException(); this.Issuer = ECPoint.DeserializeFrom(reader, ECCurve.Secp256r1); this.Admin = reader.ReadSerializable<UInt160>(); }
public static VersionPayload DecodeVersionPayload(BinaryReader reader, int payloadLength) { var position = reader.BaseStream.Position; var versionPayload = new VersionPayload ( ProtocolVersion: reader.ReadUInt32(), ServicesBitfield: reader.ReadUInt64(), Time: DateTimeOffset.FromUnixTimeSeconds((long)reader.ReadUInt64()), RemoteAddress: DecodeNetworkAddress(reader), LocalAddress: DecodeNetworkAddress(reader), Nonce: reader.ReadUInt64(), UserAgent: reader.ReadVarString(), StartBlockHeight: reader.ReadUInt32(), Relay: false ); var readCount = reader.BaseStream.Position - position; if (versionPayload.ProtocolVersion >= VersionPayload.RELAY_VERSION && payloadLength - readCount == 1) versionPayload = versionPayload.With(Relay: reader.ReadBool()); return versionPayload; }
public static VersionPayload DecodeVersionPayload(Stream stream, int payloadLength) { using (var reader = new BinaryReader(stream, Encoding.ASCII, leaveOpen: true)) { var position = stream.Position; var versionPayload = new VersionPayload ( ProtocolVersion: reader.Read4Bytes(), ServicesBitfield: reader.Read8Bytes(), UnixTime: reader.Read8Bytes(), RemoteAddress: DecodeNetworkAddress(stream), LocalAddress: DecodeNetworkAddress(stream), Nonce: reader.Read8Bytes(), UserAgent: reader.ReadVarString(), StartBlockHeight: reader.Read4Bytes(), Relay: false ); var readCount = stream.Position - position; if (versionPayload.ProtocolVersion >= VersionPayload.RELAY_VERSION && payloadLength - readCount == 1) versionPayload = versionPayload.With(Relay: reader.ReadBool()); return versionPayload; } }
public static string DecodeVarString(BinaryReader reader) { return reader.ReadVarString(); }