From 4e03b766a99980f2a4bafe21c686340cc6c8e0ab Mon Sep 17 00:00:00 2001 From: Koisu Date: Thu, 19 Jun 2025 14:35:18 -0700 Subject: [PATCH] cleanup --- Plugins/Flow.Launcher.Plugin.Calculator/Main.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs index be07fd079..b2a1c82e3 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Calculator/Main.cs @@ -7,8 +7,7 @@ using System.Windows.Controls; using Mages.Core; using Flow.Launcher.Plugin.Calculator.ViewModels; using Flow.Launcher.Plugin.Calculator.Views; -using System.IO; -using System.Net.Quic; + namespace Flow.Launcher.Plugin.Calculator { @@ -23,7 +22,6 @@ namespace Flow.Launcher.Plugin.Calculator @"factorial|sign|isprime|isinfty|" + @"==|~=|&&|\|\||(?:\<|\>)=?|" + @"[ei]|[0-9]|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]]" + - @")+$", RegexOptions.Compiled); private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled); private static Engine MagesEngine; @@ -47,9 +45,7 @@ namespace Flow.Launcher.Plugin.Calculator { { "e", Math.E }, // e is not contained in the default mages engine } - } - ); - ; + }); Func rad2deg = (rad) => rad * (180.0 / Math.PI); MagesEngine.SetFunction("rad2deg", rad2deg); MagesEngine.SetFunction("deg2rad", (double x) => x * (Math.PI / 180.0)); @@ -76,7 +72,7 @@ namespace Flow.Launcher.Plugin.Calculator expression = query.Search; break; } - // Replace all spaces in the expression + var result = MagesEngine.Interpret(expression); if (result?.ToString() == "NaN")