本文整理汇总了C#中System.IO.BinaryReader.ReadList方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadList方法的具体用法?C# BinaryReader.ReadList怎么用?C# BinaryReader.ReadList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadList方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodeInventoryPayload
public static InventoryPayload DecodeInventoryPayload(BinaryReader reader)
{
return new InventoryPayload
(
InventoryVectors: reader.ReadList(() => DecodeInventoryVector(reader))
);
}
示例2: DecodeAddressPayload
public static AddressPayload DecodeAddressPayload(BinaryReader reader)
{
return new AddressPayload
(
NetworkAddresses: reader.ReadList(() => DecodeNetworkAddressWithTime(reader))
);
}
示例3: DecodeBlock
public static Block DecodeBlock(BinaryReader reader, UInt256 blockHash = null)
{
return new Block
(
header: DecodeBlockHeader(reader, blockHash),
transactions: reader.ReadList(() => DecodeTransaction(reader))
);
}
示例4: DecodeGetBlocksPayload
public static GetBlocksPayload DecodeGetBlocksPayload(BinaryReader reader)
{
return new GetBlocksPayload
(
Version: reader.ReadUInt32(),
BlockLocatorHashes: reader.ReadList(() => reader.ReadUInt256()),
HashStop: reader.ReadUInt256()
);
}
示例5: Read
public void Read(BinaryReader reader)
{
NumberOfPeels = reader.ReadInt32();
PerformedFirstPeel = reader.ReadBoolean();
AvgTimeBetweenPeels = reader.ReadInt32();
NumberOfDumps = reader.ReadInt32();
AvgTimeBetweenDumps = reader.ReadInt32();
IsWinner = reader.ReadBoolean();
RawGameData = reader.ReadList<GameMoveDataPoint>();
}
示例6: Read
public void Read(BinaryReader reader)
{
PacketType = (PacketType)reader.ReadByte();
Sender = reader.ReadString();
Recipients = reader.ReadList();
var type = DataPacket.PacketTypeMap[PacketType];
if (type == null)
{
Data = null;
}
else if (type == typeof(string))
{
Data = reader.ReadString();
}
else
{
var binaryData = Activator.CreateInstance(type);
var hasInstance = reader.ReadBoolean();
if (!hasInstance)
{
return;
}
try
{
((IBinarySerializable) binaryData).Read(reader);
Data = binaryData;
}
catch
{
#if DEBUG
throw;
#endif
Debug.WriteLine(string.Format("Deserialization failed on PacketType {0}", PacketType.ToString()));
}
}
}
示例7: TryGetBlockUnmintedTxes
public bool TryGetBlockUnmintedTxes(UInt256 blockHash, out IImmutableList<UnmintedTx> unmintedTxes)
{
CheckTransaction();
byte[] unmintedTxesBytes;
if (this.txn.TryGet(blockUnmintedTxesTableId, DbEncoder.EncodeUInt256(blockHash), out unmintedTxesBytes))
{
using (var stream = new MemoryStream(unmintedTxesBytes))
using (var reader = new BinaryReader(stream))
{
unmintedTxes = ImmutableList.CreateRange(reader.ReadList(() => DataEncoder.DecodeUnmintedTx(reader)));
}
return true;
}
else
{
unmintedTxes = null;
return false;
}
}
示例8: TryGetBlockSpentTxes
public bool TryGetBlockSpentTxes(int blockIndex, out BlockSpentTxes spentTxes)
{
CheckTransaction();
byte[] spentTxesBytes;
if (this.txn.TryGet(blockSpentTxesTableId, DbEncoder.EncodeInt32(blockIndex), out spentTxesBytes))
{
using (var stream = new MemoryStream(spentTxesBytes))
using (var reader = new BinaryReader(stream))
{
spentTxes = BlockSpentTxes.CreateRange(reader.ReadList(() => DataEncoder.DecodeSpentTx(reader)));
}
return true;
}
else
{
spentTxes = null;
return false;
}
}
示例9: Read
public void Read(BinaryReader reader)
{
_GameData = reader.ReadList<GameData>();
}
示例10: Read
public void Read(BinaryReader reader)
{
Friends = reader.ReadList<Friend>();
}
示例11: DecodeUnmintedTx
public static UnmintedTx DecodeUnmintedTx(BinaryReader reader)
{
return new UnmintedTx(
txHash: reader.ReadUInt256(),
prevOutputTxKeys: reader.ReadList(() => DecodeTxLookupKey(reader))
);
}
示例12: DecodeTransaction
public static Transaction DecodeTransaction(BinaryReader reader, UInt256 txHash = null)
{
return new Transaction
(
version: reader.ReadUInt32(),
inputs: reader.ReadList(() => DecodeTxInput(reader)),
outputs: reader.ReadList(() => DecodeTxOutput(reader)),
lockTime: reader.ReadUInt32(),
hash: txHash
);
}
示例13: GetItemsFromCache
private async Task<CacheResponse> GetItemsFromCache(SourceProvider source)
{
var filename = GetFileName(GetCacheFile(source));
if (await _storage.Local.FileExistsAsync(filename))
{
var items = new List<ReaderItem>();
using (var file = await _storage.Local.OpenFileForReadAsync(filename))
{
using (var reader = new BinaryReader(file))
{
try
{
items = reader.ReadList<ReaderItem>();
}
catch
{
}
}
}
var expired = CacheHasExpired(source);
return new CacheResponse(items ?? new List<ReaderItem>(), expired);
}
return new CacheResponse(new List<ReaderItem>(), false);
}
示例14: Read
public void Read(BinaryReader reader)
{
GameHost = reader.ReadString();
GameMoves = reader.ReadList<GameMoveDataPoint>();
Winner = reader.ReadString();
GameDuration = reader.ReadInt32();
GameStartTime = reader.ReadDateTime();
PlayerDictionary = reader.ReadPlayerDictionary<PlayerGameStats>();
}