Skip to content

Refactor - #12

Merged
celeron533 merged 16 commits into
masterfrom
refactor
Sep 22, 2026
Merged

celeron533 merged 16 commits into
masterfrom
refactor

Conversation

@celeron533

Copy link
Copy Markdown
Owner

This pull request modernizes the window management and interop layers of the application by migrating from the deprecated PInvoke and custom NativeMethods to the official Windows.Win32 (CsWin32) interop library. It also improves resource management, updates the build pipeline to use the .NET SDK with dotnet CLI, and removes legacy dependencies. The most important changes are grouped below:

Migration to Windows.Win32 (CsWin32) Interop

  • Replaced all usages of PInvoke and custom NativeMethods with the official Windows.Win32 interop APIs in WindowInstanceInfo, WindowInstanceUtil, and related files, updating types (e.g., IntPtr to HWND) and method calls accordingly. (Stealth/Core/WindowInstanceInfo.cs, Stealth/Core/WindowInstanceUtil.cs, [1] [2] [3] [4] [5] [6] [7] [8]
  • Removed the now-unnecessary Stealth/Core/NativeMethods.cs file.

Resource Management Improvements

  • Added proper disposal of window icon bitmaps and implemented IDisposable in WindowInstanceInfo to prevent resource leaks. (Stealth/Core/WindowInstanceInfo.cs, [1] [2]

Build Pipeline Modernization

  • Updated the GitHub Actions workflow to use the .NET SDK (dotnet restore, dotnet build, dotnet test) instead of MSBuild/NuGet, set the solution file path, and replaced deprecated actions with their latest versions. (.github/workflows/msbuild.yml, [1] [2]

Dependency and Code Cleanup

  • Removed the unused GalaSoft.MvvmLight and related dispatcher initialization code from App.xaml.cs and MainService.cs. (Stealth/App.xaml.cs, [1] [2]; Stealth/Model/MainService.cs, [3]
  • Removed the System.Runtime.CompilerServices.Unsafe binding redirect from App.config as it is no longer needed. (Stealth/App.config, Stealth/App.configL16-L19)

Data Model and Event Handling Improvements

  • Ensured that the returned window info collection is a new instance and attached property change handlers to new items for proper MVVM updates. (Stealth/Model/MainService.cs, [1] [2]

•	Replaced ViewModelBase with ObservableObject
•	Replaced Set(...) with SetProperty(...)
•	Replaced Messenger.Default usage with WeakReferenceMessenger
•	Removed MvvmLight SimpleIoc/ServiceLocator usage from ViewModelLocator
•	Added a small CommunityToolkit message type for the About view trigger
•	Cleaned obsolete MvvmLight using directives
(but still fail to build in legacy project style)
- Potential GDI/memory leak in icon handling
- Nullable filter parameters are not handled safely
@celeron533
celeron533 merged commit 33f9a97 into master Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant