Class ChdProgress
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
currentHunklongNumber of hunks processed so far (1-based).
totalHunkslongTotal number of hunks in the image.
bytesProcessedlongNumber of decompressed bytes processed so far.
totalByteslongTotal decompressed size of the image.
elapsedTimeSpanWall-clock time elapsed since the operation started.
Properties
BytesProcessed
Number of decompressed image bytes processed so far.
public long BytesProcessed { get; }
Property Value
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
Elapsed
Wall-clock time elapsed since the operation started.
public TimeSpan Elapsed { get; }
Property Value
Percent
Percentage of hunks completed (0–100).
public double Percent { get; }
Property Value
TotalBytes
Total decompressed size of the image in bytes.
public long TotalBytes { get; }
Property Value
TotalHunks
Total number of hunks in the image (0 for a degenerate/empty image).
public long TotalHunks { get; }
Property Value
Methods
ToString()
Returns a human-readable summary such as "42/100 hunks, 12.5% (5.2s)".
public override string ToString()