Exemplo n.º 1
0
        public void Deserialize(BinaryReader reader)
        {
            var deserializedTransactions = new List <AbstractTransaction>();
            var count = reader.ReadInt16();

            for (int i = 0; i < count; i++)
            {
                var txPayload = new SingleStateTransactionPayload();
                txPayload.Deserialize(reader);
                deserializedTransactions.Add(txPayload.Transaction);
            }
            _transactions = deserializedTransactions;
        }
Exemplo n.º 2
0
        public void Serialize(BinaryWriter writer)
        {
            if (_transactions.Count() > Int16.MaxValue)
            {
                throw new InvalidDataException("Too many transactions");
            }

            writer.Write((Int16)_transactions.Count());
            foreach (var tx in _transactions)
            {
                var transactionPayload = new SingleStateTransactionPayload(tx);
                transactionPayload.Serialize(writer);
            }
        }