Ejemplo n.º 1
0
 void ISerializable.Serialize(BinaryWriter writer)
 {
     writer.Write(Version);
     writer.Write(Services);
     writer.Write(Timestamp);
     writer.Write(Port);
     writer.WriteVarString(UserAgent);
     writer.Write(StartHeight);
 }
Ejemplo n.º 2
0
        public static void EncodeVersionPayload(BinaryWriter writer, VersionPayload versionPayload, bool withRelay)
        {
            writer.WriteUInt32(versionPayload.ProtocolVersion);
            writer.WriteUInt64(versionPayload.ServicesBitfield);
            writer.WriteUInt64((ulong)versionPayload.Time.ToUnixTimeSeconds());
            EncodeNetworkAddress(writer, versionPayload.RemoteAddress);
            EncodeNetworkAddress(writer, versionPayload.LocalAddress);
            writer.WriteUInt64(versionPayload.Nonce);
            writer.WriteVarString(versionPayload.UserAgent);
            writer.WriteUInt32(versionPayload.StartBlockHeight);

            if (withRelay)
                writer.WriteBool(versionPayload.Relay);
        }
Ejemplo n.º 3
0
 public static void EncodeAlertPayload(BinaryWriter writer, AlertPayload alertPayload)
 {
     writer.WriteVarString(alertPayload.Payload);
     writer.WriteVarString(alertPayload.Signature);
 }
Ejemplo n.º 4
0
 public static void EncodeVarString(BinaryWriter writer, string s)
 {
     writer.WriteVarString(s);
 }
Ejemplo n.º 5
0
 protected override void SerializeExclusiveData(BinaryWriter writer)
 {
     writer.Write((byte)AssetType);
     writer.WriteVarString(Name);
     writer.Write(Amount);
     writer.Write(Issuer);
     writer.Write(Admin);
 }
Ejemplo n.º 6
0
        public static void EncodeVersionPayload(Stream stream, VersionPayload versionPayload, bool withRelay)
        {
            using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
            {
                writer.Write4Bytes(versionPayload.ProtocolVersion);
                writer.Write8Bytes(versionPayload.ServicesBitfield);
                writer.Write8Bytes(versionPayload.UnixTime);
                EncodeNetworkAddress(stream, versionPayload.RemoteAddress);
                EncodeNetworkAddress(stream, versionPayload.LocalAddress);
                writer.Write8Bytes(versionPayload.Nonce);
                writer.WriteVarString(versionPayload.UserAgent);
                writer.Write4Bytes(versionPayload.StartBlockHeight);

                if (withRelay)
                    writer.WriteBool(versionPayload.Relay);
            }
        }
Ejemplo n.º 7
0
 public static void EncodeAlertPayload(Stream stream, AlertPayload alertPayload)
 {
     using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
     {
         writer.WriteVarString(alertPayload.Payload);
         writer.WriteVarString(alertPayload.Signature);
     }
 }