We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take the code below, if the - 512 isn't included you get a System.NotSupportedException: 'Memory stream is not expandable.'
- 512
System.NotSupportedException: 'Memory stream is not expandable.'
Presumably this is for the VHD footer?
using DiscUtils.Fat; using DiscUtils.Partitions; using DiscUtils.Vhd; // create disk { var size = 32 * 1024 * 1024; var rawMemory = new byte[size]; var data = new MemoryStream(rawMemory, 0, size, true); var disk = Disk.InitializeFixed(data, DiscUtils.Streams.Ownership.None, (long)size - 512); // needed for the vhd footer?? BiosPartitionTable.Initialize(disk, WellKnownPartitionType.WindowsFat); var fileSystem = FatFileSystem.FormatPartition(disk, 0, "TEST"); Console.WriteLine($"Is : {fileSystem.FatVariant}"); var newFile = fileSystem.OpenFile("FOO.TXT", FileMode.CreateNew, FileAccess.Write); newFile.Write(new byte[] { 1, 2, 3, 4 }); newFile.Close(); Console.WriteLine($"File exists? {fileSystem.Exists("FOO.TXT")}"); File.WriteAllBytes(@"c:\temp\test.vhd", rawMemory); }
The text was updated successfully, but these errors were encountered:
Yes, most disk image formats need space for metadata and they also need to be aligned to a certain block size.
Sorry, something went wrong.
No branches or pull requests
Take the code below, if the
- 512
isn't included you get aSystem.NotSupportedException: 'Memory stream is not expandable.'
Presumably this is for the VHD footer?
The text was updated successfully, but these errors were encountered: