Sfoglia il codice sorgente

Refactor and rename

Ruben 11 mesi fa
parent
commit
b51f9efa0b

+ 2 - 2
src/PicView.Avalonia/ImageHandling/GetImageModel.cs

@@ -40,7 +40,7 @@ public static class GetImageModel
             {
                 case ".webp":
                     await AddImageAsync(fileInfo, imageModel).ConfigureAwait(false);
-                    if (ImageFunctions.IsAnimated(fileInfo))
+                    if (ImageHelper.IsAnimated(fileInfo))
                     {
                         imageModel.ImageType = ImageType.AnimatedWebp;
                     }
@@ -48,7 +48,7 @@ public static class GetImageModel
                     break;
                 case ".gif":
                     await AddImageAsync(fileInfo, imageModel).ConfigureAwait(false);
-                    if (ImageFunctions.IsAnimated(fileInfo))
+                    if (ImageHelper.IsAnimated(fileInfo))
                     {
                         imageModel.ImageType = ImageType.AnimatedGif;
                     }

+ 23 - 0
src/PicView.Avalonia/ImageHandling/ImageControl.cs

@@ -0,0 +1,23 @@
+using Avalonia.Threading;
+using PicView.Avalonia.ViewModels;
+
+namespace PicView.Avalonia.ImageHandling;
+
+public static class ImageControl
+{
+    public static void Flip(MainViewModel vm)
+    {
+        if (vm.ScaleX == 1)
+        {
+            vm.ScaleX = -1;
+            vm.GetIsFlippedTranslation = vm.UnFlip;
+        }
+        else
+        {
+            vm.ScaleX = 1;
+            vm.GetIsFlippedTranslation = vm.Flip;
+        }
+
+        Dispatcher.UIThread.Invoke(() => { vm.ImageViewer.Flip(true); });
+    }
+}

+ 37 - 1
src/PicView.Avalonia/ImageHandling/ImageFunctions.cs → src/PicView.Avalonia/ImageHandling/ImageHelper.cs

@@ -1,10 +1,14 @@
 using System.Diagnostics;
+using ImageMagick;
+using PicView.Avalonia.Navigation;
+using PicView.Avalonia.UI;
+using PicView.Avalonia.ViewModels;
 using PicView.Core.FileHandling;
 using PicView.Core.ImageDecoding;
 
 namespace PicView.Avalonia.ImageHandling;
 
-public static class ImageFunctions
+public static class ImageHelper
 {
     public static bool IsAnimated(FileInfo fileInfo)
     {
@@ -80,4 +84,36 @@ public static class ImageFunctions
 
         return string.Empty;
     }
+    
+    public static async Task OptimizeImage(MainViewModel vm)
+    {
+        if (vm is null)
+        {
+            return;
+        }
+        if (!NavigationHelper.CanNavigate(vm))
+        {
+            return;
+        }
+        if (vm.FileInfo is null)
+        {
+            return;
+        }
+        await Task.Run(() =>
+        {
+            try
+            {
+                ImageOptimizer imageOptimizer = new()
+                {
+                    OptimalCompression = true
+                };
+                imageOptimizer.LosslessCompress(vm.FileInfo.FullName);
+            }
+            catch (Exception e)
+            {
+                Trace.WriteLine(e);
+            }
+        });
+        SetTitleHelper.RefreshTitle(vm);
+    }
 }

+ 193 - 1
src/PicView.Avalonia/SettingsManagement/SettingsUpdater.cs

@@ -1,10 +1,46 @@
-using PicView.Avalonia.ViewModels;
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Controls.Primitives;
+using Avalonia.Media;
+using Avalonia.Threading;
+using PicView.Avalonia.Navigation;
+using PicView.Avalonia.UI;
+using PicView.Avalonia.ViewModels;
+using PicView.Avalonia.WindowBehavior;
 using PicView.Core.Config;
 using PicView.Core.Localization;
+using PicView.Core.ProcessHandling;
 
 namespace PicView.Avalonia.SettingsManagement;
     public static class SettingsUpdater
     {
+        public static async Task ResetSettings(MainViewModel vm)
+        {
+            SettingsHelper.DeleteSettingFiles();
+            SettingsHelper.SetDefaults();
+            await SettingsHelper.SaveSettingsAsync();
+            string args;
+            if (!NavigationHelper.CanNavigate(vm))
+            {
+                var argsList = Environment.GetCommandLineArgs();
+                args = argsList.Length > 1 ? argsList[1] : string.Empty;
+            }
+            else
+            {
+                args = vm.FileInfo.FullName;
+            }
+            ProcessHelper.RestartApp(args);
+            
+            if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                return;
+            }
+            await Dispatcher.UIThread.InvokeAsync(() =>
+            {
+                desktop.MainWindow?.Close();
+            });
+        }
+        
         public static async Task ToggleUsingTouchpad(MainViewModel vm)
         {
             SettingsHelper.Settings.Zoom.IsUsingTouchPad = !SettingsHelper.Settings
@@ -19,4 +55,160 @@ namespace PicView.Avalonia.SettingsManagement;
         
             await SettingsHelper.SaveSettingsAsync();
         }
+        
+        public static async Task ToggleSubdirectories(MainViewModel vm)
+        {
+            if (SettingsHelper.Settings.Sorting.IncludeSubDirectories)
+            {
+                vm.IsIncludingSubdirectories = false;
+                SettingsHelper.Settings.Sorting.IncludeSubDirectories = false;
+            }
+            else
+            {
+                vm.IsIncludingSubdirectories = true;
+                SettingsHelper.Settings.Sorting.IncludeSubDirectories = true;
+            }
+
+            await vm.ImageIterator.ReloadFileList();
+            SetTitleHelper.SetTitle(vm);
+            await SettingsHelper.SaveSettingsAsync();
+        }
+        
+        public static async Task ToggleTaskbarProgress(MainViewModel vm)
+        {
+            if (SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled)
+            {
+                SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled = false;
+                await Dispatcher.UIThread.InvokeAsync(() =>
+                {
+                    vm.PlatformService.StopTaskbarProgress();
+                });
+            }
+            else
+            {
+                SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled = true;
+                if (NavigationHelper.CanNavigate(vm))
+                {
+                    await Dispatcher.UIThread.InvokeAsync(() =>
+                    {
+                        vm.PlatformService.SetTaskbarProgress((ulong)vm.ImageIterator.CurrentIndex,
+                            (ulong)vm.ImageIterator.ImagePaths.Count);
+                    });
+                }
+            }
+
+            await SettingsHelper.SaveSettingsAsync();
+        }
+        
+        #region Image settings
+
+        public static async Task ToggleSideBySide(MainViewModel vm)
+        {
+            if (vm is null)
+            {
+                return;
+            }
+            
+            if (SettingsHelper.Settings.ImageScaling.ShowImageSideBySide)
+            {
+                SettingsHelper.Settings.ImageScaling.ShowImageSideBySide = false;
+                vm.IsShowingSideBySide = false;
+                vm.SecondaryImageSource = null;
+                WindowResizing.SetSize(vm);
+            }
+            else
+            {
+                SettingsHelper.Settings.ImageScaling.ShowImageSideBySide = true;
+                vm.IsShowingSideBySide = true;
+                if (NavigationHelper.CanNavigate(vm))
+                {
+                    var preloadValue = await vm.ImageIterator?.GetNextPreLoadValueAsync();
+                    vm.SecondaryImageSource = preloadValue?.ImageModel.Image;
+                    await Dispatcher.UIThread.InvokeAsync(() =>
+                    {
+                        WindowResizing.SetSize(vm.ImageWidth, vm.ImageHeight, preloadValue.ImageModel.PixelWidth,
+                            preloadValue.ImageModel.PixelHeight, vm.RotationAngle, vm);
+                    });
+                }
+            }
+
+            await SettingsHelper.SaveSettingsAsync();
+        }
+        
+        public static async Task ToggleScroll(MainViewModel vm)
+        {
+            if (vm is null)
+            {
+                return;
+            }
+            
+            if (SettingsHelper.Settings.Zoom.ScrollEnabled)
+            {
+                vm.ToggleScrollBarVisibility = ScrollBarVisibility.Disabled;
+                vm.GetIsScrollingTranslation = TranslationHelper.Translation.ScrollingDisabled;
+                vm.IsScrollingEnabled = false;
+                SettingsHelper.Settings.Zoom.ScrollEnabled = false;
+            }
+            else
+            {
+                vm.ToggleScrollBarVisibility = ScrollBarVisibility.Visible;
+                vm.GetIsScrollingTranslation = TranslationHelper.Translation.ScrollingEnabled;
+                vm.IsScrollingEnabled = true;
+                SettingsHelper.Settings.Zoom.ScrollEnabled = true;
+            }
+
+            WindowResizing.SetSize(vm);
+            
+            await SettingsHelper.SaveSettingsAsync();
+        }
+        
+        public static async Task ChangeCtrlZoom(MainViewModel vm)
+        {
+            if (vm is null)
+            {
+                return;
+            }
+            
+            SettingsHelper.Settings.Zoom.CtrlZoom = !SettingsHelper.Settings.Zoom.CtrlZoom;
+            vm.GetIsCtrlZoomTranslation = SettingsHelper.Settings.Zoom.CtrlZoom
+                ? TranslationHelper.Translation.CtrlToZoom
+                : TranslationHelper.Translation.ScrollToZoom;
+            
+            // Set source for ChangeCtrlZoomImage
+            if (!Application.Current.TryGetResource("ScanEyeImage", Application.Current.RequestedThemeVariant, out var scanEyeImage ))
+            {
+                return;
+            }
+            if (!Application.Current.TryGetResource("LeftRightArrowsImage", Application.Current.RequestedThemeVariant, out var leftRightArrowsImage ))
+            {
+                return;
+            }
+            var isNavigatingWithCtrl = SettingsHelper.Settings.Zoom.CtrlZoom;
+            vm.ChangeCtrlZoomImage = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
+            await SettingsHelper.SaveSettingsAsync().ConfigureAwait(false);
+        }
+        
+        public static async Task ToggleLooping(MainViewModel vm)
+        {
+            if (vm is null)
+            {
+                return;
+            }
+            
+            var value = !SettingsHelper.Settings.UIProperties.Looping;
+            SettingsHelper.Settings.UIProperties.Looping = value;
+            vm.GetIsLoopingTranslation = value
+                ? TranslationHelper.Translation.LoopingEnabled
+                : TranslationHelper.Translation.LoopingDisabled;
+            vm.IsLooping = value;
+
+            var msg = value
+                ? TranslationHelper.Translation.LoopingEnabled
+                : TranslationHelper.Translation.LoopingDisabled;
+            await TooltipHelper.ShowTooltipMessageAsync(msg);
+
+            await SettingsHelper.SaveSettingsAsync();
+        }
+        
+        #endregion
     }

+ 15 - 94
src/PicView.Avalonia/UI/FunctionsHelper.cs

@@ -1,13 +1,12 @@
-using System.Diagnostics;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
 using Avalonia;
 using Avalonia.Controls.ApplicationLifetimes;
 using Avalonia.Threading;
-using ImageMagick;
 using PicView.Avalonia.Clipboard;
 using PicView.Avalonia.ColorManagement;
 using PicView.Avalonia.FileSystem;
 using PicView.Avalonia.Gallery;
+using PicView.Avalonia.ImageHandling;
 using PicView.Avalonia.ImageTransformations;
 using PicView.Avalonia.Navigation;
 using PicView.Avalonia.SettingsManagement;
@@ -130,6 +129,7 @@ public static class FunctionsHelper
             "SetAsLockscreenCentered" => SetAsLockscreenCentered,
             "SetAsWallpaper" => SetAsWallpaper,
             "SetAsWallpaperFitted" => SetAsWallpaperFitted,
+            "SetAsWallpaperStretched" => SetAsWallpaperStretched,
             "SetAsWallpaperFilled" => SetAsWallpaperFilled,
             "SetAsWallpaperCentered" => SetAsWallpaperCentered,
             "SetAsWallpaperTiled" => SetAsWallpaperTiled,
@@ -339,50 +339,27 @@ public static class FunctionsHelper
 
     public static async Task ToggleScroll()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-        
-        UIHelper.ToggleScroll(Vm);
-        await SettingsHelper.SaveSettingsAsync();
+        await SettingsUpdater.ToggleScroll(Vm).ConfigureAwait(false);
     }
 
     public static async Task ChangeCtrlZoom()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-        await UIHelper.ChangeCtrlZoom(Vm);
+        await SettingsUpdater.ChangeCtrlZoom(Vm);
     }
 
     public static async Task ToggleLooping()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-        await UIHelper.ToggleLooping(Vm);
+        await SettingsUpdater.ToggleLooping(Vm);
     }
     
     public static async Task ToggleInterface()
     {
-        if (Vm is null)
-        {
-            return;
-        }
         await HideInterfaceLogic.ToggleUI(Vm);
     }
     
     public static async Task ToggleSubdirectories()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-
-        await UIHelper.ToggleSubdirectories(vm: Vm);
+        await SettingsUpdater.ToggleSubdirectories(vm: Vm);
     }
     
     public static async Task ToggleBottomToolbar()
@@ -396,11 +373,7 @@ public static class FunctionsHelper
     
     public static async Task ToggleTaskbarProgress()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-        await UIHelper.ToggleTaskbarProgress(Vm);
+        await SettingsUpdater.ToggleTaskbarProgress(Vm);
     }
     
     #endregion
@@ -469,18 +442,6 @@ public static class FunctionsHelper
         });
     }
     
-    public static async Task Quit()
-    {
-        if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
-        {
-            return;
-        }
-        await Dispatcher.UIThread.InvokeAsync(() =>
-        {
-            desktop.MainWindow?.Close();
-        });
-    }
-    
     public static async Task Center()
     {
         // TODO: scroll to center when the gallery is open
@@ -766,7 +727,7 @@ public static class FunctionsHelper
     
     public static async Task SideBySide()
     {
-        await UIHelper.SideBySide(Vm);
+        await SettingsUpdater.ToggleSideBySide(Vm);
     }
     
     public static async Task Reload()
@@ -780,6 +741,7 @@ public static class FunctionsHelper
 
     public static Task ResizeImage()
     {
+        Vm?.PlatformService?.ShowSingleImageResizeWindow();
         return Task.CompletedTask;
     }
 
@@ -788,41 +750,15 @@ public static class FunctionsHelper
         return Task.CompletedTask;
     }
 
-    public static async Task Flip()
+    public static Task Flip()
     {
-        await UIHelper.Flip(Vm);
+        ImageControl.Flip(Vm);
+        return Task.CompletedTask;
     }
 
     public static async Task OptimizeImage()
     {
-        if (Vm is null)
-        {
-            return;
-        }
-        if (!NavigationHelper.CanNavigate(Vm))
-        {
-            return;
-        }
-        if (Vm.FileInfo is null)
-        {
-            return;
-        }
-        await Task.Run(() =>
-        {
-            try
-            {
-                ImageOptimizer imageOptimizer = new()
-                {
-                    OptimalCompression = true
-                };
-                imageOptimizer.LosslessCompress(Vm.FileInfo.FullName);
-            }
-            catch (Exception e)
-            {
-                Trace.WriteLine(e);
-            }
-        });
-        SetTitleHelper.RefreshTitle(Vm);
+        await ImageHelper.OptimizeImage(Vm);
     }
 
     public static async Task Slideshow()
@@ -1105,21 +1041,7 @@ public static class FunctionsHelper
 
     public static async Task ResetSettings()
     {
-        SettingsHelper.DeleteSettingFiles();
-        SettingsHelper.SetDefaults();
-        await SettingsHelper.SaveSettingsAsync();
-        string args;
-        if (!NavigationHelper.CanNavigate(Vm))
-        {
-            var argsList = Environment.GetCommandLineArgs();
-            args = argsList.Length > 1 ? argsList[1] : string.Empty;
-        }
-        else
-        {
-            args = Vm.FileInfo.FullName;
-        }
-        ProcessHelper.RestartApp(args);
-        await Quit();
+        await SettingsUpdater.ResetSettings(Vm);
     }
     
     public static async Task Restart()
@@ -1133,7 +1055,6 @@ public static class FunctionsHelper
         }
         await Dispatcher.UIThread.InvokeAsync(() =>
         {
-            // TODO: Make it a setting to close the window
             desktop.MainWindow?.Close();
         });
     }

+ 0 - 161
src/PicView.Avalonia/UI/UIHelper.cs

@@ -1,20 +1,14 @@
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Controls.Primitives;
 using Avalonia.Layout;
-using Avalonia.Media;
 using Avalonia.Threading;
 using PicView.Avalonia.Gallery;
-using PicView.Avalonia.Navigation;
 using PicView.Avalonia.ViewModels;
 using PicView.Avalonia.Views;
 using PicView.Avalonia.Views.UC;
 using PicView.Avalonia.Views.UC.Menus;
-using PicView.Avalonia.WindowBehavior;
-using PicView.Core.Config;
 using PicView.Core.Gallery;
-using PicView.Core.Localization;
 
 namespace PicView.Avalonia.UI
 {
@@ -136,161 +130,6 @@ namespace PicView.Avalonia.UI
 
         #endregion Menus
 
-        #region Settings
-
-        public static async Task SideBySide(MainViewModel vm)
-        {
-            if (vm is null)
-            {
-                return;
-            }
-
-            if (SettingsHelper.Settings.ImageScaling.ShowImageSideBySide)
-            {
-                SettingsHelper.Settings.ImageScaling.ShowImageSideBySide = false;
-                vm.IsShowingSideBySide = false;
-                vm.SecondaryImageSource = null;
-                WindowResizing.SetSize(vm);
-            }
-            else
-            {
-                SettingsHelper.Settings.ImageScaling.ShowImageSideBySide = true;
-                vm.IsShowingSideBySide = true;
-                if (NavigationHelper.CanNavigate(vm))
-                {
-                    var preloadValue = await vm.ImageIterator?.GetNextPreLoadValueAsync();
-                    vm.SecondaryImageSource = preloadValue?.ImageModel.Image;
-                    Dispatcher.UIThread.InvokeAsync(() =>
-                    {
-                        WindowResizing.SetSize(vm.ImageWidth, vm.ImageHeight, preloadValue.ImageModel.PixelWidth,
-                                                preloadValue.ImageModel.PixelHeight, vm.RotationAngle, vm);
-                    });
-                }
-            }
-
-            await SettingsHelper.SaveSettingsAsync();
-        }
-
-        public static void ToggleScroll(MainViewModel vm)
-        {
-            if (SettingsHelper.Settings.Zoom.ScrollEnabled)
-            {
-                vm.ToggleScrollBarVisibility = ScrollBarVisibility.Disabled;
-                vm.GetIsScrollingTranslation = TranslationHelper.Translation.ScrollingDisabled;
-                vm.IsScrollingEnabled = false;
-                SettingsHelper.Settings.Zoom.ScrollEnabled = false;
-            }
-            else
-            {
-                vm.ToggleScrollBarVisibility = ScrollBarVisibility.Visible;
-                vm.GetIsScrollingTranslation = TranslationHelper.Translation.ScrollingEnabled;
-                vm.IsScrollingEnabled = true;
-                SettingsHelper.Settings.Zoom.ScrollEnabled = true;
-            }
-
-            WindowResizing.SetSize(vm);
-        }
-
-        public static async Task Flip(MainViewModel vm)
-        {
-            if (vm.ScaleX == 1)
-            {
-                vm.ScaleX = -1;
-                vm.GetIsFlippedTranslation = vm.UnFlip;
-            }
-            else
-            {
-                vm.ScaleX = 1;
-                vm.GetIsFlippedTranslation = vm.Flip;
-            }
-
-            await Dispatcher.UIThread.InvokeAsync(() => { vm.ImageViewer.Flip(true); });
-        }
-
-        public static async Task ToggleLooping(MainViewModel vm)
-        {
-            var value = !SettingsHelper.Settings.UIProperties.Looping;
-            SettingsHelper.Settings.UIProperties.Looping = value;
-            vm.GetIsLoopingTranslation = value
-                ? TranslationHelper.Translation.LoopingEnabled
-                : TranslationHelper.Translation.LoopingDisabled;
-            vm.IsLooping = value;
-
-            var msg = value
-                ? TranslationHelper.Translation.LoopingEnabled
-                : TranslationHelper.Translation.LoopingDisabled;
-            await TooltipHelper.ShowTooltipMessageAsync(msg);
-
-            await SettingsHelper.SaveSettingsAsync();
-        }
-
-        public static async Task ChangeCtrlZoom(MainViewModel vm)
-        {
-            SettingsHelper.Settings.Zoom.CtrlZoom = !SettingsHelper.Settings.Zoom.CtrlZoom;
-            vm.GetIsCtrlZoomTranslation = SettingsHelper.Settings.Zoom.CtrlZoom
-                ? TranslationHelper.Translation.CtrlToZoom
-                : TranslationHelper.Translation.ScrollToZoom;
-            
-            // Set source for ChangeCtrlZoomImage
-            if (!Application.Current.TryGetResource("ScanEyeImage", Application.Current.RequestedThemeVariant, out var scanEyeImage ))
-            {
-                return;
-            }
-            if (!Application.Current.TryGetResource("LeftRightArrowsImage", Application.Current.RequestedThemeVariant, out var leftRightArrowsImage ))
-            {
-                return;
-            }
-            var isNavigatingWithCtrl = SettingsHelper.Settings.Zoom.CtrlZoom;
-            vm.ChangeCtrlZoomImage = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
-            await SettingsHelper.SaveSettingsAsync().ConfigureAwait(false);
-        }
-
-        public static async Task ToggleSubdirectories(MainViewModel vm)
-        {
-            if (SettingsHelper.Settings.Sorting.IncludeSubDirectories)
-            {
-                vm.IsIncludingSubdirectories = false;
-                SettingsHelper.Settings.Sorting.IncludeSubDirectories = false;
-            }
-            else
-            {
-                vm.IsIncludingSubdirectories = true;
-                SettingsHelper.Settings.Sorting.IncludeSubDirectories = true;
-            }
-
-            await vm.ImageIterator.ReloadFileList();
-            SetTitleHelper.SetTitle(vm);
-            await SettingsHelper.SaveSettingsAsync();
-        }
-
-        public static async Task ToggleTaskbarProgress(MainViewModel vm)
-        {
-            if (SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled)
-            {
-                SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled = false;
-                await Dispatcher.UIThread.InvokeAsync(() =>
-                {
-                    vm.PlatformService.StopTaskbarProgress();
-                });
-            }
-            else
-            {
-                SettingsHelper.Settings.UIProperties.IsTaskbarProgressEnabled = true;
-                if (NavigationHelper.CanNavigate(vm))
-                {
-                    await Dispatcher.UIThread.InvokeAsync(() =>
-                    {
-                        vm.PlatformService.SetTaskbarProgress((ulong)vm.ImageIterator.CurrentIndex,
-                            (ulong)vm.ImageIterator.ImagePaths.Count);
-                    });
-                }
-            }
-
-            await SettingsHelper.SaveSettingsAsync();
-        }
-
-        #endregion
-
         #region Navigation
 
         public static async Task NavigateUp(MainViewModel? vm)

+ 1 - 1
src/PicView.Avalonia/ViewModels/MainViewModel.cs

@@ -1689,7 +1689,7 @@ public class MainViewModel : ViewModelBase
         
         IsLoading = true;
 
-        var file = await ImageFunctions.ConvertToCommonSupportedFormatAsync(path).ConfigureAwait(false);
+        var file = await ImageHelper.ConvertToCommonSupportedFormatAsync(path).ConfigureAwait(false);
 
         var process = new Process
         {