public SuperBlockProvider( IStreamProvider aStreamProvider, FormatSignatureAndVersionInfo aFormatSignatureAndVersionInfo) { mrStreamProvider = aStreamProvider; mrFormatSignatureAndVersionInfo = aFormatSignatureAndVersionInfo; }
public static bool TryRead( Stream aInputStream, out FormatSignatureAndVersionInfo aParsed) { //Record where we are Offset fLocationAddress = new Offset((ulong)aInputStream.Position); //Do the Read byte[] fReadBuffer = new byte[Length]; if (Length != aInputStream.Read( fReadBuffer, 0, Length)) { aParsed = null; return(false); } // Check the signature bool fGoodSignature = true; for (int fiByte = 0; fiByte < mcFormatSignatureLength; ++fiByte) { fGoodSignature &= fReadBuffer[fiByte] == FormatSignature[fiByte]; } if (!fGoodSignature) { aParsed = null; return(false); } //Record the superblock version and move on aParsed = new FormatSignatureAndVersionInfo( fReadBuffer[8], fLocationAddress); return(true); }