Skip to content
Closed
Changes from 4 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
9 changes: 6 additions & 3 deletions Plugins/Flow.Launcher.Plugin.Calculator/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
using Flow.Launcher.Plugin.Calculator.ViewModels;
using Flow.Launcher.Plugin.Calculator.Views;


namespace Flow.Launcher.Plugin.Calculator
{
public class Main : IPlugin, IPluginI18n, ISettingProvider
{
private static readonly Regex RegValidExpressChar = new Regex(
@"^(" +
@"ceil|floor|exp|pi|e|max|min|det|abs|log|ln|sqrt|" +
@"sin|cos|tan|arcsin|arccos|arctan|" +
@"sin|cos|tan|arcsin|arccos|arctan|rad2deg|deg2rad|" +
@"eigval|eigvec|eig|sum|polar|plot|round|sort|real|zeta|" +

Check warning on line 20 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`eig` is not a recognized word. (unrecognized-spelling)

Check warning on line 20 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`eigvec` is not a recognized word. (unrecognized-spelling)

Check warning on line 20 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`eigval` is not a recognized word. (unrecognized-spelling)
@"bin2dec|hex2dec|oct2dec|" +
@"factorial|sign|isprime|isinfty|" +

Check warning on line 22 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`isinfty` is not a recognized word. (unrecognized-spelling)

Check warning on line 22 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`isprime` is not a recognized word. (unrecognized-spelling)
@"==|~=|&&|\|\||(?:\<|\>)=?|" +
@"[ei]|[0-9]|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
@")+$", RegexOptions.Compiled);
Expand All @@ -45,6 +46,8 @@
{ "e", Math.E }, // e is not contained in the default mages engine
}
});
MagesEngine.SetFunction("rad2deg", (double rad) => rad * (180.0 / Math.PI));
MagesEngine.SetFunction("deg2rad", (double x) => x * (Math.PI / 180.0));
}

public List<Result> Query(Query query)
Expand Down Expand Up @@ -169,9 +172,9 @@

private bool IsBracketComplete(string query)
{
var matchs = RegBrackets.Matches(query);
var matches = RegBrackets.Matches(query);
var leftBracketCount = 0;
foreach (Match match in matchs)
foreach (Match match in matches)
{
if (match.Value == "(" || match.Value == "[")
{
Expand All @@ -188,12 +191,12 @@

public string GetTranslatedPluginTitle()
{
return Context.API.GetTranslation("flowlauncher_plugin_caculator_plugin_name");

Check warning on line 194 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`caculator` is not a recognized word. (unrecognized-spelling)
}

public string GetTranslatedPluginDescription()
{
return Context.API.GetTranslation("flowlauncher_plugin_caculator_plugin_description");

Check warning on line 199 in Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`caculator` is not a recognized word. (unrecognized-spelling)
}

public Control CreateSettingPanel()
Expand Down
Loading