Struct DownloadStats
A snapshot of an in-progress download, passed to the active ILauncherView so it can present transfer state.
public readonly struct DownloadStats
- Inherited Members
Remarks
Structured rather than a preformatted string. The download path used to hand the UI
"42% (12.1 MB)", which forced every view to display exactly what the service had
decided to say and made anything richer — a rate, a remaining time, a total — impossible
without changing the service.
TotalBytes and BytesPerSecond are both optional, and callers must treat them as such: the total is only known when the server supplied one, and no rate exists until enough samples have accumulated to measure it.
Constructors
DownloadStats(ulong, long, double, double?, float, bool)
public DownloadStats(ulong bytesDownloaded, long totalBytes, double bytesPerSecond, double? estimatedSecondsRemaining, float normalizedProgress, bool isComplete = false)
Parameters
bytesDownloadedulongtotalByteslongbytesPerSeconddoubleestimatedSecondsRemainingdouble?normalizedProgressfloatisCompletebool
Fields
BytesDownloaded
Bytes received so far.
public readonly ulong BytesDownloaded
Field Value
BytesPerSecond
Current transfer rate in bytes per second, or 0 when not yet measurable.
public readonly double BytesPerSecond
Field Value
EstimatedSecondsRemaining
Estimated seconds until completion, or null when it cannot be estimated — no known total, or no measurable rate.
public readonly double? EstimatedSecondsRemaining
Field Value
IsComplete
True when the transfer has finished and the remaining work is verification.
public readonly bool IsComplete
Field Value
NormalizedProgress
Progress from 0 to 1 as reported by the transfer.
public readonly float NormalizedProgress
Field Value
TotalBytes
Total bytes expected, or 0 when the server did not report a size.
public readonly long TotalBytes
Field Value
Remarks
Sourced from the version manifest's Size rather than from the response, so it is known before the first byte arrives and the UI can open on "0 B of 240 MB" instead of a bare "0%".
Properties
HasTotal
True when a total size is known, and therefore when "x of y" and a remaining time are meaningful.
public bool HasTotal { get; }
Property Value
Methods
FormatBytes(ulong)
Formats a byte count as a human-readable string (for example "1.2 MB").
public static string FormatBytes(ulong bytes)
Parameters
bytesulong
Returns
FormatDuration(double)
Formats a duration as a compact human-readable string (for example "3m 20s").
public static string FormatDuration(double seconds)
Parameters
secondsdouble
Returns
Remarks
Deliberately coarse. A remaining time derived from a fluctuating transfer rate is an estimate, and rendering it to the second invites the player to watch it jitter.
ToDisplayString()
Builds the player-facing progress line, including only the parts that are actually known.
public string ToDisplayString()
Returns
Remarks
Shared by both views so they cannot drift into describing the same download differently. Anything unknown is omitted rather than shown as a zero — a rate of "0 B/s" on a transfer that simply has not been measured yet reads as a stall.