Class ChdProgress

Namespace
CHDSharp.Models
Assembly
CHDSharpLib.dll

Progress snapshot reported by long-running CHD operations. Pass an IProgress<T> of this type to CheckFile(Stream, string, bool, IProgress<ChdProgress>?, CancellationToken) , CheckFileWithParent(string, string?, IProgress<ChdProgress>?, CancellationToken) , ReadAllBytes(out byte[], IProgress<ChdProgress>?, CancellationToken) , EnumerateHunks(IProgress<ChdProgress>?), or ExtractToDirectory(string, string, IProgress<ChdProgress>?, CancellationToken, bool) to receive a report after every decompressed hunk. Callers commonly wrap this in new Progress<ChdProgress>(...)> for UI binding or logging.

public sealed record ChdProgress : IEquatable<ChdProgress>
Inheritance
ChdProgress
Implements
Inherited Members

Examples

var progress = new Progress<ChdProgress>(p =>
    Console.WriteLine($"{p.Percent:F0}% — {p.BytesProcessed:N0}/{p.TotalBytes:N0} bytes, {p.Elapsed.TotalSeconds:F1}s"));

var result = Chd.CheckFile(File.OpenRead("game.chd"), "game.chd", deepCheck: true, progress);

Constructors

ChdProgress(long, long, long, long, TimeSpan)

Creates a progress snapshot with the given values.

public ChdProgress(long currentHunk, long totalHunks, long bytesProcessed, long totalBytes, TimeSpan elapsed)

Parameters

currentHunk long

Number of hunks processed so far (1-based).

totalHunks long

Total number of hunks in the image.

bytesProcessed long

Number of decompressed bytes processed so far.

totalBytes long

Total decompressed size of the image.

elapsed TimeSpan

Wall-clock time elapsed since the operation started.

Properties

BytesProcessed

Number of decompressed image bytes processed so far.

public long BytesProcessed { get; }

Property Value

long

CurrentHunk

Number of hunks processed so far (1-based; equals TotalHunks when the operation has finished). Zero-based hunk indices are CurrentHunk - 1.

public long CurrentHunk { get; }

Property Value

long

Elapsed

Wall-clock time elapsed since the operation started.

public TimeSpan Elapsed { get; }

Property Value

TimeSpan

Percent

Percentage of hunks completed (0–100).

public double Percent { get; }

Property Value

double

TotalBytes

Total decompressed size of the image in bytes.

public long TotalBytes { get; }

Property Value

long

TotalHunks

Total number of hunks in the image (0 for a degenerate/empty image).

public long TotalHunks { get; }

Property Value

long

Methods

ToString()

Returns a human-readable summary such as "42/100 hunks, 12.5% (5.2s)".

public override string ToString()

Returns

string