@@ -43,6 +43,7 @@ public static string Translate(string text, params object[] values)
43
43
{
44
44
dict . Add ( index . ToString ( ) , item ) ;
45
45
}
46
+
46
47
return Translate ( text , dict ) ;
47
48
}
48
49
@@ -75,7 +76,12 @@ public static void RelaunchProcess()
75
76
/// </summary>
76
77
/// <param name="command">The executable alias to find</param>
77
78
/// <returns>A tuple containing: a boolean hat represents whether the path was found or not; the path to the file if found.</returns>
78
- public static async Task < Tuple < bool , string > > Which ( string command )
79
+ public static async Task < Tuple < bool , string > > WhichAsync ( string command )
80
+ {
81
+ return await Task . Run ( ( ) => Which ( command ) ) ;
82
+ }
83
+
84
+ public static Tuple < bool , string > Which ( string command )
79
85
{
80
86
command = command . Replace ( ";" , "" ) . Replace ( "&" , "" ) . Trim ( ) ;
81
87
Logger . Debug ( $ "Begin \" which\" search for command { command } ") ;
@@ -95,18 +101,14 @@ public static async Task<Tuple<bool, string>> Which(string command)
95
101
} ;
96
102
process . StartInfo = UpdateEnvironmentVariables ( process . StartInfo ) ;
97
103
process . Start ( ) ;
98
- string ? line = await process . StandardOutput . ReadLineAsync ( ) ;
104
+ string ? line = process . StandardOutput . ReadLine ( ) ;
99
105
string output ;
100
- if ( line == null )
101
- {
102
- output = "" ;
103
- }
104
- else
105
- {
106
- output = line . Trim ( ) ;
107
- }
108
106
109
- await process . WaitForExitAsync ( ) ;
107
+ if ( line is null ) output = "" ;
108
+ else output = line . Trim ( ) ;
109
+
110
+ process . WaitForExit ( ) ;
111
+
110
112
if ( process . ExitCode != 0 || output == "" )
111
113
{
112
114
Logger . ImportantInfo ( $ "Command { command } was not found on the system") ;
@@ -243,6 +245,11 @@ public static async Task<double> GetFileSizeAsync(Uri? url)
243
245
return await GetFileSizeAsyncAsLong ( url ) / 1048576d ;
244
246
}
245
247
248
+ public static double GetFileSize ( Uri ? url )
249
+ {
250
+ return GetFileSizeAsyncAsLong ( url ) . GetAwaiter ( ) . GetResult ( ) / 1048576d ;
251
+ }
252
+
246
253
public static async Task < long > GetFileSizeAsyncAsLong ( Uri ? url )
247
254
{
248
255
if ( url == null )
@@ -434,7 +441,7 @@ public static long HashStringAsLong(string inputString)
434
441
/// </summary>
435
442
/// <param name="linkPath">The location of the link to be created</param>
436
443
/// <param name="targetPath">The location of the real folder where to point</param>
437
- public static async Task CreateSymbolicLinkDir ( string linkPath , string targetPath )
444
+ public static void CreateSymbolicLinkDir ( string linkPath , string targetPath )
438
445
{
439
446
var startInfo = new ProcessStartInfo
440
447
{
@@ -449,7 +456,7 @@ public static async Task CreateSymbolicLinkDir(string linkPath, string targetPat
449
456
Process ? p = Process . Start ( startInfo ) ;
450
457
if ( p is not null )
451
458
{
452
- await p . WaitForExitAsync ( ) ;
459
+ p . WaitForExit ( ) ;
453
460
}
454
461
455
462
if ( p is null || p . ExitCode != 0 )
0 commit comments