当前位置: 首页>>代码示例>>C#>>正文


C# BinaryReader.ReadList方法代码示例

本文整理汇总了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))
     );
 }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:7,代码来源:NodeEncoder.cs

示例2: DecodeAddressPayload

 public static AddressPayload DecodeAddressPayload(BinaryReader reader)
 {
     return new AddressPayload
     (
         NetworkAddresses: reader.ReadList(() => DecodeNetworkAddressWithTime(reader))
     );
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:7,代码来源:NodeEncoder.cs

示例3: DecodeBlock

 public static Block DecodeBlock(BinaryReader reader, UInt256 blockHash = null)
 {
     return new Block
     (
         header: DecodeBlockHeader(reader, blockHash),
         transactions: reader.ReadList(() => DecodeTransaction(reader))
     );
 }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:8,代码来源:DataEncoder.cs

示例4: DecodeGetBlocksPayload

 public static GetBlocksPayload DecodeGetBlocksPayload(BinaryReader reader)
 {
     return new GetBlocksPayload
     (
         Version: reader.ReadUInt32(),
         BlockLocatorHashes: reader.ReadList(() => reader.ReadUInt256()),
         HashStop: reader.ReadUInt256()
     );
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:9,代码来源:NodeEncoder.cs

示例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>();
 }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:10,代码来源:PlayerGameStats.cs

示例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()));
                }

            }
        }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:43,代码来源:PacketV1.cs

示例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;
            }
        }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:21,代码来源:LmdbChainStateCursor.cs

示例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;
            }
        }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:21,代码来源:LmdbChainStateCursor.cs

示例9: Read

 public void Read(BinaryReader reader)
 {
     _GameData = reader.ReadList<GameData>();
 }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:4,代码来源:GameDataList.cs

示例10: Read

 public void Read(BinaryReader reader)
 {
     Friends = reader.ReadList<Friend>();
 }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:4,代码来源:FriendList.cs

示例11: DecodeUnmintedTx

 public static UnmintedTx DecodeUnmintedTx(BinaryReader reader)
 {
     return new UnmintedTx(
         txHash: reader.ReadUInt256(),
         prevOutputTxKeys: reader.ReadList(() => DecodeTxLookupKey(reader))
     );
 }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:7,代码来源:DataEncoder.cs

示例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
     );
 }
开发者ID:ArsenShnurkov,项目名称:BitSharp,代码行数:11,代码来源:DataEncoder.cs

示例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);
        }
开发者ID:ScottIsAFool,项目名称:Speader,代码行数:28,代码来源:CacheService.cs

示例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>();
 }
开发者ID:jonathanyeung,项目名称:ozwego,代码行数:9,代码来源:GameData.cs


注:本文中的System.IO.BinaryReader.ReadList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。