Redpoint.ProgressMonitor 2023.365.1198

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Redpoint.ProgressMonitor --version 2023.365.1198
NuGet\Install-Package Redpoint.ProgressMonitor -Version 2023.365.1198
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="2023.365.1198" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Redpoint.ProgressMonitor --version 2023.365.1198
#r "nuget: Redpoint.ProgressMonitor, 2023.365.1198"
#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.
// Install Redpoint.ProgressMonitor as a Cake Addin
#addin nuget:?package=Redpoint.ProgressMonitor&version=2023.365.1198

// Install Redpoint.ProgressMonitor as a Cake Tool
#tool nuget:?package=Redpoint.ProgressMonitor&version=2023.365.1198

Redpoint.ProgressMonitor

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

Example

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 consoleWidth = 0;
        try
        {
            consoleWidth = Console.BufferWidth;
        }
        catch
        {
            // Not connected to a console, e.g. output is
            // redirected.
        }

        var monitor = _monitorFactory.CreateByteBasedMonitor();
        await monitor.MonitorAsync(
            progress,
            null,
            (message, count) =>
            {
                if (consoleWidth != 0)
                {
                    // Emit the progress information in such a
                    // way that we overwrite the previous info
                    // reported to the console.
                    Console.Write($"\r{message}".PadRight(consoleWidth));
                }
                else
                {
                    // Emit onto a new line every 5 seconds. This
                    // callback is invoked every 100ms.
                    if (count % 50 == 0)
                    {
                        Console.WriteLine(message);
                    }
                }
            },
            cts.Token);
    });

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

    // Stop monitoring.
    cts.Cancel();
    try
    {
        await monitorTask;
    }
    catch (TaskCanceledException) { }

    // Emit a newline after our progress message.
    if (consoleWidth != 0)
    {
        Console.WriteLine();
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2023.1176.407 139 6/25/2023
2023.1176.396 117 6/25/2023
2023.1176.363 127 6/25/2023
2023.1176.360 146 6/25/2023
2023.1175.638 123 6/24/2023
2023.1170.907 112 6/19/2023
2023.1170.900 119 6/19/2023
2023.1167.562 117 6/16/2023
2023.1167.556 124 6/16/2023
2023.1167.496 125 6/16/2023
2023.1166.1008 136 6/15/2023
2023.1166.938 110 6/15/2023
2023.1166.713 115 6/15/2023
2023.1166.699 117 6/15/2023
2023.1165.1065 125 6/14/2023
2023.1165.888 122 6/14/2023
2023.1165.878 125 6/14/2023
2023.1165.861 112 6/14/2023
2023.1165.828 120 6/14/2023
2023.1165.686 124 6/14/2023
2023.1165.653 117 6/14/2023
2023.377.1003 201 5/31/2023
2023.377.909 141 5/31/2023
2023.377.558 140 5/31/2023
2023.365.1417 161 5/30/2023
2023.365.1350 116 5/30/2023
2023.365.1327 121 5/30/2023
2023.365.1306 132 5/30/2023
2023.365.1198 149 5/30/2023
2023.365.1046 125 5/30/2023
2023.365.710 124 5/30/2023
2023.365.703 139 5/30/2023
2023.365.336 123 5/30/2023
2023.174.636 126 6/14/2023
2023.174.616 110 6/14/2023
2023.174.442 120 6/14/2023
2023.162.1243 115 6/13/2023
2023.162.1225 123 6/13/2023
2023.162.1023 114 6/13/2023
2023.162.948 108 6/13/2023
2023.162.865 120 6/13/2023
2023.162.770 142 6/13/2023
2023.162.734 132 6/13/2023
2023.162.701 127 6/13/2023
2023.162.470 137 6/13/2023
2023.162.418 122 6/13/2023
2023.150.1142 120 6/12/2023
2023.150.1121 123 6/12/2023
2023.150.1095 120 6/12/2023
2023.150.1081 123 6/12/2023
2023.150.1066 119 6/12/2023
2023.150.999 122 6/12/2023
2023.150.916 134 6/12/2023
2023.150.865 124 6/12/2023
2023.150.831 122 6/12/2023
2023.150.774 118 6/12/2023
2023.150.613 118 6/12/2023
2023.150.558 133 6/12/2023
2023.150.456 143 6/12/2023
2023.150.450 146 6/12/2023
2023.150.220 143 6/12/2023
2023.150.179 149 6/12/2023
2023.150.167 135 6/12/2023
2023.138.864 137 6/11/2023
2023.138.837 130 6/11/2023
2023.138.363 135 6/11/2023
2023.138.224 165 6/11/2023
2023.138.213 118 6/11/2023
2023.126.1167 142 6/11/2023
2023.126.1148 135 6/10/2023
2023.126.838 144 6/10/2023
2023.126.794 140 6/10/2023
2023.126.745 140 6/10/2023
2023.126.714 146 6/10/2023
2023.126.662 149 6/10/2023
2023.114.544 123 6/9/2023
2023.114.351 129 6/9/2023
2023.90.1030 139 6/7/2023
2023.90.1009 127 6/7/2023
2023.54.1152 119 6/4/2023
2023.54.419 135 6/4/2023
2023.54.198 123 6/4/2023
2023.54.60 107 6/4/2023
2023.54.48 134 6/4/2023
2023.42.745 125 6/3/2023
2023.30.1191 120 6/2/2023
2023.30.1172 134 6/2/2023
2023.30.1163 124 6/2/2023
2023.30.1147 135 6/2/2023
2023.30.1136 142 6/2/2023
2023.30.765 142 6/2/2023
2023.30.761 128 6/2/2023
2023.30.747 149 6/2/2023
2023.30.734 119 6/2/2023