Skip to content
Merged

sync #693

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
ae86e1e
BaseLib
joecare99 Jan 20, 2026
f34c63d
Merge branch 'Avalonia_Apps'
joecare99 Jan 20, 2026
fe39de9
Exclude obj\ files from build, update TLS env vars
Jan 21, 2026
982e619
Merge pull request #680 from joecare99/master
joecare99 Jan 21, 2026
9165326
Merge pull request #681 from ChristianRosewich/master
joecare99 Jan 21, 2026
1dfc047
SharpHack.Server
joecare99 Jan 21, 2026
3f20410
SharpHack.Server
joecare99 Jan 23, 2026
584ef2a
Games
joecare99 Jan 23, 2026
b8ca765
Refactor CSharpBible CI workflow for .NET 8.0
joecare99 Jan 23, 2026
d8ffe21
Update CSharpBible.yml
joecare99 Jan 23, 2026
8ec61f9
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Jan 23, 2026
982f8b4
.
joecare99 Jan 23, 2026
514dd07
Update CSharpBible.yml
joecare99 Jan 23, 2026
214587a
Update CSharpBible.yml
joecare99 Jan 23, 2026
3fc19c2
Rename CI workflow to CSharpBible CI2
joecare99 Jan 23, 2026
73af31d
SharpHack.Server
joecare99 Jan 23, 2026
e1c77e6
SharpHack.Server
joecare99 Jan 23, 2026
266d05e
Games
joecare99 Jan 23, 2026
16db2c4
Update CSharpBible CI to version 3 and clean up projects
joecare99 Jan 23, 2026
1ee71a9
SharpHack.Server
joecare99 Jan 23, 2026
90b5733
.
joecare99 Jan 23, 2026
576558a
Remove multiple projects from CSharpBible solution
joecare99 Jan 23, 2026
00e434b
Merge branch 'CSharpBible' of https://github.com/joecare99/CSharp int…
joecare99 Jan 23, 2026
e8e04bf
Merge remote-tracking branch 'origin/master' into CSharpBible
joecare99 Jan 23, 2026
379321b
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Jan 23, 2026
cbb35b8
.
joecare99 Jan 23, 2026
8bc2b27
Merge branch 'master' into CSharpBible
joecare99 Jan 23, 2026
3b52a81
Common
joecare99 Jan 23, 2026
e95e178
Update CSharpBible.yml
joecare99 Jan 23, 2026
7d17ce5
Merge branch 'CSharpBible' into master
joecare99 Jan 23, 2026
32812ac
Merge pull request #683 from joecare99/master
joecare99 Jan 23, 2026
9d53714
Update CSharpBible.yml
joecare99 Jan 23, 2026
6f9677e
Merge pull request #684 from joecare99/CSharpBible
joecare99 Jan 23, 2026
e0a873a
Merge branch 'master' of https://github.com/joecare99/CSharp
joecare99 Jan 23, 2026
6b31ade
Merge pull request #685 from joecare99/master
joecare99 Jan 23, 2026
72b6bfb
Update CSharpBible.yml to remove project references
joecare99 Jan 23, 2026
f6479ba
Merge pull request #686 from joecare99/CSharpBible
joecare99 Jan 23, 2026
83bf4f3
Update dotnet restore command with new parameters
joecare99 Jan 23, 2026
e0e5bfc
Update ReadMe.md with new content
joecare99 Jan 23, 2026
7061270
Update CSharpBible.yml to enable Windows targeting
joecare99 Jan 23, 2026
b5512e0
Update ReadMe.md with new content
joecare99 Jan 23, 2026
c781076
Add CI workflow for TestStatemens directory
joecare99 Jan 24, 2026
9786805
Update workflow to use TestStatemens.sln
joecare99 Jan 24, 2026
35a5a4d
Fix formatting in ReadMe.md
joecare99 Jan 24, 2026
e1affdf
Fix typo in workflow paths for TestStatements
joecare99 Jan 24, 2026
1ee969c
Fix directory and solution name typos in workflow
joecare99 Jan 24, 2026
bf22ec0
Fix formatting in ReadMe.md
joecare99 Jan 24, 2026
9d46f24
Change runner from Ubuntu to Windows for tests
joecare99 Jan 24, 2026
12252a4
Fix formatting in ReadMe.md
joecare99 Jan 24, 2026
8f77a03
Update .NET restore, build, and test commands
joecare99 Jan 24, 2026
8b5d85a
Fix formatting in ReadMe.md
joecare99 Jan 24, 2026
9edc992
Update target framework for dotnet restore command
joecare99 Jan 24, 2026
7f6c935
Change CI runner to Windows and update target framework
joecare99 Jan 24, 2026
33d9557
Update ReadMe.md with new content
joecare99 Jan 24, 2026
c588578
Simplify project removal commands in workflow
joecare99 Jan 24, 2026
8e8be62
Update ReadMe.md with new content
joecare99 Jan 24, 2026
6ef2485
Sokoban.Plugin
joecare99 Jan 24, 2026
8dd828a
Games
joecare99 Jan 24, 2026
4a163c0
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Jan 24, 2026
985fd3d
SharpHack.Server
joecare99 Jan 25, 2026
4a0c3ee
SharpHack.Server
joecare99 Jan 25, 2026
35f3510
Games
joecare99 Jan 25, 2026
becaa0b
SharpHack.Server
joecare99 Jan 28, 2026
c9dbd3b
Games
joecare99 Jan 28, 2026
503f5f9
AppWithPlugin
joecare99 Jan 28, 2026
b5b8bb9
TestStatements
joecare99 Jan 28, 2026
85d1984
Merge remote-tracking branch 'GH_CSharp/TestStatements'
joecare99 Jan 28, 2026
96abade
SharpHack.Server
joecare99 Jan 31, 2026
20933d2
Graphics
joecare99 Jan 31, 2026
36b68a7
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Jan 31, 2026
5c05964
SharpHack.Server
joecare99 Jan 31, 2026
f5c1cd8
Libraries
joecare99 Jan 31, 2026
1511b5a
SharpHack.Server
joecare99 Jan 31, 2026
f44ee69
Common
joecare99 Jan 31, 2026
bb72fea
Common
joecare99 Jan 31, 2026
942bac1
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Jan 31, 2026
f7801f0
Common
joecare99 Jan 31, 2026
cf700e4
Common
joecare99 Jan 31, 2026
5ffc0d7
SharpHack.Server
joecare99 Jan 31, 2026
e12466e
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Jan 31, 2026
87bd1de
MVVM_Tutorial
joecare99 Feb 1, 2026
0e95f2d
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Feb 1, 2026
5f40d10
MVVM_Tutorial
joecare99 Feb 1, 2026
32b7f9b
SharpHack.Server
joecare99 Feb 1, 2026
724d3a4
Merge remote-tracking branch 'GH_CSharp/CSharpBible'
joecare99 Feb 1, 2026
ff54708
MVVM_Tutorial
joecare99 Feb 1, 2026
c3b7fc5
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Feb 1, 2026
b86e5b4
Bump coverlet.collector from 6.0.4 to 8.0.0
dependabot[bot] Feb 16, 2026
145ca6c
Bump Microsoft.Extensions.Configuration.UserSecrets from 10.0.2 to 10…
dependabot[bot] Feb 16, 2026
75d7b02
Bump Microsoft.Extensions.DependencyInjection.Abstractions from 10.0.…
dependabot[bot] Feb 16, 2026
34218af
Bump Microsoft.Extensions.DependencyInjection and Microsoft.Extension…
dependabot[bot] Feb 16, 2026
75f9eb6
Bump Microsoft.Extensions.Logging.Abstractions from 10.0.2 to 10.0.3
dependabot[bot] Feb 16, 2026
940f294
Merge pull request #687 from joecare99/dependabot/nuget/TestStatement…
joecare99 Mar 1, 2026
cade552
Merge pull request #688 from joecare99/dependabot/nuget/TestStatement…
joecare99 Mar 1, 2026
8076ca2
Merge pull request #690 from joecare99/dependabot/nuget/CSharpBible/L…
joecare99 Mar 1, 2026
bb14ef8
Merge pull request #691 from joecare99/dependabot/nuget/TestStatement…
joecare99 Mar 1, 2026
db1dc59
Merge pull request #692 from joecare99/dependabot/nuget/TestStatement…
joecare99 Mar 1, 2026
0ad1c88
BaseLib
joecare99 Mar 1, 2026
10007f5
Merge branch 'Avalonia_Apps'
joecare99 Mar 1, 2026
2383e8e
AppWithPlugin
joecare99 Mar 1, 2026
55c75b4
Merge remote-tracking branch 'GH_CSharp/TestStatements'
joecare99 Mar 1, 2026
fbd70fe
Merge remote-tracking branch 'GH_CSharp/JC-AMS'
joecare99 Mar 1, 2026
5173851
MVVM_Tutorial
joecare99 Mar 1, 2026
156f54e
Merge remote-tracking branch 'GH_CSharp/MVVM_Tutorial'
joecare99 Mar 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 44 additions & 108 deletions .github/workflows/CSharpBible.yml
Original file line number Diff line number Diff line change
@@ -1,115 +1,51 @@
# 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 CI3

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: windows-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 }}

# 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)

# 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 }}

# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx

# 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: 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: |
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

- name: Build
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-windows
Comment on lines +13 to +51

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 5 months ago

In general, the fix is to define an explicit permissions block for the workflow or individual jobs, granting only the minimal scopes required. For this workflow, the job only needs to read repository contents to allow actions/checkout to fetch the code; it does not appear to need any write permissions or additional scopes.

The single best fix with no functional change is to add a root-level permissions section that applies to all jobs, immediately below the name (or on) block. Set contents: read as recommended by CodeQL. No imports or additional methods are needed; this is purely a YAML configuration change within .github/workflows/CSharpBible.yml.

Concretely: in .github/workflows/CSharpBible.yml, after line 1 (name: CSharpBible CI3) insert a permissions: block specifying contents: read. This will constrain the GITHUB_TOKEN for the build-test job (and any future jobs without their own permissions block) to read-only access to repository contents.

Suggested changeset 1
.github/workflows/CSharpBible.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/CSharpBible.yml b/.github/workflows/CSharpBible.yml
--- a/.github/workflows/CSharpBible.yml
+++ b/.github/workflows/CSharpBible.yml
@@ -1,5 +1,8 @@
 name: CSharpBible CI3
 
+permissions:
+  contents: read
+
 on:
   push:
     paths:
EOF
@@ -1,5 +1,8 @@
name: CSharpBible CI3

permissions:
contents: read

on:
push:
paths:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
35 changes: 35 additions & 0 deletions .github/workflows/Teststatements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: TestStatemens CI0

on:
push:
paths:
- "TestStatements/**"
pull_request:
paths:
- "TestStatements/**"

jobs:
build-test:
runs-on: windows-latest
defaults:
run:
working-directory: TestStatements
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 TestStatements.sln -p:TargetFramework=net8.0-windows

- name: Build
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-windows
Comment on lines +13 to +35

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 5 months ago

In general, the fix is to add an explicit permissions block that grants only the minimal required access to the GITHUB_TOKEN. For a CI workflow that only needs to check out the repository and build/test, contents: read is typically sufficient. This can be added at the root of the workflow (applies to all jobs) or under a specific job. Here, adding it at the root keeps the change simple and does not alter functionality.

Concretely, in .github/workflows/Teststatements.yml, add a permissions: section after the name: (before on:) with contents: read. No extra scopes are needed because there are no steps that write to the repo, issues, or pull requests. This change does not affect the existing build/test behavior but ensures that GITHUB_TOKEN is restricted to read‑only repository contents for this workflow.

Suggested changeset 1
.github/workflows/Teststatements.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/Teststatements.yml b/.github/workflows/Teststatements.yml
--- a/.github/workflows/Teststatements.yml
+++ b/.github/workflows/Teststatements.yml
@@ -1,5 +1,8 @@
 name: TestStatemens CI0
 
+permissions:
+  contents: read
+
 on:
   push:
     paths:
EOF
@@ -1,5 +1,8 @@
name: TestStatemens CI0

permissions:
contents: read

on:
push:
paths:
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vs
.gitignore
bin
obj
*.db
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </returns>
string ReadLine();
void ResetColor();

/// <summary>
/// Sets the position of the cursor within the console buffer.
Expand Down
99 changes: 52 additions & 47 deletions Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,62 @@ namespace BaseLib.Models;

public class ConsoleProxy : IConsole
{
MethodInfo _writeLineS = typeof(Console).GetMethod(nameof(Console.WriteLine), [typeof(string)])!;
MethodInfo _beep = typeof(Console).GetMethod(nameof(Console.Beep), [typeof(int), typeof(int)])!;
protected MethodInfo _writeLineS = typeof(Console).GetMethod(nameof(Console.WriteLine), [typeof(string)])!;
protected MethodInfo _beep = typeof(Console).GetMethod(nameof(Console.Beep), [typeof(int), typeof(int)])!;
#if NET5_0_OR_GREATER
MethodInfo _GetCursorPosition = typeof(Console).GetMethod(nameof(Console.GetCursorPosition), [])!;
protected MethodInfo _GetCursorPosition = typeof(Console).GetMethod(nameof(Console.GetCursorPosition), [])!;
#else
MethodInfo _CursorLeft = typeof(Console).GetMethod(nameof(Console.CursorLeft), [])!;
MethodInfo _CursorTop = typeof(Console).GetMethod(nameof(Console.CursorTop), [])!;
protected MethodInfo _CursorLeft = typeof(Console).GetMethod(nameof(Console.CursorLeft), [])!;
protected MethodInfo _CursorTop = typeof(Console).GetMethod(nameof(Console.CursorTop), [])!;
#endif
MethodInfo _ReadKey = typeof(Console).GetMethod(nameof(Console.ReadKey), [])!;
MethodInfo _Readline = typeof(Console).GetMethod(nameof(Console.ReadLine), [])!;
MethodInfo _setCursorPosition = typeof(Console).GetMethod(nameof(Console.SetCursorPosition), [typeof(int), typeof(int)])!;
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), [])!;

PropertyInfo _ForegroundColor = typeof(Console).GetProperty(nameof(Console.ForegroundColor))!;
PropertyInfo _BackgroundColor = typeof(Console).GetProperty(nameof(Console.BackgroundColor))!;
PropertyInfo _IsOutputRedirected = typeof(Console).GetProperty(nameof(Console.IsOutputRedirected))!;
PropertyInfo _KeyAvailable = typeof(Console).GetProperty(nameof(Console.KeyAvailable))!;
PropertyInfo _LargestWindowHeight = typeof(Console).GetProperty(nameof(Console.LargestWindowHeight))!;
PropertyInfo _Title = typeof(Console).GetProperty(nameof(Console.Title))!;
PropertyInfo _WindowHeight = typeof(Console).GetProperty(nameof(Console.WindowHeight))!;
PropertyInfo _WindowWidth = typeof(Console).GetProperty(nameof(Console.WindowWidth))!;
PropertyInfo _CursorVisible = typeof(Console).GetProperty(nameof(Console.CursorVisible))!;
PropertyInfo _BufferWidth = typeof(Console).GetProperty(nameof(Console.BufferWidth))!;
PropertyInfo _BufferHeight = typeof(Console).GetProperty(nameof(Console.BufferHeight))!;

public ConsoleColor ForegroundColor { get => _ForegroundColor?.GetValue(null) as ConsoleColor? ?? ConsoleColor.White; set => _ForegroundColor?.SetValue(null,value); }
public ConsoleColor BackgroundColor { get => _BackgroundColor?.GetValue(null) as ConsoleColor? ?? ConsoleColor.Black; set => _BackgroundColor?.SetValue(null, value); }
public bool IsOutputRedirected => _IsOutputRedirected?.GetValue(null) as bool? ?? false;
public bool KeyAvailable => _KeyAvailable?.GetValue(null) as bool? ?? false;
public int LargestWindowHeight => _LargestWindowHeight?.GetValue(null) as int? ?? 0;
public string Title { get => _Title?.GetValue(null) as string ?? string.Empty; set => _Title?.SetValue(null, value); }
public int WindowHeight { get => _WindowHeight?.GetValue(null) as int? ?? 0; set => _WindowHeight?.SetValue(null, value); }
public int WindowWidth { get => _WindowWidth?.GetValue(null) as int? ?? 0; set => _WindowWidth?.SetValue(null, value); }
public bool CursorVisible { get => _CursorVisible?.GetValue(null) as bool? ?? false; set => _CursorVisible?.SetValue(null, value); }
public int BufferWidth => _BufferWidth?.GetValue(null) as int? ?? 0;
public int BufferHeight => _BufferHeight?.GetValue(null) as int? ?? 0;


public void Beep(int freq, int len) => _beep?.Invoke(null, [freq, len]);
public void Clear() => _clear?.Invoke(null, []);
protected MethodInfo _ReadKey = typeof(Console).GetMethod(nameof(Console.ReadKey), [])!;
protected MethodInfo _Readline = typeof(Console).GetMethod(nameof(Console.ReadLine), [])!;
protected MethodInfo _setCursorPosition = typeof(Console).GetMethod(nameof(Console.SetCursorPosition), [typeof(int), typeof(int)])!;
protected MethodInfo _writeCh = typeof(Console).GetMethod(nameof(Console.Write), [typeof(char)])!;
protected MethodInfo _writeS = typeof(Console).GetMethod(nameof(Console.Write), [typeof(string)])!;
protected MethodInfo _clear = typeof(Console).GetMethod(nameof(Console.Clear), [])!;
protected MethodInfo _resetColor = typeof(Console).GetMethod(nameof(Console.ResetColor), [])!;

protected PropertyInfo _ForegroundColor = typeof(Console).GetProperty(nameof(Console.ForegroundColor))!;
protected PropertyInfo _BackgroundColor = typeof(Console).GetProperty(nameof(Console.BackgroundColor))!;
protected PropertyInfo _IsOutputRedirected = typeof(Console).GetProperty(nameof(Console.IsOutputRedirected))!;
protected PropertyInfo _KeyAvailable = typeof(Console).GetProperty(nameof(Console.KeyAvailable))!;
protected PropertyInfo _LargestWindowHeight = typeof(Console).GetProperty(nameof(Console.LargestWindowHeight))!;
protected PropertyInfo _Title = typeof(Console).GetProperty(nameof(Console.Title))!;
protected PropertyInfo _WindowHeight = typeof(Console).GetProperty(nameof(Console.WindowHeight))!;
protected PropertyInfo _WindowWidth = typeof(Console).GetProperty(nameof(Console.WindowWidth))!;
protected PropertyInfo _CursorVisible = typeof(Console).GetProperty(nameof(Console.CursorVisible))!;
protected PropertyInfo _BufferWidth = typeof(Console).GetProperty(nameof(Console.BufferWidth))!;
protected PropertyInfo _BufferHeight = typeof(Console).GetProperty(nameof(Console.BufferHeight))!;

protected object? instance = default;
public ConsoleColor ForegroundColor { get => _ForegroundColor?.GetValue(instance) as ConsoleColor? ?? ConsoleColor.White; set => _ForegroundColor?.SetValue(instance,value); }
public ConsoleColor BackgroundColor { get => _BackgroundColor?.GetValue(instance) as ConsoleColor? ?? ConsoleColor.Black; set => _BackgroundColor?.SetValue(instance, value); }
public bool IsOutputRedirected => _IsOutputRedirected?.GetValue(instance) as bool? ?? false;
public bool KeyAvailable => _KeyAvailable?.GetValue(instance) as bool? ?? false;
public int LargestWindowHeight => _LargestWindowHeight?.GetValue(instance) as int? ?? 0;
public string Title { get => _Title?.GetValue(instance) as string ?? string.Empty; set => _Title?.SetValue(instance, value); }
public int WindowHeight { get => _WindowHeight?.GetValue(instance) as int? ?? 0; set => _WindowHeight?.SetValue(instance, value); }
public int WindowWidth { get => _WindowWidth?.GetValue(instance) as int? ?? 0; set => _WindowWidth?.SetValue(instance, value); }
public bool CursorVisible { get => _CursorVisible?.GetValue(instance) as bool? ?? false; set => _CursorVisible?.SetValue(instance, value); }
public int BufferWidth => _BufferWidth?.GetValue(instance) as int? ?? 0;
public int BufferHeight => _BufferHeight?.GetValue(instance) as int? ?? 0;


public void Beep(int freq, int len) => _beep?.Invoke(instance, [freq, len]);
public void Clear() => _clear?.Invoke(instance, []);
#if NET5_0_OR_GREATER
public (int Left, int Top) GetCursorPosition() => _GetCursorPosition?.Invoke(null, []) as (int, int)? ?? (0, 0);
public (int Left, int Top) GetCursorPosition() => _GetCursorPosition?.Invoke(instance, []) as (int, int)? ?? (0, 0);
#else
public (int Left, int Top) GetCursorPosition() => (_CursorLeft?.Invoke(null, []) as int? ?? 0, _CursorTop?.Invoke(null, []) as int? ?? 0);
public (int Left, int Top) GetCursorPosition() => (_CursorLeft?.Invoke(instance, []) as int? ?? 0, _CursorTop?.Invoke(instance, []) as int? ?? 0);
#endif
public ConsoleKeyInfo? ReadKey() => _ReadKey?.Invoke(null, []) as ConsoleKeyInfo?;
public string ReadLine() => _Readline?.Invoke(null, [])?.ToString() ?? string.Empty;
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]);
public void WriteLine(string? v) => _writeLineS?.Invoke(null, [v]);
public ConsoleKeyInfo? ReadKey() => _ReadKey?.Invoke(instance, []) as ConsoleKeyInfo?;
public string ReadLine() => _Readline?.Invoke(instance, [])?.ToString() ?? string.Empty;

public void ResetColor() => _resetColor?.Invoke(instance, []);

public void SetCursorPosition(int left, int top) => _setCursorPosition?.Invoke(instance, [left, top]);
public void Write(char ch) => _writeCh?.Invoke(instance, [ch]);
public void Write(string? st) => _writeS?.Invoke(instance, [st]);
public void WriteLine(string? v) => _writeLineS?.Invoke(instance, [v]);
}
2 changes: 1 addition & 1 deletion CSharpBible/CSharpBible.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void ReadKeyTest()
/// <summary>
/// Defines the test method SetCursorPositionTest.
/// </summary>
[DataTestMethod()]
[TestMethod()]
[DataRow("0,0",0,0)]
[DataRow("0,1", 0, 1)]
[DataRow("1,0", 1, 0)]
Expand Down
5 changes: 5 additions & 0 deletions CSharpBible/Games/Arkanoid.Base/Arkanoid.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
<PropertyGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '10.0.100'))">
<TargetFrameworks>$(TargetFrameworks);net10.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Remove="obj\**" />
<EmbeddedResource Remove="obj\**" />
<None Remove="obj\**" />
</ItemGroup>

</Project>
Loading