Skip to content

Commit

Permalink
upd - Updated libraries
Browse files Browse the repository at this point in the history
---

Mod authors will have to consult the Terminaux breaking changes page.

---

Type: upd
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 19, 2024
1 parent e4f9227 commit 76ec146
Show file tree
Hide file tree
Showing 187 changed files with 628 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MyMod
{
public static void Main()
{
ConsoleExtensions.SetTitle("thing");
ConsoleMisc.SetTitle("thing");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleCheck/Nitrocid.LocaleCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="2.7.2" />
<PackageReference Include="Terminaux" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleClean/Nitrocid.LocaleClean.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="2.7.2" />
<PackageReference Include="Terminaux" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.LocaleTrim/Nitrocid.LocaleTrim.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Terminaux" Version="2.7.2" />
<PackageReference Include="Terminaux" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nitrocid.LocaleTools\Nitrocid.LocaleTools.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions private/Nitrocid.Tests/ConsoleBase/ColorQueryingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void TestPopulateColorsEmpty()
[Description("Querying")]
public void TestGetGrayLight()
{
var expected = new Color(ConsoleColors.Gray);
var expected = new Color(ConsoleColors.Silver);
Should.NotThrow(() => KernelColorTools.SetColor(KernelColorType.Background, new Color(255, 255, 255)));
var color = ColorTools.GetGray();
color.ShouldBe(expected);
Expand All @@ -155,7 +155,7 @@ public void TestGetGrayLight()
[Description("Querying")]
public void TestGetGrayDark()
{
var expected = new Color(ConsoleColors.Gray);
var expected = new Color(ConsoleColors.Silver);
Should.NotThrow(() => KernelColorTools.SetColor(KernelColorType.Background, new Color(0, 0, 0)));
var color = ColorTools.GetGray();
color.ShouldBe(expected);
Expand Down Expand Up @@ -189,7 +189,7 @@ public void TestGetRandomColor()
Should.NotThrow(() => color = ColorTools.GetRandomColor(type));
type = color.PlainSequence.Contains(';') ?
ColorType.TrueColor : color.ColorId.ColorId >= 16 ?
ColorType._255Color : ColorType._16Color;
ColorType.EightBitColor : ColorType.FourBitColor;
color.ShouldNotBeNull();
color.Type.ShouldBe(type);
}
Expand Down
5 changes: 3 additions & 2 deletions private/Nitrocid.Tests/ConsoleBase/ConsoleQueryingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Shouldly;
using System;
using Terminaux.Base;
using Terminaux.Base.Extensions;
using Textify.General;

namespace Nitrocid.Tests.ConsoleBase
Expand All @@ -39,8 +40,8 @@ public void TestFilterVTSequences()
{
char BellChar = Convert.ToChar(7);
char EscapeChar = CharManager.GetEsc();
ConsoleExtensions.FilterVTSequences($"Hello!{EscapeChar}[38;5;43m").ShouldBe("Hello!");
ConsoleExtensions.FilterVTSequences($"{EscapeChar}]0;This is the title{BellChar}Hello!").ShouldBe("Hello!");
ConsoleMisc.FilterVTSequences($"Hello!{EscapeChar}[38;5;43m").ShouldBe("Hello!");
ConsoleMisc.FilterVTSequences($"{EscapeChar}]0;This is the title{BellChar}Hello!").ShouldBe("Hello!");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

namespace Nitrocid.Tests.Misc.Interactive.Interactives
{
internal class MyCustomInteractiveTui : BaseInteractiveTui, IInteractiveTui
internal class MyCustomInteractiveTui : BaseInteractiveTui<int>, IInteractiveTui<int>
{
public override List<InteractiveTuiBinding> Bindings => new()
{
public override List<InteractiveTuiBinding> Bindings =>
[
new InteractiveTuiBinding("Test", ConsoleKey.F1, (_, idx) => Console.WriteLine(idx))
};
];
}
}
1 change: 1 addition & 0 deletions private/Nitrocid.Tests/Misc/Text/TextToolsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shouldly;
using System.Linq;
using Terminaux.Base.Extensions;
using Textify.General;

namespace Nitrocid.Tests.Misc.Text
Expand Down
2 changes: 1 addition & 1 deletion private/Nitrocid.Tests/Nitrocid.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<ItemGroup>
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="MSTest" Version="3.2.1" />
<PackageReference Include="Terminaux" Version="2.7.2" />
<PackageReference Include="Terminaux" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\public\Nitrocid\Nitrocid.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using Terminaux.Inputs;
using Terminaux.Base;
using Terminaux.Colors.Data;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -153,7 +154,7 @@ void ResetAll()

// Wait for the input
winner = 0;
var input = Input.DetectKeypress().Key;
var input = TermReader.ReadKey().Key;
switch (input)
{
case ConsoleKey.UpArrow:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
using Terminaux.Colors;
using Textify.Words;
using Terminaux.Base;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -167,7 +168,7 @@ public static void InitializeHangman(HangmanDifficulty difficulty)
else
{
// Wait for character
var input = Input.DetectKeypress();
var input = TermReader.ReadKey();
var inputChar = input.KeyChar;
if (RandomWord.Contains(inputChar))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Terminaux.Base;
using Terminaux.Colors.Data;
using Nitrocid.Kernel.Debugging;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -103,7 +104,7 @@ public static void InitializeMeteor(bool simulation = false, bool dodge = false)
if (ConsoleWrapper.KeyAvailable)
{
// Read the key and handle it
Keypress = Input.DetectKeypress();
Keypress = TermReader.ReadKey();
HandleKeypress(Keypress.Key, dodge);
}
}
Expand Down Expand Up @@ -177,21 +178,21 @@ private static void DrawGame(bool dodge)
if (y != SpaceshipHeight)
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", 0, y)
TextWriterWhereColor.RenderWhere(" ", 0, y)
);
}

// Show the score
buffer.Append(
new Color(ConsoleColors.Green).VTSequenceForeground +
TextWriterWhereColor.RenderWherePlain($"{score}", ConsoleWrapper.WindowWidth - $"{score}".Length, 0)
TextWriterWhereColor.RenderWhere($"{score}", ConsoleWrapper.WindowWidth - $"{score}".Length, 0)
);

// Move the meteors left
for (int Meteor = 0; Meteor <= Meteors.Count - 1; Meteor++)
{
buffer.Append(new Color(ConsoleColors.Black).VTSequenceBackground);
buffer.Append(TextWriterWhereColor.RenderWherePlain(" ", Meteors[Meteor].Item1, Meteors[Meteor].Item2));
buffer.Append(TextWriterWhereColor.RenderWhere(" ", Meteors[Meteor].Item1, Meteors[Meteor].Item2));
int MeteorX = Meteors[Meteor].Item1 - 1;
int MeteorY = Meteors[Meteor].Item2;
Meteors[Meteor] = (MeteorX, MeteorY);
Expand All @@ -201,7 +202,7 @@ private static void DrawGame(bool dodge)
for (int Bullet = 0; Bullet <= Bullets.Count - 1; Bullet++)
{
buffer.Append(new Color(ConsoleColors.Black).VTSequenceBackground);
buffer.Append(TextWriterWhereColor.RenderWherePlain(" ", Bullets[Bullet].Item1, Bullets[Bullet].Item2));
buffer.Append(TextWriterWhereColor.RenderWhere(" ", Bullets[Bullet].Item1, Bullets[Bullet].Item2));
int BulletX = Bullets[Bullet].Item1 + 1;
int BulletY = Bullets[Bullet].Item2;
Bullets[Bullet] = (BulletX, BulletY);
Expand Down Expand Up @@ -278,8 +279,8 @@ private static void DrawGame(bool dodge)
{
// The meteor crashed! Remove both the bullet and the meteor
buffer.Append(new Color(ConsoleColors.Black).VTSequenceBackground);
buffer.Append(TextWriterWhereColor.RenderWherePlain(" ", Meteor.Item1, Meteor.Item2));
buffer.Append(TextWriterWhereColor.RenderWherePlain(" ", Bullet.Item1, Bullet.Item2));
buffer.Append(TextWriterWhereColor.RenderWhere(" ", Meteor.Item1, Meteor.Item2));
buffer.Append(TextWriterWhereColor.RenderWhere(" ", Bullet.Item1, Bullet.Item2));
Bullets.RemoveAt(BulletIndex);
Meteors.RemoveAt(MeteorIndex);
score++;
Expand All @@ -288,7 +289,7 @@ private static void DrawGame(bool dodge)
}

// Wait for a few milliseconds
TextWriterColor.WritePlain(buffer.ToString(), false);
TextWriterRaw.WritePlain(buffer.ToString(), false);
ThreadManager.SleepNoBlock(MeteorSpeed, MeteorDrawThread);
}
}
Expand Down Expand Up @@ -350,7 +351,7 @@ private static string DrawMeteor(int MeteorX, int MeteorY)
private static string DrawBullet(int BulletX, int BulletY)
{
char BulletSymbol = '-';
return TextWriterWhereColor.RenderWhere(Convert.ToString(BulletSymbol), BulletX, BulletY, false, ConsoleColors.Cyan, ConsoleColors.Black);
return TextWriterWhereColor.RenderWhere(Convert.ToString(BulletSymbol), BulletX, BulletY, false, ConsoleColors.Aqua, ConsoleColors.Black);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Terminaux.Base;
using Terminaux.Colors.Data;
using Nitrocid.Kernel.Debugging;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -103,7 +104,7 @@ public static void InitializeShipDuet(bool simulation = false)
if (ConsoleWrapper.KeyAvailable)
{
// Read the key and handle it
Keypress = Input.DetectKeypress();
Keypress = TermReader.ReadKey();
HandleKeypress(Keypress.Key);
}
}
Expand Down Expand Up @@ -193,12 +194,12 @@ private static void DrawGame()
if (y != SpaceshipHeightPlayer1)
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", 0, y)
TextWriterWhereColor.RenderWhere(" ", 0, y)
);
if (y != SpaceshipHeightPlayer2)
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", ConsoleWrapper.WindowWidth - 1, y)
TextWriterWhereColor.RenderWhere(" ", ConsoleWrapper.WindowWidth - 1, y)
);
}

Expand All @@ -207,7 +208,7 @@ private static void DrawGame()
{
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", BulletsPlayer1[Bullet].Item1, BulletsPlayer1[Bullet].Item2)
TextWriterWhereColor.RenderWhere(" ", BulletsPlayer1[Bullet].Item1, BulletsPlayer1[Bullet].Item2)
);
int BulletX = BulletsPlayer1[Bullet].Item1 + 1;
int BulletY = BulletsPlayer1[Bullet].Item2;
Expand All @@ -219,7 +220,7 @@ private static void DrawGame()
{
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", BulletsPlayer2[Bullet].Item1, BulletsPlayer2[Bullet].Item2)
TextWriterWhereColor.RenderWhere(" ", BulletsPlayer2[Bullet].Item1, BulletsPlayer2[Bullet].Item2)
);
int BulletX = BulletsPlayer2[Bullet].Item1 - 1;
int BulletY = BulletsPlayer2[Bullet].Item2;
Expand All @@ -231,7 +232,7 @@ private static void DrawGame()
{
buffer.Append(
new Color(ConsoleColors.Black).VTSequenceBackground +
TextWriterWhereColor.RenderWherePlain(" ", Stars[Star].Item1, Stars[Star].Item2)
TextWriterWhereColor.RenderWhere(" ", Stars[Star].Item1, Stars[Star].Item2)
);
int StarX = Stars[Star].Item1 - 1;
int StarY = Stars[Star].Item2;
Expand Down Expand Up @@ -322,7 +323,7 @@ private static void DrawGame()
}

// Wait for a few milliseconds
TextWriterColor.WritePlain(buffer.ToString(), false);
TextWriterRaw.WritePlain(buffer.ToString(), false);
ThreadManager.SleepNoBlock(ShipDuetSpeed, ShipDuetDrawThread);
}
}
Expand Down Expand Up @@ -388,7 +389,7 @@ private static string DrawSpaceships()
private static string DrawBullet(int BulletX, int BulletY)
{
char BulletSymbol = '-';
return TextWriterWhereColor.RenderWhere(Convert.ToString(BulletSymbol), BulletX, BulletY, false, ConsoleColors.Cyan, ConsoleColors.Black);
return TextWriterWhereColor.RenderWhere(Convert.ToString(BulletSymbol), BulletX, BulletY, false, ConsoleColors.Aqua, ConsoleColors.Black);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
using Terminaux.Inputs;
using Terminaux.Base;
using Terminaux.Colors.Data;
using Terminaux.Reader;
using Terminaux.Colors.Transformation.Contrast;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -243,7 +245,7 @@ public static void InitializeSnaker(bool Simulation)
// User pressed the arrow button to move the snake
if (ConsoleWrapper.KeyAvailable)
{
var Pressed = Input.DetectKeypress().Key;
var Pressed = TermReader.ReadKey().Key;
switch (Pressed)
{
case ConsoleKey.DownArrow:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Terminaux.Writer.ConsoleWriters;
using Nitrocid.Languages;
using Textify.General;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand Down Expand Up @@ -140,9 +141,9 @@ public static void InitializeSpeedPress(SpeedPressDifficulty Difficulty, int Cus
// Prompt user for character
TextWriterColor.Write(Translate.DoTranslation("Current character:") + " {0}", SelectedChar);
TextWriters.Write("> ", false, KernelColorType.Input);
var (result, provided) = Input.ReadKeyTimeout(false, TimeSpan.FromMilliseconds(SpeedTimeout));
var (result, provided) = TermReader.ReadKeyTimeout(false, TimeSpan.FromMilliseconds(SpeedTimeout));
WrittenChar = result;
TextWriterColor.Write();
TextWriterRaw.Write();

// Check to see if the user has pressed the correct character
if (provided)
Expand All @@ -158,7 +159,7 @@ public static void InitializeSpeedPress(SpeedPressDifficulty Difficulty, int Cus
}
else
{
TextWriterColor.Write();
TextWriterRaw.Write();
TextWriters.Write(Translate.DoTranslation("Character not pressed on time."), true, KernelColorType.Warning);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Terminaux.Writer.FancyWriters;
using Terminaux.Base;
using Terminaux.Colors.Data;
using Terminaux.Reader;

namespace Nitrocid.Extras.Amusements.Amusements.Games
{
Expand All @@ -52,7 +53,7 @@ public static void InitializeWordle(bool orig = false)
RenderBoxes(RandomWord, maxGuesses, currentTries);

// Let the user decide the character
var pressedChar = Input.DetectKeypress();
var pressedChar = TermReader.ReadKey();
switch (pressedChar.Key)
{
case ConsoleKey.Escape:
Expand Down Expand Up @@ -98,7 +99,7 @@ public static void InitializeWordle(bool orig = false)

private static void RenderBoxes(string RandomWord, int maxGuesses, char[,] currentTries)
{
var boxColorNeutral = new Color(ConsoleColors.Gray);
var boxColorNeutral = new Color(ConsoleColors.Silver);
var boxColorRightChar = new Color(ConsoleColors.Green);
var boxColorMatchingChar = new Color(ConsoleColors.DarkOrange);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public override int Execute(CommandParameters parameters, ref string variableVal
[
Translate.DoTranslation("This version now refines the kernel to the point that it no longer behaves like the old versions.") + " " +
Translate.DoTranslation("Because the new groundbreaking features got released, we decided to name this kernel...") + " \n\n" +
new Color(ConsoleColors.Green3_00d700).VTSequenceForeground + "Nitrocid KS 0.1.0!\n\n" + KernelColorTools.GetColor(KernelColorType.NeutralText).VTSequenceForeground +
new Color(ConsoleColors.Green3Alt).VTSequenceForeground + "Nitrocid KS 0.1.0!\n\n" + KernelColorTools.GetColor(KernelColorType.NeutralText).VTSequenceForeground +
"< " + Translate.DoTranslation("Happy 5-year anniversary!") + " >\n\n" +
"-- Aptivi"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="Textify.Offline.Data" Version="1.3.1" />
<PackageReference Include="Textify.Offline.Data" Version="1.4.0" />
</ItemGroup>
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
Loading

0 comments on commit 76ec146

Please sign in to comment.