Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Library/DiscUtils.Udf/DiscUtils.Udf.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Managed .NET reader for UDF optical-disc filesystems and their files, directories and extended attributes.</Description>
<Description>Managed .NET reader and virtual UDF 2.01 image builder for optical-disc filesystems.</Description>

<PackageTags>DiscUtils;Filesystem;Optical;UDF</PackageTags>
</PropertyGroup>
Expand Down
24 changes: 22 additions & 2 deletions Library/DiscUtils.Udf/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LTRData.DiscUtils.Udf

Managed .NET reader for UDF optical-disc filesystems and their files, directories and extended attributes.
Managed .NET reader and image builder for UDF optical-disc filesystems.

Part of the [LTRData DiscUtils fork](https://github.com/LTRData/DiscUtils). Package IDs use `LTRData.DiscUtils`; C# namespaces remain `DiscUtils`.

Expand All @@ -15,13 +15,19 @@ dotnet add package LTRData.DiscUtils.Udf
| Capability | Support |
| --- | --- |
| Read files and directories | Yes |
| Create a filesystem | No |
| Create a filesystem | UDF 2.01 with UdfBuilder |
| Modify an existing filesystem | No |

## Usage notes

UdfReader exposes files and extended attributes. Size, UsedSpace and AvailableSpace are not implemented. For automatic ISO/UDF detection, reference LTRData.DiscUtils.OpticalDisk and register its providers; this package has no generated Formats entry point.

UdfBuilder creates a read-only UDF 2.01 image with one physical partition and 2048-byte logical blocks. Files are limited to 234 short allocation descriptors (approximately 234 GiB per file); the partition is limited to approximately 8 TiB. The builder preserves names, directories and file contents, but does not import source filesystem attributes, extended attributes or permissions.

`Build()` and `BuildAsync(cancellationToken)` return a seekable virtual image as a `Stream`. Construction creates metadata in memory and opens no file payloads. Every image owns the streams returned by its source factories; each factory must return a new readable, seekable stream of the declared length on every call. Async image reads use the source stream's async methods. Separate builds have independent positions; a single image stream must not be read concurrently.

The source-path overload checks length and last-write time whenever it opens the file. These checks do not make a content snapshot: keep source files and retained byte arrays unchanged for the image's lifetime. Unexpected truncation fails, and reads never include source data beyond a declared extent. The overloads that build to an output file or stream materialize the entire image, including payloads and zero padding.

## Example

```csharp
Expand All @@ -36,6 +42,20 @@ foreach (var file in fs.Root.GetFiles())
Console.WriteLine(file.FullName);
```

Create a virtual image from existing files:

```csharp
using System.IO;
using DiscUtils.Udf;

var builder = new UdfBuilder { VolumeIdentifier = "DISC" };
builder.AddDirectory("BDMV/EMPTY");
builder.AddFile("BDMV/index.bdmv", Path.Combine("source", "BDMV", "index.bdmv"));
builder.AddFile("readme.txt", System.Text.Encoding.UTF8.GetBytes("Virtual UDF image"));
using Stream image = builder.Build();
// Serve reads/seeks from image, or materialize it with builder.Build(output).
```

## Related packages

- [LTRData.DiscUtils.OpticalDisk](https://www.nuget.org/packages/LTRData.DiscUtils.OpticalDisk)
Expand Down
Loading
Loading