YonatanMankovich.ConsoleDiffWriter
1.0.2
dotnet add package YonatanMankovich.ConsoleDiffWriter --version 1.0.2
NuGet\Install-Package YonatanMankovich.ConsoleDiffWriter -Version 1.0.2
<PackageReference Include="YonatanMankovich.ConsoleDiffWriter" Version="1.0.2" />
<PackageVersion Include="YonatanMankovich.ConsoleDiffWriter" Version="1.0.2" />
<PackageReference Include="YonatanMankovich.ConsoleDiffWriter" />
paket add YonatanMankovich.ConsoleDiffWriter --version 1.0.2
#r "nuget: YonatanMankovich.ConsoleDiffWriter, 1.0.2"
#:package YonatanMankovich.ConsoleDiffWriter@1.0.2
#addin nuget:?package=YonatanMankovich.ConsoleDiffWriter&version=1.0.2
#tool nuget:?package=YonatanMankovich.ConsoleDiffWriter&version=1.0.2
Console Diff Writer
A library that helps keep track of text written to the console and efficiently writes only the difference with the updated text instead of rewriting all of it.
Getting Started Examples
Note that if a Point is not specified in the Diff constructor, the diff will be tracked starting the current Console cursor position.
Plain
String (or Char)
using YonatanMankovich.ConsoleDiffWriter;
StringDiff diff = new StringDiff(); // Or use 'CharDiff' if needed.
diff.WriteDiff("0123456789"); // Write the initial string.
diff.WriteDiff("01234X6789"); // Only the 'X' will be written.
diff.WriteDiff("01234X678"); // The '9' will be overwritten with a space char.
// If writing to a specific point is desired:
StringDiff diffAtPoint = new StringDiff(new Point (6, 9));
String Lines
using YonatanMankovich.ConsoleDiffWriter;
LinesDiff diff = new LinesDiff();
diff.WriteDiff(new List<string>()
{
"----------",
"----##----",
"----++----"
}); // Write the initial lines.
diff.WriteDiff(new List<string>()
{
"----------",
"----XX----",
"----++----"
}); // Only '##' will be overwritten with 'XX'.
diff.WriteDiff(new List<string>()
{
"----------",
"----XX----"
}); // The last line will be overwritten with spaces.
// If writing to a specific point is desired:
LinesDiff diffAtPoint = new LinesDiff(new Point (6, 9));
Colorful
Everything is the same as before but now in color. See SimpleColorConsole for methods for working with colored characters, strings, and lines.
ColorString (or ColorChar) and ColorLines
using YonatanMankovich.ConsoleDiffWriter.Color;
using YonatanMankovich.SimpleColorConsole;
// Or use 'ColorCharDiff' or 'ColorLinesDiff' if needed.
ColorStringDiff diff = new ColorStringDiff();
diff.WriteDiff("0123456789".TextYellow()); // Write the initial string.
diff.WriteDiff("01234X6789".TextYellow()); // Only the 'X' will be written.
// The '9' will be overwritten with a blue character.
diff.WriteDiff("01234X678".TextYellow() + new ColorChar('9').BackBlue());
// If writing to a specific point is desired:
ColorStringDiff diffAtPoint = new ColorStringDiff(new Point (6, 9));
Behavioral Note
'/n', '/r', '/t' characters will not work. If a multi-line string is needed, use string lists or ColorLines.
My Other Projects That Use This Library
| Product | Versions 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. net9.0 was computed. 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. |
-
net6.0
- YonatanMankovich.SimpleColorConsole (>= 1.0.1)
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.2 | 488 | 4/8/2023 |