123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text;
- using Utilities;
- using DiskAccessLibrary.VHD;
- namespace DiskAccessLibrary
- {
- public partial class VirtualHardDisk : DiskImage, IDiskGeometry
- {
- public override void ExtendFast(long additionalNumberOfBytes)
- {
- if (additionalNumberOfBytes % this.BytesPerSector > 0)
- {
- throw new ArgumentException("additionalNumberOfBytes must be a multiple of BytesPerSector");
- }
- if (m_vhdFooter.DiskType == VirtualHardDiskType.Fixed)
- {
- long length = this.Size;
- m_file.ExtendFast(additionalNumberOfBytes);
- m_vhdFooter.CurrentSize += (ulong)additionalNumberOfBytes;
- byte[] footerBytes = m_vhdFooter.GetBytes();
- m_file.WriteSectors((length + additionalNumberOfBytes) / this.BytesPerSector, footerBytes);
- }
- else
- {
- throw new NotImplementedException();
- }
- }
- }
- }
|