} /* GetListOfSipperFilesFromLogFiles */ private void WriteSipperPartitionSector(SipperPartitionSector partitionSector) { Int64 sipperPartitionSectorOffset = mbr.GetPartitionSectorByteOffset(Constants.SIPPER_PARTITION); fs.Seek(sipperPartitionSectorOffset, SeekOrigin.Begin); partitionSector.Write(fs); } /* WriteSipperPartitionSector */
} /* WriteSipperPartitionSector */ private void ReadSipperPartitionSector() { Int64 sipperPartitionSectorOffset = mbr.GetPartitionSectorByteOffset(Constants.SIPPER_PARTITION); fs.Seek(sipperPartitionSectorOffset, SeekOrigin.Begin); sipperPartitionSector = SipperPartitionSector.CreateFromFileStream(fs); return; } /* ReadSipperPartitionSector */
public bool Equals(SipperPartitionSector other) { if ((totalSectors != other.TotalSectors) || (fileDataSector != other.fileDataSector) || (endSector != other.endSector) || (nextFcbSector != other.nextFcbSector) || (nextFileHandle != other.nextFileHandle) ) { return(false); } else { return(true); } }
} /* ResetSipperDirectory */ //*********************************************************************************** //* Determines if the same disk drive is attached. * //*********************************************************************************** public bool AreWeTheSameDrive() { if ((sipperPartitionSector == null) || (origFirstFileControlBlock == null)) { return(false); } // For now we will always return true; return(true); BlockStart(); long lastFsPosition = 0; bool diskFileWasAlreadyOpened = false; if (fs != null) { diskFileWasAlreadyOpened = true; lastFsPosition = fs.Position; } if ((!diskFileWasAlreadyOpened) && (openedSipperFiles != null) && (openedSipperFiles.Count == 0)) { // We will only reopen the Disk handle if no SIPPER files are open. try { ReOpen(false); } catch (Exception) { BlockEnd(); return(false); } } bool weAreTheSameHardDrive = false; Int64 sipperPartitionSectorOffset = mbr.GetPartitionSectorByteOffset(Constants.SIPPER_PARTITION); fs.Seek(sipperPartitionSectorOffset, SeekOrigin.Begin); SipperPartitionSector currentSipperPartitionSector = SipperPartitionSector.CreateFromFileStream(fs); if (sipperPartitionSector.Equals(currentSipperPartitionSector)) { SipperFileControlBlock firstFileControlBlock = SipperFileControlBlock.CreateFromFileStream(fs); if (firstFileControlBlock.Equals(origFirstFileControlBlock)) { weAreTheSameHardDrive = true; } } if (diskFileWasAlreadyOpened) { fs.Seek(lastFsPosition, SeekOrigin.Begin); } else { CloseHandleToPhysicalDisk(); } BlockEnd(); return(weAreTheSameHardDrive); }
} /* GetPartitionSectorByteOffset */ public Int64 GetSipperDirectoryByteOffset() { Int64 sipperDirectoryByteOffset = 0; sipperDirectoryByteOffset = relativeSector * Constants.LOGICAL_BLOCK_SIZE + SipperPartitionSector.BuffSpaceNeeded(); return(sipperDirectoryByteOffset); } /* GetSipperDirectoryByteOffset */