public bool Load() { _io.Stream.Position = 0; Header = _io.Reader.ReadStruct <XvdHeader>(); CikIsDecrypted = !IsEncrypted; CalculateDataOffsets(); if (DataOffset >= (ulong)_io.Stream.Length) { return(false); } if (Header.XvcDataLength > 0 && IsXvcFile) { _io.Stream.Position = (long)DataOffset; XvcInfo = _io.Reader.ReadStruct <XvcInfo>(); if (XvcInfo.Version == 1) { RegionHeaders = new List <XvcRegionHeader>(); for (int i = 0; i < XvcInfo.RegionCount; i++) { RegionHeaders.Add(_io.Reader.ReadStruct <XvcRegionHeader>()); } UpdateSegments = new List <XvcUpdateSegmentInfo>(); for (int i = 0; i < XvcInfo.UpdateSegmentCount; i++) { UpdateSegments.Add(_io.Reader.ReadStruct <XvcUpdateSegmentInfo>()); } } } DataHashTreeValid = true; HashTreeValid = true; if (IsDataIntegrityEnabled) { if (!DisableDataHashChecking) { int[] invalidBlocks = VerifyDataHashTree(); DataHashTreeValid = invalidBlocks.Length <= 0; } HashTreeValid = VerifyHashTree(); } XvcDataHashValid = VerifyXvcHash(); return(true); }
public bool Load() { _io.Stream.Position = 0; Header = _io.Reader.ReadStruct<XvdHeader>(); CikIsDecrypted = !IsEncrypted; CalculateDataOffsets(); if (DataOffset >= (ulong)_io.Stream.Length) return false; if (Header.XvcDataLength > 0 && IsXvcFile) { _io.Stream.Position = (long)DataOffset; XvcInfo = _io.Reader.ReadStruct<XvcInfo>(); if (XvcInfo.Version == 1) { RegionHeaders = new List<XvcRegionHeader>(); for (int i = 0; i < XvcInfo.RegionCount; i++) RegionHeaders.Add(_io.Reader.ReadStruct<XvcRegionHeader>()); UpdateSegments = new List<XvcUpdateSegmentInfo>(); for (int i = 0; i < XvcInfo.UpdateSegmentCount; i++) UpdateSegments.Add(_io.Reader.ReadStruct<XvcUpdateSegmentInfo>()); } } DataHashTreeValid = true; HashTreeValid = true; if (IsDataIntegrityEnabled) { if (!DisableDataHashChecking) { int[] invalidBlocks = VerifyDataHashTree(); DataHashTreeValid = invalidBlocks.Length <= 0; } HashTreeValid = VerifyHashTree(); } XvcDataHashValid = VerifyXvcHash(); return true; }
public bool Load() { _io.Stream.Position = 0; Header = _io.Reader.ReadStruct <XvdHeader>(); CikIsDecrypted = !IsEncrypted; if (DriveDataOffset >= (ulong)_io.Stream.Length) { return(false); } if (Header.XvcDataLength > 0 && IsXvcFile) { _io.Stream.Position = (long)XvcInfoOffset; XvcInfo = _io.Reader.ReadStruct <XvcInfo>(); if (XvcInfo.Version >= 1) { RegionHeaders = new List <XvcRegionHeader>(); for (int i = 0; i < XvcInfo.RegionCount; i++) { RegionHeaders.Add(_io.Reader.ReadStruct <XvcRegionHeader>()); } UpdateSegments = new List <XvcUpdateSegment>(); for (int i = 0; i < XvcInfo.UpdateSegmentCount; i++) { UpdateSegments.Add(_io.Reader.ReadStruct <XvcUpdateSegment>()); } if (XvcInfo.Version >= 2) // RegionSpecifiers / RegionPresenseInfo only seems to be used on XvcInfo v2 { RegionSpecifiers = new List <XvcRegionSpecifier>(); for (int i = 0; i < XvcInfo.RegionSpecifierCount; i++) { RegionSpecifiers.Add(_io.Reader.ReadStruct <XvcRegionSpecifier>()); } if (Header.MutableDataPageCount > 0) { RegionPresenceInfo = new List <XvcRegionPresenceInfo>(); _io.Stream.Position = (long)MduOffset; for (int i = 0; i < XvcInfo.RegionCount; i++) { RegionPresenceInfo.Add((XvcRegionPresenceInfo)_io.Reader.ReadByte()); } } } } } DataHashTreeValid = true; HashTreeValid = true; if (IsDataIntegrityEnabled) { if (!DisableDataHashChecking) { ulong[] invalidBlocks = VerifyDataHashTree(); DataHashTreeValid = invalidBlocks.Length <= 0; } HashTreeValid = VerifyHashTree(); } XvcDataHashValid = VerifyXvcHash(); StaticDataLength = CalculateStaticDataLength(); Filesystem = new XvdFilesystem(this); return(true); }