From ae86e1e74e55dd6d3b1ac2e3af364887c520e174 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Tue, 20 Jan 2026 21:16:32 +0100 Subject: [PATCH 01/71] BaseLib --- Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs | 1 + Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs b/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs index 709b8e83c..51a405c64 100644 --- a/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs +++ b/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs @@ -149,6 +149,7 @@ public interface IConsole /// The next line of characters from the input stream, or an empty string if no input is available. /// string ReadLine(); + void ResetColor(); /// /// Sets the position of the cursor within the console buffer. diff --git a/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs b/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs index 62bba77c8..b62fc3237 100644 --- a/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs +++ b/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs @@ -20,6 +20,7 @@ public class ConsoleProxy : IConsole MethodInfo _writeCh = typeof(Console).GetMethod(nameof(Console.Write), [typeof(char)])!; MethodInfo _writeS = typeof(Console).GetMethod(nameof(Console.Write), [typeof(string)])!; MethodInfo _clear = typeof(Console).GetMethod(nameof(Console.Clear), [])!; + MethodInfo _resetColor = typeof(Console).GetMethod(nameof(Console.ResetColor), [])!; PropertyInfo _ForegroundColor = typeof(Console).GetProperty(nameof(Console.ForegroundColor))!; PropertyInfo _BackgroundColor = typeof(Console).GetProperty(nameof(Console.BackgroundColor))!; @@ -55,6 +56,9 @@ public class ConsoleProxy : IConsole #endif public ConsoleKeyInfo? ReadKey() => _ReadKey?.Invoke(null, []) as ConsoleKeyInfo?; public string ReadLine() => _Readline?.Invoke(null, [])?.ToString() ?? string.Empty; + + public void ResetColor() => _resetColor?.Invoke(null, []); + public void SetCursorPosition(int left, int top) => _setCursorPosition?.Invoke(null, [left, top]); public void Write(char ch) => _writeCh?.Invoke(null, [ch]); public void Write(string? st) => _writeS?.Invoke(null, [st]); From fe39de919921b598e3a704c3685fdbf893895b10 Mon Sep 17 00:00:00 2001 From: deroschr Date: Wed, 21 Jan 2026 16:36:41 +0100 Subject: [PATCH 02/71] Exclude obj\ files from build, update TLS env vars Added ItemGroups to all relevant .csproj files to exclude obj\ artifacts from Compile, EmbeddedResource, None, and Page items, preventing accidental inclusion of build outputs. Refactored Sokoban.Server/Program.cs to use SOKOSERVER_TLS_* environment variables instead of SHARPHACK_TLS_*, with constants for consistency. Console output now displays the assembly name dynamically. Reordered ProjectReference entries in Sokoban.Server.csproj. Changed PreBuild target condition in Sokoban_Base.csproj from net6.0 to net6.01. Added a conditional using for System.Runtime.Loader in AppWithPlugin.cs for .NET 6.0 or greater, and a clarifying comment in AppWithPlugin.csproj. --- .../Games/Arkanoid.Base/Arkanoid.Base.csproj | 5 +++++ .../Games/Arkanoid.Cons/Arkanoid.Cons.csproj | 5 +++++ .../Games/MidiSwing.MVVM/MidiSwing.MVVM.csproj | 7 +++++++ .../Games/SharpHack.AI/SharpHack.AI.csproj | 6 ++++++ .../SharpHack.AITests/SharpHack.AITests.csproj | 6 ++++++ .../Games/SharpHack.Base/SharpHack.Base.csproj | 5 +++++ .../SharpHack.MapExport.csproj | 8 +++++++- .../SharpHack.Server/SharpHack.Server.csproj | 3 +++ .../SharpHack.Terminal/SharpHack.Terminal.csproj | 6 ++++++ CSharpBible/Games/Sokoban.Server/Program.cs | 16 ++++++++++------ .../Games/Sokoban.Server/Sokoban.Server.csproj | 2 +- .../Games/Sokoban_Base/Sokoban_Base.csproj | 2 +- .../TileSetAnimator.Tests.csproj | 7 +++++++ .../Games/TileSetAnimator/TileSetAnimator.csproj | 6 ++++++ .../AppWithPlugin/AppWithPlugin.csproj | 1 + .../AppWithPlugin/Model/AppWithPlugin.cs | 3 +++ 16 files changed, 79 insertions(+), 9 deletions(-) diff --git a/CSharpBible/Games/Arkanoid.Base/Arkanoid.Base.csproj b/CSharpBible/Games/Arkanoid.Base/Arkanoid.Base.csproj index 28ead3f4a..1705ad3c5 100644 --- a/CSharpBible/Games/Arkanoid.Base/Arkanoid.Base.csproj +++ b/CSharpBible/Games/Arkanoid.Base/Arkanoid.Base.csproj @@ -15,5 +15,10 @@ $(TargetFrameworks);net10.0 + + + + + diff --git a/CSharpBible/Games/Arkanoid.Cons/Arkanoid.Cons.csproj b/CSharpBible/Games/Arkanoid.Cons/Arkanoid.Cons.csproj index 8118714f1..aeb6601b0 100644 --- a/CSharpBible/Games/Arkanoid.Cons/Arkanoid.Cons.csproj +++ b/CSharpBible/Games/Arkanoid.Cons/Arkanoid.Cons.csproj @@ -15,6 +15,11 @@ $(TargetFrameworks);net10.0 + + + + + diff --git a/CSharpBible/Games/MidiSwing.MVVM/MidiSwing.MVVM.csproj b/CSharpBible/Games/MidiSwing.MVVM/MidiSwing.MVVM.csproj index 2f871f341..fb8e4cf3a 100644 --- a/CSharpBible/Games/MidiSwing.MVVM/MidiSwing.MVVM.csproj +++ b/CSharpBible/Games/MidiSwing.MVVM/MidiSwing.MVVM.csproj @@ -8,6 +8,13 @@ true + + + + + + + diff --git a/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj b/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj index f23578f99..c9df3d96e 100644 --- a/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj +++ b/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj @@ -6,6 +6,12 @@ enable + + + + + + diff --git a/CSharpBible/Games/SharpHack.AITests/SharpHack.AITests.csproj b/CSharpBible/Games/SharpHack.AITests/SharpHack.AITests.csproj index 51aefe53a..59561df96 100644 --- a/CSharpBible/Games/SharpHack.AITests/SharpHack.AITests.csproj +++ b/CSharpBible/Games/SharpHack.AITests/SharpHack.AITests.csproj @@ -7,6 +7,12 @@ false + + + + + + diff --git a/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj b/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj index cd6db5978..ebec553e3 100644 --- a/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj +++ b/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj @@ -4,5 +4,10 @@ enable enable + + + + + diff --git a/CSharpBible/Games/SharpHack.MapExport/SharpHack.MapExport.csproj b/CSharpBible/Games/SharpHack.MapExport/SharpHack.MapExport.csproj index 06d75777a..367b8ee67 100644 --- a/CSharpBible/Games/SharpHack.MapExport/SharpHack.MapExport.csproj +++ b/CSharpBible/Games/SharpHack.MapExport/SharpHack.MapExport.csproj @@ -1,4 +1,4 @@ - + Exe net10.0-windows @@ -6,6 +6,12 @@ true enable + + + + + + diff --git a/CSharpBible/Games/SharpHack.Server/SharpHack.Server.csproj b/CSharpBible/Games/SharpHack.Server/SharpHack.Server.csproj index 5b022d74a..5dfc74145 100644 --- a/CSharpBible/Games/SharpHack.Server/SharpHack.Server.csproj +++ b/CSharpBible/Games/SharpHack.Server/SharpHack.Server.csproj @@ -9,8 +9,11 @@ + + + diff --git a/CSharpBible/Games/SharpHack.Terminal/SharpHack.Terminal.csproj b/CSharpBible/Games/SharpHack.Terminal/SharpHack.Terminal.csproj index 42ca14001..220eb6968 100644 --- a/CSharpBible/Games/SharpHack.Terminal/SharpHack.Terminal.csproj +++ b/CSharpBible/Games/SharpHack.Terminal/SharpHack.Terminal.csproj @@ -7,6 +7,12 @@ enable + + + + + + diff --git a/CSharpBible/Games/Sokoban.Server/Program.cs b/CSharpBible/Games/Sokoban.Server/Program.cs index a4a798ebc..f4803b754 100644 --- a/CSharpBible/Games/Sokoban.Server/Program.cs +++ b/CSharpBible/Games/Sokoban.Server/Program.cs @@ -6,6 +6,7 @@ using System.Net; using System.Net.Security; using System.Net.Sockets; +using System.Reflection; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; @@ -16,6 +17,9 @@ namespace Sokoban.Server; /// public static class Program { + private static readonly string SOKOSERVER_TLS_CERT_PATH= "SOKOSERVER_TLS_CERT_PATH"; + private static readonly string SOKOSERVER_TLS_CERT_PASSWORD = "SOKOSERVER_TLS_CERT_PASSWORD"; + private static readonly string SOKOSERVER_TLS = "SOKOSERVER_TLS"; public static async Task Main(string[] args) { @@ -30,11 +34,11 @@ public static async Task Main(string[] args) var listener = new TcpListener(IPAddress.Any, port); listener.Start(); - System.Console.WriteLine($"SharpHack server listening on 0.0.0.0:{port}"); + System.Console.WriteLine($"{Assembly.GetExecutingAssembly().GetName().Name} server listening on 0.0.0.0:{port}"); if (useTls) { System.Console.WriteLine("TLS enabled: connect with an SSL/TLS capable client, then use TELNET/RAW over the secure channel."); - System.Console.WriteLine($"Certificate: {(string.IsNullOrWhiteSpace(certPath) ? "" : certPath)}"); + System.Console.WriteLine($"Certificate: {(string.IsNullOrWhiteSpace(certPath) ? $"" : certPath)}"); } else { @@ -178,19 +182,19 @@ private static void ParseArgs(string[] args, ref int port, ref bool useTls, ref if (!useTls) { - var envTls = Environment.GetEnvironmentVariable("SHARPHACK_TLS") ?? Environment.GetEnvironmentVariable("SHARPHACK_SSL"); + var envTls = Environment.GetEnvironmentVariable(SOKOSERVER_TLS) ?? Environment.GetEnvironmentVariable("SHARPHACK_SSL"); if (!string.IsNullOrWhiteSpace(envTls) && (envTls.Equals("1") || envTls.Equals("true", StringComparison.OrdinalIgnoreCase) || envTls.Equals("yes", StringComparison.OrdinalIgnoreCase))) { useTls = true; } } - certPath ??= Environment.GetEnvironmentVariable("SHARPHACK_TLS_CERT_PATH"); - certPassword ??= Environment.GetEnvironmentVariable("SHARPHACK_TLS_CERT_PASSWORD"); + certPath ??= Environment.GetEnvironmentVariable(SOKOSERVER_TLS_CERT_PATH); + certPassword ??= Environment.GetEnvironmentVariable(SOKOSERVER_TLS_CERT_PASSWORD); if (useTls && string.IsNullOrWhiteSpace(certPath)) { - throw new InvalidOperationException("TLS is enabled but no certificate was provided. Use --cert or set SHARPHACK_TLS_CERT_PATH."); + throw new InvalidOperationException($"TLS is enabled but no certificate was provided. Use --cert or set {SOKOSERVER_TLS_CERT_PATH}."); } } diff --git a/CSharpBible/Games/Sokoban.Server/Sokoban.Server.csproj b/CSharpBible/Games/Sokoban.Server/Sokoban.Server.csproj index 13255fa4b..b56b76480 100644 --- a/CSharpBible/Games/Sokoban.Server/Sokoban.Server.csproj +++ b/CSharpBible/Games/Sokoban.Server/Sokoban.Server.csproj @@ -14,8 +14,8 @@ - + diff --git a/CSharpBible/Games/Sokoban_Base/Sokoban_Base.csproj b/CSharpBible/Games/Sokoban_Base/Sokoban_Base.csproj index 54e62e3ef..5b8e9d0c0 100644 --- a/CSharpBible/Games/Sokoban_Base/Sokoban_Base.csproj +++ b/CSharpBible/Games/Sokoban_Base/Sokoban_Base.csproj @@ -60,7 +60,7 @@ - + diff --git a/CSharpBible/Games/TileSetAnimator.Tests/TileSetAnimator.Tests.csproj b/CSharpBible/Games/TileSetAnimator.Tests/TileSetAnimator.Tests.csproj index 885c5aef2..b0d45bcf7 100644 --- a/CSharpBible/Games/TileSetAnimator.Tests/TileSetAnimator.Tests.csproj +++ b/CSharpBible/Games/TileSetAnimator.Tests/TileSetAnimator.Tests.csproj @@ -8,6 +8,13 @@ enable + + + + + + + diff --git a/CSharpBible/Games/TileSetAnimator/TileSetAnimator.csproj b/CSharpBible/Games/TileSetAnimator/TileSetAnimator.csproj index 214539916..d28784a93 100644 --- a/CSharpBible/Games/TileSetAnimator/TileSetAnimator.csproj +++ b/CSharpBible/Games/TileSetAnimator/TileSetAnimator.csproj @@ -8,6 +8,12 @@ preview true + + + + + + diff --git a/TestStatements/AppWithPlugin/AppWithPlugin.csproj b/TestStatements/AppWithPlugin/AppWithPlugin.csproj index 3a53ab609..faac5a526 100644 --- a/TestStatements/AppWithPlugin/AppWithPlugin.csproj +++ b/TestStatements/AppWithPlugin/AppWithPlugin.csproj @@ -24,6 +24,7 @@ + diff --git a/TestStatements/AppWithPlugin/Model/AppWithPlugin.cs b/TestStatements/AppWithPlugin/Model/AppWithPlugin.cs index cb3cf1933..ff7e86ffe 100644 --- a/TestStatements/AppWithPlugin/Model/AppWithPlugin.cs +++ b/TestStatements/AppWithPlugin/Model/AppWithPlugin.cs @@ -11,6 +11,9 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +#if NET6_0_OR_GREATER +using System.Runtime.Loader; +#endif namespace AppWithPlugin.Model; From 1dfc0477796339daee7c4d5af9eea3bc6d940b3c Mon Sep 17 00:00:00 2001 From: Joe Care Date: Wed, 21 Jan 2026 19:25:21 +0100 Subject: [PATCH 03/71] SharpHack.Server --- .../Games/Sokoban.Plugin/MiniSokoCommand.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs diff --git a/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs b/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs new file mode 100644 index 000000000..c20132d64 --- /dev/null +++ b/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs @@ -0,0 +1,50 @@ +using BaseLib.Interfaces; +using Microsoft.Extensions.Logging; +using PluginBase.Interfaces; +using Sokoban.Plugin; +using Sokoban.Properties; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sokoban; + +public class MiniSokoCommand : ICommand +{ + private IEnvironment _env; + private IRandom? _rnd; + private ILogger? _logger; + private ISysTime? _time; + private IConsole? _console; + + public string Name => "sokoban-mini"; + + public string Description => Resources.cmdDescription2; + + public int Execute(object? param = null) + { + _logger?.LogDebug($"{nameof(SokoCommand)}.{nameof(Execute)}"); + if (_console != null) + { + _console.Clear(); + _display = + var game = new MiniSokoGame(_env, _console); + game.Run(); + } + else + { + _logger?.LogError("Console service is not available."); + } + } + + public void Initialize(IEnvironment env) + { + _env = env; + _rnd = _env.GetService(); + _logger = _env.GetService(); + _time = _env.GetService(); + _console = _env.GetService(); + } +} From 3f20410c76adb3c6eff225241da05ff9d6f43762 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 20:21:15 +0100 Subject: [PATCH 04/71] SharpHack.Server --- .../Games/SharpHack.AI/SharpHack.AI.csproj | 22 +++-- .../Interfaces/IContainerItem.cs | 1 + .../SharpHack.Base/Interfaces/ICreature.cs | 1 + .../SharpHack.Base/Interfaces/IGameObject.cs | 20 ++--- .../SharpHack.Base/Interfaces/IGamePersist.cs | 1 + .../Games/SharpHack.Base/Interfaces/ITile.cs | 1 + .../SharpHack.Base/SharpHack.Base.csproj | 27 +++--- .../SharpHack.BaseCreatures.csproj | 18 ++-- .../SharpHack.BaseItems.csproj | 18 ++-- .../SharpHack.BaseItemsTests.csproj | 21 +++-- .../SharpHack.BaseTests.csproj | 21 +++-- .../SharpHack.Combat/SharpHack.Combat.csproj | 20 +++-- .../SharpHack.CombatTests.csproj | 29 ++++--- .../SharpHack.EngineTests.csproj | 29 ++++--- .../SharpHack.LevelGenTests.csproj | 29 ++++--- .../Games/Sokoban.Plugin/MiniSokoCommand.cs | 87 ++++++++++++++++++- 16 files changed, 253 insertions(+), 92 deletions(-) diff --git a/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj b/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj index c9df3d96e..388c0b5aa 100644 --- a/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj +++ b/CSharpBible/Games/SharpHack.AI/SharpHack.AI.csproj @@ -1,12 +1,22 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + Sokoban + AnyCPU;x64 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - + diff --git a/CSharpBible/Games/SharpHack.Base/Interfaces/IContainerItem.cs b/CSharpBible/Games/SharpHack.Base/Interfaces/IContainerItem.cs index 6c7e5aff5..dfb7e7c0b 100644 --- a/CSharpBible/Games/SharpHack.Base/Interfaces/IContainerItem.cs +++ b/CSharpBible/Games/SharpHack.Base/Interfaces/IContainerItem.cs @@ -1,4 +1,5 @@ using SharpHack.Base.Model; +using System.Collections.Generic; namespace SharpHack.Base.Interfaces; diff --git a/CSharpBible/Games/SharpHack.Base/Interfaces/ICreature.cs b/CSharpBible/Games/SharpHack.Base/Interfaces/ICreature.cs index 2c16947b4..f7483912d 100644 --- a/CSharpBible/Games/SharpHack.Base/Interfaces/ICreature.cs +++ b/CSharpBible/Games/SharpHack.Base/Interfaces/ICreature.cs @@ -1,4 +1,5 @@ using SharpHack.Base.Model; +using System.Collections.Generic; namespace SharpHack.Base.Interfaces { diff --git a/CSharpBible/Games/SharpHack.Base/Interfaces/IGameObject.cs b/CSharpBible/Games/SharpHack.Base/Interfaces/IGameObject.cs index 09b930d1e..859fe76e4 100644 --- a/CSharpBible/Games/SharpHack.Base/Interfaces/IGameObject.cs +++ b/CSharpBible/Games/SharpHack.Base/Interfaces/IGameObject.cs @@ -1,14 +1,14 @@ using SharpHack.Base.Model; +using System; -namespace SharpHack.Base.Interfaces +namespace SharpHack.Base.Interfaces; + +public interface IGameObject { - public interface IGameObject - { - ConsoleColor Color { get; set; } - string Description { get; set; } - Guid Id { get; } - string Name { get; set; } - Point Position { get; set; } - char Symbol { get; set; } - } + ConsoleColor Color { get; set; } + string Description { get; set; } + Guid Id { get; } + string Name { get; set; } + Point Position { get; set; } + char Symbol { get; set; } } \ No newline at end of file diff --git a/CSharpBible/Games/SharpHack.Base/Interfaces/IGamePersist.cs b/CSharpBible/Games/SharpHack.Base/Interfaces/IGamePersist.cs index 0d276c4a5..9241642ac 100644 --- a/CSharpBible/Games/SharpHack.Base/Interfaces/IGamePersist.cs +++ b/CSharpBible/Games/SharpHack.Base/Interfaces/IGamePersist.cs @@ -1,4 +1,5 @@ using SharpHack.Base.Model; +using System.Collections.Generic; namespace SharpHack.Base.Interfaces; diff --git a/CSharpBible/Games/SharpHack.Base/Interfaces/ITile.cs b/CSharpBible/Games/SharpHack.Base/Interfaces/ITile.cs index f6acc35bb..8439a162a 100644 --- a/CSharpBible/Games/SharpHack.Base/Interfaces/ITile.cs +++ b/CSharpBible/Games/SharpHack.Base/Interfaces/ITile.cs @@ -1,5 +1,6 @@ using SharpHack.Base.Data; using SharpHack.Base.Model; +using System.Collections.Generic; namespace SharpHack.Base.Interfaces; diff --git a/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj b/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj index ebec553e3..49b654132 100644 --- a/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj +++ b/CSharpBible/Games/SharpHack.Base/SharpHack.Base.csproj @@ -1,13 +1,20 @@ - - - net10.0 - enable - enable + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 - - - - - + + + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 + + + + + diff --git a/CSharpBible/Games/SharpHack.BaseCreatures/SharpHack.BaseCreatures.csproj b/CSharpBible/Games/SharpHack.BaseCreatures/SharpHack.BaseCreatures.csproj index 0401b2193..761cc8606 100644 --- a/CSharpBible/Games/SharpHack.BaseCreatures/SharpHack.BaseCreatures.csproj +++ b/CSharpBible/Games/SharpHack.BaseCreatures/SharpHack.BaseCreatures.csproj @@ -1,9 +1,17 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 diff --git a/CSharpBible/Games/SharpHack.BaseItems/SharpHack.BaseItems.csproj b/CSharpBible/Games/SharpHack.BaseItems/SharpHack.BaseItems.csproj index 15462413b..a7baa2e57 100644 --- a/CSharpBible/Games/SharpHack.BaseItems/SharpHack.BaseItems.csproj +++ b/CSharpBible/Games/SharpHack.BaseItems/SharpHack.BaseItems.csproj @@ -1,9 +1,17 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 diff --git a/CSharpBible/Games/SharpHack.BaseItemsTests/SharpHack.BaseItemsTests.csproj b/CSharpBible/Games/SharpHack.BaseItemsTests/SharpHack.BaseItemsTests.csproj index 7583d6412..d6e9103be 100644 --- a/CSharpBible/Games/SharpHack.BaseItemsTests/SharpHack.BaseItemsTests.csproj +++ b/CSharpBible/Games/SharpHack.BaseItemsTests/SharpHack.BaseItemsTests.csproj @@ -1,13 +1,20 @@ - + + + + Library + net462;net472;net48;net481;net7.0;net8.0 + + + - - net10.0 - enable - enable - false + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - + diff --git a/CSharpBible/Games/SharpHack.BaseTests/SharpHack.BaseTests.csproj b/CSharpBible/Games/SharpHack.BaseTests/SharpHack.BaseTests.csproj index 09920bec8..ba89292ed 100644 --- a/CSharpBible/Games/SharpHack.BaseTests/SharpHack.BaseTests.csproj +++ b/CSharpBible/Games/SharpHack.BaseTests/SharpHack.BaseTests.csproj @@ -1,13 +1,20 @@ - + + + + Library + net462;net472;net48;net481;net7.0;net8.0 + + + - - net10.0 - enable - enable - false + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - + diff --git a/CSharpBible/Games/SharpHack.Combat/SharpHack.Combat.csproj b/CSharpBible/Games/SharpHack.Combat/SharpHack.Combat.csproj index c9df3d96e..1a62f0f72 100644 --- a/CSharpBible/Games/SharpHack.Combat/SharpHack.Combat.csproj +++ b/CSharpBible/Games/SharpHack.Combat/SharpHack.Combat.csproj @@ -1,12 +1,20 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - + diff --git a/CSharpBible/Games/SharpHack.CombatTests/SharpHack.CombatTests.csproj b/CSharpBible/Games/SharpHack.CombatTests/SharpHack.CombatTests.csproj index 7be22461d..f483ab9fd 100644 --- a/CSharpBible/Games/SharpHack.CombatTests/SharpHack.CombatTests.csproj +++ b/CSharpBible/Games/SharpHack.CombatTests/SharpHack.CombatTests.csproj @@ -1,17 +1,24 @@ - + + + + Library + net462;net472;net48;net481;net7.0;net8.0 + + + - - net10.0 - enable - enable - false + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - - - - - + + + + + diff --git a/CSharpBible/Games/SharpHack.EngineTests/SharpHack.EngineTests.csproj b/CSharpBible/Games/SharpHack.EngineTests/SharpHack.EngineTests.csproj index c1fcefb4e..57f9bc0b9 100644 --- a/CSharpBible/Games/SharpHack.EngineTests/SharpHack.EngineTests.csproj +++ b/CSharpBible/Games/SharpHack.EngineTests/SharpHack.EngineTests.csproj @@ -1,17 +1,24 @@ - + + + + Library + net462;net472;net48;net481;net7.0;net8.0 + + + - - net10.0 - enable - enable - false + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - - - - - + + + + + diff --git a/CSharpBible/Games/SharpHack.LevelGenTests/SharpHack.LevelGenTests.csproj b/CSharpBible/Games/SharpHack.LevelGenTests/SharpHack.LevelGenTests.csproj index 2809b428e..7764ff80e 100644 --- a/CSharpBible/Games/SharpHack.LevelGenTests/SharpHack.LevelGenTests.csproj +++ b/CSharpBible/Games/SharpHack.LevelGenTests/SharpHack.LevelGenTests.csproj @@ -1,17 +1,24 @@ - + + + + Library + net462;net472;net48;net481;net7.0;net8.0 + + + - - net10.0 - enable - enable - false + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - - - - - + + + + + diff --git a/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs b/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs index c20132d64..5efceb74c 100644 --- a/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs +++ b/CSharpBible/Games/Sokoban.Plugin/MiniSokoCommand.cs @@ -1,10 +1,14 @@ using BaseLib.Interfaces; +using ConsoleDisplay.View; using Microsoft.Extensions.Logging; using PluginBase.Interfaces; +using Sokoban.Models; using Sokoban.Plugin; using Sokoban.Properties; +using Sokoban.ViewModels; using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -18,6 +22,8 @@ public class MiniSokoCommand : ICommand private ILogger? _logger; private ISysTime? _time; private IConsole? _console; + private Display _display; + private Game _game; public string Name => "sokoban-mini"; @@ -29,14 +35,89 @@ public int Execute(object? param = null) if (_console != null) { _console.Clear(); - _display = - var game = new MiniSokoGame(_env, _console); - game.Run(); + _game = new Game(); + _game.Init(); + _display = new Display(_console, 3, 3,_game.PFSize.Width,_game.PFSize.Height); + _game.visSetMessage = (msg) => + { + _console.SetCursorPosition(0, 15); + _console.WriteLine(msg); + }; + _game.visShow = (ua) => + { + _display.Clear(); + for (int y = 0; y < _game.PFSize.Height; y++) + { + for (int x = 0; x < _game.PFSize.Width; x++) + { + var tile = _game.GetTile(new Point(x, y)); + ConsoleColor color = tile switch + { + TileDef.Wall => ConsoleColor.DarkGray, + TileDef.Floor => ConsoleColor.Black, + TileDef.Destination => ConsoleColor.Yellow, + _ => ConsoleColor.Black, + }; + _display.PutPixel(x, y, color); + } + } + foreach (var stone in _game.Stones) + { + _display.PutPixel(stone.Position.X, stone.Position.Y, ConsoleColor.Blue); + } + if (_game.player != null) + { + _display.PutPixel(_game.player.Position.X, _game.player.Position.Y, ConsoleColor.Green); + } + _display.Update(); + }; + _game.visUpdate = () => + { + // Optional: Implement if needed + }; + _game.visGetUserAction = (ua) => + { + _console.SetCursorPosition(0, 14); + _console.WriteLine("Use W/A/S/D to move, Q to quit."); + while (true) + { + var keyInfo = _console.ReadKey(); + if (keyInfo.HasValue) + { + var key = keyInfo.Value.Key; + return key switch + { + ConsoleKey.W => UserAction.GoNorth, + ConsoleKey.UpArrow => UserAction.GoNorth, + ConsoleKey.A => UserAction.GoWest, + ConsoleKey.LeftArrow => UserAction.GoWest, + ConsoleKey.S => UserAction.GoSouth, + ConsoleKey.DownArrow => UserAction.GoSouth, + ConsoleKey.D => UserAction.GoEast, + ConsoleKey.RightArrow => UserAction.GoEast, + ConsoleKey.Q => UserAction.Quit, + _ => null, + }; + } + } + }; + + while (LabDefs.SLevels.Length > _game.level) + { + var action = _game.Run(); + if (action == UserAction.Quit) + { + break; + } + } + + _game.Cleanup(); } else { _logger?.LogError("Console service is not available."); } + return 0; } public void Initialize(IEnvironment env) From 584ef2a1920d13dee21ff6b28763a28ce86ef2b3 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 20:21:26 +0100 Subject: [PATCH 05/71] Games --- CSharpBible/Games/Directory.Packages.props | 1 - 1 file changed, 1 deletion(-) diff --git a/CSharpBible/Games/Directory.Packages.props b/CSharpBible/Games/Directory.Packages.props index eb83fa4d5..97d7b7148 100644 --- a/CSharpBible/Games/Directory.Packages.props +++ b/CSharpBible/Games/Directory.Packages.props @@ -2,6 +2,5 @@ - From b8ca765693f2bf2a8a63440c4694b3b387721ef7 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 20:57:29 +0100 Subject: [PATCH 06/71] Refactor CSharpBible CI workflow for .NET 8.0 --- .github/workflows/CSharpBible.yml | 126 ++++++------------------------ 1 file changed, 22 insertions(+), 104 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index a601fb628..6e9ed89f8 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -1,115 +1,33 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow will build, test, sign and package a WPF or Windows Forms desktop application -# built on .NET Core. -# To learn how to migrate your existing application to .NET Core, -# refer to https://docs.microsoft.com/en-us/dotnet/desktop-wpf/migration/convert-project-from-net-framework -# -# To configure this workflow: -# -# 1. Configure environment variables -# GitHub sets default environment variables for every workflow run. -# Replace the variables relative to your project in the "env" section below. -# -# 2. Signing -# Generate a signing certificate in the Windows Application -# Packaging Project or add an existing signing certificate to the project. -# Next, use PowerShell to encode the .pfx file using Base64 encoding -# by running the following Powershell script to generate the output string: -# -# $pfx_cert = Get-Content '.\SigningCertificate.pfx' -Encoding Byte -# [System.Convert]::ToBase64String($pfx_cert) | Out-File 'SigningCertificate_Encoded.txt' -# -# Open the output file, SigningCertificate_Encoded.txt, and copy the -# string inside. Then, add the string to the repo as a GitHub secret -# and name it "Base64_Encoded_Pfx." -# For more information on how to configure your signing certificate for -# this workflow, refer to https://github.com/microsoft/github-actions-for-desktop-apps#signing -# -# Finally, add the signing certificate password to the repo as a secret and name it "Pfx_Key". -# See "Build the Windows Application Packaging project" below to see how the secret is used. -# -# For more information on GitHub Actions, refer to https://github.com/features/actions -# For a complete CI/CD sample to get started with GitHub Action workflows for Desktop Applications, -# refer to https://github.com/microsoft/github-actions-for-desktop-apps - -name: .NET Core Desktop +name: CSharpBible CI on: push: - branches: [ "master" ] + paths: + - "CSharpBible/**" pull_request: - branches: [ "master" ] + paths: + - "CSharpBible/**" jobs: - - build: - - strategy: - matrix: - configuration: [Debug, Release] - - runs-on: windows-latest # For a list of available runner types, refer to - # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on - - env: - Solution_Name: CSharpBible.sln # Replace with your solution name, i.e. MyWpfApp.sln. - Test_Project_Path: Tests\Test.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj. - Wap_Project_Directory: CSharpBible # Replace with the Wap project directory relative to the solution, i.e. MyWpfApp.Package. - Wap_Project_Path: CSharpBible # Replace with the path to your Wap project, i.e. MyWpf.App.Package\MyWpfApp.Package.wapproj. - + build-test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: CSharpBible steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - # Install the .NET Core workload - - name: Install .NET Core - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 6.0.x - - # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild - - name: Setup MSBuild.exe - uses: microsoft/setup-msbuild@v1.0.2 - - # Execute all unit tests in the solution - - name: Execute unit tests - run: dotnet test - - # Restore the application to populate the obj folder with RuntimeIdentifiers - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration - env: - Configuration: ${{ matrix.configuration }} + - name: Checkout + uses: actions/checkout@v4 - # Decode the base 64 encoded pfx and save the Signing_Certificate - - name: Decode the pfx - run: | - $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") - $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx - [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" - # Create the app package by building and packaging the Windows Application Packaging project - - name: Create the app package - run: msbuild $env:Wap_Project_Path /p:Configuration=$env:Configuration /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} - env: - Appx_Bundle: Always - Appx_Bundle_Platforms: x86|x64 - Appx_Package_Build_Mode: StoreUpload - Configuration: ${{ matrix.configuration }} + - name: Restore + run: dotnet restore CSharpBible.sln - # Remove the pfx - - name: Remove the pfx - run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx + - name: Build + run: dotnet build CSharpBible.sln --configuration Release --no-restore - # Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: MSIX Package - path: ${{ env.Wap_Project_Directory }}\AppPackages + - name: Test + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal From d8ffe21a78087c0297191a9abc17d8a466491876 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:10:09 +0100 Subject: [PATCH 07/71] Update CSharpBible.yml --- .github/workflows/CSharpBible.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 6e9ed89f8..63872c7ea 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -27,7 +27,7 @@ jobs: run: dotnet restore CSharpBible.sln - name: Build - run: dotnet build CSharpBible.sln --configuration Release --no-restore + run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 - name: Test - run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 From 514dd07cbd06c6e7d3342aa0a7fe316e8ef70833 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:43:47 +0100 Subject: [PATCH 08/71] Update CSharpBible.yml --- .github/workflows/CSharpBible.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 63872c7ea..f21e96634 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -23,6 +23,17 @@ jobs: with: dotnet-version: "8.0.x" + - name: Remove private projects + run: + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/MauiApp1/MauiApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFktTests/AGVFktTests.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFkt/AGVFkt.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/DB/ADO_Test/ADO_Test.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" + - name: Restore run: dotnet restore CSharpBible.sln From 214587a0f84ef996dd4b2626b6b6505a4ae2089c Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:51:46 +0100 Subject: [PATCH 09/71] Update CSharpBible.yml --- .github/workflows/CSharpBible.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index f21e96634..cdbd4ef57 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -24,7 +24,7 @@ jobs: dotnet-version: "8.0.x" - name: Remove private projects - run: + run: | dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/MauiApp1/MauiApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFktTests/AGVFktTests.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFkt/AGVFkt.csproj" From 3fc19c26de3c6bc252143b0e61b069860955b832 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:02:02 +0100 Subject: [PATCH 10/71] Rename CI workflow to CSharpBible CI2 --- .github/workflows/CSharpBible.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index cdbd4ef57..78deed05a 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -1,4 +1,4 @@ -name: CSharpBible CI +name: CSharpBible CI2 on: push: From 73af31d442f16aa373673efeb2df034999b39588 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:05:28 +0100 Subject: [PATCH 11/71] SharpHack.Server --- .../SharpHack.Engine/SharpHack.Engine.csproj | 28 ++++++++++++------- .../SharpHack.LevelGen.csproj | 28 ++++++++++++------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj b/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj index 3447ad059..f93dd707d 100644 --- a/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj +++ b/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj @@ -1,16 +1,24 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - - - - - + + + + + diff --git a/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj b/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj index 585be23d6..fafa634a7 100644 --- a/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj +++ b/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj @@ -1,16 +1,24 @@ - + + + + Library + net462;net472;net48;net481;net6.0;net7.0;net8.0 + + + - - net10.0 - enable - enable + + $(TargetFrameworks);net9.0 + + + $(TargetFrameworks);net10.0 - - - - - + + + + + From 982f8b476a826ea9009fd8fba4d9a8c486e9cd0a Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:19:51 +0100 Subject: [PATCH 12/71] . --- CSharpBible/ReadMe.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index 2f5e0ff39..f01c6af4b 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,3 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Fri, 23 Jan 2026 22:23:07 +0100 Subject: [PATCH 13/71] Remove multiple projects from CSharpBible solution --- .github/workflows/CSharpBible.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 78deed05a..b68de786b 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -32,8 +32,14 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" - + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Shared/MyComponent.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/WinUI/App1/App1/App1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/App2/App2.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/PackageDwnLd.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/BlazorApp1/BlazorApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/BlazorApp2/BlazorApp2.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" + - name: Restore run: dotnet restore CSharpBible.sln From 3b52a81a34f993f7196d65a6ea0aca963c62dd58 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 21:44:46 +0100 Subject: [PATCH 14/71] Common --- CSharpBible/CSharpBible.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/CSharpBible.sln b/CSharpBible/CSharpBible.sln index 2eaf51596..7b314ff76 100644 --- a/CSharpBible/CSharpBible.sln +++ b/CSharpBible/CSharpBible.sln @@ -427,7 +427,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_00_TemplateTests", "MV EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_06_Converters_4_net", "MVVM_Tutorial\MVVM_06_Converters_4\MVVM_06_Converters_4_net.csproj", "{70AD3FCB-F529-4E08-BE39-E56C940EA114}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_16_Usercontrol1_net", "MVVM_Tutorial\MVVM_16_Usercontrol1\MVVM_16_Usercontrol1_net.csproj", "{CDC8B1F7-3C94-4686-9EE0-6841231E6144}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_16_Usercontrol1_net", "MVVM_Tutorial\MVVM_16_Usercontrol1\MVVM_16_UserControl1_net.csproj", "{CDC8B1F7-3C94-4686-9EE0-6841231E6144}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Simulation", "Simulation", "{0DF8EC71-8008-41CF-9A87-946604FBD24D}" ProjectSection(SolutionItems) = preProject From 266d05edb5b4057c794cfcd5058b58a573c6edf4 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:17:12 +0100 Subject: [PATCH 15/71] Games --- CSharpBible/Games/Directory.Packages.props | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CSharpBible/Games/Directory.Packages.props b/CSharpBible/Games/Directory.Packages.props index 97d7b7148..56c7ac5db 100644 --- a/CSharpBible/Games/Directory.Packages.props +++ b/CSharpBible/Games/Directory.Packages.props @@ -1,6 +1,9 @@ - + - + + + + \ No newline at end of file From 16db2c4ba73a55cab209197aa9c52b3ed2f09657 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:17:39 +0100 Subject: [PATCH 16/71] Update CSharpBible CI to version 3 and clean up projects Updated CI workflow to version 3 and removed additional projects from the solution. --- .github/workflows/CSharpBible.yml | 35 ++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 78deed05a..12e3dedd3 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -1,4 +1,4 @@ -name: CSharpBible CI2 +name: CSharpBible CI3 on: push: @@ -25,15 +25,30 @@ jobs: - name: Remove private projects run: | - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/MauiApp1/MauiApp1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFktTests/AGVFktTests.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFkt/AGVFkt.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/DB/ADO_Test/ADO_Test.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" - + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/MauiApp1/MauiApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFktTests/AGVFktTests.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFkt/AGVFkt.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/DB/ADO_Test/ADO_Test.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Shared/MyComponent.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/WinUI/App1/App1/App1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/App2/App2.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/PackageDwnLd.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/BlazorApp1/BlazorApp1.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/BlazorApp2/BlazorApp2.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" + + - name: Check for missing projects + run: | + for project in $(cat CSharpBible.sln | grep .csproj | awk -F\" '{print $4}'); do + if [ ! -f "$project" ]; then + echo "Missing $project" + exit 1 + fi + done + - name: Restore run: dotnet restore CSharpBible.sln From 90b5733725ef65487191934c157a49d4c8498246 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:20:06 +0100 Subject: [PATCH 17/71] . --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9c1706033..0b4b38c24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs +.gitignore bin obj *.db @@ -24,7 +25,7 @@ obj /CSharpBible/Libraries/CSFreeVision_ /CSharpBible/Libraries/MathLibraryTests/TestResults /CSharpBible/Graphics/PermutationTests/TestResults -/CSharpBible/MVVM_Tutorial/UWP_00_Test +/CSharpBible/MVVM_Tutorial /CSharpBible/WinUI/App1 /TestStatements/Help /CSharpBible/Games/SharpHack.Wpf/tiles.png From e95e17869767be2e0d600ffcbcf4b1266bc86ce2 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:37:57 +0100 Subject: [PATCH 18/71] Update CSharpBible.yml --- .github/workflows/CSharpBible.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 12e3dedd3..b834aa430 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -39,15 +39,6 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/BlazorApp1/BlazorApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/BlazorApp2/BlazorApp2.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" - - - name: Check for missing projects - run: | - for project in $(cat CSharpBible.sln | grep .csproj | awk -F\" '{print $4}'); do - if [ ! -f "$project" ]; then - echo "Missing $project" - exit 1 - fi - done - name: Restore run: dotnet restore CSharpBible.sln From 9d5371455e6103957d6b1f629f6bf7e100f05da8 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:54:18 +0100 Subject: [PATCH 19/71] Update CSharpBible.yml --- .github/workflows/CSharpBible.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index dbddb3084..a7a6bef50 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -32,7 +32,7 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Server.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Shared/MyComponent.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/WinUI/App1/App1/App1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/App2/App2.csproj" From cbb35b8a2a422ebc121ae12aeb76d3fa68ae6f4b Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 22:31:03 +0100 Subject: [PATCH 20/71] . --- CSharpBible/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index f01c6af4b..cce927a1e 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,4 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Fri, 23 Jan 2026 23:37:46 +0100 Subject: [PATCH 21/71] Update CSharpBible.yml to remove project references Removed a project reference and a check for missing projects from the CSharpBible workflow. --- .github/workflows/CSharpBible.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index c512d0c06..8bc246b0f 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -32,7 +32,7 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Server.csproj" + dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Shared/MyComponent.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/WinUI/App1/App1/App1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/App2/App2.csproj" @@ -40,15 +40,6 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/BlazorApp1/BlazorApp1.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/BlazorApp2/BlazorApp2.csproj" dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" - - - name: Check for missing projects - run: | - for project in $(cat CSharpBible.sln | grep .csproj | awk -F\" '{print $4}'); do - if [ ! -f "$project" ]; then - echo "Missing $project" - exit 1 - fi - done - name: Restore run: dotnet restore CSharpBible.sln From 83bf4f3cacc2ab3c239bb3286889f005b3a95b26 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 23:45:45 +0100 Subject: [PATCH 22/71] Update dotnet restore command with new parameters --- .github/workflows/CSharpBible.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 8bc246b0f..9f01d629a 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -42,7 +42,7 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" - name: Restore - run: dotnet restore CSharpBible.sln + run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Build run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 From e0e5bfc96a5398c33f2b3ed03e4a660a628f1e7d Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 23:46:54 +0100 Subject: [PATCH 23/71] Update ReadMe.md with new content --- CSharpBible/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index cce927a1e..6d2f966f4 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,4 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Fri, 23 Jan 2026 23:54:48 +0100 Subject: [PATCH 24/71] Update CSharpBible.yml to enable Windows targeting Added EnableWindowsTargeting property to build and test commands. --- .github/workflows/CSharpBible.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 9f01d629a..ed847782a 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -45,7 +45,7 @@ jobs: run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Build - run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 + run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Test - run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true From b5512e0c253cfc1863e68e4c9147776d0c930f4f Mon Sep 17 00:00:00 2001 From: Joe Care Date: Fri, 23 Jan 2026 23:55:14 +0100 Subject: [PATCH 25/71] Update ReadMe.md with new content --- CSharpBible/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index 6d2f966f4..9e4dad44c 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,4 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Sat, 24 Jan 2026 18:10:44 +0100 Subject: [PATCH 26/71] Add CI workflow for TestStatemens directory --- .github/workflows/Teststatements.yml | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/Teststatements.yml diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml new file mode 100644 index 000000000..29f209039 --- /dev/null +++ b/.github/workflows/Teststatements.yml @@ -0,0 +1,36 @@ +name: TestStatemens CI0 + +on: + push: + paths: + - "TestStatemens/**" + pull_request: + paths: + - "TestStatemens/**" + +jobs: + build-test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: TestStatemens + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + - name: Remove private projects + run: | + + - name: Restore + run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + + - name: Build + run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + + - name: Test + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true From 9786805b84347d3814d00215c7d1881f003e2bdc Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:12:18 +0100 Subject: [PATCH 27/71] Update workflow to use TestStatemens.sln --- .github/workflows/Teststatements.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index 29f209039..5b035dd47 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -27,10 +27,10 @@ jobs: run: | - name: Restore - run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet restore TestStatemens.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Build - run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet build TestStatemens.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Test - run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet test TestStatemens.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true From 35a5a4d95ee93e7583d83c678d142801dd9a2d6d Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:12:55 +0100 Subject: [PATCH 28/71] Fix formatting in ReadMe.md --- TestStatements/ReadMe.md | 81 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/TestStatements/ReadMe.md b/TestStatements/ReadMe.md index 38d2311c1..c9ab1510a 100644 --- a/TestStatements/ReadMe.md +++ b/TestStatements/ReadMe.md @@ -1,7 +1,7 @@ # TestStatements inspired by [MS Walktroughs] -## (DE) berblick +## (DE) Überblick Dies ist eine Sammlung von Beispielprojekten rund um C#, Sprachelemente, .NET-Laufzeiten, Desktop (WinForms/WPF), Reflection, Generics, Plugins, dynamisches Laden, asynchrone Programmierung, Geometrie/Algorithmik und Spezialthemen wie Unicode & GPU-Rechnen. --- @@ -11,7 +11,7 @@ Dies ist eine Sammlung von Beispielprojekten rund um C#, Sprachelemente, .NET-La Dies ist das **Hauptprojekt** mit den meisten Beispielen. #### [Anweisungen](TestStatements/Anweisungen) -Beispiele fr verschiedene Sprach-/System-Anweisungen: +Beispiele für verschiedene Sprach-/System-Anweisungen: - Checking - Conditional statements (If ...) - Declarations @@ -26,13 +26,13 @@ Beispiele f - Yield statement #### [CS-Concepts](TestStatements/CS_Concepts) -Beispiele fr das C#-Typsystem. +Beispiele für das C#-Typsystem. #### [Classes and objects](TestStatements/ClassesAndObjects) -Beispiele fr Interfaces & Klassen-Member. +Beispiele für Interfaces & Klassen-Member. #### [Collection/Generic](TestStatements/Collection/Generic) -Beispiele fr den Namensraum `System.Collections.Generic`: +Beispiele für den Namensraum `System.Collections.Generic`: - Comparer - Dictionary - SortedList @@ -42,7 +42,7 @@ Beispiele f Konstanten vs. readonly-Felder/Eigenschaften. #### [DataTypes](TestStatements/DataTypes) -Beispiele fr Datentypen: +Beispiele für Datentypen: - Enum - String & Formatting - Integrierte Typen @@ -69,22 +69,22 @@ Beispiele f Beispiele rund um `System` & XML. #### [Threading/Tasks](TestStatements/Threading/Tasks) -Frhstcks-/Async-Beispiele. +Frühstücks-/Async-Beispiele. --- ## (DE) Weitere Projekte (Kurz) -- TestStatementTests Tests fr TestStatements. -- CallAllExamples Starter fr alle Beispiele. -- ctlClockLib / TestClockApp WinForms Uhr-/Alarm-Controls & Host-App. -- TestNamespaces Namespace-Experimente. -- AsyncExampleWPF Async in WPF (Full Framework). -- Tutorials Kuratierte Schritt-fr-Schritt Beispiele. -- PluginBase / AppWithPlugin / AppWithPluginWpf / HelloPlugin / OtherPlugin Plugin-Architektur & Demonstrationen. -- DynamicSample Dynamik & Reflection (getrennt fr .NET Framework & moderne .NET). -- TestStatementsNew Moderne WPF-Variante der Beispiel-Sammlung. -- TestGJKAlg / TestGJKAlgTest Geometrischer Algorithmus (GJK) + Tests. -- ZeroLengthChar Unicode / Zero-width Zeichen. -- SOq1 ILGPU / GPU-Rechnen Beispiel. +- TestStatementTests – Tests für TestStatements. +- CallAllExamples – Starter für alle Beispiele. +- ctlClockLib / TestClockApp – WinForms Uhr-/Alarm-Controls & Host-App. +- TestNamespaces – Namespace-Experimente. +- AsyncExampleWPF – Async in WPF (Full Framework). +- Tutorials – Kuratierte Schritt-für-Schritt Beispiele. +- PluginBase / AppWithPlugin / AppWithPluginWpf / HelloPlugin / OtherPlugin – Plugin-Architektur & Demonstrationen. +- DynamicSample – Dynamik & Reflection (getrennt für .NET Framework & moderne .NET). +- TestStatementsNew – Moderne WPF-Variante der Beispiel-Sammlung. +- TestGJKAlg / TestGJKAlgTest – Geometrischer Algorithmus (GJK) + Tests. +- ZeroLengthChar – Unicode / Zero-width Zeichen. +- SOq1 – ILGPU / GPU-Rechnen Beispiel. --- # (EN) TestStatements Suite @@ -119,15 +119,15 @@ Coverage highlights: - Dependency Injection / Hosting (Extensions.* packages in modern variant) Folder mapping (representative): -- `Anweisungen` (Statements) language statements & control constructs -- `CS_Concepts` type system exploration -- `ClassesAndObjects` members, interfaces, nested types -- `Collection/Generic` generic collections & algorithms -- `DataTypes` primitives, formatting, Unicode handling -- `Threading/Tasks` task orchestration examples -- `Reflection` runtime inspection -- `Runtime/Loader` dynamic compile & load -- `SystemNS` system namespace & XML demos +- `Anweisungen` (Statements) – language statements & control constructs +- `CS_Concepts` – type system exploration +- `ClassesAndObjects` – members, interfaces, nested types +- `Collection/Generic` – generic collections & algorithms +- `DataTypes` – primitives, formatting, Unicode handling +- `Threading/Tasks` – task orchestration examples +- `Reflection` – runtime inspection +- `Runtime/Loader` – dynamic compile & load +- `SystemNS` – system namespace & XML demos ### Assembly Versioning Modern variant pins `AssemblyVersion` to a static semantic (+ illustrative build number). Classic variant mirrors for parity. @@ -151,11 +151,11 @@ A curated linear path distinct from the broad, exploratory catalog. Focuses on c --- ## 6. Plugin Architecture Projects: -- `PluginBase` shared contracts & MVVM helpers (CommunityToolkit.Mvvm) +- `PluginBase` – shared contracts & MVVM helpers (CommunityToolkit.Mvvm) - `AppWithPlugin` (console host) - `AppWithPluginWpf` (WPF host) -- `HelloPlugin`, `OtherPlugin` plugin implementations (localized resources, dynamic loading enabled) -- `AppWithPluginTest`, `HelloPluginTest` contract & behavior verification with MSTest + NSubstitute +- `HelloPlugin`, `OtherPlugin` – plugin implementations (localized resources, dynamic loading enabled) +- `AppWithPluginTest`, `HelloPluginTest` – contract & behavior verification with MSTest + NSubstitute Features: - Dynamic assembly discovery (content-copied plugin DLLs + satellite resource assemblies) @@ -170,21 +170,21 @@ Extension ideas: --- ## 7. Desktop UI Samples -- `ctlClockLib` reusable WinForms clock/alarm UserControls -- `TestClockApp` host application embedding the controls -- `AsyncExampleWPF` async responsiveness patterns in WPF (legacy frameworks) -- `AppWithPluginWpf` plugin-enabled GUI host +- `ctlClockLib` – reusable WinForms clock/alarm UserControls +- `TestClockApp` – host application embedding the controls +- `AsyncExampleWPF` – async responsiveness patterns in WPF (legacy frameworks) +- `AppWithPluginWpf` – plugin-enabled GUI host --- ## 8. Specialized Domains -- `TestGJKAlg` & `TestGJKAlgTest` GJK collision detection visualization + algorithm tests -- `SOq1` ILGPU sample (GPU kernel & accelerator usage) -- `ZeroLengthChar` Unicode / zero-width character exploration +- `TestGJKAlg` & `TestGJKAlgTest` – GJK collision detection visualization + algorithm tests +- `SOq1` – ILGPU sample (GPU kernel & accelerator usage) +- `ZeroLengthChar` – Unicode / zero-width character exploration --- ## 9. Testing Infrastructure Multi-target test suites ensure cross-runtime consistency: -- `TestStatements_netTest` (net6net9) +- `TestStatements_netTest` (net6–net9) - `TestStatementsTest` (full framework set) - Plugin & geometry focused test projects @@ -225,7 +225,7 @@ Purpose: --- ## Plugin Demo Usage 1. Build `PluginBase`, `HelloPlugin`, `OtherPlugin`, and host (`AppWithPlugin` or `AppWithPluginWpf`). -2. Run host it probes the `PlugIns` directory (content items copied during build). +2. Run host – it probes the `PlugIns` directory (content items copied during build). 3. Observe loaded plugin list & invoked behaviors. Optional enhancements: add command-line filtering or interactive reload. @@ -259,3 +259,4 @@ Original German section retained for native reference; English expansion supplie --- Happy exploring! ?? +. From e1affdfdf3f9f3362c6a4656e50daf8e832a73dc Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:14:39 +0100 Subject: [PATCH 29/71] Fix typo in workflow paths for TestStatements --- .github/workflows/Teststatements.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index 5b035dd47..0abae740a 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -3,10 +3,10 @@ name: TestStatemens CI0 on: push: paths: - - "TestStatemens/**" + - "TestStatements/**" pull_request: paths: - - "TestStatemens/**" + - "TestStatements/**" jobs: build-test: From 1ee969c02c37c5aaa86eb7ba0aa97a301ece10dd Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:15:43 +0100 Subject: [PATCH 30/71] Fix directory and solution name typos in workflow --- .github/workflows/Teststatements.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index 0abae740a..ca75f3677 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest defaults: run: - working-directory: TestStatemens + working-directory: TestStatements steps: - name: Checkout uses: actions/checkout@v4 @@ -27,10 +27,10 @@ jobs: run: | - name: Restore - run: dotnet restore TestStatemens.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Build - run: dotnet build TestStatemens.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet build TestStatements.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - name: Test - run: dotnet test TestStatemens.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet test TestStatements.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true From bf22ec085c3978675b67df2863a17bded708466c Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:17:16 +0100 Subject: [PATCH 31/71] Fix formatting in ReadMe.md --- TestStatements/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestStatements/ReadMe.md b/TestStatements/ReadMe.md index c9ab1510a..a063e602e 100644 --- a/TestStatements/ReadMe.md +++ b/TestStatements/ReadMe.md @@ -259,4 +259,4 @@ Original German section retained for native reference; English expansion supplie --- Happy exploring! ?? -. + From 9d46f24ad97835c078378d5ff42d264d372aac6c Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:24:13 +0100 Subject: [PATCH 32/71] Change runner from Ubuntu to Windows for tests --- .github/workflows/Teststatements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index ca75f3677..fbae52b2f 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -10,7 +10,7 @@ on: jobs: build-test: - runs-on: ubuntu-latest + runs-on: windows-latest defaults: run: working-directory: TestStatements From 12252a408700b20cd1ac507f9871edc917099a81 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:24:41 +0100 Subject: [PATCH 33/71] Fix formatting in ReadMe.md --- TestStatements/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestStatements/ReadMe.md b/TestStatements/ReadMe.md index a063e602e..c9ab1510a 100644 --- a/TestStatements/ReadMe.md +++ b/TestStatements/ReadMe.md @@ -259,4 +259,4 @@ Original German section retained for native reference; English expansion supplie --- Happy exploring! ?? - +. From 8f77a03527bd817aa0fa7b44a78543d152080663 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:28:31 +0100 Subject: [PATCH 34/71] Update .NET restore, build, and test commands --- .github/workflows/Teststatements.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index fbae52b2f..33391e296 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -27,10 +27,9 @@ jobs: run: | - name: Restore - run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0 - name: Build - run: dotnet build TestStatements.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true - + run: dotnet build TestStatements.sln --configuration Release --no-restore -p:TargetFramework=net8.0-windows - name: Test - run: dotnet test TestStatements.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet test TestStatements.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0-windows From 8b5d85a899225577905d57b5729fe448af793b9f Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:29:09 +0100 Subject: [PATCH 35/71] Fix formatting in ReadMe.md --- TestStatements/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestStatements/ReadMe.md b/TestStatements/ReadMe.md index c9ab1510a..a063e602e 100644 --- a/TestStatements/ReadMe.md +++ b/TestStatements/ReadMe.md @@ -259,4 +259,4 @@ Original German section retained for native reference; English expansion supplie --- Happy exploring! ?? -. + From 9edc992039b0ca750987fb4a6cbab72bfe1cec21 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:31:36 +0100 Subject: [PATCH 36/71] Update target framework for dotnet restore command --- .github/workflows/Teststatements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml index 33391e296..ec5a8018d 100644 --- a/.github/workflows/Teststatements.yml +++ b/.github/workflows/Teststatements.yml @@ -27,7 +27,7 @@ jobs: run: | - name: Restore - run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0 + run: dotnet restore TestStatements.sln -p:TargetFramework=net8.0-windows - name: Build run: dotnet build TestStatements.sln --configuration Release --no-restore -p:TargetFramework=net8.0-windows From 7f6c9358cb81d27ddcc28b25bbcbe3a274644e84 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:33:20 +0100 Subject: [PATCH 37/71] Change CI runner to Windows and update target framework --- .github/workflows/CSharpBible.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index ed847782a..9cb1b997c 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -10,7 +10,7 @@ on: jobs: build-test: - runs-on: ubuntu-latest + runs-on: windows-latest defaults: run: working-directory: CSharpBible @@ -42,10 +42,10 @@ jobs: dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" - name: Restore - run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0-windows - name: Build - run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet build CSharpBible.sln --configuration Release --no-restore -p:TargetFramework=net8.0-windows - name: Test - run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0 -p:EnableWindowsTargeting=true + run: dotnet test CSharpBible.sln --configuration Release --no-build --verbosity normal -p:TargetFramework=net8.0-windows From 33d95577fdde18ff0e064914d42ef53142f33ce2 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:34:02 +0100 Subject: [PATCH 38/71] Update ReadMe.md with new content --- CSharpBible/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index 9e4dad44c..c59a83292 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,4 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Sat, 24 Jan 2026 18:38:05 +0100 Subject: [PATCH 39/71] Simplify project removal commands in workflow --- .github/workflows/CSharpBible.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml index 9cb1b997c..80e82e2a4 100644 --- a/.github/workflows/CSharpBible.yml +++ b/.github/workflows/CSharpBible.yml @@ -25,21 +25,21 @@ jobs: - name: Remove private projects run: | - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/MauiApp1/MauiApp1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFktTests/AGVFktTests.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Simulation/AGVFkt/AGVFkt.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/DB/ADO_Test/ADO_Test.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Libraries/CSFreeVision_/CSFreeVision.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Mobile/DXMauiApp1/DXMauiApp1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Client/MyComponent.Client.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Server/MyComponent.Server.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/MyComponent/Shared/MyComponent.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/WinUI/App1/App1/App1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/App2/App2.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/PackageDwnLd.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/BlazorApp1/BlazorApp1.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/BlazorApp2/BlazorApp2.csproj" - dotnet sln CSharpBible.sln remove "/home/runner/work/CSharp/CSharp/CSharpBible/Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" + dotnet sln CSharpBible.sln remove "Mobile/MauiApp1/MauiApp1.csproj" + dotnet sln CSharpBible.sln remove "Simulation/AGVFktTests/AGVFktTests.csproj" + dotnet sln CSharpBible.sln remove "Simulation/AGVFkt/AGVFkt.csproj" + dotnet sln CSharpBible.sln remove "DB/ADO_Test/ADO_Test.csproj" + dotnet sln CSharpBible.sln remove "Libraries/CSFreeVision_/CSFreeVision.csproj" + dotnet sln CSharpBible.sln remove "Mobile/DXMauiApp1/DXMauiApp1.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Client/MyComponent.Client.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Server/MyComponent.Server.csproj" + dotnet sln CSharpBible.sln remove "Web/MyComponent/Shared/MyComponent.csproj" + dotnet sln CSharpBible.sln remove "WinUI/App1/App1/App1.csproj" + dotnet sln CSharpBible.sln remove "App2/App2.csproj" + dotnet sln CSharpBible.sln remove "../PackageDwnLd.csproj" + dotnet sln CSharpBible.sln remove "Web/BlazorApp1/BlazorApp1.csproj" + dotnet sln CSharpBible.sln remove "Web/WebApp1/BlazorApp2/BlazorApp2.csproj" + dotnet sln CSharpBible.sln remove "Web/WebApp1/WebApplication1/WebApplication1/WebApplication1.csproj" - name: Restore run: dotnet restore CSharpBible.sln -p:TargetFramework=net8.0-windows From 8e8be62e0db94c997a49bef14b09a8869fd99dcf Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sat, 24 Jan 2026 18:38:30 +0100 Subject: [PATCH 40/71] Update ReadMe.md with new content --- CSharpBible/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CSharpBible/ReadMe.md b/CSharpBible/ReadMe.md index c59a83292..d8386ded3 100644 --- a/CSharpBible/ReadMe.md +++ b/CSharpBible/ReadMe.md @@ -39,4 +39,4 @@ w++]=i;}if(w!=0){var i=Il[r.Next(w)]&3;P=lQ[i]+A;E[A]=a|(O<=h)P=ll[h++];}Q(D-2);for(A=O;A>O);Q(D+ O);for(A=O;A Date: Sun, 25 Jan 2026 00:08:09 +0100 Subject: [PATCH 41/71] Sokoban.Plugin --- .../ViewModels/BoxFlightViewModel.cs | 4 +- .../Games/BoxFlight/World/GameWorld.cs | 45 ++++--- .../Properties/Resources.Designer.cs | 9 ++ .../Properties/Resources.de.resx | 4 + .../Properties/Resources.en.resx | 4 + .../Properties/Resources.fr.resx | 4 + .../Sokoban.Plugin/Properties/Resources.resx | 4 + .../Werner_Flaschbier.Console2/Program.cs | 56 +++++++++ .../View/IVisual.cs | 19 +++ .../View/VTileDef.cs | 106 +++++++++++++++++ .../Werner_Flaschbier.Console2/View/Visual.cs | 110 ++++++++++++++++++ .../Werner_Flaschbier.Console2.csproj | 30 +++++ .../Werner_Flaschbier/Model/WernerGame.cs | 6 +- .../ConsoleDisplay/View/TileDisplay.cs | 8 +- 14 files changed, 391 insertions(+), 18 deletions(-) create mode 100644 CSharpBible/Games/Werner_Flaschbier.Console2/Program.cs create mode 100644 CSharpBible/Games/Werner_Flaschbier.Console2/View/IVisual.cs create mode 100644 CSharpBible/Games/Werner_Flaschbier.Console2/View/VTileDef.cs create mode 100644 CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs create mode 100644 CSharpBible/Games/Werner_Flaschbier.Console2/Werner_Flaschbier.Console2.csproj diff --git a/CSharpBible/Games/BoxFlight/ViewModels/BoxFlightViewModel.cs b/CSharpBible/Games/BoxFlight/ViewModels/BoxFlightViewModel.cs index c729f0bac..68b81a521 100644 --- a/CSharpBible/Games/BoxFlight/ViewModels/BoxFlightViewModel.cs +++ b/CSharpBible/Games/BoxFlight/ViewModels/BoxFlightViewModel.cs @@ -36,7 +36,7 @@ public BoxFlightViewModel(IGameWorld world) { _world = world; - int width = 640, height = 360; + int width = 1280, height = 720; Frame = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgra32, null); MiniMap = new WriteableBitmap(400, 400, 96, 96, PixelFormats.Bgra32, null); _render = new RenderEntry[width]; @@ -128,7 +128,7 @@ private void DrawRenderEntries(int bd2) for (int x = 0; x < _render.Length; x++) { var re = _render[x]; - if (re.Height > re.Shad / 2) + if (re.Shad !=0 && re.Height > re.Shad / 2) DrawVLine(buffer, stride, x, bd2 + re.Shad, bd2 + re.Shad / 2, Colors.Black); int c1 = Math.Clamp(re.Light, 0, 255); diff --git a/CSharpBible/Games/BoxFlight/World/GameWorld.cs b/CSharpBible/Games/BoxFlight/World/GameWorld.cs index d93f45ce2..9b352a558 100644 --- a/CSharpBible/Games/BoxFlight/World/GameWorld.cs +++ b/CSharpBible/Games/BoxFlight/World/GameWorld.cs @@ -71,17 +71,15 @@ public void Step(int time, bool stereo, int scrollOffset, int focusX, int maxHei var lCv2 = new Vector(lCv1.Y, -lCv1.X); _cMove = _cPoint - cMoveOld; + _cPoint.X -= Math.Truncate(_cPoint.X / 400.0) * 400.0; _cPoint.Y -= Math.Truncate(_cPoint.Y / 400.0) * 400.0; - var sPnt = _cPoint; - if (stereo) { _cPoint.X += _cView.Y * 0.4; _cPoint.Y += -_cView.X * 0.4; } - else { _cPoint.X += -_cView.Y * 0.4; _cPoint.Y += _cView.X * 0.4; } - sPnt.X += _cView.X; sPnt.Y += _cView.Y; foreach (var o in Objects) { - o.Visible = false; o.Hit = false; + o.Visible = false; + o.Hit = false; if (o.Size <= 0) continue; var vp = new Vector(o.Pos.X, o.Pos.Y) + (Vector)_cPoint + new Vector(400, 400); vp -= new Vector(Math.Floor(vp.X / 400.0) * 400.0, Math.Floor(vp.Y / 400.0) * 400.0); @@ -95,20 +93,38 @@ public void Step(int time, bool stereo, int scrollOffset, int focusX, int maxHei o.Visible = vis; } + int half = render.Length / 2; int hrc2 = half / 2; int obj = -1; - for (int j = 0; j < render.Length; j++) + Parallel.For (0,render.Length, (j)=> { + var sPnt = _cPoint; double s, c; - if (j <= half) { s = Math.Sin((hrc2 - j) * 0.6 / hrc2); c = Math.Cos((hrc2 - j) * 0.6 / hrc2); } - else { s = Math.Sin((-j + hrc2 * 3) * 0.6 / hrc2); c = Math.Cos((-j + hrc2 * 3) * 0.6 / hrc2); } + if (stereo) + if (j <= half) + { + sPnt.X -= _cView.Y * 0.4; + sPnt.Y += _cView.X * 0.4; + s = Math.Sin((hrc2 - j) * 0.6 / hrc2); + c = Math.Cos((hrc2 - j) * 0.6 / hrc2); + } + else + { + sPnt.X += _cView.Y * 0.4; + sPnt.Y -= _cView.X * 0.4; + s = Math.Sin((-j + hrc2 * 3) * 0.6 / hrc2); + c = Math.Cos((-j + hrc2 * 3) * 0.6 / hrc2); + } + else + { + s = Math.Sin((half - j) * 0.6 / half); + c = Math.Cos((half - j) * 0.6 / half); + } var renDir = new Vector(_cView.X * c + _cView.Y * s, -_cView.X * s + _cView.Y * c); render[j] = Trace(maxHeight, sPnt, obj, renDir, j == focusX); - } + }); - if (stereo) { _cPoint.X += -_cView.Y * 0.8; _cPoint.Y += _cView.X * 0.8; } - else { _cPoint.X += _cView.Y * 0.8; _cPoint.Y += -_cView.X * 0.8; } cPoint2 = _cPoint2; cPoint3 = _cPoint3; } @@ -118,10 +134,10 @@ private RenderEntry Trace(int maxHeight, Point sPnt, int obj, Vector renDir, boo float rDistQ, r; double rDist; double rr = 0; int hObj = obj; var entry = new RenderEntry { Oo1 = -1, Oo2 = -1, Light = 0, Height = 0, Light2 = 0, Height2 = 0, Shad = 0 }; - if (obj >= 0 && Objects[obj].HitTest(_cPoint, renDir, out rDistQ, out r) && rDistQ > 2 && rDistQ < 300) { rDist = rDistQ; rr = r; } + if (obj >= 0 && Objects[obj].HitTest(sPnt, renDir, out rDistQ, out r) && rDistQ > 2 && rDistQ < 300) { rDist = rDistQ; rr = r; } else { obj = -1; rDist = 300.0; } - ObjHit(_cPoint, renDir, -1, ref obj, ref rDist, ref rr); + ObjHit(sPnt, renDir, -1, ref obj, ref rDist, ref rr); if (obj >= 0) { var o = Objects[obj]; @@ -155,7 +171,8 @@ private RenderEntry Trace(int maxHeight, Point sPnt, int obj, Vector renDir, boo int lsobj = hObj; double shDist = 300.0; double shRr = 0.0; ObjHit(sPnt, renDir, -1, ref lsobj, ref shDist, ref shRr); - if (lsobj >= 0) entry.Shad = (int)(maxHeight / (shDist + 1.0)); else entry.Shad = 0; + // if (lsobj >= 0) entry.Shad = (int)(maxHeight / (shDist + 1.0)); else + entry.Shad = 0; return entry; } diff --git a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.Designer.cs b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.Designer.cs index 3b1c11adb..34a7ac193 100644 --- a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.Designer.cs +++ b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.Designer.cs @@ -69,6 +69,15 @@ public static string cmdDescription { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die A Sokoban game (mini) ähnelt. + /// + public static string cmdDescription2 { + get { + return ResourceManager.GetString("cmdDescription2", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die A test ! ähnelt. /// diff --git a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.de.resx b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.de.resx index 9d56166ce..14c3225ec 100644 --- a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.de.resx +++ b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.de.resx @@ -124,4 +124,8 @@ Ein Sokoban-Spiel Description of test-command + + Ein Sokoban-Spiel (Mini) + Description of test-command + \ No newline at end of file diff --git a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.en.resx b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.en.resx index 2383f1f07..a38671e7c 100644 --- a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.en.resx +++ b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.en.resx @@ -124,4 +124,8 @@ A Sokoban game Description of test-command + + A Sokoban game (mini) + Description of test-command + \ No newline at end of file diff --git a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.fr.resx b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.fr.resx index 642c2a87a..88f30fced 100644 --- a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.fr.resx +++ b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.fr.resx @@ -124,4 +124,8 @@ A Sokoban game Description of test-command + + A Sokoban game (mini) + Description of test-command + \ No newline at end of file diff --git a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.resx b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.resx index 2383f1f07..a38671e7c 100644 --- a/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.resx +++ b/CSharpBible/Games/Sokoban.Plugin/Properties/Resources.resx @@ -124,4 +124,8 @@ A Sokoban game Description of test-command + + A Sokoban game (mini) + Description of test-command + \ No newline at end of file diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/Program.cs b/CSharpBible/Games/Werner_Flaschbier.Console2/Program.cs new file mode 100644 index 000000000..719cf2566 --- /dev/null +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/Program.cs @@ -0,0 +1,56 @@ +using BaseLib.Helper; +using BaseLib.Interfaces; +using BaseLib.Models; +using ConsoleDisplay.View; +using Microsoft.Extensions.DependencyInjection; +using System.Threading; +using Werner_Flaschbier.Console2.View; +using Werner_Flaschbier_Base.Model; +using Werner_Flaschbier_Base.ViewModels; + +namespace Werner_Flaschbier.Console2; + +public class Programm +{ + private IWernerGame? game; + private IVisual? visual; + + private void OnStartUp() + { + var sc = new ServiceCollection() + .AddSingleton() + .AddTransient() + .AddSingleton() + .AddSingleton() + .AddSingleton(); + + var sp = sc.BuildServiceProvider(); + + IoC.Configure(sp); + } + + public static void Main(params string[] args) + { + var program = new Programm(); + program.Initialize(args); + program.Run(); + } + + public void Run() + { + while (game!.isRunning) + { + visual?.CheckUserAction(); + var delay = game.GameStep(); + Thread.Sleep(delay); + } + } + + public void Initialize(string[] args) + { + OnStartUp(); + + game = IoC.GetRequiredService(); + visual = IoC.GetRequiredService(); + } +} diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/View/IVisual.cs b/CSharpBible/Games/Werner_Flaschbier.Console2/View/IVisual.cs new file mode 100644 index 000000000..9248641d3 --- /dev/null +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/View/IVisual.cs @@ -0,0 +1,19 @@ +// *********************************************************************** +// Assembly : Werner_Flaschbier_Base +// Author : Mir +// Created : 08-02-2022 +// +// Last Modified By : Mir +// Last Modified On : 09-09-2022 +// *********************************************************************** +// +// Copyright (c) JC-Soft. All rights reserved. +// +// +// *********************************************************************** +namespace Werner_Flaschbier.Console2.View; + +public interface IVisual +{ + bool CheckUserAction(); +} \ No newline at end of file diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/View/VTileDef.cs b/CSharpBible/Games/Werner_Flaschbier.Console2/View/VTileDef.cs new file mode 100644 index 000000000..56f8560f7 --- /dev/null +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/View/VTileDef.cs @@ -0,0 +1,106 @@ +// *********************************************************************** +// Assembly : Werner_Flaschbier_Base +// Author : Mir +// Created : 08-02-2022 +// +// Last Modified By : Mir +// Last Modified On : 09-09-2022 +// *********************************************************************** +// +// Copyright (c) JC-Soft. All rights reserved. +// +// +// *********************************************************************** +using System; +using System.Drawing; +using ConsoleDisplay.View; + +namespace Werner_Flaschbier.Console2.View +{ + + /// + /// Class VTileDef. + /// + public class VTileDef : TileDefBase, ITileDef { + /// + /// The v tile definition string + /// + private string[][] _vTileDefStr = [ + [" ", " "], + ["=-=-", "-=-="], + ["─┴┬─", "─┬┴─"], + [" ╓╖ ", "▓░▒▓"], + ["⌐°@)", " ⌡⌡‼"], + [@"/¯¯\", @"\__/"], + ["]°°[", "_!!_"], + ["◄°@[",@"_!!\"], + ["]oo[", "_!!_"], + ["]@°►", "/!!_"], + [@"/╨╨\", @"\__/"], + [" +*∩", "╘═◊@"], + [" ", " "], + ["─┴┬┴", "─┬┴─"], + ["┬┴┬─", "┴┬┴─"], + ["┬┴┬┴", "┴┬┴─"], + + ["┬┴┬─", "┴┬┴┬"], + ["┬┴┬┴", "┴┬┴┬"], + ["┬┴┬─", "┴┬┴┬"], + ["┬┴┬┴", "┴┬┴┬"], + + ["─┴┬─", "─┬┴─"], + ["─┴┬┴", "─┬┴─"], + ["┬┴┬─", "┴┬┴─"], + ["┬┴┬┴", "┴┬┴─"], + + ["┬┴┬─", "┴┬┴┬"], + ["┬┴┬┴", "┴┬┴┬"], + ["┬┴┬─", "┴┬┴┬"], + ["┬┴┬┴", "┴┬┴┬"] + ]; + + /// + /// The v tile colors + /// + private byte[][] _vTileColors = + [ + [0x00], + [0x6E], + [0x4F], + [0x0E, 0x0E, 0x0E, 0x0E, 0x2A, 0x22, 0x02, 0x22], + [0x6F], + [0x6E], + [0x1A,0xA0,0xA0,0x1A,0x1A,0xA0,0xA0,0x1A], + [0x1A,0xA0,0xA0,0x1A,0x1A,0xA0,0xA0,0x1A], + [0x1A,0xA0,0xA0,0x1A,0x1A,0xA0,0xA0,0x1A], + [0x1A,0xA0,0xA0,0x1A,0x1A,0xA0,0xA0,0x1A], + [0x6E], + [0x6F], + [0x6E], + [0x4F], + + ]; + + public new Size TileSize => new Size(4,2); + + /// + /// Gets the tile colors. + /// + /// The tile. + /// FullColor[]. + private (ConsoleColor fgr, ConsoleColor bgr)[] GetTileColors(Enum? tile) + { + var result = new (ConsoleColor fgr, ConsoleColor bgr)[8]; + byte[] colDef = GetArrayElement(_vTileColors, tile); + for (var i =0;i> 4)); + } + return result; + } + + public override (string[] lines, (ConsoleColor fgr, ConsoleColor bgr)[] colors) GetTileDef(Enum? tile) + => (GetArrayElement(_vTileDefStr, tile), GetTileColors((Enum?)tile)); + } +} diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs b/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs new file mode 100644 index 000000000..17ccadc19 --- /dev/null +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs @@ -0,0 +1,110 @@ +using BaseLib.Interfaces; +using ConsoleDisplay.View; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using Werner_Flaschbier_Base.Model; +using Werner_Flaschbier_Base.ViewModels; + +namespace Werner_Flaschbier.Console2.View +{ + public class Visual : IVisual + { + private readonly TileDisplay _display; + private readonly IWernerViewModel _viewModel; + private readonly IConsole _console; + + public static Dictionary keyAction = new Dictionary { + { 'I', UserAction.GoUp }, + { 'J', UserAction.GoWest }, + { 'K', UserAction.GoDown }, + { 'L', UserAction.GoEast }, + { '?', UserAction.Help }, + { 'H', UserAction.Help }, + { 'R', UserAction.Restart }, + { 'Q', UserAction.Quit }, +#if DEBUG + { 'N', UserAction.NextLvl }, + { 'V', UserAction.PrevLvl }, +#endif + { '\u001b', UserAction.Quit } }; + + public Visual(IWernerViewModel viewModel, IConsole console, ITileDef tileDef) + { + _viewModel = viewModel; + _console = console; + _display = new TileDisplay(console, tileDef); + _display.FncGetTile = (p) => (Tiles)_viewModel.Tiles[p]; + _display.FncOldPos = (p) => _viewModel.OldPos(p); + _display.SetDispSize(_viewModel.size); + + _viewModel.PropertyChanged += OnPropertyChanged; + FullRedraw(); + } + + private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "Tiles") + _display.Update(_viewModel!.HalfStep); + else if (e.PropertyName == "Level") + FullRedraw(); + } + + public void FullRedraw(object? sender = null, EventArgs? e = null) + { + if (_viewModel == null) return; + _display.FullRedraw(); + ShowStatistics(); + } + + private void ShowStatistics() + { + if (_viewModel == null) return; + _console.SetCursorPosition(0, 24); + _console.BackgroundColor = ConsoleColor.Black; + _console.ForegroundColor = ConsoleColor.Yellow; + _console.Write($"\t{_viewModel.Level + 1}\t\t{_viewModel.Score}\t\t{_viewModel.Lives}/{_viewModel.MaxLives} \t\t{Math.Floor(_viewModel.TimeLeft)}\t\x08"); + } + + public void WriteTile(PointF p, Tiles tile) + { + _display.WriteTile(p, tile); + } + + public void Sound(GameSound gs) + { + switch (gs) + { + case GameSound.NoSound: + break; + case GameSound.Tick: + _console.Beep(1000, 10); + break; + case GameSound.DeepBoom: + _console.Beep(300, 20); + break; + default: + break; + } + } + + public bool CheckUserAction() + { + bool result = false; + UserAction action = UserAction.Nop; + if (_console.KeyAvailable) + { + var ch = _console.ReadKey()?.KeyChar ?? '\x00'; + ch = Char.ToUpper(ch); + if (keyAction.ContainsKey(ch)) + { + action = keyAction[ch]; + result = true; + } + } + _viewModel?.HandleUserAction(action); + return result; + } + } +} diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/Werner_Flaschbier.Console2.csproj b/CSharpBible/Games/Werner_Flaschbier.Console2/Werner_Flaschbier.Console2.csproj new file mode 100644 index 000000000..d2a6da173 --- /dev/null +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/Werner_Flaschbier.Console2.csproj @@ -0,0 +1,30 @@ + + + + net462;net472;net48;net481;net6.0;net7.0;net8.0;net9.0 + Exe + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSharpBible/Games/Werner_Flaschbier/Model/WernerGame.cs b/CSharpBible/Games/Werner_Flaschbier/Model/WernerGame.cs index b4dd809a1..ab4907147 100644 --- a/CSharpBible/Games/Werner_Flaschbier/Model/WernerGame.cs +++ b/CSharpBible/Games/Werner_Flaschbier/Model/WernerGame.cs @@ -163,7 +163,7 @@ public Tiles GetTile(Point p) public Point OldPos(Point p) { var field = playfield[p]; - if (field is Space s && s.Item != null) + if (field is Space s && s.Item != null && !(s.Item is Dirt) ) return s.Item.OldPosition; else return p; @@ -242,7 +242,11 @@ public int GameStep() foreach (PlayObject po in playfield.ActiveObjects) po.Handled = false; foreach (Space sp in playfield.Spaces) + { sp.OldItem = sp.Item; + if (sp.Item != null) + sp.Item.OldPosition = sp.Position; + } playfield.player?.TryMove(actDir); actDir = nextDir; nextDir = nextDir2; diff --git a/CSharpBible/Libraries/ConsoleDisplay/View/TileDisplay.cs b/CSharpBible/Libraries/ConsoleDisplay/View/TileDisplay.cs index 18f95a7d2..24165c84a 100644 --- a/CSharpBible/Libraries/ConsoleDisplay/View/TileDisplay.cs +++ b/CSharpBible/Libraries/ConsoleDisplay/View/TileDisplay.cs @@ -257,6 +257,8 @@ public void WriteTile(PointF p, T tile) public void Update(bool e) { + var cv = console.CursorVisible; + console.CursorVisible = false; _bgr = ConsoleColor.Black; _fgr = ConsoleColor.Black; var diffFields = new List<(Point, T, Point?)>(); @@ -271,7 +273,7 @@ public void Update(bool e) p3.Y = p.Y + DispOffset.Y; T td = FncGetTile(p3)!; T? ot = GetTile(p); - var po = e? FncOldPos?.Invoke(p3):null; + var po = FncOldPos?.Invoke(p3); bool x1 = !td.Equals(ot); bool x2 = (po != null) && (po != p3); @@ -311,10 +313,13 @@ public void Update(bool e) } WriteTile(f.Item1, f.Item2); } + console.CursorVisible = cv; } public void FullRedraw() { + var cv = console.CursorVisible; + console.CursorVisible = false; if (FncGetTile == null) return; // Draw playfield Point p = new(); @@ -325,6 +330,7 @@ public void FullRedraw() p2.Y = p.Y + DispOffset.Y; WriteTile(p, _tiles[p] = FncGetTile(p2)); } + console.CursorVisible = cv; } #endregion #endregion From 8dd828a30b5cfbb42373b69b71f6b14d120c9358 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sun, 25 Jan 2026 00:08:18 +0100 Subject: [PATCH 42/71] Games --- CSharpBible/Games/Games.sln | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CSharpBible/Games/Games.sln b/CSharpBible/Games/Games.sln index 83a20c7ee..62d6de34c 100644 --- a/CSharpBible/Games/Games.sln +++ b/CSharpBible/Games/Games.sln @@ -261,6 +261,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OtherPlugin", "..\..\TestSt EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sokoban.Plugin", "Sokoban.Plugin\Sokoban.Plugin.csproj", "{D193A2C2-F42F-4172-9960-CF81051C12E9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Werner_Flaschbier.Console2", "Werner_Flaschbier.Console2\Werner_Flaschbier.Console2.csproj", "{1895981C-B544-4BE4-EC3C-9B1034F2024E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1471,6 +1473,18 @@ Global {D193A2C2-F42F-4172-9960-CF81051C12E9}.Release|x64.Build.0 = Release|Any CPU {D193A2C2-F42F-4172-9960-CF81051C12E9}.Release|x86.ActiveCfg = Release|Any CPU {D193A2C2-F42F-4172-9960-CF81051C12E9}.Release|x86.Build.0 = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|x64.ActiveCfg = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|x64.Build.0 = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|x86.ActiveCfg = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Debug|x86.Build.0 = Debug|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|Any CPU.Build.0 = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|x64.ActiveCfg = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|x64.Build.0 = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|x86.ActiveCfg = Release|Any CPU + {1895981C-B544-4BE4-EC3C-9B1034F2024E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1564,6 +1578,7 @@ Global {CE53A7C0-B60F-08B3-1E98-F00307A06E3F} = {D44D28AA-A653-4BFC-A3CF-0CC30230A191} {E953E2A6-54ED-57D7-8C8C-5FA30B2E58AF} = {D44D28AA-A653-4BFC-A3CF-0CC30230A191} {D193A2C2-F42F-4172-9960-CF81051C12E9} = {EAA6A4C4-78C2-412B-A322-0D3FA6691D50} + {1895981C-B544-4BE4-EC3C-9B1034F2024E} = {7337A459-E02B-4BD0-8271-807FD3E16A1B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {51252E6F-E712-436A-B391-1C5243F65ABE} From 985fd3d2d10267fc52ecf9ebf335116e607be319 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sun, 25 Jan 2026 10:38:06 +0100 Subject: [PATCH 43/71] SharpHack.Server --- .../Pathfinding/AStarPathfinder.cs | 5 +- .../Pathfinding/SimplePriorityQueue.cs | 52 +++++++++++++++++++ .../SharpHack.Engine/SharpHack.Engine.csproj | 6 +-- .../BSP/BSPRoomMazeMapGenerator.cs | 4 ++ .../SharpHack.LevelGen.csproj | 2 +- .../Werner_Flaschbier.Console2/View/Visual.cs | 44 ++++++++++++---- 6 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 CSharpBible/Games/SharpHack.Engine/Pathfinding/SimplePriorityQueue.cs diff --git a/CSharpBible/Games/SharpHack.Engine/Pathfinding/AStarPathfinder.cs b/CSharpBible/Games/SharpHack.Engine/Pathfinding/AStarPathfinder.cs index d284f6d90..5f27b1810 100644 --- a/CSharpBible/Games/SharpHack.Engine/Pathfinding/AStarPathfinder.cs +++ b/CSharpBible/Games/SharpHack.Engine/Pathfinding/AStarPathfinder.cs @@ -14,8 +14,11 @@ public static class AStarPathfinder { return null; } - +#if NET5_0_OR_GREATER var open = new PriorityQueue(); +#else + var open = new SimplePriorityQueue(); +#endif var cameFrom = new Dictionary(); var gScore = new Dictionary { diff --git a/CSharpBible/Games/SharpHack.Engine/Pathfinding/SimplePriorityQueue.cs b/CSharpBible/Games/SharpHack.Engine/Pathfinding/SimplePriorityQueue.cs new file mode 100644 index 000000000..ea4a8c53b --- /dev/null +++ b/CSharpBible/Games/SharpHack.Engine/Pathfinding/SimplePriorityQueue.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; + +namespace SharpHack.Engine.Pathfinding; + +public class SimplePriorityQueue where TPriority : IComparable +{ + private readonly List<(TElement Element, TPriority Priority)> _nodes = new(); + + public int Count => _nodes.Count; + + public void Enqueue(TElement element, TPriority priority) + { + _nodes.Add((element, priority)); + var i = _nodes.Count - 1; + while (i > 0) + { + var parent = (i - 1) / 2; + if (_nodes[parent].Priority.CompareTo(_nodes[i].Priority) <= 0) break; + (_nodes[parent], _nodes[i]) = (_nodes[i], _nodes[parent]); + i = parent; + } + } + + public TElement Dequeue() + { + if (_nodes.Count == 0) throw new InvalidOperationException("Queue ist leer."); + + var result = _nodes[0].Element; + _nodes[0] = _nodes[_nodes.Count - 1]; + _nodes.RemoveAt(_nodes.Count - 1); + + var i = 0; + while (true) + { + var left = i * 2 + 1; + var right = i * 2 + 2; + var smallest = i; + + if (left < _nodes.Count && _nodes[left].Priority.CompareTo(_nodes[smallest].Priority) < 0) + smallest = left; + if (right < _nodes.Count && _nodes[right].Priority.CompareTo(_nodes[smallest].Priority) < 0) + smallest = right; + + if (smallest == i) break; + (_nodes[i], _nodes[smallest]) = (_nodes[smallest], _nodes[i]); + i = smallest; + } + + return result; + } +} \ No newline at end of file diff --git a/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj b/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj index 5c99cb60d..02a2f09f4 100644 --- a/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj +++ b/CSharpBible/Games/SharpHack.Engine/SharpHack.Engine.csproj @@ -1,4 +1,4 @@ - + Library @@ -18,11 +18,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/CSharpBible/Games/SharpHack.LevelGen/BSP/BSPRoomMazeMapGenerator.cs b/CSharpBible/Games/SharpHack.LevelGen/BSP/BSPRoomMazeMapGenerator.cs index 8e0bc1337..c1bb8fa98 100644 --- a/CSharpBible/Games/SharpHack.LevelGen/BSP/BSPRoomMazeMapGenerator.cs +++ b/CSharpBible/Games/SharpHack.LevelGen/BSP/BSPRoomMazeMapGenerator.cs @@ -340,7 +340,11 @@ private void ApplyDoors(Map map, List doorCandidates) private static int ClampEven(int value, int min, int max) { +#if NET5_0_OR_GREATER int v = Math.Clamp(value, min, max); +#else + int v = Math.Max(min, Math.Min(max, value)); +#endif if ((v & 1) == 1) { if (v + 1 <= max) v++; diff --git a/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj b/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj index 96c12de53..9e11dfb86 100644 --- a/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj +++ b/CSharpBible/Games/SharpHack.LevelGen/SharpHack.LevelGen.csproj @@ -18,7 +18,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs b/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs index 17ccadc19..bcdcb6579 100644 --- a/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs +++ b/CSharpBible/Games/Werner_Flaschbier.Console2/View/Visual.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; +using System.Linq; using Werner_Flaschbier_Base.Model; using Werner_Flaschbier_Base.ViewModels; @@ -14,6 +15,7 @@ public class Visual : IVisual private readonly TileDisplay _display; private readonly IWernerViewModel _viewModel; private readonly IConsole _console; + private readonly List _actionBuffer = new List(); public static Dictionary keyAction = new Dictionary { { 'I', UserAction.GoUp }, @@ -34,6 +36,7 @@ public Visual(IWernerViewModel viewModel, IConsole console, ITileDef tileDef) { _viewModel = viewModel; _console = console; + _console.CursorVisible = false; _display = new TileDisplay(console, tileDef); _display.FncGetTile = (p) => (Tiles)_viewModel.Tiles[p]; _display.FncOldPos = (p) => _viewModel.OldPos(p); @@ -46,7 +49,12 @@ public Visual(IWernerViewModel viewModel, IConsole console, ITileDef tileDef) private void OnPropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Tiles") + { _display.Update(_viewModel!.HalfStep); + _console.SetCursorPosition(0, 24); + _console.BackgroundColor = ConsoleColor.Black; + _console.ForegroundColor = ConsoleColor.Yellow; + } else if (e.PropertyName == "Level") FullRedraw(); } @@ -91,19 +99,37 @@ public void Sound(GameSound gs) public bool CheckUserAction() { - bool result = false; - UserAction action = UserAction.Nop; - if (_console.KeyAvailable) + while (_console.KeyAvailable) { - var ch = _console.ReadKey()?.KeyChar ?? '\x00'; - ch = Char.ToUpper(ch); - if (keyAction.ContainsKey(ch)) + var ch = char.ToUpper(_console.ReadKey()?.KeyChar ?? '\x00'); + if (keyAction.TryGetValue(ch, out var action)) { - action = keyAction[ch]; - result = true; + int sameCount = 0; + for (int i = _actionBuffer.Count - 1; i >= 0 && _actionBuffer[i] == action; i--) + { + sameCount++; + } + + if (sameCount < 2) + { + _actionBuffer.Add(action); + } + if (_actionBuffer.Count > 2) + { + _actionBuffer.RemoveAt(0); + } } } - _viewModel?.HandleUserAction(action); + UserAction currentAction = UserAction.Nop; + bool result = _actionBuffer.Count > 0; + + if (result) + { + currentAction = _actionBuffer[0]; + _actionBuffer.RemoveAt(0); + } + + _viewModel?.HandleUserAction(currentAction); return result; } } From 4a0c3ee47e11142a2be2c0038c5ece46d8d21fdb Mon Sep 17 00:00:00 2001 From: Joe Care Date: Sun, 25 Jan 2026 11:03:38 +0100 Subject: [PATCH 44/71] SharpHack.Server --- .../Games/SharpHack.View.FirstPerson/App.xaml | 7 ++ .../SharpHack.View.FirstPerson/App.xaml.cs | 64 +++++++++++ .../MainWindow.xaml | 38 +++++++ .../MainWindow.xaml.cs | 20 ++++ .../Properties/Resources.resx | 62 ++++++++++ .../SharpHack.View.FirstPerson.csproj | 35 ++++++ .../Views/FirstPersonView.xaml | 27 +++++ .../Views/FirstPersonView.xaml.cs | 17 +++ .../FirstPersonGameViewModelTests.cs | 81 +++++++++++++ .../SharpHack.ViewModel.Tests.csproj | 22 ++++ .../FirstPersonGameViewModel.cs | 107 ++++++++++++++++++ 11 files changed, 480 insertions(+) create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml.cs create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml.cs create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/Properties/Resources.resx create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/SharpHack.View.FirstPerson.csproj create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/Views/FirstPersonView.xaml create mode 100644 CSharpBible/Games/SharpHack.View.FirstPerson/Views/FirstPersonView.xaml.cs create mode 100644 CSharpBible/Games/SharpHack.ViewModel.Tests/FirstPersonGameViewModelTests.cs create mode 100644 CSharpBible/Games/SharpHack.ViewModel.Tests/SharpHack.ViewModel.Tests.csproj create mode 100644 CSharpBible/Games/SharpHack.ViewModel/FirstPersonGameViewModel.cs diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml b/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml new file mode 100644 index 000000000..a9f70bb6a --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml.cs b/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml.cs new file mode 100644 index 000000000..73cad4e79 --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/App.xaml.cs @@ -0,0 +1,64 @@ +using System.Windows; +using Microsoft.Extensions.DependencyInjection; +using SharpHack.ViewModel; +using SharpHack.Engine; +using SharpHack.LevelGen.BSP; +using SharpHack.Combat; +using SharpHack.AI; +using BaseLib.Models; +using BaseLib.Models.Interfaces; +using SharpHack.Base.Interfaces; +using SharpHack.Persist; + +namespace SharpHack.View.FirstPerson; + +/// +/// Interaction logic for App.xaml +/// +public partial class App : Application +{ + private ServiceProvider _serviceProvider; + + /// + /// Initializes a new instance of the class. + /// + public App() + { + ServiceCollection services = new ServiceCollection(); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + } + + /// + /// Configures the services for the application. + /// + /// The service collection to add services to. + private void ConfigureServices(ServiceCollection services) + { + // Core Services + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + + // Game Session + services.AddSingleton(); + + // ViewModel + services.AddSingleton(); + + // View + services.AddSingleton(); + } + + /// + /// Raises the event. + /// + /// A that contains the event data. + protected override void OnStartup(StartupEventArgs e) + { + var mainWindow = _serviceProvider.GetRequiredService(); + mainWindow.Show(); + } +} diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml b/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml new file mode 100644 index 000000000..fd9e4f2c0 --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml.cs b/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml.cs new file mode 100644 index 000000000..0555a69e2 --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/MainWindow.xaml.cs @@ -0,0 +1,20 @@ +using System.Windows; +using SharpHack.ViewModel; + +namespace SharpHack.View.FirstPerson; + +/// +/// Interaction logic for MainWindow.xaml +/// +public partial class MainWindow : Window +{ + /// + /// Initializes a new instance of the class. + /// + /// The view model. + public MainWindow(FirstPersonGameViewModel viewModel) + { + InitializeComponent(); + DataContext = viewModel; + } +} diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/Properties/Resources.resx b/CSharpBible/Games/SharpHack.View.FirstPerson/Properties/Resources.resx new file mode 100644 index 000000000..1e55a5757 --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/Properties/Resources.resx @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + SharpHack First Person + + + HP: + + + Level: + + diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/SharpHack.View.FirstPerson.csproj b/CSharpBible/Games/SharpHack.View.FirstPerson/SharpHack.View.FirstPerson.csproj new file mode 100644 index 000000000..e0a9bf61b --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/SharpHack.View.FirstPerson.csproj @@ -0,0 +1,35 @@ + + + WinExe + net10.0-windows + enable + true + enable + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + PublicResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/CSharpBible/Games/SharpHack.View.FirstPerson/Views/FirstPersonView.xaml b/CSharpBible/Games/SharpHack.View.FirstPerson/Views/FirstPersonView.xaml new file mode 100644 index 000000000..61e9e51ba --- /dev/null +++ b/CSharpBible/Games/SharpHack.View.FirstPerson/Views/FirstPersonView.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +