Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Abstractions
Abstractions for Wox DLLs. Yay for testable community plugins!
https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Abstractions
microsoft-powertoys plugin plugins powertoys powertoys-run powertoys-run-plugin
Last synced: 4 months ago
JSON representation
Abstractions for Wox DLLs. Yay for testable community plugins!
- Host: GitHub
- URL: https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Abstractions
- Owner: hlaueriksson
- License: mit
- Created: 2024-08-12T16:37:35.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T17:38:25.000Z (4 months ago)
- Last Synced: 2024-08-13T18:12:55.361Z (4 months ago)
- Topics: microsoft-powertoys, plugin, plugins, powertoys, powertoys-run, powertoys-run-plugin
- Language: C#
- Homepage: https://www.nuget.org/packages/Community.PowerToys.Run.Plugin.Abstractions
- Size: 67.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-powertoys-run-plugins - Community.PowerToys.Run.Plugin.Abstractions - NuGet package with abstractions for community plugin dependencies. (Resources)
README
# Community.PowerToys.Run.Plugin.Abstractions
[![build](https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Abstractions/actions/workflows/build.yml/badge.svg)](https://github.com/hlaueriksson/Community.PowerToys.Run.Plugin.Abstractions/actions/workflows/build.yml)
[![Community.PowerToys.Run.Plugin.Abstractions](https://img.shields.io/nuget/v/Community.PowerToys.Run.Plugin.Abstractions.svg?label=Community.PowerToys.Run.Plugin.Abstractions)](https://www.nuget.org/packages/Community.PowerToys.Run.Plugin.Abstractions)This NuGet package is intended for PowerToys Run community plugins authors.
It contains abstractions for the `Wox` DLLs:
- `Wox.Infrastructure.dll`
- `Wox.Plugin.dll`In other words, interfaces and wrappers for the static classes:
- `Wox.Infrastructure.Helper`
- `Wox.Plugin.Common.DefaultBrowserInfo`
- `Wox.Plugin.Logger.Log`## Installation
.NET CLI:
```cmd
dotnet add package Community.PowerToys.Run.Plugin.Abstractions
```Package Manager:
```cmd
PM> NuGet\Install-Package Community.PowerToys.Run.Plugin.Abstractions
```PackageReference:
```csproj
```
## Example
```csproj
```
```cs
using Community.PowerToys.Run.Plugin.Abstractions;
using static Wox.Infrastructure.Helper;
``````cs
///
/// Initializes a new instance of the class.
///
public Main()
{
Helper = new HelperWrapper();
DefaultBrowserInfo = new DefaultBrowserInfoWrapper();
Log = new LogWrapper();
}internal Main(IHelper helper, IDefaultBrowserInfo defaultBrowserInfo, ILog log)
{
Helper = helper;
DefaultBrowserInfo = defaultBrowserInfo;
Log = log;
}private IHelper Helper { get; }
private IDefaultBrowserInfo DefaultBrowserInfo { get; }
private ILog Log { get; }
``````cs
DefaultBrowserInfo.UpdateIfTimePassed();if (!Helper.OpenCommandInShell(DefaultBrowserInfo.Path, DefaultBrowserInfo.ArgumentsPattern, url))
{
Log.Error("Open default browser failed.", GetType());
Api.ShowMsg($"Plugin: {Metadata.Name}", "Open default browser failed.");
}
``````cs
[SetUp]
public void SetUp()
{
_subject = new Main(Substitute.For(), Substitute.For(), Substitute.For());
}
```## Disclaimer
This is not an official Microsoft PowerToys package.