diff --git a/proprietary/DiskImage/Raw/IRawDisk.cs b/proprietary/DiskImage/Disk/Interfaces.cs similarity index 100% rename from proprietary/DiskImage/Raw/IRawDisk.cs rename to proprietary/DiskImage/Disk/Interfaces.cs diff --git a/proprietary/DiskImage/Raw/Windows.cs b/proprietary/DiskImage/Disk/Windows.cs similarity index 100% rename from proprietary/DiskImage/Raw/Windows.cs rename to proprietary/DiskImage/Disk/Windows.cs diff --git a/proprietary/DiskImage/Filesystem/IFileMetadata.cs b/proprietary/DiskImage/Filesystem/IFileMetadata.cs deleted file mode 100644 index 324af67b7..000000000 --- a/proprietary/DiskImage/Filesystem/IFileMetadata.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.IO; - -namespace Duplicati.Proprietary.DiskImage.Filesystem; - -public interface IFileMetadata -{ - string Path { get; } - long Size { get; } - DateTime CreatedUtc { get; } - DateTime LastModifiedUtc { get; } - FileAttributes Attributes { get; } - bool IsFolder { get; } -} \ No newline at end of file diff --git a/proprietary/DiskImage/Filesystem/IFilesystem.cs b/proprietary/DiskImage/Filesystem/IFilesystem.cs deleted file mode 100644 index 1cf8950f3..000000000 Binary files a/proprietary/DiskImage/Filesystem/IFilesystem.cs and /dev/null differ diff --git a/proprietary/DiskImage/Filesystem/IVolumeHandle.cs b/proprietary/DiskImage/Filesystem/IVolumeHandle.cs deleted file mode 100644 index fed8a480b..000000000 Binary files a/proprietary/DiskImage/Filesystem/IVolumeHandle.cs and /dev/null differ diff --git a/proprietary/DiskImage/Filesystem/Interfaces.cs b/proprietary/DiskImage/Filesystem/Interfaces.cs new file mode 100644 index 000000000..a0d4bd1c9 --- /dev/null +++ b/proprietary/DiskImage/Filesystem/Interfaces.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Duplicati.Library.Interface; +using Duplicati.Proprietary.DiskImage.Partition; + +namespace Duplicati.Proprietary.DiskImage.Filesystem; + +public interface IFilesystem : IDisposable +{ + +} \ No newline at end of file diff --git a/proprietary/DiskImage/Partition/IPartition.cs b/proprietary/DiskImage/Partition/IPartition.cs deleted file mode 100644 index 677a079fb..000000000 Binary files a/proprietary/DiskImage/Partition/IPartition.cs and /dev/null differ diff --git a/proprietary/DiskImage/Partition/IPartitionTable.cs b/proprietary/DiskImage/Partition/IPartitionTable.cs deleted file mode 100644 index d76a14c35..000000000 Binary files a/proprietary/DiskImage/Partition/IPartitionTable.cs and /dev/null differ diff --git a/proprietary/DiskImage/Partition/Interfaces.cs b/proprietary/DiskImage/Partition/Interfaces.cs new file mode 100644 index 000000000..ef8dbd605 --- /dev/null +++ b/proprietary/DiskImage/Partition/Interfaces.cs @@ -0,0 +1,91 @@ +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); +}