예제 #1
0
        public override void Deserialize(byte[] bytes, ref int index)
        {
            var countBytes = new byte[4];

            this.Transactions.Clear();

            Array.Copy(bytes, index, countBytes, 0, countBytes.Length);
            index += 4;

            if (BitConverter.IsLittleEndian)
            {
                Array.Reverse(countBytes);
            }

            int count = BitConverter.ToInt32(countBytes, 0);

            var txIndex = 0;

            while (txIndex < count)
            {
                var transactionMsg = new TransactionMsg();
                transactionMsg.Deserialize(bytes, ref index);
                this.Transactions.Add(transactionMsg);

                txIndex++;
            }
        }
예제 #2
0
        public override void Deserialize(byte[] bytes, ref int index)
        {
            this.Header = new BlockHeaderMsg();
            this.Header.Deserialize(bytes, ref index);

            var txIndex = 0;

            while (txIndex < this.Header.TotalTransaction)
            {
                var transactionMsg = new TransactionMsg();
                transactionMsg.Deserialize(bytes, ref index);
                this.Transactions.Add(transactionMsg);

                txIndex++;
            }
        }