5
5
using System . Runtime . InteropServices ;
6
6
using System . Text . RegularExpressions ;
7
7
using System . Windows . Controls ;
8
- using Mages . Core ;
9
- using Flow . Launcher . Plugin . Calculator . Views ;
10
8
using Flow . Launcher . Plugin . Calculator . ViewModels ;
9
+ using Flow . Launcher . Plugin . Calculator . Views ;
10
+ using Mages . Core ;
11
11
12
12
namespace Flow . Launcher . Plugin . Calculator
13
13
{
@@ -57,10 +57,10 @@ public List<Result> Query(Query query)
57
57
{
58
58
var search = query . Search ;
59
59
bool isFunctionPresent = FunctionRegex . IsMatch ( search ) ;
60
-
60
+
61
61
// Mages is case sensitive, so we need to convert all function names to lower case.
62
62
search = FunctionRegex . Replace ( search , m => m . Value . ToLowerInvariant ( ) ) ;
63
-
63
+
64
64
var decimalSep = GetDecimalSeparator ( ) ;
65
65
var groupSep = GetGroupSeparator ( decimalSep ) ;
66
66
var expression = NumberRegex . Replace ( search , m => NormalizeNumber ( m . Value , isFunctionPresent , decimalSep , groupSep ) ) ;
@@ -292,7 +292,7 @@ private static string NormalizeNumber(string numberStr, bool isFunctionPresent,
292
292
{
293
293
processedStr = processedStr . Replace ( decimalSep , "." ) ;
294
294
}
295
-
295
+
296
296
return processedStr ;
297
297
}
298
298
else
@@ -310,7 +310,7 @@ private static string NormalizeNumber(string numberStr, bool isFunctionPresent,
310
310
return processedStr ;
311
311
}
312
312
}
313
-
313
+
314
314
private static bool IsValidGrouping ( string [ ] parts , int [ ] groupSizes )
315
315
{
316
316
if ( parts . Length <= 1 ) return true ;
@@ -326,7 +326,7 @@ private static bool IsValidGrouping(string[] parts, int[] groupSizes)
326
326
327
327
var lastGroupSize = groupSizes . Last ( ) ;
328
328
var canRepeatLastGroup = lastGroupSize != 0 ;
329
-
329
+
330
330
int groupIndex = 0 ;
331
331
for ( int i = parts . Length - 1 ; i > 0 ; i -- )
332
332
{
@@ -335,7 +335,7 @@ private static bool IsValidGrouping(string[] parts, int[] groupSizes)
335
335
{
336
336
expectedSize = groupSizes [ groupIndex ] ;
337
337
}
338
- else if ( canRepeatLastGroup )
338
+ else if ( canRepeatLastGroup )
339
339
{
340
340
expectedSize = lastGroupSize ;
341
341
}
@@ -345,7 +345,7 @@ private static bool IsValidGrouping(string[] parts, int[] groupSizes)
345
345
}
346
346
347
347
if ( parts [ i ] . Length != expectedSize ) return false ;
348
-
348
+
349
349
groupIndex ++ ;
350
350
}
351
351
0 commit comments