Ejemplo n.º 1
0
        public static void Encode(XdrDataOutputStream stream, BucketEntry encodedBucketEntry)
        {
            stream.WriteInt((int)encodedBucketEntry.Discriminant.InnerValue);
            switch (encodedBucketEntry.Discriminant.InnerValue)
            {
            case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
                LedgerEntry.Encode(stream, encodedBucketEntry.LiveEntry);
                break;

            case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
                LedgerKey.Encode(stream, encodedBucketEntry.DeadEntry);
                break;
            }
        }
Ejemplo n.º 2
0
        public static BucketEntry Decode(XdrDataInputStream stream)
        {
            BucketEntry     decodedBucketEntry = new BucketEntry();
            BucketEntryType discriminant       = BucketEntryType.Decode(stream);

            decodedBucketEntry.Discriminant = discriminant;
            switch (decodedBucketEntry.Discriminant.InnerValue)
            {
            case BucketEntryType.BucketEntryTypeEnum.LIVEENTRY:
                decodedBucketEntry.LiveEntry = LedgerEntry.Decode(stream);
                break;

            case BucketEntryType.BucketEntryTypeEnum.DEADENTRY:
                decodedBucketEntry.DeadEntry = LedgerKey.Decode(stream);
                break;
            }
            return(decodedBucketEntry);
        }