public static LedgerKey Decode(XdrDataInputStream stream) { LedgerKey decodedLedgerKey = new LedgerKey(); LedgerEntryType 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); }
public static LedgerEntryData Decode(XdrDataInputStream stream) { LedgerEntryData decodedLedgerEntryData = new LedgerEntryData(); LedgerEntryType discriminant = LedgerEntryType.Decode(stream); decodedLedgerEntryData.Discriminant = discriminant; switch (decodedLedgerEntryData.Discriminant.InnerValue) { case LedgerEntryType.LedgerEntryTypeEnum.ACCOUNT: decodedLedgerEntryData.Account = AccountEntry.Decode(stream); break; case LedgerEntryType.LedgerEntryTypeEnum.TRUSTLINE: decodedLedgerEntryData.TrustLine = TrustLineEntry.Decode(stream); break; case LedgerEntryType.LedgerEntryTypeEnum.OFFER: decodedLedgerEntryData.Offer = OfferEntry.Decode(stream); break; case LedgerEntryType.LedgerEntryTypeEnum.DATA: decodedLedgerEntryData.Data = DataEntry.Decode(stream); break; } return(decodedLedgerEntryData); }