commit b8d02bb115afb7218c1def94f88d5d175e468b7a Author: Fehér Roland Date: Wed Feb 4 14:27:36 2026 +0100 I have no clue what I am doing diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca79cff --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +*/bin/ +*/obj/ diff --git a/DummyWinUI/App.xaml b/DummyWinUI/App.xaml new file mode 100644 index 0000000..0ab094f --- /dev/null +++ b/DummyWinUI/App.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/DummyWinUI/App.xaml.cs b/DummyWinUI/App.xaml.cs new file mode 100644 index 0000000..fa9200e --- /dev/null +++ b/DummyWinUI/App.xaml.cs @@ -0,0 +1,50 @@ +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using Microsoft.UI.Xaml.Shapes; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace DummyWinUI +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + public partial class App : Application + { + private Window? _window; + + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + InitializeComponent(); + } + + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + _window = new MainWindow(); + _window.Activate(); + } + } +} diff --git a/DummyWinUI/Assets/LockScreenLogo.scale-200.png b/DummyWinUI/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..7440f0d Binary files /dev/null and b/DummyWinUI/Assets/LockScreenLogo.scale-200.png differ diff --git a/DummyWinUI/Assets/SplashScreen.scale-200.png b/DummyWinUI/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000..32f486a Binary files /dev/null and b/DummyWinUI/Assets/SplashScreen.scale-200.png differ diff --git a/DummyWinUI/Assets/Square150x150Logo.scale-200.png b/DummyWinUI/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..53ee377 Binary files /dev/null and b/DummyWinUI/Assets/Square150x150Logo.scale-200.png differ diff --git a/DummyWinUI/Assets/Square44x44Logo.scale-200.png b/DummyWinUI/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..f713bba Binary files /dev/null and b/DummyWinUI/Assets/Square44x44Logo.scale-200.png differ diff --git a/DummyWinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/DummyWinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..dc9f5be Binary files /dev/null and b/DummyWinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/DummyWinUI/Assets/StoreLogo.png b/DummyWinUI/Assets/StoreLogo.png new file mode 100644 index 0000000..a4586f2 Binary files /dev/null and b/DummyWinUI/Assets/StoreLogo.png differ diff --git a/DummyWinUI/Assets/Wide310x150Logo.scale-200.png b/DummyWinUI/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..8b4a5d0 Binary files /dev/null and b/DummyWinUI/Assets/Wide310x150Logo.scale-200.png differ diff --git a/DummyWinUI/DummyWinUI.csproj b/DummyWinUI/DummyWinUI.csproj new file mode 100644 index 0000000..c2a4d7b --- /dev/null +++ b/DummyWinUI/DummyWinUI.csproj @@ -0,0 +1,60 @@ + + + WinExe + net8.0-windows10.0.19041.0 + 10.0.17763.0 + DummyWinUI + app.manifest + x86;x64;ARM64 + win-x86;win-x64;win-arm64 + win-$(Platform).pubxml + true + false + true + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + False + True + False + True + + \ No newline at end of file diff --git a/DummyWinUI/DummyWinUI.csproj.user b/DummyWinUI/DummyWinUI.csproj.user new file mode 100644 index 0000000..5fc5cf7 --- /dev/null +++ b/DummyWinUI/DummyWinUI.csproj.user @@ -0,0 +1,15 @@ + + + + + + Designer + + + Designer + + + Designer + + + \ No newline at end of file diff --git a/DummyWinUI/MainWindow.xaml b/DummyWinUI/MainWindow.xaml new file mode 100644 index 0000000..9e15a8b --- /dev/null +++ b/DummyWinUI/MainWindow.xaml @@ -0,0 +1,19 @@ + + + + + + + + + + + diff --git a/DummyWinUI/MainWindow.xaml.cs b/DummyWinUI/MainWindow.xaml.cs new file mode 100644 index 0000000..2ea1d4e --- /dev/null +++ b/DummyWinUI/MainWindow.xaml.cs @@ -0,0 +1,31 @@ +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Data; +using Microsoft.UI.Xaml.Input; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Navigation; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +namespace DummyWinUI +{ + /// + /// An empty window that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/DummyWinUI/Package.appxmanifest b/DummyWinUI/Package.appxmanifest new file mode 100644 index 0000000..86b0fb4 --- /dev/null +++ b/DummyWinUI/Package.appxmanifest @@ -0,0 +1,51 @@ + + + + + + + + + + DummyWinUI + rolan + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DummyWinUI/Properties/PublishProfiles/win-arm64.pubxml b/DummyWinUI/Properties/PublishProfiles/win-arm64.pubxml new file mode 100644 index 0000000..8953cce --- /dev/null +++ b/DummyWinUI/Properties/PublishProfiles/win-arm64.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + ARM64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/DummyWinUI/Properties/PublishProfiles/win-x64.pubxml b/DummyWinUI/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000..cd99561 --- /dev/null +++ b/DummyWinUI/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/DummyWinUI/Properties/PublishProfiles/win-x86.pubxml b/DummyWinUI/Properties/PublishProfiles/win-x86.pubxml new file mode 100644 index 0000000..a70c694 --- /dev/null +++ b/DummyWinUI/Properties/PublishProfiles/win-x86.pubxml @@ -0,0 +1,14 @@ + + + + + FileSystem + x86 + win-x86 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + + \ No newline at end of file diff --git a/DummyWinUI/Properties/launchSettings.json b/DummyWinUI/Properties/launchSettings.json new file mode 100644 index 0000000..1490458 --- /dev/null +++ b/DummyWinUI/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "DummyWinUI (Package)": { + "commandName": "MsixPackage" + }, + "DummyWinUI (Unpackaged)": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/DummyWinUI/app.manifest b/DummyWinUI/app.manifest new file mode 100644 index 0000000..be36165 --- /dev/null +++ b/DummyWinUI/app.manifest @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + PerMonitorV2 + + + \ No newline at end of file diff --git a/PVabel2026.slnx b/PVabel2026.slnx new file mode 100644 index 0000000..55050b0 --- /dev/null +++ b/PVabel2026.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/YetAnotherDummy/Program.cs b/YetAnotherDummy/Program.cs new file mode 100644 index 0000000..27538ff --- /dev/null +++ b/YetAnotherDummy/Program.cs @@ -0,0 +1,176 @@ +// See https://aka.ms/new-console-template for more information +using System.Net; +using System.Net.Sockets; +using static RemoteFrameBufferClientProtocol; + +IPAddress tessia = new([192,168,16,253]); + +IRemoteFrameBufferClientStreamProvider tessia6001vnc = new IRemoteFrameBufferClientStreamProvider.RemoteFrameBufferTcpClientStreamProvider(tessia, 5901); +RemoteFramebufferClient client = new(tessia6001vnc); + +client.Start(); +Console.ReadLine(); +client.Stop(); + +public interface INetEndPoint +{ + public IPEndPoint EndPoint { get; } + public IPAddress Address { get; } + public Int32 Port { get; } + + public class NetEndPointFromIP : INetEndPoint + { + public IPEndPoint EndPoint { get; } + public IPAddress Address => this.EndPoint.Address; + public Int32 Port => this.EndPoint.Port; + + public NetEndPointFromIP(IPEndPoint endpoint) + { + this.EndPoint = endpoint; + } + + public NetEndPointFromIP(IPAddress address, Int32 port) : this(new(address, port)) { } + } + + public class NetEndPointFromHostname(String hostname, Int32 port) : INetEndPoint + { + public String Hostname { get; } = hostname; + public IPEndPoint EndPoint => new(this.Address, this.Port); + + public IPAddress Address { + get + { + IPHostEntry entry = Dns.GetHostEntry(this.Hostname); + return entry.AddressList[0]; + } + } + public Int32 Port { get; } = port; + } +} + +public interface IRemoteFrameBufferClientStreamProvider +{ + public Stream GetRemoteFrameBufferClientStream(); + + public class RemoteFrameBufferTcpClientStreamProvider : IRemoteFrameBufferClientStreamProvider + { + private readonly INetEndPoint remoteEndPoint; + private readonly IPEndPoint localEndPoint; + + public RemoteFrameBufferTcpClientStreamProvider(INetEndPoint remoteEndPoint, IPEndPoint? localEndPoint) + { + this.remoteEndPoint = remoteEndPoint; + this.localEndPoint = localEndPoint ?? new(IPAddress.Any, 0); + } + + public Stream GetRemoteFrameBufferClientStream() + { + TcpClient tcpClient = new TcpClient(this.localEndPoint); + tcpClient.Connect(this.remoteEndPoint.EndPoint); + return tcpClient.GetStream(); + } + + public RemoteFrameBufferTcpClientStreamProvider(String hostname, Int16 port, IPEndPoint? localEndPoint = null) : this(new INetEndPoint.NetEndPointFromHostname(hostname, port), localEndPoint) { } + public RemoteFrameBufferTcpClientStreamProvider(IPAddress address, Int32 port, IPEndPoint? localEndPoint = null) : this(new INetEndPoint.NetEndPointFromIP(address, port), localEndPoint) { } + public RemoteFrameBufferTcpClientStreamProvider(IPEndPoint remoteEndPoint, IPEndPoint? localEndPoint = null) : this(new INetEndPoint.NetEndPointFromIP(remoteEndPoint), localEndPoint) { } + } +} + +public class RemoteFramebufferClient +{ + private static Dictionary _protocolHandlers; + + private readonly IRemoteFrameBufferClientStreamProvider _socketProvider; + private Task? backgroundWorker; + private CancellationTokenSource cancellationTokenSource = new(); + + static RemoteFramebufferClient() { + _protocolHandlers = new() { + { new RfbProtoVersion(3, 3), new RemoteFrameBufferClientProtocolFactory() }, + }; + } + + public RemoteFramebufferClient(IRemoteFrameBufferClientStreamProvider socketProvider) + { + this._socketProvider = socketProvider; + } + + public void Start() + { + if (this.backgroundWorker == null) + { + Console.Error.WriteLine("VNC client starting"); + this.backgroundWorker = new Task(this.Worker, this.cancellationTokenSource.Token); + this.backgroundWorker.ContinueWith(this.WorkerStopped); + this.backgroundWorker.Start(); + } + } + + public void Stop() + { + if (this.backgroundWorker != null) + { + this.cancellationTokenSource.Cancel(); + this.backgroundWorker.Wait(); + } + } + + private void Worker() + { + while (!this.cancellationTokenSource.Token.IsCancellationRequested) + { + Console.Error.WriteLine("Attempting to connect"); + Stream s = this._socketProvider.GetRemoteFrameBufferClientStream(); + using (s) + { + + } + + } + } + + private void WorkerStopped(Task t) + { + Console.Error.WriteLine("VNC client exited"); + this.backgroundWorker = null; + if (!this.cancellationTokenSource.TryReset()) + { + this.cancellationTokenSource = new(); + } + } + + private struct RfbProtoVersion(Int16 major, Int16 minor) + { + public Int16 Major = major; + public Int16 Minor = minor; + } + +} + +public abstract class RemoteFrameBufferClientProtocol +{ + protected readonly Stream vncStream; + + public RemoteFrameBufferClientProtocol(Stream s) + { + this.vncStream = s; + } + + public interface IRemoteFramebufferClientProtocolFactory { + public abstract RemoteFrameBufferClientProtocol Construct(Stream s); + } + public class RemoteFrameBufferClientProtocolFactory : IRemoteFramebufferClientProtocolFactory where T : RemoteFrameBufferClientProtocol + { + public RemoteFrameBufferClientProtocol Construct(Stream s) + { + return (RemoteFrameBufferClientProtocol)Activator.CreateInstance(typeof(T), s)!; + } + } + + public class RemoteFrameBufferClientProtocol_3_3 : RemoteFrameBufferClientProtocol + { + public RemoteFrameBufferClientProtocol_3_3(Stream s) : base(s) + { + } + } +} \ No newline at end of file diff --git a/YetAnotherDummy/YetAnotherDummy.csproj b/YetAnotherDummy/YetAnotherDummy.csproj new file mode 100644 index 0000000..ed9781c --- /dev/null +++ b/YetAnotherDummy/YetAnotherDummy.csproj @@ -0,0 +1,10 @@ + + + + Exe + net10.0 + enable + enable + + +