本文整理匯總了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);
}