示例#1
0
        public static LedgerKey Decode(XdrDataInputStream stream)
        {
            var decodedLedgerKey = new LedgerKey();
            var discriminant     = LedgerEntryType.Decode(stream);

            decodedLedgerKey.Discriminant = discriminant;
            switch (decodedLedgerKey.Discriminant.InnerValue)
            {
            case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT:
                decodedLedgerKey.Account = LedgerKeyAccount.Decode(stream);
                break;

            case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE:
                decodedLedgerKey.TrustLine = LedgerKeyTrustLine.Decode(stream);
                break;

            case LedgerEntryType.LedgerEntryTypeEnum.OFFER:
                decodedLedgerKey.Offer = LedgerKeyOffer.Decode(stream);
                break;

            case LedgerEntryType.LedgerEntryTypeEnum.DATA:
                decodedLedgerKey.Data = LedgerKeyData.Decode(stream);
                break;
            }
            return(decodedLedgerKey);
        }