本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# __BinaryParser.ReadBytes方法的具体用法?C# __BinaryParser.ReadBytes怎么用?C# __BinaryParser.ReadBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.Formatters.Binary.__BinaryParser
的用法示例。
在下文中一共展示了__BinaryParser.ReadBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(__BinaryParser input)
{
byte[] buffer = input.ReadBytes(0x11);
if (buffer.Length < 0x11)
{
__Error.EndOfFile();
}
this.majorVersion = GetInt32(buffer, 9);
if (this.majorVersion > this.binaryFormatterMajorVersion)
{
throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", new object[] { BitConverter.ToString(buffer) }));
}
this.binaryHeaderEnum = (BinaryHeaderEnum) buffer[0];
this.topId = GetInt32(buffer, 1);
this.headerId = GetInt32(buffer, 5);
this.minorVersion = GetInt32(buffer, 13);
}
示例2: Read
[System.Security.SecurityCritical] // implements Critical method
public void Read(__BinaryParser input)
{
byte [] headerBytes = input.ReadBytes(17);
// Throw if we couldnt read header bytes
if (headerBytes.Length < 17)
__Error.EndOfFile();
majorVersion = GetInt32(headerBytes, 9);
if (majorVersion > binaryFormatterMajorVersion)
throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", BitConverter.ToString(headerBytes)));
// binaryHeaderEnum has already been read
binaryHeaderEnum = (BinaryHeaderEnum)headerBytes[0];
topId = GetInt32(headerBytes, 1);
headerId = GetInt32(headerBytes, 5);
minorVersion = GetInt32(headerBytes, 13);
}