using System; using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; using Duplicati.Proprietary.DiskImage.Raw; namespace Duplicati.Proprietary.DiskImage.Partition; /// /// Represents a single partition on a disk. /// public interface IPartition : IDisposable { /// /// Gets the partition number (1-based). /// int PartitionNumber { get; } /// /// Gets the partition type identifier. /// PartitionType Type { get; } /// /// Gets the starting offset in bytes. /// long StartOffset { get; } /// /// Gets the size in bytes. /// long Size { get; } /// /// Gets the partition name (if available). /// string? Name { get; } /// /// Gets the filesystem type (if detectable). /// FileSystemType FilesystemType { get; } /// /// Gets the volume GUID (for GPT). /// Guid? VolumeGuid { get; } /// /// Creates a stream to read the raw partition data. /// /// Cancellation token. /// Stream for reading partition data. Task OpenReadAsync(CancellationToken cancellationToken); } /// /// Partition table parsing interface. /// public interface IPartitionTable : IDisposable { /// /// Gets the raw disk this table was parsed from. /// IRawDisk? RawDisk { get; } /// /// Gets the partition table type. /// PartitionTableType TableType { get; } /// /// Enumerates all partitions on the disk. /// /// Cancellation token. /// Async enumerable of partitions. IAsyncEnumerable EnumeratePartitions(CancellationToken cancellationToken); /// /// Gets a specific partition by number. /// /// The partition number. /// The partition, or null if not found. Task GetPartitionAsync(int partitionNumber, CancellationToken cancellationToken); /// /// Gets the protective MBR (for GPT disks). /// Task GetProtectiveMbrAsync(CancellationToken cancellationToken); }