當前位置: 首頁>>代碼示例>>C#>>正文


C# BinaryReader.ReadSerializableArray方法代碼示例

本文整理匯總了C#中System.IO.BinaryReader.ReadSerializableArray方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryReader.ReadSerializableArray方法的具體用法?C# BinaryReader.ReadSerializableArray怎麽用?C# BinaryReader.ReadSerializableArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.BinaryReader的用法示例。


在下文中一共展示了BinaryReader.ReadSerializableArray方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Deserialize

 public override void Deserialize(BinaryReader reader)
 {
     Version = reader.ReadUInt32();
     Inputs = reader.ReadSerializableArray<TransactionInput>();
     for (int i = 1; i < Inputs.Length; i++)
         for (int j = 0; j < i; j++)
             if (Inputs[i].PrevHash == Inputs[j].PrevHash && Inputs[i].PrevIndex == Inputs[j].PrevIndex)
                 throw new FormatException();
     Outputs = reader.ReadSerializableArray<TransactionOutput>();
     LockTime = reader.ReadUInt32();
 }
開發者ID:erikzhang,項目名稱:IceWallet,代碼行數:11,代碼來源:Transaction.cs

示例2: DeserializeExclusiveData

 protected override void DeserializeExclusiveData(BinaryReader reader)
 {
     this.Enrollments = reader.ReadSerializableArray<UInt256>();
     if (Enrollments.Length == 0 || Enrollments.Length > 1024)
         throw new FormatException();
     if (Enrollments.Length != Enrollments.Distinct().Count())
         throw new FormatException();
 }
開發者ID:4T-Shirt,項目名稱:AntShares,代碼行數:8,代碼來源:VotingTransaction.cs

示例3: using

 void ISignable.FromUnsignedArray(byte[] value)
 {
     using (MemoryStream ms = new MemoryStream(value, false))
     using (BinaryReader reader = new BinaryReader(ms))
     {
         this.AssetId = reader.ReadSerializable<UInt256>();
         this.ValueAssetId = reader.ReadSerializable<UInt256>();
         this.Agent = reader.ReadSerializable<UInt160>();
         this.Amount = reader.ReadSerializable<Fixed8>();
         this.Price = reader.ReadSerializable<Fixed8>();
         this.Client = reader.ReadSerializable<UInt160>();
         this.Inputs = reader.ReadSerializableArray<TransactionInput>();
     }
 }
開發者ID:imcoddy,項目名稱:AntShares,代碼行數:14,代碼來源:Order.cs

示例4: DeserializeUnsignedInternal

 private void DeserializeUnsignedInternal(BinaryReader reader, UInt256 asset_id, UInt256 value_asset_id, UInt160 agent)
 {
     AssetId = asset_id;
     ValueAssetId = value_asset_id;
     Agent = agent;
     Amount = reader.ReadSerializable<Fixed8>();
     if (Amount == Fixed8.Zero) throw new FormatException();
     if (Amount.GetData() % 10000 != 0) throw new FormatException();
     Price = reader.ReadSerializable<Fixed8>();
     if (Price <= Fixed8.Zero) throw new FormatException();
     if (Price.GetData() % 10000 != 0) throw new FormatException();
     Client = reader.ReadSerializable<UInt160>();
     Inputs = reader.ReadSerializableArray<TransactionInput>();
     if (Inputs.Distinct().Count() != Inputs.Length)
         throw new FormatException();
 }
開發者ID:zhengger,項目名稱:AntShares,代碼行數:16,代碼來源:Order.cs

示例5:

 void ISignable.DeserializeUnsigned(BinaryReader reader)
 {
     PrevHash = reader.ReadSerializable<UInt256>();
     Miner = ECPoint.DeserializeFrom(reader, ECCurve.Secp256r1);
     IV = reader.ReadBytes(16);
     NoncePieces.Clear();
     int count = (int)reader.ReadVarInt();
     for (int i = 0; i < count; i++)
     {
         ECPoint key = ECPoint.DeserializeFrom(reader, ECCurve.Secp256r1);
         if (key == Miner) throw new FormatException();
         byte[] value = reader.ReadBytes((int)reader.ReadVarInt());
         NoncePieces.Add(key, value);
     }
     NonceHash = reader.ReadSerializable<UInt256>();
     TransactionHashes = reader.ReadSerializableArray<UInt256>();
 }
開發者ID:EppoFq,項目名稱:AntShares,代碼行數:17,代碼來源:BlockConsensusRequest.cs

示例6: Deserialize

 public override void Deserialize(BinaryReader reader)
 {
     this.PrevHash = reader.ReadSerializable<UInt256>();
     this.Miner = Secp256r1Point.DeserializeFrom(reader);
     this.NoncePieces.Clear();
     int count = (int)reader.ReadVarInt();
     for (int i = 0; i < count; i++)
     {
         Secp256r1Point key = Secp256r1Point.DeserializeFrom(reader);
         if (key == Miner) throw new FormatException();
         byte[] value = reader.ReadBytes((int)reader.ReadVarInt());
         NoncePieces.Add(key, value);
     }
     this.NonceHash = reader.ReadSerializable<UInt256>();
     this.TransactionHashes = reader.ReadSerializableArray<UInt256>();
     this.Script = reader.ReadBytes((int)reader.ReadVarInt());
 }
開發者ID:imcoddy,項目名稱:AntShares,代碼行數:17,代碼來源:BlockConsensusRequest.cs

示例7: DeserializeWithoutType

 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();
 }
開發者ID:imcoddy,項目名稱:AntShares,代碼行數:11,代碼來源:Transaction.cs

示例8: using

 void ISignable.FromUnsignedArray(byte[] value)
 {
     using (MemoryStream ms = new MemoryStream(value, false))
     using (BinaryReader reader = new BinaryReader(ms))
     {
         if ((TransactionType)reader.ReadByte() != Type)
             throw new FormatException();
         DeserializeExclusiveData(reader);
         this.Inputs = reader.ReadSerializableArray<TransactionInput>();
         this.Outputs = reader.ReadSerializableArray<TransactionOutput>();
     }
 }
開發者ID:imcoddy,項目名稱:AntShares,代碼行數:12,代碼來源:Transaction.cs

示例9: DeserializeExclusiveData

 protected override void DeserializeExclusiveData(BinaryReader reader)
 {
     this.Attributes = reader.ReadSerializableArray<TransactionAttribute>();
 }
開發者ID:4T-Shirt,項目名稱:AntShares,代碼行數:4,代碼來源:ContractTransaction.cs

示例10: DeserializeFrom

 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.ReadSerializableArray<Script>();
     return transaction;
 }
開發者ID:qlw,項目名稱:AntShares,代碼行數:11,代碼來源:Transaction.cs

示例11: DeserializeUnsignedWithoutType

 private void DeserializeUnsignedWithoutType(BinaryReader reader)
 {
     DeserializeExclusiveData(reader);
     Attributes = reader.ReadSerializableArray<TransactionAttribute>();
     Inputs = reader.ReadSerializableArray<TransactionInput>();
     TransactionInput[] inputs = GetAllInputs().ToArray();
     for (int i = 1; i < inputs.Length; i++)
         for (int j = 0; j < i; j++)
             if (inputs[i].PrevHash == inputs[j].PrevHash && inputs[i].PrevIndex == inputs[j].PrevIndex)
                 throw new FormatException();
     Outputs = reader.ReadSerializableArray<TransactionOutput>();
     if (Outputs.Length > ushort.MaxValue + 1)
         throw new FormatException();
 }
開發者ID:qlw,項目名稱:AntShares,代碼行數:14,代碼來源:Transaction.cs

示例12: using

 void ISignable.FromUnsignedArray(byte[] value)
 {
     using (MemoryStream ms = new MemoryStream(value, false))
     using (BinaryReader reader = new BinaryReader(ms))
     {
         this.PrevHash = reader.ReadSerializable<UInt256>();
         this.Miner = Secp256r1Point.DeserializeFrom(reader);
         this.NoncePieces.Clear();
         int count = (int)reader.ReadVarInt();
         for (int i = 0; i < count; i++)
         {
             Secp256r1Point key = Secp256r1Point.DeserializeFrom(reader);
             if (key == Miner) throw new FormatException();
             value = reader.ReadBytes((int)reader.ReadVarInt());
             NoncePieces.Add(key, value);
         }
         this.NonceHash = reader.ReadSerializable<UInt256>();
         this.TransactionHashes = reader.ReadSerializableArray<UInt256>();
     }
 }
開發者ID:imcoddy,項目名稱:AntShares,代碼行數:20,代碼來源:BlockConsensusRequest.cs

示例13: DeserializeInTransaction

 internal void DeserializeInTransaction(BinaryReader reader, AgencyTransaction tx)
 {
     DeserializeUnsignedInternal(reader, tx.AssetId, tx.ValueAssetId, tx.Agent);
     Scripts = reader.ReadSerializableArray<Script>();
 }
開發者ID:zhengger,項目名稱:AntShares,代碼行數:5,代碼來源:Order.cs

示例14:

 void ISerializable.Deserialize(BinaryReader reader)
 {
     this.Headers = reader.ReadSerializableArray<BlockHeader>();
 }
開發者ID:4T-Shirt,項目名稱:AntShares,代碼行數:4,代碼來源:HeadersPayload.cs

示例15:

 void ISerializable.Deserialize(BinaryReader reader)
 {
     this.Version = reader.ReadUInt32();
     this.HashStart = reader.ReadSerializableArray<UInt256>();
     this.HashStop = reader.ReadSerializable<UInt256>();
 }
開發者ID:erikzhang,項目名稱:IceWallet,代碼行數:6,代碼來源:GetBlocksPayload.cs


注:本文中的System.IO.BinaryReader.ReadSerializableArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。