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


C# MemoryStream.PeekByte方法代码示例

本文整理汇总了C#中System.IO.MemoryStream.PeekByte方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryStream.PeekByte方法的具体用法?C# MemoryStream.PeekByte怎么用?C# MemoryStream.PeekByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.MemoryStream的用法示例。


在下文中一共展示了MemoryStream.PeekByte方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Skip

 public void Skip(MemoryStream memoryStream)
 {
     memoryStream.ReadByte();
     memoryStream.ReadByte();
     memoryStream.ReadLEShort();
     byte typeId;
     do
     {
         typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     } while (typeId != BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId);
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:13,代码来源:BinarySerializationExternalVariableLengthObjectSegment.cs

示例2: Skip

 public void Skip(MemoryStream memoryStream)
 {
     SkipPrefix(memoryStream);
     memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     short propertyCount = memoryStream.ReadLEShort();
     memoryStream.ReadLEShort();
     for (int i = 0; i < propertyCount; i++)
     {
         memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     }
     var propertyTypes = new List<byte>();
     for (int i = 0; i < propertyCount; i++)
     {
         propertyTypes.Add((byte)memoryStream.ReadByte());
     }
     int referencePropertyCount = propertyTypes.Count(x => x == (int)BinarySerializationPropertyType.Reference);
     for (int i = 0; i < referencePropertyCount; i++)
     {
         memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     }
     for (int i = 0; i < referencePropertyCount; i++)
     {
         byte typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     }
     byte nextTypeId = memoryStream.PeekByte();
     if (nextTypeId == BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId)
     {
         BinarySerializationSegment.EndVariableLengthObjectSegment.Handler.Skip(memoryStream);
         nextTypeId = memoryStream.PeekByte();
     }
     if (nextTypeId != BinarySerializationSegment.VariableLengthObjectSegment.TypeId)
     {
         throw new ArgumentException("Expected next segment to be " + BinarySerializationSegment.VariableLengthObjectSegment.TypeId
                                     + " but was " + nextTypeId);
     }
     // the next segment should contain the text of the StackTrace
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:39,代码来源:BinarySerializationPartialExceptionClassSegment.cs

示例3: Skip

 public void Skip(MemoryStream memoryStream)
 {
     memoryStream.ReadByte();
     memoryStream.ReadLEShort();
     memoryStream.ReadLEShort();
     memoryStream.ReadStringHaving7bitVariableLengthInt32Prefix();
     byte typeId;
     do
     {
         typeId = memoryStream.PeekByte();
         var handler = BinarySerializationSegment.GetFor(typeId);
         handler.Skip(memoryStream);
     } while (typeId != BinarySerializationSegment.EndVariableLengthObjectSegment.TypeId &&
              typeId != BinarySerializationSegment.ObjectReferenceSegment.TypeId);
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:15,代码来源:BinarySerializationVariableLengthObjectSegment.cs

示例4: FindStackTraceSegment

 private static void FindStackTraceSegment(MemoryStream stream)
 {
     stream.Position = 0;
     new BinarySerializationHeaderSegment().Skip(stream);
     var assemblyInfoSegment = BinarySerializationSegment.AssemblyInfoSegment.Handler;
     if (assemblyInfoSegment.IsMatch(stream))
     {
         assemblyInfoSegment.Skip(stream);
     }
     var exceptionClassSegment = new BinarySerializationPartialExceptionClassSegment();
     if (!exceptionClassSegment.IsMatch(stream))
     {
         throw new ArgumentException(String.Format("don't know how to handle segment type '0x{0:x2}'", stream.PeekByte()));
     }
     exceptionClassSegment.Skip(stream);
     exceptionClassSegment.SkipPrefix(stream);
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:17,代码来源:ExceptionRewriter.cs

示例5: IsMatch

 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.RuntimeClassSegment.TypeId ||
            typeId == BinarySerializationSegment.ExternalClassSegment.TypeId;
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:6,代码来源:BinarySerializationPartialExceptionClassSegment.cs

示例6: IsMatch

 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.ObjectReferenceSegment.TypeId;
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:5,代码来源:BinarySerializationObjectReferenceSegment.cs

示例7: IsMatch

 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.BoxedPrimitiveSegment.TypeId;
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:5,代码来源:BinarySerializationBoxedPrimitiveSegment.cs

示例8: IsMatch

 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.ExternalVariableLengthObjectSegment.TypeId;
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:5,代码来源:BinarySerializationExternalVariableLengthObjectSegment.cs

示例9: IsMatch

 public bool IsMatch(MemoryStream memoryStream)
 {
     byte typeId = memoryStream.PeekByte();
     return typeId == BinarySerializationSegment.AssemblyInfoSegment.TypeId;
 }
开发者ID:Capparelli,项目名称:FluentAssert,代码行数:5,代码来源:BinarySerializationAssemblyInfoSegment.cs


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