Exemple #1
0
 public static void Encode(XdrDataOutputStream stream, SCPHistoryEntry encodedSCPHistoryEntry)
 {
     stream.WriteInt((int)encodedSCPHistoryEntry.Discriminant);
     switch (encodedSCPHistoryEntry.Discriminant)
     {
     case 0:
         SCPHistoryEntryV0.Encode(stream, encodedSCPHistoryEntry.V0);
         break;
     }
 }
        public static void Encode(XdrDataOutputStream stream, SCPHistoryEntryV0 encodedSCPHistoryEntryV0)
        {
            int quorumSetssize = encodedSCPHistoryEntryV0.QuorumSets.Length;

            stream.WriteInt(quorumSetssize);
            for (int i = 0; i < quorumSetssize; i++)
            {
                SCPQuorumSet.Encode(stream, encodedSCPHistoryEntryV0.QuorumSets[i]);
            }
            LedgerSCPMessages.Encode(stream, encodedSCPHistoryEntryV0.LedgerMessages);
        }
        public static SCPHistoryEntryV0 Decode(XdrDataInputStream stream)
        {
            SCPHistoryEntryV0 decodedSCPHistoryEntryV0 = new SCPHistoryEntryV0();
            int quorumSetssize = stream.ReadInt();

            decodedSCPHistoryEntryV0.QuorumSets = new SCPQuorumSet[quorumSetssize];
            for (int i = 0; i < quorumSetssize; i++)
            {
                decodedSCPHistoryEntryV0.QuorumSets[i] = SCPQuorumSet.Decode(stream);
            }
            decodedSCPHistoryEntryV0.LedgerMessages = LedgerSCPMessages.Decode(stream);
            return(decodedSCPHistoryEntryV0);
        }
Exemple #4
0
        public static SCPHistoryEntry Decode(XdrDataInputStream stream)
        {
            SCPHistoryEntry decodedSCPHistoryEntry = new SCPHistoryEntry();
            int             discriminant           = stream.ReadInt();

            decodedSCPHistoryEntry.Discriminant = discriminant;
            switch (decodedSCPHistoryEntry.Discriminant)
            {
            case 0:
                decodedSCPHistoryEntry.V0 = SCPHistoryEntryV0.Decode(stream);
                break;
            }
            return(decodedSCPHistoryEntry);
        }