Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.
Closed

WPF #120

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5485924
Adding base core
xafero Jun 3, 2023
51a3d36
Replacing the views and adding UI independent helpers
xafero Jun 3, 2023
4734793
Update .gitignore
xafero Jun 3, 2023
0d50e09
Added message boxes even without main window initialized
xafero Jun 3, 2023
e1d385e
Adding older code without ui deps
xafero Jun 3, 2023
0452a0f
Correcting namespaces
xafero Jun 3, 2023
a7abd57
Fixing visual designer not opening anymore
xafero Jun 3, 2023
c63f503
Added as much dialogs as initially possible
xafero Jun 3, 2023
8ac9421
Readding settings
xafero Jun 3, 2023
dc4ffaa
Working on main window
xafero Jun 3, 2023
cd8391b
Fixing dialog sizes
xafero Jun 3, 2023
01ac403
Got icons to show up in data grid
xafero Jun 3, 2023
285ae30
Showing status of VMs
xafero Jun 3, 2023
46e21cb
Restored open folder and file dialogs
xafero Jun 3, 2023
0bfb108
Implementing vm row
xafero Jun 3, 2023
043d3c6
Added missing button actions
xafero Jun 3, 2023
5a92321
Added the context menu for vm
xafero Jun 3, 2023
67b5b27
Uncommenting code
xafero Jun 3, 2023
0038630
Implemented row
xafero Jun 3, 2023
bfa5045
Adding tray icon
xafero Jun 4, 2023
7abcf4a
Implemented some of the rest
xafero Jun 4, 2023
2b89cf8
Cleaning some
xafero Jun 4, 2023
721f7d8
Correcting colors in setting version
xafero Jun 4, 2023
1cb5aed
Removing old code and replaced with more stable one
xafero Jun 4, 2023
1e5c15d
Made script executable
xafero Jun 4, 2023
8c55e80
Fixed start position of dialogs and message boxes
xafero Jun 4, 2023
a9be9a9
Removed doubled code
xafero Jun 4, 2023
5f9f987
Fixed add dialog
xafero Jun 4, 2023
dd3c8a8
Fixed clone dialog
xafero Jun 4, 2023
6440973
Fixed edit dialog
xafero Jun 4, 2023
787c405
Fixed settings dialog
xafero Jun 4, 2023
297abe1
Fixed wrong thread
xafero Jun 4, 2023
b38d200
Merging other repo
xafero Jun 20, 2023
3a2427a
Merging other repo
xafero Jun 20, 2023
de6af4e
Removed second build script
xafero Jun 20, 2023
a045810
Corrected namespaces
xafero Jun 20, 2023
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
43 changes: 43 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: .NET

on:
push:
branches: [ "master" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal

- name: Publish
if: startsWith(github.ref, 'refs/tags/')
run: |
sudo apt-get install -y zip
./build.sh

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: pub/*.*
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,7 @@ ASALocalRun/
.mfractor/

# Local History for Visual Studio
.localhistory/
.localhistory/
/dist
/pub
.DS_Store
8 changes: 8 additions & 0 deletions 86BoxManager.API/86BoxManager.API.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_86BoxManager.API</RootNamespace>
</PropertyGroup>

</Project>
17 changes: 17 additions & 0 deletions 86BoxManager.API/IEnv.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace _86BoxManager.API
{
public interface IEnv
{
string MyComputer { get; }

string UserProfile { get; }

string[] ExeNames { get; }

string MyDocuments { get; }

string Desktop { get; }

string[] GetProgramFiles(string appName);
}
}
17 changes: 17 additions & 0 deletions 86BoxManager.API/IExecVars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace _86BoxManager.API
{
public interface IExecVars
{
string FileName { get; }

string RomPath { get; }

string LogFile { get; }

string VmPath { get; }

IVm Vm { get; }

(string id, string hWnd)? Handle { get; }
}
}
11 changes: 11 additions & 0 deletions 86BoxManager.API/IExecutor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Diagnostics;

namespace _86BoxManager.API
{
public interface IExecutor
{
ProcessStartInfo BuildStartInfo(IExecVars args);

ProcessStartInfo BuildConfigInfo(IExecVars args);
}
}
21 changes: 21 additions & 0 deletions 86BoxManager.API/IManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace _86BoxManager.API
{
public interface IManager
{
bool IsFirstInstance(string name);

IntPtr RestoreAndFocus(string title, string handleTitle);

bool IsProcessRunning(string name);

IVerInfo GetBoxVersion(string exeDir);

IMessageLoop GetLoop(IMessageReceiver callback);

IMessageSender GetSender();

IExecutor GetExecutor();
}
}
9 changes: 9 additions & 0 deletions 86BoxManager.API/IMessageLoop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System;

namespace _86BoxManager.API
{
public interface IMessageLoop
{
IntPtr GetHandle();
}
}
18 changes: 18 additions & 0 deletions 86BoxManager.API/IMessageReceiver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace _86BoxManager.API
{
public interface IMessageReceiver
{
void OnEmulatorInit(IntPtr hWnd, uint vmId);
void OnEmulatorShutdown(IntPtr hWnd);

void OnVmPaused(IntPtr hWnd);
void OnVmResumed(IntPtr hWnd);

void OnDialogOpened(IntPtr hWnd);
void OnDialogClosed(IntPtr hWnd);

void OnManagerStartVm(string vmName);
}
}
20 changes: 20 additions & 0 deletions 86BoxManager.API/IMessageSender.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;

namespace _86BoxManager.API
{
public interface IMessageSender
{
void DoVmRequestStop(IVm vm);
void DoVmForceStop(IVm vm);

void DoVmPause(IVm vm);
void DoVmResume(IVm vm);

void DoVmCtrlAltDel(IVm vm);
void DoVmHardReset(IVm vm);

void DoVmConfigure(IVm vm);

void DoManagerStartVm(IntPtr hWnd, string vmName);
}
}
17 changes: 17 additions & 0 deletions 86BoxManager.API/IShell.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace _86BoxManager.API
{
public interface IShell
{
void CreateShortcut(string address, string name, string desc, string startup);

void PushToForeground(IntPtr window);

void PrepareAppId(string appId);

void OpenFolder(string folder);

void EditFile(string file);
}
}
13 changes: 13 additions & 0 deletions 86BoxManager.API/IVerInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace _86BoxManager.API
{
public interface IVerInfo
{
int FilePrivatePart { get; }

int FileMajorPart { get; }

int FileMinorPart { get; }

int FileBuildPart { get; }
}
}
24 changes: 24 additions & 0 deletions 86BoxManager.API/IVm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

// ReSharper disable InconsistentNaming

namespace _86BoxManager.API
{
public interface IVm
{
/// <summary>
/// Name of the virtual machine
/// </summary>
string Name { get; }

/// <summary>
/// Window handle for the VM once it's started
/// </summary>
IntPtr hWnd { get; }

/// <summary>
/// Callback to invoke when VM is gone
/// </summary>
Action<IVm> OnExit { set; }
}
}
12 changes: 12 additions & 0 deletions 86BoxManager.Common/86BoxManager.Common.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>_86BoxManager.Common</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\86BoxManager.API\86BoxManager.API.csproj" />
</ItemGroup>

</Project>
19 changes: 19 additions & 0 deletions 86BoxManager.Common/CommonExecVars.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using _86BoxManager.API;

namespace _86BoxManager.Common
{
public sealed class CommonExecVars : IExecVars
{
public string FileName { get; set; }

public string RomPath { get; set; }

public string LogFile { get; set; }

public string VmPath { get; set; }

public IVm Vm { get; set; }

public (string id, string hWnd)? Handle { get; set; }
}
}
39 changes: 39 additions & 0 deletions 86BoxManager.Common/CommonExecutor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Diagnostics;
using _86BoxManager.API;

namespace _86BoxManager.Common
{
public abstract class CommonExecutor : IExecutor
{
public virtual ProcessStartInfo BuildStartInfo(IExecVars args)
{
var info = new ProcessStartInfo(args.FileName);
var ops = info.ArgumentList;
if (!string.IsNullOrWhiteSpace(args.RomPath))
{
ops.Add("-R");
ops.Add(args.RomPath);
}
if (!string.IsNullOrWhiteSpace(args.LogFile))
{
ops.Add("-L");
ops.Add(args.LogFile);
}
ops.Add("-P");
ops.Add(args.VmPath);
ops.Add("-V");
ops.Add(args.Vm.Name);
return info;
}

public virtual ProcessStartInfo BuildConfigInfo(IExecVars args)
{
var info = new ProcessStartInfo(args.FileName);
var ops = info.ArgumentList;
ops.Add("--settings");
ops.Add("-P");
ops.Add(args.VmPath);
return info;
}
}
}
47 changes: 47 additions & 0 deletions 86BoxManager.Common/CommonManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using _86BoxManager.API;

namespace _86BoxManager.Common
{
public abstract class CommonManager : IManager
{
private IntPtr _lastEnemy;

public virtual bool IsFirstInstance(string name)
{
var entry = Assembly.GetEntryAssembly()?.Location;
if (entry != null)
{
var exeName = Path.GetFileNameWithoutExtension(entry);
var myProcId = Environment.ProcessId;
var processes = Process.GetProcessesByName(exeName);
foreach (var proc in processes)
if (proc.Id != myProcId)
{
_lastEnemy = new IntPtr(proc.Id);
return false;
}
}
return true;
}

public virtual IntPtr RestoreAndFocus(string title, string handleTitle)
{
return _lastEnemy;
}

public virtual bool IsProcessRunning(string name)
{
var processes = Process.GetProcessesByName(name);
return processes.Length > 0;
}

public abstract IVerInfo GetBoxVersion(string exeDir);
public abstract IMessageLoop GetLoop(IMessageReceiver callback);
public abstract IMessageSender GetSender();
public abstract IExecutor GetExecutor();
}
}
Loading