Redpoint.ProgressMonitor 2025.1166.1178

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Redpoint.ProgressMonitor --version 2025.1166.1178
                    
NuGet\Install-Package Redpoint.ProgressMonitor -Version 2025.1166.1178
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Redpoint.ProgressMonitor" Version="2025.1166.1178" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Redpoint.ProgressMonitor" Version="2025.1166.1178" />
                    
Directory.Packages.props
<PackageReference Include="Redpoint.ProgressMonitor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Redpoint.ProgressMonitor --version 2025.1166.1178
                    
#r "nuget: Redpoint.ProgressMonitor, 2025.1166.1178"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Redpoint.ProgressMonitor@2025.1166.1178
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Redpoint.ProgressMonitor&version=2025.1166.1178
                    
Install as a Cake Addin
#tool nuget:?package=Redpoint.ProgressMonitor&version=2025.1166.1178
                    
Install as a Cake Tool

Redpoint.ProgressMonitor

This library provides APIs for monitoring and reporting the progress of arbitrary operations in console applications.

Read on for the following examples:

Example for a generic stream

You can monitor an operation that uses a stream like so:

// Inject these services.
IProgressFactory _progressFactory;
IMonitorFactory _monitorFactory;

using (var stream = new FileStream(...))
{
    // Start monitoring.
    var cts = new CancellationTokenSource();
    var progress = _progressFactory.CreateProgressForStream(stream);
    var monitorTask = Task.Run(async () =>
    {
        var monitor = _monitorFactory.CreateByteBasedMonitor();
        await monitor.MonitorAsync(
            progress,
            SystemConsole.ConsoleInformation,
            SystemConsole.WriteProgressToConsole,
            cts.Token);
    });

    // e.g. hash the stream.
    byte[] hashBytes;
    using (var hasher = SHA256.Create())
    {
        hashBytes = await hasher.ComputeHashAsync(stream);
    }

    // Stop monitoring.
    await SystemConsole.CancelAndWaitForConsoleMonitoringTaskAsync(monitorTask, cts);
}

Example for a HTTP download

If you're reporting progress on a HTTP stream, there's a few extra things to keep in mind:

  • You need to pass HttpCompletionOption.ResponseHeadersRead as the completion option, or HttpClient will buffer the entire response by default.
  • You need to wrap the stream you read from in PositionAwareStream, which is a class provided by this library. Since the underlying HTTP stream does not support Position or Length, this wrapping stream tracks the position as the stream is read from and allows the length to be passed in as a constructor parameter (which you should set based on the Content-Length header).

Below is a concise example of how to show the progress of downloading a file:

using (var client = new HttpClient())
{
    using (var target = new FileStream(targetPath, FileMode.Create, FileAccess.Write, FileShare.None))
    {
        var response = await client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead);
        using (var stream = new PositionAwareStream(
            await response.Content.ReadAsStreamAsync(),
            response.Content.Headers.ContentLength!.Value))
        {
            var cts = new CancellationTokenSource();
            var progress = _progressFactory.CreateProgressForStream(stream);
            var monitorTask = Task.Run(async () =>
            {
                var monitor = _monitorFactory.CreateByteBasedMonitor();
                await monitor.MonitorAsync(
                    progress,
                    SystemConsole.ConsoleInformation,
                    SystemConsole.WriteProgressToConsole,
                    cts.Token);
            });

            await stream.CopyToAsync(target);
            
            await SystemConsole.CancelAndWaitForConsoleMonitoringTaskAsync(monitorTask, cts);
        }
    }
}

The SystemConsole static class

The SystemConsole type provides common values for monitoring parameters, such as the current console information and rendering progress information to the console. You should replace the static values in the examples above with your own callbacks and values if you're not rendering progress to the console.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Redpoint.ProgressMonitor:

Package Downloads
Redpoint.PackageManagement

Provides APIs for installing, upgrading and uninstalling packages with WinGet and Homebrew.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2025.1198.1048 0 7/17/2025
2025.1198.682 0 7/17/2025
2025.1198.638 0 7/17/2025
2025.1198.574 2 7/17/2025
2025.1198.187 25 7/17/2025
2025.1191.922 132 7/10/2025
2025.1191.235 136 7/10/2025
2025.1190.175 137 7/9/2025
2025.1189.851 137 7/8/2025
2025.1189.841 141 7/8/2025
2025.1187.587 140 7/6/2025
2025.1183.853 134 7/2/2025
2025.1181.644 129 6/30/2025
2025.1175.340 139 6/24/2025
2025.1174.62 136 6/23/2025
2025.1171.352 128 6/20/2025
2025.1169.413 140 6/18/2025
2025.1166.1191 136 6/15/2025
2025.1166.1178 139 6/15/2025
2025.1166.1177 139 6/15/2025
2025.1159.445 120 6/8/2025
2025.1159.364 116 6/8/2025
2025.1159.324 118 6/8/2025
2025.1155.438 142 6/4/2025
2025.1141.1424 147 5/21/2025
2025.1140.383 149 5/20/2025
2025.1140.377 149 5/20/2025
2025.1139.983 148 5/19/2025
2025.1139.952 144 5/19/2025
2025.1139.941 149 5/19/2025
2025.1139.855 150 5/19/2025
2025.1139.850 143 5/19/2025
2025.1139.837 143 5/19/2025
2025.1139.811 145 5/19/2025
2025.1139.806 146 5/19/2025
2025.1139.796 147 5/19/2025
2025.1139.729 146 5/19/2025
2025.1139.719 146 5/19/2025
2025.1139.706 147 5/19/2025
2025.1139.694 142 5/19/2025
2025.1139.679 146 5/19/2025
2025.1139.662 142 5/19/2025
2025.1139.638 138 5/19/2025
2025.1139.628 139 5/19/2025
2025.1139.626 146 5/19/2025
2025.1139.619 143 5/19/2025
2025.1139.605 141 5/19/2025
2025.1139.600 142 5/19/2025
2025.1139.583 143 5/19/2025
2025.1139.573 146 5/19/2025
2025.1139.564 142 5/19/2025
2025.1139.552 143 5/19/2025
2025.1139.543 141 5/19/2025
2025.1138.909 144 5/18/2025
2025.1136.150 214 5/16/2025
2025.1135.267 218 5/15/2025
2025.1135.143 224 5/15/2025
2025.1133.453 226 5/13/2025
2025.1133.351 231 5/13/2025
2025.1133.349 237 5/13/2025
2025.1133.347 228 5/13/2025
2025.1130.236 79 5/10/2025
2025.1129.831 108 5/9/2025
2025.1129.346 152 5/9/2025
2023.1176.407 208 6/25/2023
2023.1176.396 170 6/25/2023
2023.1176.363 180 6/25/2023
2023.1176.360 216 6/25/2023
2023.1175.638 175 6/24/2023
2023.1170.907 171 6/19/2023
2023.1170.900 173 6/19/2023
2023.1167.562 174 6/16/2023
2023.1167.556 178 6/16/2023
2023.1167.496 191 6/16/2023
2023.1166.1008 194 6/15/2023
2023.1166.938 167 6/15/2023
2023.1166.713 185 6/15/2023
2023.1166.699 175 6/15/2023
2023.1165.1065 185 6/14/2023
2023.1165.888 181 6/14/2023
2023.1165.878 181 6/14/2023
2023.1165.861 171 6/14/2023
2023.1165.828 182 6/14/2023
2023.1165.686 195 6/14/2023
2023.1165.653 176 6/14/2023
2023.377.1003 267 5/31/2023
2023.377.909 199 5/31/2023
2023.377.558 195 5/31/2023
2023.365.1417 244 5/30/2023
2023.365.1350 183 5/30/2023
2023.365.1327 179 5/30/2023
2023.365.1306 197 5/30/2023
2023.365.1198 208 5/30/2023
2023.365.1046 186 5/30/2023
2023.365.710 185 5/30/2023
2023.365.703 197 5/30/2023
2023.365.336 186 5/30/2023
2023.174.636 183 6/14/2023
2023.174.616 166 6/14/2023
2023.174.442 181 6/14/2023
2023.162.1243 176 6/13/2023
2023.162.1225 184 6/13/2023
2023.162.1023 169 6/13/2023
2023.162.948 175 6/13/2023
2023.162.865 180 6/13/2023
2023.162.770 203 6/13/2023
2023.162.734 194 6/13/2023
2023.162.701 185 6/13/2023
2023.162.470 195 6/13/2023
2023.162.418 178 6/13/2023
2023.150.1142 179 6/12/2023
2023.150.1121 182 6/12/2023
2023.150.1095 182 6/12/2023
2023.150.1081 169 6/12/2023
2023.150.1066 176 6/12/2023
2023.150.999 169 6/12/2023
2023.150.916 196 6/12/2023
2023.150.865 181 6/12/2023
2023.150.831 181 6/12/2023
2023.150.774 178 6/12/2023
2023.150.613 176 6/12/2023
2023.150.558 191 6/12/2023
2023.150.456 202 6/12/2023
2023.150.450 203 6/12/2023
2023.150.220 201 6/12/2023
2023.150.179 206 6/12/2023
2023.150.167 208 6/12/2023
2023.138.864 192 6/11/2023
2023.138.837 187 6/11/2023
2023.138.363 197 6/11/2023
2023.138.224 226 6/11/2023
2023.138.213 171 6/11/2023
2023.126.1167 199 6/11/2023
2023.126.1148 193 6/10/2023
2023.126.838 205 6/10/2023
2023.126.794 198 6/10/2023
2023.126.745 199 6/10/2023
2023.126.714 211 6/10/2023
2023.126.662 207 6/10/2023
2023.114.544 183 6/9/2023
2023.114.351 192 6/9/2023
2023.90.1030 197 6/7/2023
2023.90.1009 180 6/7/2023
2023.54.1152 182 6/4/2023
2023.54.419 203 6/4/2023
2023.54.198 183 6/4/2023
2023.54.60 164 6/4/2023
2023.54.48 197 6/4/2023
2023.42.745 183 6/3/2023
2023.30.1191 182 6/2/2023
2023.30.1172 197 6/2/2023
2023.30.1163 187 6/2/2023
2023.30.1147 193 6/2/2023
2023.30.1136 210 6/2/2023
2023.30.765 205 6/2/2023
2023.30.761 192 6/2/2023
2023.30.747 205 6/2/2023
2023.30.734 193 6/2/2023