ReadBytes() private method

private ReadBytes ( int length ) : Byte[]
length int
return Byte[]
 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);
 }
Ejemplo n.º 2
0
 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);
 }
 public void Read(__BinaryParser input)
 {
     byte[] array = input.ReadBytes(17);
     if (array.Length < 17)
     {
         __Error.EndOfFile();
     }
     this.majorVersion = SerializationHeaderRecord.GetInt32(array, 9);
     if (this.majorVersion > this.binaryFormatterMajorVersion)
     {
         throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFormat", new object[]
         {
             BitConverter.ToString(array)
         }));
     }
     this.binaryHeaderEnum = (BinaryHeaderEnum)array[0];
     this.topId            = SerializationHeaderRecord.GetInt32(array, 1);
     this.headerId         = SerializationHeaderRecord.GetInt32(array, 5);
     this.minorVersion     = SerializationHeaderRecord.GetInt32(array, 13);
 }
        [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);
        }