From b2ffa91aa26a3586eca4cf307dfd802ab31f634c Mon Sep 17 00:00:00 2001 From: Carl Johnsen Date: Wed, 4 Feb 2026 09:42:38 +0100 Subject: [PATCH] Restructured the interfaces --- .../{Raw/IRawDisk.cs => Disk/Interfaces.cs} | 0 .../DiskImage/{Raw => Disk}/Windows.cs | 0 .../DiskImage/Filesystem/IFileMetadata.cs | 14 --- .../DiskImage/Filesystem/IFilesystem.cs | Bin 3198 -> 0 bytes .../DiskImage/Filesystem/IVolumeHandle.cs | Bin 2592 -> 0 bytes .../DiskImage/Filesystem/Interfaces.cs | 14 +++ proprietary/DiskImage/Partition/IPartition.cs | Bin 2786 -> 0 bytes .../DiskImage/Partition/IPartitionTable.cs | Bin 2804 -> 0 bytes proprietary/DiskImage/Partition/Interfaces.cs | 91 ++++++++++++++++++ 9 files changed, 105 insertions(+), 14 deletions(-) rename proprietary/DiskImage/{Raw/IRawDisk.cs => Disk/Interfaces.cs} (100%) rename proprietary/DiskImage/{Raw => Disk}/Windows.cs (100%) delete mode 100644 proprietary/DiskImage/Filesystem/IFileMetadata.cs delete mode 100644 proprietary/DiskImage/Filesystem/IFilesystem.cs delete mode 100644 proprietary/DiskImage/Filesystem/IVolumeHandle.cs create mode 100644 proprietary/DiskImage/Filesystem/Interfaces.cs delete mode 100644 proprietary/DiskImage/Partition/IPartition.cs delete mode 100644 proprietary/DiskImage/Partition/IPartitionTable.cs create mode 100644 proprietary/DiskImage/Partition/Interfaces.cs 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 1cf8950f3bbcee851c3bdfbc9ce2dac22974ccfd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3198 zcmezWuau#fA(J7GA)P^iA()|(p_rkBA(bJQ!J2`Wfr|l`tR6!MLk2?;Ln=ceLkd(s z={i8BBr+5;WHS_FvCoB}l%aqjhar<8nIVy(gdvkbk0F4eh#{Y$fT4&XlOdI%gdvfk zh@p}}kHLi@6KswrLoP!iLpnn$SS?5vqz{Di8SeQpey3^`yk(L)hrqdo%&DlphE6f=}E3GpqW}&QkiXr*u?g~32}1@rHb9|NzyPwP2%I8Q7!(-N zu!OJzLkUAALjgl7g9bw}gC+wc4A9NT6&5gcpi~b^Q?PshN_oh3hd}L6V5nwL0H?1K z25SZdhFY+nLGcSSi8O!vGUPLqGUPFoFo67?$e;jDk02jsf>S&wu0j6JXDGtye^B}b zrQl+QVlsV?a5E@3fYMnmg8~CAkJvIOVR4lbgB`dG0OcHrE>JE5VThYc81fku7;@qM z(_;X|0YoJz??KW%W~d=lpt=B52IPTrY7RpVQcehA$Y;oANM*=l0J+GSA&~)_Do`qc zsUy}Upwg{`p_HMBA&;S$!Hyw}A)g@!oOeNf&H&q#0?zS>7y^||=s6W)AG&GCX(ogL zQVQBIc%seATb>V1qNK< zg9t?haA}Jz3=wKHkxEj`7zE{9^zsc|6~ZU5bPq~(}0yw@Ez$H4!&t*s{ z3zAwOu{V742`siz%Pvp}LEU^3#E{5P&OkV~Ajj8W$|o-1dNGwD8CpZYYDfGvA*jWW z#sErX*yj)_45bVO3^@#$49N_M3?&Si40;R!3`Gq23TD3@Ho>3}p=Y3^`zvKyFWC$Y&^GP+&;I z;s%(`B4{XrLZX;K55-;^27RpVDqtvONP@M2!MC3_;=K4vu|L*px72fMc(e zA&()2A(f$sA%~$7>{3vw2gPm?IPJjF04Ov-Aq5JJas~x(>IJ1hNO+*zgDYHM>O2_& zz-bUoI|fjR2XYTAHWc8p#JF6K0hIa> z_CQJsSZok>38>V}1E;_oh8(24AHtB&kj(%pNkDFN2Ip8%35co+6q+z~#JU6&!X@Bz z4~i>0hG2#gXdRIYE}I}_6i5}K)&SW9$-%Htg4hO9g=`jbiiOo0HYhgOF(@#=QVJ|} zIx-Y9R5E}TtV@q!=S)`D+~}Jr2wvjK<1<}poSAdjV4n4f*DKLN_})y zh*Av}77E~63RKUffMYNbT5hB31f>*WY_I{RKv3BSiV@P&EhKJ0VFxi|=%qe)-nJ9kPW1R 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 677a079fb79e8aac7d26cd24cde0447c15e3f687..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2786 zcmezWuau#fA(J7GA)P^iA()|(p_rkBA(bJQ!J2`Wfr|l`tR90WgFitvAq*J|MGUD7 zi3}-FI|!MIsY8z;gdvfkm?4{?7-}ELU3mJyCU8xLt3?&T3 z3T3mXD1+j! zh#?IgE}jelV1I+`0%3?vRtyRZp3rb8V8~}EW=I5^lM1%A8cZrMKp@P2*nJOCqW}&e zP$;;ALmK4s5{3+%{>=l2V-iCuLlJ`lg9d{kgDyi7IHpq>QW!KDAihU88&@d6)PYiR z34;O_AN!%$SIwXRj`b1-YX${|TCi_H=?Z2JEqq+UP{~jL4v$QR6b4B8$Ye+Zr_3TU z{fim1A#hs|EL!^(RA#{P4x}W>XGmj6V<-lv1W2k>U`S%91eYzvWcoD+oJSz#6eK5? zF!-a`LwkQ_GE_lhFpq({K7yG{Yd>Hsdtjw0C?A4SB&ZxJV@PDkWXOS+3gqTUP}%^M zzMynr&!E8I2Q9f37-;QNP|gCCx5Y@cngRnN7ius-{0hp8pfWQVTt9%y(p0j`A2)EA zrJ~fNhMRpNFme%1>#*ojD11<$YwWT{lD7gFw#d#V-KDZQiX9!>jA=~fn45bX9 zk_{BgVMunt#Hk(Q&d|06DDFVD4Wynefr{obfZ{rzK>^B70rMgCQ4vETLpg&2xb1*m z52t|J4vA!zQHXj2lFvY`6a@xY{<39I0=G@_z%7;>aPETD$RP~*4B6mXL5abR!I>eE z0h=m_pCIb=7(lfl!X8Ll1hWPMwZKXkN*Rh6@)(L4>==R>ki!TT_aIe>b{e6u0oe@F zfov{v{RwNc*`U~F$DqLA53U3Az-=XveU1#E+yL^c22Nii!bX9J@Y960+aR?%0L(Y2 Ap8x;= diff --git a/proprietary/DiskImage/Partition/IPartitionTable.cs b/proprietary/DiskImage/Partition/IPartitionTable.cs deleted file mode 100644 index d76a14c35646d3cf41f4a379e05a7c39694494da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2804 zcmezWuau#fA(J7GA)P^iA()|(p_rkBA(bJQ!J2`Wfr|l`tR90iLq0eKLo!1N zLncE$LmophgC2uBLn=caLn=cNLncEqK~p>#{0XWFVaQ-8Vn}63WJrO!l#tsnb?7mK zFeEY*Gh{OqW3kVLp_HM3AqVW@M6hr47y=lI81fkk!2U>OC}BusC}OB&&|`36$ON0? z$&kyC$dJyE%Am&(#E{5P4mB4PYIzKa47m)c48;ru42cZM454J4!s81fm4 z84|%Jrh@IS29pX55D4=fcE3Z^D1gHU6b7KwS;A1v0P=YTI9`gtai;)ITcGp-kpaaq zhy}A(fuS6neh{IQ%8o$`CAkcckU_T%R|vt>c|ubT#HZN|_6!PWA_@%E3<}^> zR>EM-pukWI_B$xfVP;V3e^3f70;hRcx$~vfYJwf zF^z~NNO*(F2L%RLIbqA7#E{I8$dCsvD?p_x$c>OPHH0CbAsbw#DlynGIO9+Sawklk z9s?-dA?$&a0lbX{r@)ZJP{{yF51=ql0@t3jN@tLC0ZQi}3`*mE;G6-m z6_mz6wI`?)##D*!Lh{lXZu4~*KxwQ98WNy<0IEMgX)cc;pP>X?-sUruGUPF&Fc400 zpppiZW3i_!dj?S2g2WYOdP3v{4QLI9E#8nr4&-)RxpUxBUjVL;S|#SEHc)@_K;4`wKVw%>A5!W`7T0_A2% W`w`?KUxp-xBBXMH+IbpMdjbIWxX4ui 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); +}