[Run][Plugin] Rename Calculator plugin to follow the required schema (#9026)

This commit is contained in:
dziadkiewicz 2021-01-20 11:38:52 +01:00 committed by GitHub
parent 433e2e57ed
commit da33d22c85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 186 additions and 190 deletions

View File

@ -104,7 +104,7 @@ steps:
testAssemblyVer2: |
**\Microsoft.Plugin.Folder.UnitTest.dll
**\Microsoft.Plugin.Program.UnitTests.dll
**\Microsoft.Plugin.Calculator.UnitTest.dll
**\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll
**\Microsoft.Plugin.Uri.UnitTests.dll
**\Wox.Test.dll
**\Microsoft.PowerToys.Settings.UI.UnitTests.dll

View File

@ -103,10 +103,10 @@ build:
- 'modules\launcher\ManagedCommon.dll'
- 'modules\launcher\Microsoft.PowerToys.Common.UI.dll'
- 'modules\launcher\Microsoft.Launcher.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Calculator\Microsoft.Plugin.Calculator.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Calculator\Wox.Infrastructure.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Calculator\Wox.Plugin.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Calculator\Telemetry.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Microsoft.PowerToys.Run.Plugin.Calculator.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Wox.Infrastructure.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Wox.Plugin.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Telemetry.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Folder\Microsoft.Plugin.Folder.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Folder\Wox.Infrastructure.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Folder\Wox.Plugin.dll'

View File

@ -127,7 +127,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wox.Test", "src\modules\lau
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{4AFC9975-2456-4C70-94A4-84073C1CED93}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Calculator", "src\modules\launcher\Plugins\Microsoft.Plugin.Calculator\Microsoft.Plugin.Calculator.csproj", "{59BD9891-3837-438A-958D-ADC7F91F6F7E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.Calculator", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Microsoft.PowerToys.Run.Plugin.Calculator.csproj", "{59BD9891-3837-438A-958D-ADC7F91F6F7E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.WindowWalker", "src\modules\launcher\Plugins\Microsoft.Plugin.WindowWalker\Microsoft.Plugin.WindowWalker.csproj", "{74F1B9ED-F59C-4FE7-B473-7B453E30837E}"
EndProject
@ -233,7 +233,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Uri.UnitTe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Settings.UI.UnitTests", "src\settings-ui\Microsoft.PowerToys.Settings.UI.UnitTests\Microsoft.PowerToys.Settings.UI.UnitTests.csproj", "{0F85E674-34AE-443D-954C-8321EB8B93B1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Calculator.UnitTest", "src\modules\launcher\Plugins\Microsoft.Plugin.Calculator.UnitTest\Microsoft.Plugin.Calculator.UnitTest.csproj", "{632BBE62-5421-49EA-835A-7FFA4F499BD6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.csproj", "{632BBE62-5421-49EA-835A-7FFA4F499BD6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.Folder.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.Folder.UnitTests\Microsoft.Plugin.Folder.UnitTests.csproj", "{4FA206A5-F69F-4193-BF8F-F6EEB496734C}"
EndProject

View File

@ -3,18 +3,18 @@ The Calculator plugin as the name suggests is used to perform calculations on th
![Image of Calculator plugin](/doc/images/launcher/plugins/calculator.png)
### [`CalculateHelper`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs)
- The [`CalculateHelper.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs) class checks to see if the user entered query is a valid input to the calculator and only if the input is valid does it perform the operation.
### [`CalculateHelper`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs)
- The [`CalculateHelper.cs`](src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateHelper.cs) class checks to see if the user entered query is a valid input to the calculator and only if the input is valid does it perform the operation.
- It does so by matching the user query to a valid regex.
### [`CalculateEngine`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs)
- The main computation is done in the [`CalculateEngine.cs`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs) file using the `Mages` library.
### [`CalculateEngine`](src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateEngine.cs)
- The main computation is done in the [`CalculateEngine.cs`](src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateEngine.cs) file using the `Mages` library.
```csharp
var result = CalculateEngine.Interpret(query.Search, CultureInfo.CurrentUICulture);
```
### [`CalculateResult`](src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateResult.cs)
### [`CalculateResult`](src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/CalculateResult.cs)
- The class which encapsulates the result of the computation.
- It comprises of the `Result` and `RoundedResult` properties.

View File

@ -222,7 +222,7 @@
<Directory Id="AssetsFolder" Name="Assets" />
<Directory Id="LauncherImagesFolder" Name="Images" />
<Directory Id="LauncherPluginsFolder" Name="Plugins">
<Directory Id="CalculatorPluginFolder" Name="Microsoft.Plugin.Calculator">
<Directory Id="CalculatorPluginFolder" Name="Calculator">
<Directory Id="CalculatorImagesFolder" Name="Images" />
<Directory Id="CalculatorLanguagesFolder" Name="Languages" />
</Directory>
@ -855,7 +855,7 @@
</Component>
<!-- Launcher plugin resources -->
<Component Id="Launcher_Calculator_$(var.IdSafeLanguage)_Component" Directory="Resource$(var.IdSafeLanguage)CalculatorPluginFolder">
<File Id="Launcher_Calculator_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\$(var.Language)\Microsoft.Plugin.Calculator.resources.dll" />
<File Id="Launcher_Calculator_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\Calculator\$(var.Language)\Microsoft.PowerToys.Run.Plugin.Calculator.resources.dll" />
</Component>
<Component Id="Launcher_Folder_$(var.IdSafeLanguage)_Component" Directory="Resource$(var.IdSafeLanguage)FolderPluginFolder">
<File Id="Launcher_Folder_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Folder\$(var.Language)\Microsoft.Plugin.Folder.resources.dll" />
@ -910,13 +910,13 @@
<!-- Calculator Plugin -->
<Component Id="calculatorComponent" Directory="CalculatorPluginFolder" Guid="19DE1022-583C-4969-9AFC-D43CB944003D">
<?foreach File in plugin.json;Microsoft.Plugin.Calculator.deps.json;Microsoft.Plugin.Calculator.dll;ManagedTelemetry.dll?>
<File Id="Calculator_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\$(var.File)" />
<?foreach File in plugin.json;Microsoft.PowerToys.Run.Plugin.Calculator.deps.json;Microsoft.PowerToys.Run.Plugin.Calculator.dll;ManagedTelemetry.dll?>
<File Id="Calculator_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Calculator\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="calculatorImagesComponent" Directory="CalculatorImagesFolder" Guid="07EC9232-CF9A-4CDB-8D8E-E79DC75096C0">
<File Id="calculatorPluginImg_calculator_light" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.light.png" />
<File Id="calculatorPluginImg_calculator_dark" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.Plugin.Calculator\Images\calculator.dark.png" />
<File Id="calculatorPluginImg_calculator_light" Source="$(var.BinX64Dir)modules\launcher\Plugins\Calculator\Images\calculator.light.png" />
<File Id="calculatorPluginImg_calculator_dark" Source="$(var.BinX64Dir)modules\launcher\Plugins\Calculator\Images\calculator.dark.png" />
</Component>
<!-- Folder Plugin -->

View File

@ -4,7 +4,7 @@
using NUnit.Framework;
namespace Microsoft.Plugin.Calculator.UnitTests
namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
{
[TestFixture]
public class BracketHelperTests

View File

@ -6,7 +6,7 @@ using System;
using System.Globalization;
using NUnit.Framework;
namespace Microsoft.Plugin.Calculator.UnitTests
namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
{
[TestFixture]
public class ExtendedCalculatorParserTests

View File

@ -5,7 +5,7 @@
<IsPackable>false</IsPackable>
<Platforms>x64</Platforms>
<RootNamespace>Microsoft.Plugin.Calculator.UnitTests</RootNamespace>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Plugin.Calculator\Microsoft.Plugin.Calculator.csproj" />
<ProjectReference Include="..\Microsoft.PowerToys.Run.Plugin.Calculator\Microsoft.PowerToys.Run.Plugin.Calculator.csproj" />
</ItemGroup>
<ItemGroup>

View File

@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public static class BracketHelper
{

View File

@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Globalization;
using Mages.Core;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public class CalculateEngine
{

View File

@ -5,7 +5,7 @@
using System;
using System.Text.RegularExpressions;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public static class CalculateHelper
{

View File

@ -3,9 +3,8 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public struct CalculateResult : IEquatable<CalculateResult>
{

View File

@ -4,9 +4,9 @@
"LanguageSet": "Azure_Languages",
"LocItems": [
{
"SourceFile": "src\\modules\\launcher\\Plugins\\Microsoft.Plugin.Calculator\\Properties\\Resources.resx",
"SourceFile": "src\\modules\\launcher\\Plugins\\Microsoft.PowerToys.Run.Plugin.Calculator\\Properties\\Resources.resx",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\modules\\launcher\\Plugins\\Microsoft.Plugin.Calculator\\Properties"
"OutputPath": "src\\modules\\launcher\\Plugins\\Microsoft.PowerToys.Run.Plugin.Calculator\\Properties"
}
]
}

View File

@ -9,7 +9,7 @@ using ManagedCommon;
using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public class Main : IPlugin, IPluginI18n, IDisposable
{

View File

@ -5,8 +5,8 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Plugin.Calculator</RootNamespace>
<AssemblyName>Microsoft.Plugin.Calculator</AssemblyName>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.Calculator</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.Calculator</AssemblyName>
<Version>$(Version).0</Version>
<useWPF>true</useWPF>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
@ -17,7 +17,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Microsoft.Plugin.Calculator\</OutputPath>
<OutputPath>..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Calculator\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -30,7 +30,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\..\..\..\..\x64\Release\modules\launcher\Plugins\Microsoft.Plugin.Calculator\</OutputPath>
<OutputPath>..\..\..\..\..\x64\Release\modules\launcher\Plugins\Calculator\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>

View File

@ -7,7 +7,7 @@ using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
/// <summary>
/// Tries to convert all numbers in a text from one culture format to another.

View File

@ -8,10 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Plugin.Calculator.Properties {
using System;
namespace Microsoft.PowerToys.Run.Plugin.Calculator.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -39,7 +36,7 @@ namespace Microsoft.Plugin.Calculator.Properties {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Plugin.Calculator.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.PowerToys.Run.Plugin.Calculator.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

View File

@ -8,7 +8,7 @@ using System.Threading;
using System.Windows;
using Wox.Plugin;
namespace Microsoft.Plugin.Calculator
namespace Microsoft.PowerToys.Run.Plugin.Calculator
{
public static class ResultHelper
{

View File

@ -7,6 +7,6 @@
"Version":"1.0.0",
"Language":"csharp",
"Website":"https://aka.ms/powertoys",
"ExecuteFileName":"Microsoft.Plugin.Calculator.dll",
"ExecuteFileName":"Microsoft.PowerToys.Run.Plugin.Calculator.dll",
"IcoPath":"Images\\calculator.dark.png"
}