Skip to content

Add PowerKit and Gress integrations; replace redundant utilities/extensions#812

Merged
Tyrrrz merged 12 commits intoprimefrom
copilot/add-powerkit-package
Apr 20, 2026
Merged

Add PowerKit and Gress integrations; replace redundant utilities/extensions#812
Tyrrrz merged 12 commits intoprimefrom
copilot/add-powerkit-package

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

  • Update PowerKit to 1.1.1
  • Update Gress to 2.2.0
  • Delete ResizableSemaphore.cs — now in PowerKit
  • Delete ThrottleLock.cs — now in PowerKit
  • Delete DirectoryExtensions.csDirectory.CreateForFile now in PowerKit
  • Delete CommandExtensions.csExecuteIfCan now in PowerKit
  • Delete NotifyPropertyChangedExtensions.cs — now in PowerKit
  • Delete ProcessExtensions.csProcess.StartShellExecute now in PowerKit
  • Delete DisposableCollector.cs — replaced by Disposable.Merge from PowerKit
  • Delete HttpExtensions.csHttpClient.DownloadAsync now in Gress.Integrations.HttpClientExtensions
  • Delete StreamExtensions.cs — only used internally by the deleted HttpExtensions
  • Delete Url.csUrl.TryExtractFileName replaced by Uri.TryGetFileName() from PowerKit
  • Rename CreateDirectoryForFileCreateForFile at all call sites
  • Replace DisposableCollector usage with IDisposable _eventSubscription fields; multi-subscription sites use Disposable.Merge
  • Update using directives in all affected files (add PowerKit.Extensions / Gress.Integrations, remove stale YoutubeDownloader.Utils.Extensions where no longer needed)

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 18, 2026

I think you might be able to replace DisposableCollector with Disposable.Merge entirely @copilot

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 18, 2026

I think you might be able to replace DisposableCollector with Disposable.Merge entirely @copilot

Done in 50547b8. DisposableCollector is deleted — all 6 call sites now hold an IDisposable _eventRoot field. Classes with a single subscription assign it directly; those with two (LocalizationManager, DashboardViewModel) use Disposable.Merge(item1, item2).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from Tyrrrz April 18, 2026 20:15
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 18, 2026

@copilot rename _eventRoot to _eventSubscription

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 18, 2026

@copilot rename _eventRoot to _eventSubscription

Done in 895dab0 — renamed across all 6 files.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 19, 2026

@copilot update PowerKit to the latest pre-release version and check if you can replace more utilities/extensions now. Also check if any of its provided utilities/extensions can be useful to refactor existing code.

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 19, 2026

@copilot please fix build errors

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 19, 2026

@copilot please fix build errors

Fixed in 9a3ab92 — the YoutubeDownloader.Core.Downloading using directive was accidentally dropped from DashboardViewModel.cs during the refactor. Build now succeeds.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 20, 2026

@copilot if you update Gress, you should be able to remove a few more extensions I believe.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

@copilot if you update Gress, you should be able to remove a few more extensions I believe.

Done in bf454e2. Updated Gress to 2.2.0, which adds Gress.Integrations.HttpClientExtensions.DownloadAsync (matching the exact IProgress<Percentage> signature we used). Deleted HttpExtensions.cs and StreamExtensions.cs — the latter was only ever used internally by HttpExtensions. Updated FFmpeg.cs to use Gress.Integrations instead.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add PowerKit and replace redundant utilities/extensions Add PowerKit and Gress integrations; replace redundant utilities/extensions Apr 20, 2026
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Apr 20, 2026

@copilot also please update PowerKit. It comes with Uri.TryGetFileName() and maybe some other useful things.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 20, 2026

@copilot also please update PowerKit. It comes with Uri.TryGetFileName() and maybe some other useful things.

Done in 64bdf99. Updated PowerKit to 1.1.1. The new Uri.TryGetFileName() extension replaces the hand-rolled Url.TryExtractFileName regex — YoutubeExtensions.cs now calls new Uri(thumbnail.Url).TryGetFileName() and Url.cs is deleted.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.2/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Tyrrrz Tyrrrz marked this pull request as ready for review April 20, 2026 19:27
Copilot AI review requested due to automatic review settings April 20, 2026 19:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the solution to rely on PowerKit and Gress 2.2.0 for common integrations/utilities, removing several local helper/extension implementations that are now redundant.

Changes:

  • Add PowerKit package references (UI + Core) and bump Gress to 2.2.0 via central package management.
  • Replace local utility classes (e.g., DisposableCollector, ResizableSemaphore, ThrottleLock, various extensions) with PowerKit/Gress equivalents.
  • Update call sites/usings accordingly (e.g., Directory.CreateForFile, Process.StartShellExecute, HttpClient.DownloadAsync).

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
YoutubeDownloader/YoutubeDownloader.csproj Adds PowerKit dependency to the UI project.
YoutubeDownloader/Views/Components/DashboardView.axaml.cs Switches ExecuteIfCan extension import to PowerKit.
YoutubeDownloader/ViewModels/MainViewModel.cs Uses PowerKit Process extensions for shell execute.
YoutubeDownloader/ViewModels/Dialogs/SettingsViewModel.cs Replaces DisposableCollector with single IDisposable subscription.
YoutubeDownloader/ViewModels/Dialogs/DownloadSingleSetupViewModel.cs Uses PowerKit Directory.CreateForFile.
YoutubeDownloader/ViewModels/Dialogs/DownloadMultipleSetupViewModel.cs Uses PowerKit Directory.CreateForFile.
YoutubeDownloader/ViewModels/Dialogs/AuthSetupViewModel.cs Replaces DisposableCollector with single IDisposable subscription.
YoutubeDownloader/ViewModels/Components/DownloadViewModel.cs Replaces DisposableCollector with single IDisposable subscription; uses PowerKit Process extensions.
YoutubeDownloader/ViewModels/Components/DashboardViewModel.cs Replaces DisposableCollector with Disposable.Merge; migrates ResizableSemaphore to PowerKit.
YoutubeDownloader/Utils/ResizableSemaphore.cs Deleted (now provided by PowerKit).
YoutubeDownloader/Utils/Extensions/ProcessExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader/Utils/Extensions/NotifyPropertyChangedExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader/Utils/Extensions/DisposableExtensions.cs Deleted (no longer needed after PowerKit migration).
YoutubeDownloader/Utils/Extensions/DirectoryExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader/Utils/Extensions/CommandExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader/Utils/DisposableCollector.cs Deleted (replaced by Disposable.Merge / individual IDisposable fields).
YoutubeDownloader/Utils/Disposable.cs Deleted (replaced by PowerKit Disposable).
YoutubeDownloader/Localization/LocalizationManager.cs Uses Disposable.Merge + PowerKit property-watch extensions.
YoutubeDownloader/Framework/ViewModelManager.cs Uses PowerKit collection extensions (AddRange).
YoutubeDownloader/App.axaml.cs Replaces DisposableCollector with single IDisposable subscription for theme watching.
YoutubeDownloader.Core/YoutubeDownloader.Core.csproj Adds PowerKit dependency to the Core project.
YoutubeDownloader.Core/Utils/Url.cs Deleted (replaced by PowerKit URI helpers).
YoutubeDownloader.Core/Utils/ThrottleLock.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Utils/Http.cs Uses PowerKit assembly version helper for User-Agent.
YoutubeDownloader.Core/Utils/Extensions/YoutubeExtensions.cs Deleted (replaced by new thumbnail extension).
YoutubeDownloader.Core/Utils/Extensions/ThumbnailExtensions.cs New: derives thumbnail image format using PowerKit URI helpers.
YoutubeDownloader.Core/Utils/Extensions/StringExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Utils/Extensions/StreamExtensions.cs Deleted (was only used by removed HTTP extension).
YoutubeDownloader.Core/Utils/Extensions/PathExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Utils/Extensions/HttpExtensions.cs Deleted (replaced by Gress HttpClient integration).
YoutubeDownloader.Core/Utils/Extensions/GenericExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Utils/Extensions/CollectionExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Utils/Extensions/AsyncCollectionExtensions.cs Deleted (now provided by PowerKit).
YoutubeDownloader.Core/Tagging/MusicBrainzClient.cs Migrates ThrottleLock usage to PowerKit type.
YoutubeDownloader.Core/Tagging/MediaTagInjector.cs Uses new ThumbnailExtensions.TryGetImageFormat.
YoutubeDownloader.Core/Downloading/VideoDownloadOption.cs Switches to PowerKit extensions for collection helpers.
YoutubeDownloader.Core/Downloading/FileNameTemplate.cs Switches to PowerKit Path.EscapeFileName.
YoutubeDownloader.Core/Downloading/FFmpeg.cs Switches to Gress.Integrations HttpClient download extension.
Directory.Packages.props Adds PowerKit 1.1.1 and bumps Gress to 2.2.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
Comment thread YoutubeDownloader.Core/Utils/Extensions/ThumbnailExtensions.cs Outdated
Tyrrrz and others added 2 commits April 20, 2026 22:34
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Tyrrrz Tyrrrz merged commit b202937 into prime Apr 20, 2026
11 checks passed
@Tyrrrz Tyrrrz deleted the copilot/add-powerkit-package branch April 20, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants