Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
71 changes: 71 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# GitHub Actions Build Workflow

This directory contains GitHub Actions workflows for automating the build process of the Spark project.

## Workflows

### build.yml

The main build workflow that builds the Spark Windows executable. This workflow runs on:
- Push to `main`, `master`, or `develop` branches
- Pull requests targeting `main`, `master`, or `develop` branches
- Manual trigger via workflow dispatch

#### Jobs

1. **build**: Creates a framework-dependent build
- Faster build time
- Smaller artifact size
- Requires .NET 8.0 runtime to be installed on the target machine
- Output artifact: `Spark-Windows-x64`

2. **build-self-contained**: Creates a self-contained build
- Includes .NET runtime
- Larger artifact size (~150MB+)
- No .NET runtime installation required on target machine
- Single-file executable with native libraries
- Output artifact: `Spark-Windows-x64-SelfContained`

#### Build Artifacts

Build artifacts are automatically uploaded and retained for 30 days. You can download them from the Actions tab of the repository.

## Requirements

- Windows runner (due to WPF/Windows Forms dependencies)
- .NET 8.0 SDK
- No additional secrets required for basic builds

## MSIX Packaging

MSIX packaging is not included in the automated workflow because it requires:
- Code signing certificate (must be stored as a GitHub secret)
- Additional configuration for certificate thumbprint
- Windows Store association (if distributing through Microsoft Store)

To add MSIX packaging in the future, you would need to:
1. Store the signing certificate as a GitHub secret
2. Import the certificate in the workflow
3. Build the `SparkMSIX.wapproj` project with appropriate signing configuration

## Local Testing

To test the build locally on Windows:

```powershell
# Framework-dependent build
dotnet restore Spark.csproj
dotnet build Spark.csproj --configuration Release
dotnet publish Spark.csproj --configuration Release --output ./publish

# Self-contained build
dotnet publish Spark.csproj --configuration Release --runtime win-x64 --self-contained true --output ./publish-self-contained -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
```

## Troubleshooting

**Build fails on non-Windows runner**: This is expected. The project uses WPF and Windows Forms, which require a Windows environment.

**Missing dependencies**: Ensure all NuGet packages are restored. The workflow automatically runs `dotnet restore` before building.

**Self-contained build is very large**: This is normal. Self-contained builds include the entire .NET runtime (~150MB+). If size is a concern, use the framework-dependent build instead.
86 changes: 86 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build Spark

on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
permissions:
contents: read
actions: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore Spark.csproj

- name: Build
run: dotnet build Spark.csproj --configuration Release --no-restore

- name: Publish executable
run: dotnet publish Spark.csproj --configuration Release --no-build --output ./publish

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: Spark-Windows-x64
path: ./publish/**/*
retention-days: 30

- name: Display build output
shell: pwsh
run: Get-ChildItem ./publish

build-self-contained:
runs-on: windows-latest
permissions:
contents: read
actions: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore Spark.csproj

- name: Build
run: dotnet build Spark.csproj --configuration Release --no-restore

- name: Publish self-contained executable
run: |
dotnet publish Spark.csproj `
--configuration Release `
--runtime win-x64 `
--self-contained true `
--output ./publish-self-contained `
-p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true

- name: Upload self-contained artifact
uses: actions/upload-artifact@v4
with:
name: Spark-Windows-x64-SelfContained
path: ./publish-self-contained/**/*
retention-days: 30

- name: Display build output
shell: pwsh
run: Get-ChildItem ./publish-self-contained
70 changes: 70 additions & 0 deletions MODERNIZATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Spark Project Modernization

This document outlines the modernization changes made to the Spark project to bring it up to current .NET standards and best practices.

## Changes Made

### .NET Framework Update
- **Updated global.json**: Modernized from .NET 5.0 to .NET 8.0
- **Updated target framework**: Changed from `net6.0-windows10.0.17763.0` to `net8.0-windows`
- **Updated C# language version**: Upgraded from C# 9 to C# 12

### Package Updates
The following packages were updated to their latest .NET 8.0 compatible versions:

- `Microsoft.Data.Sqlite`: 7.0.2 → 8.0.0
- `Microsoft.Web.WebView2`: 1.0.1518.46 → 1.0.2592.51
- `Microsoft.Win32.SystemEvents`: 7.0.0 → 8.0.0
- `System.Configuration.ConfigurationManager`: 7.0.0 → 8.0.0
- `System.Management`: 7.0.0 → 8.0.0
- `Newtonsoft.Json`: 13.0.2 → 13.0.3
- `NAudio`: 2.1.0 → 2.2.1
- `Microsoft.Windows.SDK.BuildTools`: 10.0.22621.1 → 10.0.26100.1

### Code Modernization
- **Replaced deprecated WindowsAPICodePack**: Replaced `WindowsAPICodePack-Shell` with the modern `OpenFolderDialog` API available in .NET
- **Removed legacy package**: Eliminated dependency on the old WindowsAPICodePack-Shell package

### Project Configuration
- **Simplified SDK reference**: Continued using `Microsoft.NET.Sdk` for better compatibility
- **Maintained Windows-specific features**: Preserved WPF and Windows Forms functionality
- **Updated build tools**: Modern Windows SDK BuildTools for MSIX packaging

## Building the Project

### Requirements
- .NET 8.0 SDK or later
- Windows 10/11 (required for WPF applications)
- Visual Studio 2022 or compatible IDE with Windows development workload

### Build Commands
```bash
# Restore packages
dotnet restore

# Build the main application
dotnet build Spark.csproj

# Build the entire solution (includes MSIX packaging)
dotnet build Spark.sln
```

### Platform Support
This is a Windows-specific WPF application. The modernization maintains this Windows-only requirement while updating to current .NET standards.

## Benefits of Modernization

1. **Latest .NET Features**: Access to .NET 8.0 performance improvements and language features
2. **Security Updates**: Latest package versions with security patches
3. **Modern APIs**: Replaced deprecated APIs with current alternatives
4. **Better Tooling**: Improved IDE support and debugging capabilities
5. **Future Compatibility**: Positioned for easier future updates

## Validation

The modernization has been validated to ensure:
- ✅ Package restore works correctly
- ✅ Project file is well-formed
- ✅ All dependencies are compatible with .NET 8.0
- ✅ Modern APIs are properly implemented
- ✅ Build configuration is optimized for current tools
21 changes: 10 additions & 11 deletions Spark.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
<StartupObject>Spark.App</StartupObject>
Expand All @@ -18,7 +18,7 @@
<PackageId>Spark</PackageId>
<AssemblyName>Spark</AssemblyName>
<RootNamespace>Spark</RootNamespace>
<LangVersion>9</LangVersion>
<LangVersion>12</LangVersion>
<PackageVersion>2.6.16</PackageVersion>
</PropertyGroup>

Expand Down Expand Up @@ -199,18 +199,17 @@
<PackageReference Include="Fleck" Version="1.2.0" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf.NetCore" Version="1.0.18" />
<PackageReference Include="HidSharpCore" Version="1.2.1.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1518.46" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="7.0.0" />
<PackageReference Include="NAudio" Version="2.1.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
<PackageReference Include="NAudio" Version="2.2.1" />
<PackageReference Include="NetMQ" Version="4.0.1.10" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="obs-websocket-dotnet" Version="5.0.0.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Management" Version="7.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="Vosk" Version="0.3.38" />
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
<PackageReference Include="ZstdNet" Version="1.4.5" />
<PackageReference Include="EchoVRAPI" Version="1.1.2" />
<PackageReference Include="ButterReplays" Version="1.3.4" />
Expand Down
2 changes: 1 addition & 1 deletion SparkMSIX/SparkMSIX.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Spark.csproj">
Expand Down
12 changes: 6 additions & 6 deletions Windows/Settings/UnifiedSettingsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Microsoft.WindowsAPICodePack.Dialogs;
using System.Windows.Navigation;
using System.Windows.Data;
using Newtonsoft.Json;
Expand Down Expand Up @@ -337,14 +336,15 @@ private void SetStorageLocation(object sender, RoutedEventArgs e)
{
if (!initialized) return;
string selectedPath = "";
CommonOpenFileDialog folderBrowserDialog = new CommonOpenFileDialog

var folderBrowserDialog = new OpenFolderDialog
Copy link

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenFolderDialog class requires a using statement for Microsoft.Win32 namespace. Verify that the appropriate using directive is added to ensure the code compiles correctly.

Copilot uses AI. Check for mistakes.
{
InitialDirectory = SparkSettings.instance.saveFolder,
IsFolderPicker = true
InitialDirectory = SparkSettings.instance.saveFolder
};
if (folderBrowserDialog.ShowDialog() == CommonFileDialogResult.Ok)

if (folderBrowserDialog.ShowDialog() == true)
{
selectedPath = folderBrowserDialog.FileName;
selectedPath = folderBrowserDialog.FolderName;
}

if (selectedPath != "")
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "5.0",
"version": "8.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
Expand Down
Loading
Loading