Exemplo n.º 1
0
        public static void Encode(IByteWriter stream, Memo encodedMemo)
        {
            XdrEncoding.EncodeInt32((int)encodedMemo.Discriminant.InnerValue, stream);
            switch (encodedMemo.Discriminant.InnerValue)
            {
            case MemoType.MemoTypeEnum.MEMO_NONE:
                break;

            case MemoType.MemoTypeEnum.MEMO_TEXT:
                XdrEncoding.WriteString(stream, encodedMemo.Text);
                break;

            case MemoType.MemoTypeEnum.MEMO_ID:
                Uint64.Encode(stream, encodedMemo.Id);
                break;

            case MemoType.MemoTypeEnum.MEMO_HASH:
                Hash.Encode(stream, encodedMemo.Hash);
                break;

            case MemoType.MemoTypeEnum.MEMO_RETURN:
                Hash.Encode(stream, encodedMemo.RetHash);
                break;
            }
        }
Exemplo n.º 2
0
 public static void Encode(IByteWriter stream, Hello encodedHello)
 {
     Uint32.Encode(stream, encodedHello.LedgerVersion);
     Uint32.Encode(stream, encodedHello.OverlayVersion);
     Uint32.Encode(stream, encodedHello.OverlayMinVersion);
     Hash.Encode(stream, encodedHello.NetworkID);
     XdrEncoding.WriteString(stream, encodedHello.VersionStr);
     XdrEncoding.EncodeInt32(encodedHello.ListeningPort, stream);
     NodeID.Encode(stream, encodedHello.PeerID);
     AuthCert.Encode(stream, encodedHello.Cert);
     Uint256.Encode(stream, encodedHello.Nonce);
 }
Exemplo n.º 3
0
 public static void Encode(IByteWriter stream, Error encodedError)
 {
     ErrorCode.Encode(stream, encodedError.Code);
     XdrEncoding.WriteString(stream, encodedError.Msg);
 }
Exemplo n.º 4
0
 public static void Encode(IByteWriter stream, String64 encodedString64)
 {
     XdrEncoding.WriteString(stream, encodedString64.InnerValue);
 }