public Stream OpenBootImage() { BootInitialEntry initialEntry = GetBootInitialEntry(); if (initialEntry != null) { return(new SubStream(_data, initialEntry.ImageStart * IsoUtilities.SectorSize, initialEntry.SectorCount * Sizes.Sector)); } else { throw new InvalidOperationException("No valid boot image"); } }
/// <summary> /// Sets the boot image for the ISO image. /// </summary> /// <param name="image">Stream containing the boot image.</param> /// <param name="emulation">The type of emulation requested of the BIOS.</param> /// <param name="loadSegment">The memory segment to load the image to (0 for default).</param> public void SetBootImage(Stream image, BootDeviceEmulation emulation, int loadSegment) { if (_bootEntry != null) { throw new InvalidOperationException("Boot image already set"); } _bootEntry = new BootInitialEntry(); _bootEntry.BootIndicator = 0x88; _bootEntry.BootMediaType = emulation; _bootEntry.LoadSegment = (ushort)loadSegment; _bootEntry.SystemType = 0; _bootImage = image; }