本文整理汇总了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
}
示例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);
}
示例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);
}
示例5: IsMatch
public bool IsMatch(MemoryStream memoryStream)
{
byte typeId = memoryStream.PeekByte();
return typeId == BinarySerializationSegment.RuntimeClassSegment.TypeId ||
typeId == BinarySerializationSegment.ExternalClassSegment.TypeId;
}
示例6: IsMatch
public bool IsMatch(MemoryStream memoryStream)
{
byte typeId = memoryStream.PeekByte();
return typeId == BinarySerializationSegment.ObjectReferenceSegment.TypeId;
}
示例7: IsMatch
public bool IsMatch(MemoryStream memoryStream)
{
byte typeId = memoryStream.PeekByte();
return typeId == BinarySerializationSegment.BoxedPrimitiveSegment.TypeId;
}
示例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;
}