FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Extract file metadata for DiscUtils-based disc image formats by Copilot · Pull Request #200 · microsoft/RecursiveExtractor · GitHub

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .config  (1) .cs  (21) .csproj  (4) .iso  (2) .md  (1) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
43 changes: 43 additions & 0 deletions README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,49 @@ public string? ParentPath { get; }
public DateTime CreateTime { get; }
public DateTime ModifyTime { get; }
public DateTime AccessTime { get; }
public FileEntryMetadata? Metadata { get; set; }
```
</details>

<details>
<summary>File Metadata</summary>
<br/>
When the source archive or disc image records it, `FileEntry.Metadata` holds additional attributes for the entry. Every property is nullable, and `Metadata` itself is `null` when the format carries no metadata at all, so you can distinguish "not recorded" from a real value.

```csharp
public long? Mode { get; set; } // Unix permission bits
public bool? IsExecutable { get; } // Derived from Mode
public bool? IsSetUid { get; } // Derived from Mode
public bool? IsSetGid { get; } // Derived from Mode
public long? Uid { get; set; } // Unix owner id
public long? Gid { get; set; } // Unix group id
public FileAttributes? FileAttributes { get; set; } // Windows/DOS file attributes
public string? SecurityDescriptorSddl { get; set; } // Windows security descriptor, SDDL form
```

Which properties are populated depends on the format:

| Source | Populated |
| --- | --- |
| TAR, AR/DEB | `Mode`, `Uid`, `Gid` |
| ZIP | `Mode`, when the entry records Unix permissions in its external attributes |
| RAR, 7z | `Mode`, taken from the raw attribute field the archive records: a Unix mode for archives created on Unix, DOS attributes otherwise |
| Ext, XFS, Btrfs, HFS+ (inside VHD/VHDX/VMDK/DMG) | `Mode`, `Uid`, `Gid` |
| ISO 9660 with RockRidge extensions | `Mode`, `Uid`, `Gid`, `FileAttributes` |
| ISO 9660 without RockRidge extensions | `FileAttributes` |
| FAT (inside a disc image) | `FileAttributes` |
| NTFS (inside a disc image) | `FileAttributes`, `SecurityDescriptorSddl` |
| WIM | `FileAttributes`, and `SecurityDescriptorSddl` when the image records one |
| UDF | None; `Metadata` is `null` |

```csharp
foreach (var file in extractor.Extract("path/to/image.vhdx"))
{
if (file.Metadata?.SecurityDescriptorSddl is { } sddl)
{
Console.WriteLine($"{file.FullPath}: {sddl}");
}
}
```
</details>

Expand Down
8 changes: 4 additions & 4 deletions RecursiveExtractor.Cli.Tests/CliTests/CliTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ public static TheoryData<string, int> CliArchiveData
{
{ "TestData.zip", 5 },
{ "TestData.7z", 3 },
{ "TestData.tar", 6 },
{ "TestData.tar", 5 },
{ "TestData.rar", 3 },
{ "TestData.rar4", 3 },
{ "TestData.tar.bz2", 6 },
{ "TestData.tar.gz", 6 },
{ "TestData.tar.bz2", 5 },
{ "TestData.tar.gz", 5 },
{ "TestData.tar.xz", 3 },
{ "sysvbanner_1.0-17fakesync1_amd64.deb", 8 },
{ "TestData.a", 3 },
{ "TestData.bsd.ar", 3 },
{ "TestData.iso", 3 },
{ "TestData.vhdx", 3 },
{ "EmptyFile.txt", 1 },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 54 : 52 },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 51 : 49 },
};
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<ItemGroup>
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageReference Include="coverlet.collector" Version="10.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.1.3" />
</ItemGroup>

<ItemGroup>
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public static TheoryData<string, int, bool> DisposeData
var data = new TheoryData<string, int, bool>
{
{ "TestData.7z", 3, false },
{ "TestData.tar", 6, false },
{ "TestData.tar", 5, false },
{ "TestData.rar", 3, false },
{ "TestData.rar4", 3, false },
{ "TestData.tar.bz2", 6, false },
{ "TestData.tar.gz", 6, false },
{ "TestData.tar.bz2", 5, false },
{ "TestData.tar.gz", 5, false },
{ "TestData.tar.xz", 3, false },
{ "sysvbanner_1.0-17fakesync1_amd64.deb", 8, false },
{ "TestData.a", 3, false },
Expand All @@ -37,20 +37,20 @@ public static TheoryData<string, int, bool> DisposeData
{ "EmptyFile.txt", 1, false },
{ "TestData.zip", 5, true },
{ "TestData.7z", 3, true },
{ "TestData.tar", 6, true },
{ "TestData.tar", 5, true },
{ "TestData.rar", 3, true },
{ "TestData.rar4", 3, true },
{ "TestData.tar.bz2", 6, true },
{ "TestData.tar.gz", 6, true },
{ "TestData.tar.bz2", 5, true },
{ "TestData.tar.gz", 5, true },
{ "TestData.tar.xz", 3, true },
{ "sysvbanner_1.0-17fakesync1_amd64.deb", 8, true },
{ "TestData.a", 3, true },
{ "TestData.bsd.ar", 3, true },
{ "TestData.iso", 3, true },
{ "TestData.vhdx", 3, true },
{ "EmptyFile.txt", 1, true },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 54 : 52, true },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 54 : 52, false },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 51 : 49, true },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 51 : 49, false },
};
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ public static TheoryData<string, int> ArchiveData
{ "100trees.7z", 101 },
{ "TestData.zip", 5 },
{ "TestData.7z",3 },
{ "TestData.tar", 6 },
{ "TestData.tar", 5 },
{ "TestData.rar",3 },
{ "TestData.rar4",3 },
{ "TestData.tar.bz2", 6 },
{ "TestData.tar.gz", 6 },
{ "TestData.tar.bz2", 5 },
{ "TestData.tar.gz", 5 },
{ "TestData.tar.xz",3 },
{ "sysvbanner_1.0-17fakesync1_amd64.deb", 8 },
{ "TestData.a",3 },
{ "TestData.bsd.ar",3 },
{ "TestData.iso",3 },
{ "TestDataRockRidge.iso",2 },
{ "TestDataJolietRockRidge.iso",2 },
{ "TestData.vhdx",3 },
{ "EmptyFile.txt", 1 },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 54 : 52 },
{ "TestDataArchivesNested.zip", RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 51 : 49 },
{ "UdfTest.iso", 3 },
{ "UdfTestWithMultiSystem.iso", 3 },
{ "TestData.arj", 1 },
Expand Down Expand Up @@ -69,7 +71,7 @@ public static TheoryData<string, int> NoRecursionData
{ "100trees.7z", 101 },
{ "TestData.zip", 5 },
{ "TestData.7z", 3 },
{ "TestData.tar", 6 },
{ "TestData.tar", 5 },
{ "TestData.rar", 3 },
{ "TestData.rar4", 3 },
{ "TestData.tar.bz2", 1 },
Expand All @@ -79,6 +81,8 @@ public static TheoryData<string, int> NoRecursionData
{ "TestData.a", 3 },
{ "TestData.bsd.ar", 3 },
{ "TestData.iso", 3 },
{ "TestDataRockRidge.iso", 2 },
{ "TestDataJolietRockRidge.iso", 2 },
{ "TestData.vhdx", 3 },
{ "EmptyFile.txt", 1 },
{ "TestDataArchivesNested.zip", 14 },
Expand Down
Loading

Back | FazBrowse Home | New Git URL