/* ******************************************************************************** * Functions * ****************************************************************************** */ #region "Functions" /// <summary> /// Load the contents of a stream into this structure. /// </summary> /// <param name="streamReference">Reference to the (predefined) stream.</param> public virtual void Read(Stream streamReference) { BinaryReader _binaryReader = new BinaryReader(streamReference); this.version = _binaryReader.ReadUInt32(); this.prev_block = _binaryReader.ReadBytes(32); this.merkle_root = _binaryReader.ReadBytes(32); this.timestamp = _binaryReader.ReadUInt32(); this.bits = _binaryReader.ReadUInt32(); this.nonce = _binaryReader.ReadUInt32(); this.transactions = new Transaction[VarInt.FromStream(streamReference)]; for (int i = 0; i < this.transactions.Length; i++) { this.transactions[i] = Transaction.FromStream(streamReference); } }
/* ******************************************************************************** * Functions * ****************************************************************************** */ #region "Functions" /// <summary> /// Load the contents of a stream into this structure. /// </summary> /// <param name="streamReference">Reference to the (predefined) stream.</param> public void Read(Stream streamReference) { BinaryReader _binaryReader = new BinaryReader(streamReference); this.version = _binaryReader.ReadUInt32(); this.inputs = new TxIn[VarInt.FromStream(streamReference)]; for (int i = 0; i < this.inputs.Length; i++) { this.inputs[i] = TxIn.FromStream(streamReference); } this.outputs = new TxOut[VarInt.FromStream(streamReference)]; for (int i = 0; i < this.outputs.Length; i++) { this.outputs[i] = TxOut.FromStream(streamReference); } this.lock_time = _binaryReader.ReadUInt32(); }