private void DeserializeWithoutType(BinaryReader reader) { DeserializeExclusiveData(reader); this.Inputs = reader.ReadSerializableArray<TransactionInput>(); if (GetAllInputs().Distinct().Count() != GetAllInputs().Count()) throw new FormatException(); this.Outputs = reader.ReadSerializableArray<TransactionOutput>(); if (Outputs.Any(p => p.Value == Fixed8.Zero)) throw new FormatException(); this.Scripts = reader.ReadBytesArray(); }
public override void Deserialize(BinaryReader reader) { ((ISignable)this).DeserializeUnsigned(reader); this.Scripts = reader.ReadBytesArray(); }
internal static Transaction DeserializeFrom(BinaryReader reader) { TransactionType type = (TransactionType)reader.ReadByte(); string typeName = string.Format("{0}.{1}", typeof(Transaction).Namespace, type); Transaction transaction = typeof(Transaction).Assembly.CreateInstance(typeName) as Transaction; if (transaction == null) throw new FormatException(); transaction.DeserializeUnsignedWithoutType(reader); transaction.Scripts = reader.ReadBytesArray(); return transaction; }
internal void DeserializeInTransaction(BinaryReader reader, AgencyTransaction tx) { DeserializeUnsignedInternal(reader, tx.AssetId, tx.ValueAssetId, tx.Agent); this.Scripts = reader.ReadBytesArray(); }
void ISerializable.Deserialize(BinaryReader reader) { ((ISignable)this).DeserializeUnsigned(reader); this.Scripts = reader.ReadBytesArray(); }
private void DeserializeInternal(BinaryReader reader, UInt256 asset_id, UInt256 value_asset_id, UInt160 agent) { this.AssetId = asset_id; this.ValueAssetId = value_asset_id; this.Agent = agent; this.Amount = reader.ReadSerializable<Fixed8>(); if (Amount == Fixed8.Zero) throw new FormatException(); if (Amount.GetData() % 10000 != 0) throw new FormatException(); this.Price = reader.ReadSerializable<Fixed8>(); if (Price <= Fixed8.Zero) throw new FormatException(); if (Price.GetData() % 10000 != 0) throw new FormatException(); this.Client = reader.ReadSerializable<UInt160>(); this.Inputs = reader.ReadSerializableArray<TransactionInput>(); if (Inputs.Distinct().Count() != Inputs.Length) throw new FormatException(); this.Scripts = reader.ReadBytesArray(); }