Redpoint.ProgressMonitor 2025.1175.340

Prefix Reserved
dotnet add package Redpoint.ProgressMonitor --version 2025.1175.340
                    
NuGet\Install-Package Redpoint.ProgressMonitor -Version 2025.1175.340
                    
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.1175.340" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Redpoint.ProgressMonitor" Version="2025.1175.340" />
                    
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.1175.340
                    
#r "nuget: Redpoint.ProgressMonitor, 2025.1175.340"
                    
#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.
#addin nuget:?package=Redpoint.ProgressMonitor&version=2025.1175.340
                    
Install as a Cake Addin
#tool nuget:?package=Redpoint.ProgressMonitor&version=2025.1175.340
                    
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.1175.340 42 4 days ago
2025.1174.62 42 5 days ago
2025.1171.352 88 8 days ago
2025.1169.413 106 9 days ago
2025.1166.1191 130 12 days ago
2025.1166.1178 133 12 days ago
2025.1166.1177 132 12 days ago
2025.1159.445 115 19 days ago
2025.1159.364 112 20 days ago
2025.1159.324 113 20 days ago
2025.1155.438 135 23 days ago
2025.1141.1424 143 a month ago
2025.1140.383 144 a month ago
2025.1140.377 143 a month ago
2025.1139.983 143 a month ago
2025.1139.952 141 a month ago
2025.1139.941 144 a month ago
2025.1139.855 145 a month ago
2025.1139.850 139 a month ago
2025.1139.837 138 a month ago
2025.1139.811 139 a month ago
2025.1139.806 141 a month ago
2025.1139.796 143 a month ago
2025.1139.729 142 a month ago
2025.1139.719 141 a month ago
2025.1139.706 141 a month ago
2025.1139.694 139 a month ago
2025.1139.679 142 a month ago
2025.1139.662 139 a month ago
2025.1139.638 134 a month ago
2025.1139.628 136 a month ago
2025.1139.626 142 a month ago
2025.1139.619 139 a month ago
2025.1139.605 137 a month ago
2025.1139.600 138 a month ago
2025.1139.583 138 a month ago
2025.1139.573 141 a month ago
2025.1139.564 136 a month ago
2025.1139.552 139 a month ago
2025.1139.543 137 a month ago
2025.1138.909 139 a month ago
2025.1136.150 209 a month ago
2025.1135.267 213 a month ago
2025.1135.143 219 a month ago
2025.1133.453 220 a month ago
2025.1133.351 226 a month ago
2025.1133.349 233 a month ago
2025.1133.347 223 a month ago
2025.1130.236 72 2 months ago
2025.1129.831 100 2 months ago
2025.1129.346 146 2 months ago
2023.1176.407 198 6/25/2023
2023.1176.396 160 6/25/2023
2023.1176.363 170 6/25/2023
2023.1176.360 205 6/25/2023
2023.1175.638 165 6/24/2023
2023.1170.907 161 6/19/2023
2023.1170.900 163 6/19/2023
2023.1167.562 164 6/16/2023
2023.1167.556 168 6/16/2023
2023.1167.496 181 6/16/2023
2023.1166.1008 184 6/15/2023
2023.1166.938 156 6/15/2023
2023.1166.713 175 6/15/2023
2023.1166.699 165 6/15/2023
2023.1165.1065 174 6/14/2023
2023.1165.888 171 6/14/2023
2023.1165.878 171 6/14/2023
2023.1165.861 160 6/14/2023
2023.1165.828 172 6/14/2023
2023.1165.686 185 6/14/2023
2023.1165.653 166 6/14/2023
2023.377.1003 257 5/31/2023
2023.377.909 189 5/31/2023
2023.377.558 185 5/31/2023
2023.365.1417 234 5/30/2023
2023.365.1350 173 5/30/2023
2023.365.1327 169 5/30/2023
2023.365.1306 187 5/30/2023
2023.365.1198 197 5/30/2023
2023.365.1046 176 5/30/2023
2023.365.710 174 5/30/2023
2023.365.703 187 5/30/2023
2023.365.336 176 5/30/2023
2023.174.636 173 6/14/2023
2023.174.616 156 6/14/2023
2023.174.442 170 6/14/2023
2023.162.1243 166 6/13/2023
2023.162.1225 171 6/13/2023
2023.162.1023 158 6/13/2023
2023.162.948 165 6/13/2023
2023.162.865 169 6/13/2023
2023.162.770 193 6/13/2023
2023.162.734 184 6/13/2023
2023.162.701 175 6/13/2023
2023.162.470 185 6/13/2023
2023.162.418 168 6/13/2023
2023.150.1142 168 6/12/2023
2023.150.1121 172 6/12/2023
2023.150.1095 171 6/12/2023
2023.150.1081 159 6/12/2023
2023.150.1066 166 6/12/2023
2023.150.999 157 6/12/2023
2023.150.916 186 6/12/2023
2023.150.865 171 6/12/2023
2023.150.831 171 6/12/2023
2023.150.774 168 6/12/2023
2023.150.613 166 6/12/2023
2023.150.558 180 6/12/2023
2023.150.456 192 6/12/2023
2023.150.450 193 6/12/2023
2023.150.220 190 6/12/2023
2023.150.179 196 6/12/2023
2023.150.167 198 6/12/2023
2023.138.864 181 6/11/2023
2023.138.837 177 6/11/2023
2023.138.363 185 6/11/2023
2023.138.224 216 6/11/2023
2023.138.213 161 6/11/2023
2023.126.1167 189 6/11/2023
2023.126.1148 183 6/10/2023
2023.126.838 194 6/10/2023
2023.126.794 188 6/10/2023
2023.126.745 189 6/10/2023
2023.126.714 200 6/10/2023
2023.126.662 196 6/10/2023
2023.114.544 172 6/9/2023
2023.114.351 182 6/9/2023
2023.90.1030 187 6/7/2023
2023.90.1009 170 6/7/2023
2023.54.1152 171 6/4/2023
2023.54.419 192 6/4/2023
2023.54.198 172 6/4/2023
2023.54.60 154 6/4/2023
2023.54.48 187 6/4/2023
2023.42.745 173 6/3/2023
2023.30.1191 172 6/2/2023
2023.30.1172 187 6/2/2023
2023.30.1163 177 6/2/2023
2023.30.1147 183 6/2/2023
2023.30.1136 199 6/2/2023
2023.30.765 195 6/2/2023
2023.30.761 182 6/2/2023
2023.30.747 195 6/2/2023
2023.30.734 182 6/2/2023