/// <summary> /// Copy sectors from another disk /// </summary> /// <param name="diskIn">The disk to copy sectors from</param> /// <param name="mode">Sector's mode</param> /// <param name="count">Number of sectors to copy</param> public void CopySectors(DataTrackReader diskIn, SectorMode mode, int count) { if (diskIn.IsXa) { XaSubHeader subHeader; for (int i = 0; i < count; i++) { WriteSector(diskIn.ReadSector(mode, out subHeader), mode, subHeader); } } else { for (int i = 0; i < count; i++) { WriteSector(diskIn.ReadSector()); } } }
/// <summary> /// Copy a stream (XA sound, str video, etc) /// </summary> /// <param name="filePath">The full file path of the file to write (eg : /FOO/BAR/FILE.EXT)</param> /// <param name="diskIn">The disk to copy stream's sectors from</param> /// <param name="entry">The entry of the reading disk</param> public void CopyStream(string filePath, DataTrackReader diskIn, DataTrackIndexEntry inEntry) { if (_index.GetEntry(filePath) != null) { throw new FrameworkException("Error while creating file \"{0}\" : entry already exists", filePath); } var parent = _index.FindAParent(filePath); if (parent == null) { throw new FrameworkException("Error while creating file \"{0}\" : parent directory does not exists", filePath); } var entry = new DirectoryEntry(_isXa); entry.Name = _regFileName.Match(filePath).Groups[1].Value + (_appendVersionToFileName ? ";1" : ""); entry.Length += (byte)(entry.Name.Length - 1); entry.Length += (byte)(entry.Name.Length % 2 == 0 ? 1 : 0); entry.ExtentSize = (uint)inEntry.Size; entry.ExtentLba = (uint)SectorCount; var indexEntry = new DataTrackIndexEntry(parent, entry); _index.AddToIndex(indexEntry); CopySectors ( diskIn, _defaultSectorMode == SectorMode.XA_FORM1 ? SectorMode.XA_FORM2 : _defaultSectorMode, entry.ExtentLba, inEntry.Lba, (int)(inEntry.Size / GetSectorDataSize(diskIn.DefautSectorMode)) ); }
/// <summary> /// Copy the application-reserved zone of the iso (pvd's Application Data) /// </summary> /// <param name="diskIn"></param> public void CopyApplicationData(DataTrackReader diskIn) { CBuffer.Copy(diskIn.PrimaryVolumeDescriptor.ApplicationData, _primaryVolumeDescriptor.ApplicationData); }
/// <summary> /// Copy the system-reserved zone of the iso (16 first sectors) /// </summary> /// <param name="diskIn">The disk to copy sector's from</param> public void CopySystemZone(DataTrackReader diskIn) { CopySectors(diskIn, _defaultSectorMode, 0, 0, 16); }
/// <summary> /// Copy sectors from another disk /// </summary> /// <param name="reader">The disk to copy sectors from</param> /// <param name="mode">Sector's mode</param> /// <param name="readerLba">Starting LBA for reading</param> /// <param name="writerLba">Starting LBA for writing</param> /// <param name="count">Number of sectors to copy</param> public void CopySectors(DataTrackReader reader, SectorMode mode, long readerLba, long writerLba, int count) { SeekSector(writerLba); reader.SeekSector(readerLba); CopySectors(reader, mode, count); }