SDConsole 1.0.16

There is a newer version of this package available.
See the version list below for details.
dotnet add package SDConsole --version 1.0.16                
NuGet\Install-Package SDConsole -Version 1.0.16                
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="SDConsole" Version="1.0.16" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SDConsole --version 1.0.16                
#r "nuget: SDConsole, 1.0.16"                
#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 SDConsole as a Cake Addin
#addin nuget:?package=SDConsole&version=1.0.16

// Install SDConsole as a Cake Tool
#tool nuget:?package=SDConsole&version=1.0.16                

About SDConsole

SDConsole is a wrapper around Console and aimed at concurrent threads which write text to the console.
Threads can use the usual Write() and WriteLine() methods to write to SDConsole.
SDConsole will buffer the current cursor status along with the desired output and process the buffered commands later. This way multiple threads can safely output the desired text without handling concurrency issues.

Include in your project

The easiest way to include SDConsole in your project is by including the SDConsole Nuget Package.

Usage

Text output

Below is an example for using SDConsole in C#.

using SDConNS; // (1)

namespace Example
{
    public class ExampleClass
    {
        public void ExampleMethod()
        {
            lock (SDConsole.GetCursorStateLock()) // (2)
            {
                Console.SetCursorPosition(42, 42); // (3)
                SDConsole.Write("Example text"); // (4)
            }
        }
    }
}

Explanation

  1. using SDConNS includes the SDConsole namespace.
  2. lock (SDConsole.GetCursorStateLock()) acquires a lock from SDConsole. This ensures that no other thread will be able to modify the cursor status until the Write() method has been executed.
  3. Console.SetCursorPosition(42, 42) is an example for how you can modify the current cursor status. You could also modify the color or if the cursor itself is visible. SDConsole will preserve the set status and apply it accordingly when the actual text output takes place.
  4. SDConsole.Write("Example text") stores "Example text" in the output buffer of SDConsole along with the current cursor status.

Control thread sleep time

The default thread sleep time of the buffer processor is 30 milliseconds.
You can alter and reset that value using the methods below.

SDConsole.SetThreadSleepTime(42);
SDConsole.ResetThreadSleepTime();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.
  • net6.0

    • No dependencies.

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
1.0.19 461 1/23/2022
1.0.18 418 1/23/2022
1.0.17 406 1/23/2022
1.0.16 442 1/19/2022
1.0.15 427 1/19/2022
1.0.14 430 1/18/2022
1.0.13 448 1/18/2022
1.0.12 441 1/18/2022
1.0.11 429 1/18/2022
1.0.10 429 1/18/2022
1.0.9 411 1/18/2022
1.0.8 443 1/16/2022
1.0.7 437 1/16/2022
1.0.2 382 12/30/2021
1.0.1 273 12/29/2021
1.0.0 284 12/29/2021