public static TransactionMeta Decode(XdrDataInputStream stream) { TransactionMeta decodedTransactionMeta = new TransactionMeta(); int discriminant = stream.ReadInt(); decodedTransactionMeta.Discriminant = discriminant; switch (decodedTransactionMeta.Discriminant) { case 0: int operationssize = stream.ReadInt(); decodedTransactionMeta.Operations = new OperationMeta[operationssize]; for (int i = 0; i < operationssize; i++) { decodedTransactionMeta.Operations[i] = OperationMeta.Decode(stream); } break; case 1: decodedTransactionMeta.V1 = TransactionMetaV1.Decode(stream); break; case 2: decodedTransactionMeta.V2 = TransactionMetaV2.Decode(stream); break; } return(decodedTransactionMeta); }
public static void Encode(XdrDataOutputStream stream, TransactionMetaV1 encodedTransactionMetaV1) { LedgerEntryChanges.Encode(stream, encodedTransactionMetaV1.TxChanges); int operationssize = encodedTransactionMetaV1.Operations.Length; stream.WriteInt(operationssize); for (int i = 0; i < operationssize; i++) { OperationMeta.Encode(stream, encodedTransactionMetaV1.Operations[i]); } }
public static TransactionMetaV1 Decode(XdrDataInputStream stream) { TransactionMetaV1 decodedTransactionMetaV1 = new TransactionMetaV1(); decodedTransactionMetaV1.TxChanges = LedgerEntryChanges.Decode(stream); int operationssize = stream.ReadInt(); decodedTransactionMetaV1.Operations = new OperationMeta[operationssize]; for (int i = 0; i < operationssize; i++) { decodedTransactionMetaV1.Operations[i] = OperationMeta.Decode(stream); } return decodedTransactionMetaV1; }
public static void Encode(XdrDataOutputStream stream, TransactionMeta encodedTransactionMeta) { stream.WriteInt((int)encodedTransactionMeta.Discriminant); switch (encodedTransactionMeta.Discriminant) { case 0: int operationssize = encodedTransactionMeta.Operations.Length; stream.WriteInt(operationssize); for (int i = 0; i < operationssize; i++) { OperationMeta.Encode(stream, encodedTransactionMeta.Operations[i]); } break; case 1: TransactionMetaV1.Encode(stream, encodedTransactionMeta.V1); break; } }