Files
duplicati/proprietary/FullDiskRunner/Program.cs
T

16 lines
646 B
C#
Raw Normal View History

2026-02-02 07:14:33 +01:00
using Duplicati.Proprietary.DiskImage;
// TODO this project is just a test project to test the disk image library. Remove later, or elevate to a proper tool.
using var disk = new Duplicati.Proprietary.DiskImage.Raw.Windows(@"\\.\PhysicalDrive0");
var initialized = await disk.InitializeAsync(CancellationToken.None);
if (!initialized)
{
Console.WriteLine("Failed to initialize disk.");
return;
}
using var partition = await disk.ReadBytesAsync(0, 4096, CancellationToken.None);
byte[] buffer = new byte[4096];
await partition.ReadExactlyAsync(buffer, CancellationToken.None);
await File.WriteAllBytesAsync("partition0.bin", buffer);