mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' of https://github.com/Koisu-unavailable/Flow.Launcher into dev
This commit is contained in:
commit
8d8388be61
1 changed files with 6 additions and 3 deletions
|
|
@ -8,6 +8,7 @@ using Mages.Core;
|
|||
using Flow.Launcher.Plugin.Calculator.ViewModels;
|
||||
using Flow.Launcher.Plugin.Calculator.Views;
|
||||
|
||||
|
||||
namespace Flow.Launcher.Plugin.Calculator
|
||||
{
|
||||
public class Main : IPlugin, IPluginI18n, ISettingProvider
|
||||
|
|
@ -15,7 +16,7 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
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|" +
|
||||
@"bin2dec|hex2dec|oct2dec|" +
|
||||
@"factorial|sign|isprime|isinfty|" +
|
||||
|
|
@ -45,6 +46,8 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
{ "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)
|
||||
|
|
@ -169,9 +172,9 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
|
||||
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 == "[")
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue