Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 public override void Deserialize(BinaryReader reader)
 {
     ((ISignable)this).DeserializeUnsigned(reader);
     this.Scripts = reader.ReadBytesArray();
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
 internal void DeserializeInTransaction(BinaryReader reader, AgencyTransaction tx)
 {
     DeserializeUnsignedInternal(reader, tx.AssetId, tx.ValueAssetId, tx.Agent);
     this.Scripts = reader.ReadBytesArray();
 }
Ejemplo n.º 5
0
 void ISerializable.Deserialize(BinaryReader reader)
 {
     ((ISignable)this).DeserializeUnsigned(reader);
     this.Scripts = reader.ReadBytesArray();
 }
Ejemplo n.º 6
0
 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();
 }