internal DiskImageFileInfo(FileHeader fileHeader, VhdxHeader vhdxHeader1, VhdxHeader vhdxHeader2, RegionTable regions, Metadata metadata, LogSequence activeLogSequence) { _fileHeader = fileHeader; _vhdxHeader1 = vhdxHeader1; _vhdxHeader2 = vhdxHeader2; _regions = regions; _metadata = metadata; _activeLogSequence = activeLogSequence; }
private LogSequence FindActiveLogSequence() { using (Stream logStream = new CircularStream(new SubStream(_fileStream, (long)_header.LogOffset, (long)_header.LogLength), Ownership.Dispose)) { LogSequence candidateActiveSequence = new LogSequence(); LogEntry logEntry = null; long oldTail; long currentTail = 0; do { oldTail = currentTail; logStream.Position = currentTail; LogSequence currentSequence = new LogSequence(); while (LogEntry.TryRead(logStream, out logEntry) && logEntry.LogGuid == _header.LogGuid && (currentSequence.Count == 0 || logEntry.SequenceNumber == currentSequence.Head.SequenceNumber + 1)) { currentSequence.Add(logEntry); logEntry = null; } if (currentSequence.Count > 0 && currentSequence.Contains(currentSequence.Head.Tail) && currentSequence.HigherSequenceThan(candidateActiveSequence)) { candidateActiveSequence = currentSequence; } if (currentSequence.Count == 0) { currentTail += LogEntry.LogSectorSize; } else { currentTail = currentSequence.Head.Position + LogEntry.LogSectorSize; } currentTail = currentTail % logStream.Length; } while (currentTail > oldTail); return candidateActiveSequence; } }