System.Diagnostics.Process.Start(string, string)

Here are the examples of the csharp api System.Diagnostics.Process.Start(string, string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

997 Examples 7

19 View Source File : MainWindow.cs
License : GNU General Public License v3.0
Project Creator : a4004

private async void Init()
        {
            if (Program.Portable)
                goto InitTaskEnd;
InitPyChk:
            WaitFm.Caption("Checking if Python is installed");
            await Task.Delay(1000);

            if (!ShellManager.CheckCommand("py", "--version"))
            {
                WaitFm.Debug("Python could not be detected on your system. You can choose to install Python or use N2D22 in portable mode.", Event.Warning);

                CreateRequest("Python isn't installed on this PC", "You can choose to install Python",
                    "Install Python 3.9.7 (Recommended)", "Portable mode (Legacy, not recommended)", out int result);

                if (result == 1 /*install python*/)
                {
                    WaitFm.Caption("Downloading Python x64 3.9.7");

                    try
                    {
                        WebClient client = new WebClient();

                        client.DownloadProgressChanged += (s, e) =>
                        {
                            WaitFm.Caption($"Downloading Python x64 3.9.7 from python.org ({e.ProgressPercentage}%)");
                        };
                        client.DownloadFileCompleted += delegate
                        {
                            WaitFm.Debug("Successfully downloaded python-3.9.7-amd64.exe from python.org", Event.Success);
                            WaitFm.Caption("Installing Python x64 3.9.7");
                        };

                        WaitFm.Debug("Downloading python-3.9.7-amd64.exe from python.org");
                        await client.DownloadFileTaskAsync("https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe", "python-3.9.7-amd64.exe");

                        WaitFm.Caption("Installing Python");
                        WaitFm.Debug("Installing Python x64 3.9.7");

                        if (ShellManager.RunCommand(out string output, "python-3.9.7-amd64.exe", "/quiet InstallAllUsers=1 PrependPath=1"))
                        {
                            WaitFm.Caption("Verifying Python is installed");
                            WaitFm.Debug("Verifying Python x64 3.9.7", Event.Success);
                            WaitFm.replacedle("Preparing");
                            await Task.Delay(1000);

                            goto InitPyChk;
                        }
                        else
                            throw new Exception(output == default ? "Process not started." : output);
                    }
                    catch (Exception ex)
                    {
                        WaitFm.Debug($"Python could not be installed due to an error. {ex.Message}", Event.Critical);
                        await CreateMessage("We couldn't install Python", "Something went wrong during the install process. You can try again.");

                        WaitFm.Host.CloseTask();
                        WindowManager.UnmountWindow(Controls, TaskManager.ForegroundWindow);
                        TaskManager.ReleaseFLock();
                        return;
                    }
                }
                else if (result == 2 /*run in portable mode*/)
                {
                    Process.Start(Application.ExecutablePath, string.Join(" ", Environment.GetCommandLineArgs()) + " --portable");
                    Program.Terminate();
                    return;
                }
                else
                    throw new Exception($"The selection could not be determined due to an invalid value. {result}");
            }
            else
            {
                if (ShellManager.RunCommand(out string filePath, "py", "-c \"import sys; print(sys.executable)\""))
                    WaitFm.Debug($"Python is installed on this PC at \"{filePath}\".", Event.Success);
                else
                    WaitFm.Debug("Could not get the executable path of the Python binary.", Event.Warning);

                Program.Settings.PythonExe = filePath;

                WaitFm.replacedle("Getting ready");
                WaitFm.Caption("Checking for esptool.py");
                await Task.Delay(1000);

                if (!ShellManager.CheckCommand("py", "-m esptool --help"))
                {
                    WaitFm.Debug("esptool.py isn't installed in the default Python environment. " +
                        "You can choose to install esptool or use N2D22 in portable mode.");

                    CreateRequest("esptool.py is missing", "You can choose to install it right now",
                        "Install esptool.py (Recommended)", "Portable mode (Legacy, not recommended)", out int result);

                    if (result == 1 /*install esptool*/)
                    {
                        WaitFm.Debug("Installing esptool.py");
                        WaitFm.Caption("Installing esptool.py");

                        if (ShellManager.RunCommand(out string output, "py", "-m pip install esptool"))
                        {
                            WaitFm.Debug("esptool.py was installed successfully.");
                            WaitFm.replacedle("Preparing");
                            await Task.Delay(3000);

                            goto InitPyChk;
                        }
                    }
                    else if (result == 2 /*run in portable mode*/)
                    {
                        Process.Start(Application.ExecutablePath, string.Join(" ", Environment.GetCommandLineArgs()) + " --portable");
                        Program.Terminate();
                        return;
                    }
                    else
                        throw new Exception($"The selection could not be determined due to an invalid value. {result}");
                }
                else
                {
                    WaitFm.Caption("Making sure you're ready to flash");
                    WaitFm.Debug("esptool.py is installed in the default Python environment.");
                    Program.Settings.EsptoolPy = true;

                    await Task.Delay(1000);
                    WaitFm.Debug("Searching for device drivers.");
                    await Task.Delay(1000);

                    string silabserPath = Directory.GetDirectories(Environment.SystemDirectory + "\\DriverStore\\FileRepository\\")
                        .ToList().Where(o => o.Contains("silabser")).FirstOrDefault();
                    WaitFm.Debug($"Check \"{Environment.SystemDirectory}\\DriverStore\\FileRepository\\\" for \"silabser\"");
                    string ch34serPath = Directory.GetDirectories(Environment.SystemDirectory + "\\DriverStore\\FileRepository\\")
                        .ToList().Where(o => o.Contains("ch341ser")).FirstOrDefault();
                    WaitFm.Debug($"Check \"{Environment.SystemDirectory}\\DriverStore\\FileRepository\\\" for \"ch34ser\"");
                    string ftdiPortPath = Directory.GetDirectories(Environment.SystemDirectory + "\\DriverStore\\FileRepository\\")
                        .ToList().Where(o => o.Contains("ftdiport")).FirstOrDefault();
                    WaitFm.Debug($"Check \"{Environment.SystemDirectory}\\DriverStore\\FileRepository\\\" for \"ftdiport\"");
                    string ftdiBusPath = Directory.GetDirectories(Environment.SystemDirectory + "\\DriverStore\\FileRepository\\")
                        .ToList().Where(o => o.Contains("ftdibus")).FirstOrDefault();
                    WaitFm.Debug($"Check \"{Environment.SystemDirectory}\\DriverStore\\FileRepository\\\" for \"ftdibus\"");

                    if (silabserPath == default && ch34serPath == default && ftdiPortPath == default && ftdiBusPath == default)
                    {
                        WaitFm.Debug("Driver files not found in FileRepository.", Event.Warning);

                        await CreateMessage("Device drivers not found", "We could not detect any Espressif compatible device drivers " +
                            "on this PC. You can still try flashing your device as Windows may automatically install the correct drivers " +
                            "for you.", 10);
                    }
                    else if (silabserPath != default && ch34serPath != default && ftdiPortPath != default && ftdiBusPath != default)
                    {
                        WaitFm.Debug("Detected drivers: SILABSER, CH34SER, FTDIPORT-FTDIBUS", Event.Success);

                        await CreateMessage("Found multiple device drivers", "We found device drivers for Silicon Labs, CH34 and FTDI compatible " +
                            "devices on this PC. The correct driver will automatically take control of your device when flashing.", 10);
                    }
                    else
                    {
                        if (silabserPath != default)
                        {
                            WaitFm.Debug("Detected driver: SILABSER", Event.Success);

                            await CreateMessage("Found device driver (Silicon Labs)", "We found a device driver for Silicon Labs devices on this PC. " +
                                "Please ensure it is the correct driver for your device otherwise flashing might not work.", 5);
                        }
                        if (ch34serPath != default)
                        {
                            WaitFm.Debug("Detected driver: CH34SER", Event.Success);

                            await CreateMessage("Found device driver (CH34)", "We found a device driver for CH34 devices on this PC. " +
                                "Please ensure it is the correct driver for your device otherwise flashing might not work.", 5);
                        }
                        if (ftdiBusPath != default && ftdiPortPath != default)
                        {
                            WaitFm.Debug("Detected driver: FTDIPORT-FTDIBUS", Event.Success);

                            await CreateMessage("Found device driver (FTDI)", "We found a device driver for FTDI devices on this PC. " +
                                "Please ensure it is the correct driver for your device otherwise flashing might not work.", 5);
                        }
                        else if (ftdiBusPath != default || ftdiPortPath != default)
                        {
                            WaitFm.Debug($"Detected partial driver: {(ftdiPortPath != default ? "FTDIPORT" : ftdiBusPath != default ? "FTDIBUS" : "?")}", Event.Warning);

                            await CreateMessage("Found device driver files (FTDI)", "We found parts of a device driver package for FTDU " +
                                "devices on this PC. The driver might not be installed correctly. Ensure the driver is correct and/or " +
                                "installed correctly.", 7);
                        }
                    }
                }
            }

InitTaskEnd:
            WaitFm.Caption(""); 
            await Task.Delay(1000);
            WaitFm.Host.CloseTask();

            WindowManager.UnmountWindow(Controls, TaskManager.ForegroundWindow);
            TaskManager.ReleaseFLock();

            if (Program.Settings.PortFix)
            {
                Invoke(new Action(() =>
                {
                    mitigationNotice.Show();
                    CreateForegroundTask("devicescan-patch", new Task(delegate() { }), "", "Please connect your device to this PC. When you've confirmed it's connected, click Continue.");
                }));
            }
            else
            {
                Invoke(new Action(() =>
                {
                    CreateForegroundTask("devicescan", new Task(Search), "Searching for your device", "You should connect your device now");
                }));
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : ABTSoftware

private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            Process.Start("explorer.exe", "https://www.scichart.com/scichart-wpf-v6-the-worlds-fastest-wpf-charts/");
        }

19 View Source File : ShellControl.xaml.cs
License : MIT License
Project Creator : ABTSoftware

private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            Process.Start("explorer.exe", "http://www.scichart.com");
        }

19 View Source File : RichTextBoxHelper.cs
License : MIT License
Project Creator : ABTSoftware

private static void LinkOnClick(object sender, RequestNavigateEventArgs e)
        {
            Process.Start("explorer.exe", e.Uri.AbsoluteUri);
            e.Handled = true;
        }

19 View Source File : PowerManager.cs
License : MIT License
Project Creator : ABTSoftware

public void OpenControlPanel()
        {
            var root = Environment.GetEnvironmentVariable("SystemRoot");
            Process.Start(root + "\\system32\\control.exe", "/name Microsoft.PowerOptions");
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : Accelerider

private static void Pack(FolderElement info, bool openFolder = true)
        {
            string zipTargetPath;
            using (var tempFolder = new TempDirectory(info.Target))
            {
                Print.Info($"Start Copying: {info.Source} --> {info.Target}");
                info
                    .Flatten()
                    .Where(item => !(item is FolderElement folder) ||
                                   !folder.Files.Any() && !folder.Folders.Any())
                    .ForEach(item => item.Source.CopyTo(item.Target));
                Print.Info("Completed Copying. ");

                zipTargetPath = $"{tempFolder.Path}.zip";
                Print.Info($"Start Package: {zipTargetPath}...");
                if (File.Exists(zipTargetPath)) File.Delete(zipTargetPath);
                ZipFile.CreateFromDirectory(
                    tempFolder.Path,
                    zipTargetPath,
                    CompressionLevel.Optimal,
                    true);

                Print.Info("Completed Package. ");
            }

            if (openFolder)
            {
                Print.Info($"Opening the file: {zipTargetPath}...");
                Process.Start("explorer.exe", $"/select, {zipTargetPath}");
            }

            Print.Divider();
        }

19 View Source File : ClonesManager.cs
License : MIT License
Project Creator : adrenak

private static void StartHiddenConsoleProcess(string fileName, string args)
        {
            System.Diagnostics.Process.Start(fileName, args);
        }

19 View Source File : CSC.cs
License : MIT License
Project Creator : adrenak

public void Build() {
			Process.Start("cmd.exe", ToCommand());
		}

19 View Source File : AeroEpubSchemeHandlerFactory.cs
License : MIT License
Project Creator : Aeroblast

public IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
        {
            var uri = new Uri(request.Url);
            Log.log(request.Url);
            var route = uri.AbsolutePath.Split('/')[1];
            switch (route)
            {
                case "book":
                    {
                        if (uri.Query.Contains("footnote"))
                        {
                            return ResourceHandler.FromString("");
                        }
                        var epubItemPath = uri.AbsolutePath.Substring("/book/".Length);
                        if (epubItemPath[0] == '/') epubItemPath = epubItemPath.Substring(1);
                        Item i = Program.epub.Gereplacedem(epubItemPath);
                        if (i != null)
                        {
                            if (i.mediaType == "application/xhtml+xml")
                            {
                                string content = (i.GetFile() as TextEpubFileEntry).text;
                                content = HtmlHack.Hack(content);
                                return ResourceHandler.FromString(content);
                            }
                            if (i.mediaType == "text/css")
                            {
                                //html里的其实也应该处理……
                                string content = (i.GetFile() as TextEpubFileEntry).text;
                                content = CssHack.Hack(content);
                                return ResourceHandler.FromString(content, null, true, i.mediaType);
                            }
                            if (i.mediaType.StartsWith("image"))
                            {
                                //Image warm color process
                                if (uri.Query.Contains("warm"))
                                {
                                    switch (i.mediaType)
                                    {
                                        case "image/heic":
                                        case "image/webp":
                                            byte[] imageData = i.GetFile().GetBytes();
                                            var decoded = ImageHack.TryDecode(imageData);
                                            if (decoded != null)
                                            {
                                                return ResourceHandler.FromByteArray(ImageHack.Warmer(decoded), "image/bmp");
                                            }
                                            else//local decoder not found 
                                            {
                                                return ResourceHandler.FromByteArray(imageData, i.mediaType);
                                            }
                                        default:
                                            return ResourceHandler.FromByteArray(ImageHack.Warmer(i.GetFile().GetBytes()), "image/bmp");
                                    }
                                }
                                //do not return image but  a html page 
                                if (uri.Query.Contains("page"))
                                {
                                    if (imagePageSizeAttribute == null)
                                    {
                                        if (Program.epub.spine.pageProgressionDirection == "rtl")
                                        { imagePageSizeAttribute = "height=\"100%\""; }
                                        else
                                        { imagePageSizeAttribute = "width=\"100%\""; }
                                    }
                                    return ResourceHandler.FromString($"<html><head><link href=\"aeroepub://viewer/viewer-inject.css\" rel=\"stylesheet\" type=\"text/css\"/></head><body><img {imagePageSizeAttribute} src={("aeroepub://book" + uri.AbsolutePath)}><script src=\"aeroepub://viewer/viewer-inject.js\"></script></body></html>");
                                }
                                //normally return image data. Decode use system decoder for some format
                                switch (i.mediaType)
                                {
                                    case "image/heic":
                                        byte[] imageData = i.GetFile().GetBytes();
                                        var decoded = ImageHack.TryDecode(imageData);
                                        if (decoded != null)
                                        {
                                            return ResourceHandler.FromByteArray(decoded, "image/bmp");
                                        }
                                        else//local decoder not found 
                                        {
                                            return ResourceHandler.FromByteArray(imageData, i.mediaType);
                                        }
                                    default:
                                        return ResourceHandler.FromByteArray(i.GetFile().GetBytes(), i.mediaType);

                                }

                            }
                            return ResourceHandler.FromByteArray(i.GetFile().GetBytes(), i.mediaType);

                        }
                        else
                        {
                            Log.log("[Error]Cannot get " + uri);
                        }

                    }
                    break;
                case "viewer":
                    {
                        var filename = uri.AbsolutePath.Substring("/viewer/".Length).Replace("/", ".");
                        Stream fs = replacedembly.GetManifestResourceStream("AeroEpubViewer.Res." + filename);
                        string mime = Util.GetMimeType(filename);
                        if (mime != null)
                            return ResourceHandler.FromStream(fs, mime);
                        return ResourceHandler.FromStream(fs);
                    } //break;
                case "app":
                    {
                        string[] args = uri.AbsolutePath.Substring("/app/".Length).Split('/');
                        switch (args[0])
                        {
                            case "pos":
                                ResizeManage.SetPara(args);
                                return ResourceHandler.FromString("OK");
                            case "bookfontsize":
                                UserSettings.bookFontSize = int.Parse(args[1]);
                                EpubViewer.chromium.LoadingStateChanged += EpubViewer.SendDataWhenLoad;
                                EpubViewer.chromium.Reload(true);
                                return ResourceHandler.FromString("OK");
                            case "screentest":
                                CssHack.SetScreenTest(args);
                                return ResourceHandler.FromString("OK");
                            case "inspector":
                                EpubViewer.chromium.ShowDevTools();
                                return ResourceHandler.FromString("OK");
                            case "theme":
                                UserSettings.theme = args[1];
                                return ResourceHandler.FromString("OK");
                            case "ImageQuickView":
                                return ResourceHandler.FromString(SpecialPageService.ImageQuickView());
                            case "BookInfo":
                                return ResourceHandler.FromString(SpecialPageService.BookInfo());
                            case "StartSearch":
                                {
                                    var t = uri.AbsolutePath.Substring("/app/".Length);
                                    int i = t.IndexOf('/');
                                    var word = Uri.UnescapeDataString(t.Substring(i + 1));
                                    SearchService.Start(word);
                                    Log.log(word);
                                    return ResourceHandler.FromString("OK");
                                }
                            case "CheckSearchResult":
                                return ResourceHandler.FromString(SearchService.GetResult(int.Parse(args[1])));
                            case "CopyImage":
                                {
                                    string path = uri.AbsolutePath.Substring("/app/CopyImage/".Length);
                                    var f = Program.epub.GetFile(path);
                                    using (var stm = new MemoryStream(f.GetBytes()))
                                    using (var img = System.Drawing.Image.FromStream(stm))
                                        System.Windows.Forms.Clipboard.SetImage(img);
                                }
                                return ResourceHandler.FromString("OK");
                            case "UserBookCss":
                                return ResourceHandler.FromString(UserSettings.userBookCssContent, null, true, "text/css");
                            case "UserBookCssRtl":
                                return ResourceHandler.FromString(UserSettings.userBookCssContent_rtl, null, true, "text/css");
                            case "UserBookCssLtr":
                                return ResourceHandler.FromString(UserSettings.userBookCssContent_ltr, null, true, "text/css");
                            case "External":
                                System.Diagnostics.Process.Start("explorer.exe", Uri.UnescapeDataString(args[1]));
                                return ResourceHandler.FromString("OK");
                        }


                    }
                    break;


            }
            return null;
        }

19 View Source File : SystemHandlers.cs
License : MIT License
Project Creator : afxw

public static void HandleRestart(PaceClient client, IPacket packet)
        {
            Process.Start("shutdown.exe", "-r -t 00");
        }

19 View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : akaAgar

public static void Main(string[] args)
        {
             Console.WriteLine(@"
        @@@@@@@@@@  .@@@@@@@@@@  @@@&  @@@@@@@@@@  @@@@@@@@@/ @@@   @@@@,   @@@   *@@@@@@@@@#       
        @@@    @@@  .@@@    @@@  @@@&  @@@         @@@        @@@   @@@@@@  @@@  @@@@               
        @@@@@@@@@@  .@@@@@@@@@.  @@@&  @@@@@@@@@   @@@@@@@@@  @@@   @@@ @@@@@@@  @@@   (@@@@@       
        @@@    %@@@ .@@@  @@@@   @@@&  @@@         @@@        @@@   @@@   @@@@@  ,@@@@   /@@@       
        @@@@@@@@@   .@@@    @@@# @@@&  @@@@@@@@@@  @@@        @@@   @@@     @@@     @@@@@@@.        
                                                                                                    
        @@@@@@@@@@@@@@(          *@@@@@@@@@@@      %@@@@@@@@@@%         @@@@@@         &@@@@@       
        @@@@@@@@@@@@@@@@@      @@@@@@&# ,&@@@@@@@@@@@@&&  &&@@@@@%      @@@@@@@      /@@@@@@@       
        @@@@@       @@@@@@   #@@@@   (@@@(   /@@@@@   (&@@&(  ,@@@@     @@@@@@@@#   @@@@@@@@@       
        @@@@@       .@@@@@   @@@@  @@@@@@@@@@@@@@  /@@@@@@@@@& .@@@@    @@@@@@@@@@@@@@@@@@@@@       
        @@@@@@@@@@@@@@@@@   #@@@.  @@@@@@@@@@@%  (@@@@@@@@@@@@  %@@@    @@@@@ &@@@@@@@  @@@@@       
        @@@@@@@@@@@@@@,      @@@@  #@@@@@@@@(  ,@@@.@@@@@@@@@  .@@@#    @@@@@   @@@@@   @@@@@       
        @@@@@    @@@@@@      .@@@@.   .&     @@@@@@(    &&    @@@@@     @@@@@    ,@     @@@@@       
        @@@@@      @@@@@&      #@@@@@@@@@@@@@@@@/@@@@@@@@@@@@@@@@       @@@@@           @@@@@       
        @@@@@       .@@@@@/        @@@@@@@@@/       @@@@@@@@@@          @@@@@           @@@@@     
         ___  _   _  ___   ___                          
        / __|| | | ||_ _| / __| ___  _ _ __ __ ___  _ _ 
       | (_ || |_| | | |  \__ \/ -_)| '_|\ V // -_)| '_|
        \___| \___/ |___| |___/\___||_|   \_/ \___||_|  
                                                  

                                                                                                 
                                                                                                 
    OPEN Browser on http://localhost:5000                                                                                                                                                                                                 
                                                                                                              
Server Logs:");
            Process.Start("explorer.exe", "http://localhost:5000");
            CreateHostBuilder(args).Build().Run();
        }

19 View Source File : MainWindow.xaml.cs
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev

public async void ActionButton_Click(object sender, RoutedEventArgs e)
        {
            Button actionButton = sender as Button;
            string buttonScript = ((ActionButton)actionButton.DataContext).ButtonScript;
            string buttonScriptPathType = ((ActionButton)actionButton.DataContext).ButtonScriptPathType;
            string buttonScriptType = ((ActionButton)actionButton.DataContext).ButtonScriptType;
            string scriptPath = GetScriptPath(buttonScript, buttonScriptPathType);
            string powershellArguments = GetPowerShellArguments(config.powershell_arguments);
            int ownerTab = MainTab.SelectedIndex;

            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                try
                {
                    Process.Start("explorer.exe", GetScriptPath(RemoveScriptFileFromPath(buttonScript), buttonScriptPathType));
                    AddTextToEventsList("Opened script location folder: " + GetScriptPath(RemoveScriptFileFromPath(buttonScript), buttonScriptPathType), false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    AddTextToEventsList("Could not open script location folder: " + ex.Message, false);
                }
                return;
            }

            if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
            {
                try
                {
                    Process.Start("explorer.exe", scriptPath);
                    AddTextToEventsList("Opened script : " + scriptPath, false);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    AddTextToEventsList("Could not open script: " + ex.Message, false);
                }
                return;
            }

            List<Answer> buttonArguments = ((ActionButton)actionButton.DataContext).ButtonArguments;
            AddTextToConsole("Start script: " + scriptPath + "<br><span style=\"color:yellow;\">=====================================================================</span><br>", ownerTab);
            AddTextToEventsList("Execution of " + scriptPath + " has been started.", false);

            if (buttonArguments.Count == 0)
            {
                AddTextToEventsList("Starting script " + scriptPath, false);
                if (buttonScriptType.ToLower() == "powershell")
                {
                    await RunProcessAsync(config.default_powershell_path, powershellArguments + "-File \"" + scriptPath + "\"", ownerTab, buttonScript);
                }
                else
                {
                    await RunProcessAsync(config.default_cmd_path, "/c \"" + scriptPath + "\"", ownerTab, buttonScript);
                }
            }
            else
            {
                AnswerDialog dialog = new AnswerDialog(ConvertArgumentsToAnswers(buttonArguments));
                if (dialog.ShowDialog() == true)
                {
                    AddTextToEventsList("Starting script" + scriptPath, false);
                    if (buttonScriptType.ToLower() == "powershell")
                    {
                        await RunProcessAsync(config.default_powershell_path, powershellArguments + "-File \"" + scriptPath + "\" " + ConvertArgumentsToPowerShell(dialog.answerData.Answers), ownerTab, buttonScript);
                    }
                    else
                    {
                        await RunProcessAsync(config.default_cmd_path, powershellArguments + "/c \"" + scriptPath + "\" " + ConvertArgumentsToCMD(dialog.answerData.Answers), ownerTab, buttonScript);
                    }
                }
                else
                {
                    AddTextToEventsList("Task cancelled by user", false);
                    AddTextToConsole("Task cancelled by user!", ownerTab);
                }
            }
        }

19 View Source File : MainWindow.xaml.cs
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev

private void OpenAppFolderMenuItem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Process.Start("explorer.exe", AppDomain.CurrentDomain.BaseDirectory);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); 
                AddTextToEventsList("Opened application running folder", false);
            }
        }

19 View Source File : ScriptAssetOpener.cs
License : MIT License
Project Creator : akof1314

private static void OpenVisualStudioFile(string projectPath, string file, int line)
        {
#if UNITY_2017_1_OR_NEWER
            string vsPath = ScriptEditorUtility.GetExternalScriptEditor();
#else
            string vsPath = InternalEditorUtility.GetExternalScriptEditor();
#endif
            if (IsNotWindowsEditor())
            {
                Process.Start("open", "-a " + QuotePathIfNeeded(vsPath) + " " + QuotePathIfNeeded(file));
                return;
            }

            if (string.IsNullOrEmpty(vsPath) || !File.Exists(vsPath))
            {
                return;
            }
            string exePath = String.Empty;

#if UNITY_2018_1_OR_NEWER
            var packageInfos = Packages.GetAll();
            foreach (var packageInfo in packageInfos)
            {
                if (packageInfo.name == "com.wuhuan.consoletiny")
                {
                    exePath = packageInfo.resolvedPath;
                    // https://github.com/akof1314/VisualStudioFileOpenTool
                    exePath = exePath + "\\Editor\\VisualStudioFileOpenTool.exe";
                    break;
                }
            }

#elif UNITY_2017_1_OR_NEWER
            // TODO
            exePath = "../../PackagesCustom/com.wuhuan.consoletiny";
#endif
            if (string.IsNullOrEmpty(exePath))
            {
                exePath = "replacedets/Editor/VisualStudioFileOpenTool.exe";
            }

            if (!string.IsNullOrEmpty(exePath))
            {
                if (!File.Exists(exePath))
                {
                    return;
                }

                ThreadPool.QueueUserWorkItem(_ =>
                {
                    OpenVisualStudioFileInter(exePath, vsPath, projectPath, file, line);
                });
            }
        }

19 View Source File : RecoveryManager.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

public static void RegisterForRecovery()
        {
            var callback = new RecoveryDelegate(p =>
            {
                Process.Start(replacedembly.GetEntryreplacedembly().Location, RestartCommandLine);
                ApplicationRecoveryFinished(true);
                return 0;
            });

            var interval = 100U;
            var flags = 0U;

            var result = RegisterApplicationRecoveryCallback(callback, IntPtr.Zero, interval, flags);
        }

19 View Source File : WinOperatingSystemUIService.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

public void ShowFileInExplorer(string filePath)
        {
            Process.Start("explorer.exe", string.Format("/select,\"{0}\"", filePath));
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : alexleen

private void OpenLogFolderClick(object sender, RoutedEventArgs e)
        {
            string filePath = GetFilePath(sender);
            string dirPath = Path.GetDirectoryName(filePath);

            if (File.Exists(filePath))
            {
                Process.Start("explorer.exe", $"/select, \"{filePath}\"");
            }
            else if (Directory.Exists(dirPath))
            {
                Process.Start(dirPath);
            }
            else
            {
                mToastService.ShowInformation("Log file and directory do not exist");
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : alexleen

private void OpenInExplorer(object sender, RoutedEventArgs e)
        {
            string selectedConfig = (string)xConfigComboBox.SelectedItem;

            if (!string.IsNullOrEmpty(selectedConfig))
            {
                if (File.Exists(selectedConfig))
                {
                    Process.Start("explorer.exe", $"/select, \"{selectedConfig}\"");
                }
                else
                {
                    mMessageBoxService.ShowWarning("File has not been saved yet and therefore cannot be opened.");
                }
            }
            else
            {
                mToastService.ShowInformation("No configuration file selected");
            }
        }

19 View Source File : Concatenate.cs
License : MIT License
Project Creator : Alkl58

public static void Concat(string videoOutput, bool audioOutput, string currentPath, string ffmpegPath, bool trackone, bool tracktwo, bool trackthree, bool trackfour)
        {
            if (MainWindow.Cancel.CancelAll == false)
            {

                string outputfilename = videoOutput;

                //Lists all ivf files in mylist.txt
                Process process = new Process();
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                startInfo.FileName = "cmd.exe";
                //FFmpeg Arguments
                startInfo.Arguments = "/C (for %i in ("+ '\u0022' + currentPath + "\\Chunks\\*.ivf"+ '\u0022' + ") do @echo file '%i') > "+ '\u0022' + currentPath+"\\Chunks\\mylist.txt"+ '\u0022';
                Console.WriteLine(startInfo.Arguments);
                process.StartInfo = startInfo;
                process.Start();
                process.WaitForExit();

                if (audioOutput == false)
                {
                    //Concat the Videos
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    startInfo.FileName = "cmd.exe";
                    startInfo.WorkingDirectory = ffmpegPath;
                    //FFmpeg Arguments
                    startInfo.Arguments = "/C ffmpeg.exe -f concat -safe 0 -i " + '\u0022' + currentPath + "\\Chunks\\mylist.txt"+ '\u0022' + " -c copy " + '\u0022' + outputfilename + '\u0022';
                    Console.WriteLine(startInfo.Arguments);
                    process.StartInfo = startInfo;
                    process.Start();
                    process.WaitForExit();
                }
                else if (audioOutput == true)
                {
                    //Concat the Videos
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    startInfo.FileName = "cmd.exe";
                    startInfo.WorkingDirectory = ffmpegPath;
                    //FFmpeg Arguments
                    startInfo.Arguments = "/C ffmpeg.exe -f concat -safe 0 -i " + '\u0022' + currentPath + "\\Chunks\\mylist.txt" + '\u0022' + " -c copy "+ '\u0022' + currentPath+"\\no_audio.mkv" + '\u0022';
                    Console.WriteLine(startInfo.Arguments);
                    process.StartInfo = startInfo;
                    process.Start();
                    process.WaitForExit();

                    //Concat the Videos
                    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    startInfo.FileName = "cmd.exe";
                    startInfo.WorkingDirectory = ffmpegPath;
                    //FFmpeg Arguments
                    //Sets the mapping of the video and audiostreams and muxes them
                    if (MainWindow.numberOfAudioTracks == 1)
                    {
                        startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + currentPath + "\\no_audio.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio0.mkv" + '\u0022' + " -map 0:v -map 1:a -c copy " + '\u0022' + outputfilename + '\u0022';

                    }
                    else if (MainWindow.numberOfAudioTracks == 2)
                    {
                        startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + currentPath + "\\no_audio.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio0.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio1.mkv" + '\u0022' + " -map 0:v -map 1:a -map 2:a -c copy " + '\u0022' + outputfilename + '\u0022';

                    }
                    else if (MainWindow.numberOfAudioTracks == 3)
                    {

                        startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + currentPath + "\\no_audio.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio0.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio1.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio2.mkv" + '\u0022' + " -map 0:v -map 1:a -map 2:a -map 3:a -c copy " + '\u0022' + outputfilename + '\u0022';

                    }
                    else if (MainWindow.numberOfAudioTracks == 4)
                    {
                        startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + currentPath + "\\no_audio.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio0.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio1.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio2.mkv" + '\u0022' + " -i " + '\u0022' + currentPath + "\\AudioEncoded\\audio3.mkv" + '\u0022' + " -map 0:v -map 1:a -map 2:a -map 3:a -map 4:a -c copy " + '\u0022' + outputfilename + '\u0022';
                    }
                    //startInfo.Arguments = "/C ffmpeg.exe -i no_audio.mkv -i AudioEncoded\\audioOutput.mkv -map 0:0 -map 0:1 -map 0:2 -c copy " + '\u0022' + outputfilename + '\u0022';
                    Console.WriteLine(startInfo.Arguments);
                    process.StartInfo = startInfo;
                    process.Start();
                    process.WaitForExit();
                }

                if (MainWindow.shutdownafterencode == true && MainWindow.batchEncoding == false)
                {
                    if (MainWindow.Cancel.CancelAll == false)
                    {
                        //Shutdowns the PC if specified in settings
                        Process.Start("shutdown.exe", "/s /t 0");
                    }
                }
            }
        }

19 View Source File : PopupWindow.xaml.cs
License : MIT License
Project Creator : Alkl58

private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
        {
            // Opens the video output file location and select the video file
            System.Diagnostics.Process.Start("explorer.exe", "/select, \"" + fileLocation + "\"");
        }

public static void OpenFolder(string path)
        {
            // We have to replace forward slashes with backslashes here on windows because explorer.exe is picky...
            string realPath = currentPlatform.IsWinForms ? Environment.ExpandEnvironmentVariables(path).Replace("/", "\\") : path.Replace("~", Environment.GetEnvironmentVariable("HOME"));
            if (!Directory.Exists(realPath))
                Directory.CreateDirectory(realPath);

            //needs quotes otherwise paths with space wont open
            if (currentPlatform.IsWinForms)
                // And we're using explorer.exe to prevent people from stuffing system commands in here wholesale. That would be bad.
                Process.Start("explorer.exe", "\"{realPath}\"");
            // linux only opens the directory bc opening and selecting a file is pain
            else if (currentPlatform.IsGtk)
                Process.Start("xdg-open", $"\"{realPath}\"");
        }

19 View Source File : ProcessHelper.cs
License : MIT License
Project Creator : amazingalek

public void Start(string path, string[] args = null)
		{
			if (args is null)
			{
				Process.Start(path);
				return;
			}

			Process.Start(path, string.Join(" ", args));
		}

public static void OpenURL(string url)
        {
            if(currentPlatform.IsWinForms)
                Process.Start(url);
            else if(currentPlatform.IsGtk)
                Process.Start("xdg-open", url);
        }

public static void OpenFolderAndSelectFile(string path)
        {
            // We have to replace forward slashes with backslashes here on windows because explorer.exe is picky...
            string realPath = currentPlatform.IsWinForms ? Environment.ExpandEnvironmentVariables(path).Replace("/", "\\") : path.Replace("~", Environment.GetEnvironmentVariable("HOME"));
            if (!File.Exists(realPath))
                return;

            //needs quotes otherwise paths with spaces wont open
            if (currentPlatform.IsWinForms)
                // And we're using explorer.exe to prevent people from stuffing system commands in here wholesale. That would be bad.
                Process.Start("explorer.exe", $"/select, \"{realPath}\"");
            else if (currentPlatform.IsGtk)
                Process.Start("xdg-open", $"\"{Path.GetDirectoryName(realPath)}\"");
        }

19 View Source File : LauncherUpdater.cs
License : GNU General Public License v3.0
Project Creator : AM2R-Community-Developers

public static void Main()
        {
            log.Info("Running update check...");

            string version = VERSION.Replace(".", "");

            //update section

            //delete old files that have been left
            if (File.Exists(CrossPlatformOperations.CURRENTPATH + "/AM2RLauncher.bak"))
            {
                log.Info("AM2RLauncher.bak detected. Removing file.");
                File.Delete(CrossPlatformOperations.CURRENTPATH + "/AM2RLauncher.bak");
            }
            if (currentPlatform.IsWinForms && File.Exists(oldConfigPath))
            {
                log.Info(CrossPlatformOperations.LAUNCHERNAME + ".oldCfg detected. Removing file.");
                File.Delete(oldConfigPath);
            }
            if (currentPlatform.IsWinForms && Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/oldLib"))
            {
                log.Info("Old lib folder detected, removing folder.");
                Directory.Delete(CrossPlatformOperations.CURRENTPATH + "/oldLib", true);
            }

            // Clean up old update libs
            if (currentPlatform.IsWinForms && Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/lib"))
            {
                foreach (FileInfo file in new DirectoryInfo(CrossPlatformOperations.CURRENTPATH + "/lib").GetFiles())
                {
                    if (file.Name.EndsWith(".bak"))
                        file.Delete();
                }

                // Do the same for each subdir
                foreach (DirectoryInfo dir in new DirectoryInfo(CrossPlatformOperations.CURRENTPATH + "/lib").GetDirectories())
                {
                    foreach (FileInfo file in dir.GetFiles())
                    {
                        if (file.Name.EndsWith(".bak"))
                            file.Delete();
                    }
                }
            }

            //check settings if autoUpdateLauncher is set to true
            bool autoUpdate = bool.Parse(CrossPlatformOperations.ReadFromConfig("AutoUpdateLauncher"));

            if (autoUpdate)
            {
                log.Info("AutoUpdate Launcher set to true!");

                //this is supposed to fix the updater throwing an exception on windows 7 and earlier(?)
                //see this for information: https://stackoverflow.com/questions/2859790/the-request-was-aborted-could-not-create-ssl-tls-secure-channel and https://stackoverflow.com/a/50977774
                if (currentPlatform.IsWinForms)
                {
                    ServicePointManager.Expect100Continue = true;
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                }

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://github.com/AM2R-Community-Developers/AM2RLauncher/releases/latest");
                HttpWebResponse response = null;
                try
                {        
                    response = (HttpWebResponse)request.GetResponse();
                }
                catch (WebException)
                {
                    log.Error("WebException caught! Displaying MessageBox.");
                    MessageBox.Show(Language.Text.NoInternetConnection);
                    return;
                }

                Uri realUri = response.ResponseUri;
                string onlineVersion = realUri.AbsoluteUri.Substring(realUri.AbsoluteUri.LastIndexOf('/') + 1);
                bool isCurrentVersionOutdated = false;

                string[] localVersionArray = VERSION.Split('.');
                string[] onlineVersionArray = onlineVersion.Split('.');

                for (int i = 0; i < localVersionArray.Length; i++)
                {
                    if (int.Parse(onlineVersionArray[i]) > int.Parse(localVersionArray[i]))
                    {
                        isCurrentVersionOutdated = true;
                        break;
                    }
                }

                if (isCurrentVersionOutdated)
                {
                    log.Info("Current version (" + VERSION + ") is outdated! Initiating update for version " + onlineVersion + ".");

                    string tmpUpdatePath = CrossPlatformOperations.CURRENTPATH + "/tmpupdate/";
                    string zipPath = CrossPlatformOperations.CURRENTPATH + "/launcher.zip";

                    // Clean tmpupdate
                    if (Directory.Exists(tmpUpdatePath))
                        Directory.Delete(tmpUpdatePath);
                    if (!Directory.Exists(tmpUpdatePath))
                        Directory.CreateDirectory(tmpUpdatePath);

                    try
                    { 
                        using (var client = new WebClient())
                        {
                            string platformSuffix = "";
                            if (currentPlatform.IsWinForms) platformSuffix = "_win";
                            else if (currentPlatform.IsGtk) platformSuffix = "_lin";

                            log.Info("Downloading https://github.com/AM2R-Community-Developers/AM2RLauncher/releases/latest/download/AM2RLauncher_" + onlineVersion + platformSuffix + ".zip to " + zipPath + ".");
                            
                            client.DownloadFile("https://github.com/AM2R-Community-Developers/AM2RLauncher/releases/latest/download/AM2RLauncher_" + onlineVersion + platformSuffix + ".zip", zipPath);

                            log.Info("File successfully downloaded.");
                        }
                    }
                    catch(UnauthorizedAccessException)
                    {
                        log.Error("UnauthorizedAccessException caught! Displaying MessageBox.");
                        MessageBox.Show(Language.Text.UnauthorizedAccessMessage);
                        return;
                    }

                    ZipFile.ExtractToDirectory(zipPath, tmpUpdatePath);
                    log.Info("Updates successfully extracted to " + tmpUpdatePath);

                    File.Delete(zipPath);
                    File.Move(updatePath + "/" + CrossPlatformOperations.LAUNCHERNAME, CrossPlatformOperations.CURRENTPATH + "/AM2RLauncher.bak");
                    if (currentPlatform.IsWinForms) File.Move(CrossPlatformOperations.LAUNCHERNAME + ".config", CrossPlatformOperations.LAUNCHERNAME + ".oldCfg");

                    foreach (var file in new DirectoryInfo(tmpUpdatePath).GetFiles())
                    {
                        log.Info("Moving " +  file.FullName + " to " + CrossPlatformOperations.CURRENTPATH + "/" + file.Name);
                        File.Copy(file.FullName, updatePath + "/" + file.Name, true);
                    }
                    // for windows, the actual application is in "AM2RLauncher.dll". Which means, we need to update the lib folder as well.
                    if (currentPlatform.IsWinForms && Directory.Exists(CrossPlatformOperations.CURRENTPATH + "/lib"))
                    {
                        // Directory.Move(CrossPlatformOperations.CURRENTPATH + "/lib", CrossPlatformOperations.CURRENTPATH + "/oldLib");
                        // So, because Windows behavior is dumb...

                        // Rename all files in lib to *.bak
                        foreach (FileInfo file in new DirectoryInfo(CrossPlatformOperations.CURRENTPATH + "/lib").GetFiles())
                        {
                            file.CopyTo(file.Directory + file.Name + ".bak");
                        }

                        // Do the same for each subdir
                        foreach(DirectoryInfo dir in new DirectoryInfo(CrossPlatformOperations.CURRENTPATH + "/lib").GetDirectories())
                        {
                            foreach (FileInfo file in dir.GetFiles())
                            {
                                file.CopyTo(file.Directory + file.Name + ".bak");
                            }
                        }

                        // Yes, the above calls could be recursive. No, I can't be bothered to make them as such.

                        HelperMethods.DirectoryCopy(tmpUpdatePath + "lib", CrossPlatformOperations.CURRENTPATH + "/lib", true);
                    }
                    
                    Directory.Delete(tmpUpdatePath, true);

                    CrossPlatformOperations.CopyOldConfigToNewConfig();

                    log.Info("Files extracted. Preparing to restart executable...");

                    if (currentPlatform.IsGtk) System.Diagnostics.Process.Start("chmod", "+x ./AM2RLauncher.Gtk");

                    System.Diagnostics.Process.Start(updatePath + "/" + CrossPlatformOperations.LAUNCHERNAME);
                    Environment.Exit(0);
                }
            }
            else
            {
                log.Info("AutoUpdate Launcher set to false. Exiting update check.");
            }
        }

19 View Source File : LocalLogFilesUC.cs
License : MIT License
Project Creator : Analogy-LogViewer

private void bBtnOpen_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (treeList1.Selection.Any())
            {
                var filename = (string)treeList1.Selection.First().GetValue(colFullPath);
                if (filename == null || !File.Exists(filename))
                {
                    return;
                }

                Process.Start("explorer.exe", "/select, \"" + filename + "\"");
            }
        }

19 View Source File : BuildDeployTools.cs
License : MIT License
Project Creator : anderm

public static bool BuildAppxFromSLN(string productName, string msBuildVersion, bool forceRebuildAppx, string buildConfig, string buildDirectory, bool incrementVersion, bool showDialog = true)
        {
            EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 0);
            string slnFilename = Path.Combine(buildDirectory, PlayerSettings.productName + ".sln");

            if (!File.Exists(slnFilename))
            {
                Debug.LogError("Unable to find Solution to build from!");
                EditorUtility.ClearProgressBar();
                return false;
            }

            // Get and validate the msBuild path...
            var vs = CalcMSBuildPath(msBuildVersion);

            if (!File.Exists(vs))
            {
                Debug.LogError("MSBuild.exe is missing or invalid (path=" + vs + "). Note that the default version is " + DefaultMSBuildVersion);
                EditorUtility.ClearProgressBar();
                return false;
            }

            // Get the path to the NuGet tool
            string unity = Path.GetDirectoryName(EditorApplication.applicationPath);
            System.Diagnostics.Debug.replacedert(unity != null, "unity != null");
            string storePath = Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), buildDirectory));
            string solutionProjectPath = Path.GetFullPath(Path.Combine(storePath, productName + @".sln"));

            // Bug in Unity editor that doesn't copy project.json and project.lock.json files correctly if solutionProjectPath is not in a folder named UWP.
            if (!File.Exists(storePath + "\\project.json"))
            {
                File.Copy(unity + @"\Data\PlaybackEngines\MetroSupport\Tools\project.json", storePath + "\\project.json");
            }

            string nugetPath = Path.Combine(unity, @"Data\PlaybackEngines\MetroSupport\Tools\NuGet.exe");

            // Before building, need to run a nuget restore to generate a json.lock file. Failing to do
            // this breaks the build in VS RTM
            if (!RestoreNugetPackages(nugetPath, storePath) ||
                !RestoreNugetPackages(nugetPath, storePath + "\\" + productName) ||
                EditorUserBuildSettings.wsaGenerateReferenceProjects && !RestoreNugetPackages(nugetPath, storePath + "/GeneratedProjects/UWP/replacedembly-CSharp") ||
                EditorUserBuildSettings.wsaGenerateReferenceProjects && !RestoreNugetPackages(nugetPath, storePath + "/GeneratedProjects/UWP/replacedembly-CSharp-firstpreplaced"))
            {
                Debug.LogError("Failed to restore nuget packages");
                EditorUtility.ClearProgressBar();
                return false;
            }

            EditorUtility.DisplayProgressBar("Build AppX", "Building AppX Package...", 25);

            // Ensure that the generated .appx version increments by modifying
            // Package.appxmanifest
            if (incrementVersion)
            {
                IncrementPackageVersion();
            }

            // Now do the actual build
            var pInfo = new System.Diagnostics.ProcessStartInfo
            {
                FileName = vs,
                CreateNoWindow = false,
                Arguments = string.Format("\"{0}\" /t:{2} /p:Configuration={1} /p:Platform=x86 /verbosity:m",
                    solutionProjectPath,
                    buildConfig,
                    forceRebuildAppx ? "Rebuild" : "Build")
            };

            // Uncomment out to debug by copying into command window
            //Debug.Log("\"" + vs + "\"" + " " + pInfo.Arguments);

            var process = new System.Diagnostics.Process { StartInfo = pInfo };

            try
            {
                if (!process.Start())
                {
                    Debug.LogError("Failed to start Cmd process!");
                    EditorUtility.ClearProgressBar();
                    return false;
                }

                process.WaitForExit();

                EditorUtility.ClearProgressBar();

                if (process.ExitCode == 0 &&
                    showDialog &&
                    !EditorUtility.DisplayDialog("Build AppX", "AppX Build Successful!", "OK", "Open Project Folder"))
                {
                    System.Diagnostics.Process.Start("explorer.exe", "/select," + storePath);
                }

                if (process.ExitCode != 0)
                {
                    Debug.LogError("MSBuild error (code = " + process.ExitCode + ")");
                    EditorUtility.DisplayDialog(PlayerSettings.productName + " build Failed!", "Failed to build appx from solution. Error code: " + process.ExitCode, "OK");
                    return false;
                }

                process.Close();
                process.Dispose();

            }
            catch (Exception e)
            {
                Debug.LogError("Cmd Process EXCEPTION: " + e);
                EditorUtility.ClearProgressBar();
                return false;
            }

            return true;
        }

19 View Source File : AspNetToNgRedirector.cs
License : MIT License
Project Creator : andfomin

public static void Main(string[] args)
        {
            /* Visual Studio configures IIS Express to host a Kestrel server.
             * When we run the project, Visual Studio starts the IIS Express which in turn starts the Kestrel server, then launches a browser and points it to the IIS Express. 
             * We serve a page from ASP.NET Core that redirects the browser from the IIS Express to the NG Development Server.
             */

            // Visual Studio writes Byte Order Mark when saves files. 
            // Webpack fails reading such a package.json. +https://github.com/webpack/enhanced-resolve/issues/87
            // Athough the docs claim that VS is aware of the special case of package.json, 
            // apparently VS fails to recognize the file when the template wizard saves it during the project creation.
            EnsurePackageJsonFileHasNoBom();

            var webHostBuilder = new WebHostBuilder();

            string ngServeOptions = GetNgServeOptions(webHostBuilder);

            // Run "ng serve". For ASP.NET applications the working directory is the project root.
            // TODO AF20170914 replacedign explicitly ngProcess.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
            var ngProcess = Process.Start("cmd.exe", "/k start ng.cmd serve"
              + (!String.IsNullOrWhiteSpace(ngServeOptions) ? " " + ngServeOptions : String.Empty)); // TODO AF20170914. Simplify: ngServeOptions??String.Empty

            var ngServerProtocol = GetNgServerProtocol(ngServeOptions);
            var ngServerPort = GetNgServerPort(ngServeOptions);
            // An NG Develpment Server may have already been started manually from the Command Prompt. Check if that is the case.
            bool isNgServerPortAvailable = IsNgServerPortAvailable(ngServerPort);

            var startPage = (isNgServerPortAvailable
              ? (StartPage
              .Replace("{{PollingUrl}}", ngServerProtocol == "https" ? PollingUrl : $"http://localhost:{ngServerPort}/")
              .Replace("{{RedirectionPageUrl}}", RedirectionPageUrl)
              .Replace("{{DebuggerWarning}}", (Debugger.IsAttached ? DebuggerWarning : String.Empty))
              )
              // Inform the developer how to specify another port.
              : PortUnavailableErrorPage
              )
              .Replace("{{StyleSection}}", StyleSection)
              ;

            var redirectionPage = RedirectionPage
              .Replace("{{NgServerProtocol}}", ngServerProtocol)
              .Replace("{{NgServerPort}}", ngServerPort.ToString());

            // We use a CancellationToken for shutting down the Kestrel server after the redirection page has been sent to the browser.
            var cancellationTokenSource = new CancellationTokenSource();
            var cancellationToken = cancellationTokenSource.Token;

            var webHost = webHostBuilder
              .UseKestrel()
              .UseIISIntegration()
              .Configure(app => app.Run(async context =>
              {
                  switch (context.Request.Path.Value)
                  {
                      case "/":
                          await context.Response.WriteAsync(startPage);
                          break;
                      case PollingUrl:
                          var isNgServerReady = await IsNgServerReady(ngServerProtocol, ngServerPort, cancellationToken);
                          context.Response.StatusCode = isNgServerReady ? StatusCodes.Status204NoContent : StatusCodes.Status503ServiceUnavailable;
                          break;
                      case RedirectionPageUrl:
                          await context.Response.WriteAsync(redirectionPage);
                          cancellationTokenSource.Cancel();
                          break;
                      default:
                          context.Response.StatusCode = StatusCodes.Status404NotFound;
                          break;
                  }

              }))
              .Build()
              ;

            // When the profile is "IIS Express" this setting is present. Sometimes we face "{{AppName}}" as the active profile, which doesn't have this setting (its value returns "production"? default?). That "{{AppName}}" profile doesn't open a web browser, so we cannot redirect anyway.
            var environmentSetting = webHostBuilder.GetSetting("environment");
            var isIISExpressEnvironment = !String.IsNullOrEmpty(environmentSetting) && (environmentSetting.ToLower() == "development");
            if (isIISExpressEnvironment)
            {
                webHost.Run(cancellationToken);
            }

            if (ngProcess != null)
            {
                ngProcess.WaitForExit();
                ngProcess.Dispose();
            }
        }

19 View Source File : ExtensionCore.cs
License : MIT License
Project Creator : AndreiMisiukevich

private void OnNewClientAddressAdded(object sender, string address)
        {
            var addressParts = address.Split(new[] {":", "//"}, StringSplitOptions.RemoveEmptyEntries);

            if (addressParts[1] == "127.0.0.1")
            {
                var port = addressParts[2];
                Process.Start("adb", $"forward tcp:{port} tcp:{port}");
            }
        }

19 View Source File : DnaEnvironment.cs
License : MIT License
Project Creator : angelsix

private bool OpenFolder(string destination)
        {
            // For windows use explorer
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start("explorer.exe", destination);
                return true;
            }
            // For Linux use xdg-open
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process.Start("xdg-open", destination);
                return true;
            }
            // For Mac use open
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Process.Start("open", destination);
                return true;
            }

            // Unknown system
            return false;
        }

19 View Source File : DnaEnvironment.cs
License : MIT License
Project Creator : angelsix

private static bool OpenBrowser(string url)
        {
            // For windows use a command line call to start URL
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}") { CreateNoWindow = true });
                return true;
            }
            // For Linux use xdg-open
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process.Start("xdg-open", url);
                return true;
            }
            // For Mac use open
            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Process.Start("open", url);
                return true;
            }

            // Unknown system
            return false;
        }

19 View Source File : UpdateChecker.cs
License : BSD 3-Clause "New" or "Revised" License
Project Creator : anoyetta

public static async void StartUpdateScript(
            bool usePreRelease = false)
        {
            var cd = Path.GetDirectoryName(replacedembly.GetExecutingreplacedembly().Location);
            var script = Path.Combine(cd, "update_hojoring.ps1");

            using (var web = new WebClient())
            {
                var temp = Path.GetTempFileName();
                File.Delete(temp);

                await web.DownloadFileTaskAsync(
                    UpdateScriptUrl,
                    temp);

                Thread.Sleep(10);
                File.Copy(temp, script, true);
            }

            if (File.Exists(script))
            {
                var args = $"-NoLog  -NoProfile -ExecutionPolicy Unrestricted -File \"{script}\" {usePreRelease}";

                Process.Start("powershell.exe", args);
            }
        }

19 View Source File : DownloaderViewModel.cs
License : GNU General Public License v3.0
Project Creator : antikmozib

internal void OpenContainingFolder(object obj)
        {
            if (obj == null) return;
            var items = (obj as ObservableCollection<object>).Cast<DownloaderObjectModel>().ToList();
            var itemsOpenable = from item in items
                                where File.Exists(item.Destination) ||
                                Directory.Exists(Path.GetDirectoryName(item.Destination))
                                select item;
            if (itemsOpenable.Count() > 1)
            {
                var result = _displayMessage.Invoke(
                    "You have selected to open " + items.Count + " folders.\n\n" +
                    "Opening too many folders at the same time may cause the system to crash.\n\n" +
                    "Do you wish to proceed?", "Open Folder",
                    MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No);

                if (result == MessageBoxResult.No)
                {
                    return;
                }
            }
            foreach (var item in itemsOpenable)
            {
                if (File.Exists(item.Destination))
                {
                    Process.Start("explorer.exe", "/select, \"\"" + item.Destination + "\"\"");
                }
                else if (Directory.Exists(Path.GetDirectoryName(item.Destination)))
                {
                    Process.Start("explorer.exe", Path.GetDirectoryName(item.Destination));
                }
            }
        }

19 View Source File : DownloaderViewModel.cs
License : GNU General Public License v3.0
Project Creator : antikmozib

private async Task TriggerUpdateCheckAsync(bool silent = false)
        {
            string url = await AppUpdateService.GetUpdateUrl(
                   AppConstants.UpdateLink,
                    replacedembly.GetExecutingreplacedembly().GetName().Name,
                    replacedembly.GetExecutingreplacedembly().GetName().Version.ToString());

            if (string.IsNullOrEmpty(url))
            {
                if (!silent)
                {
                    _displayMessage.Invoke(
                        "No new updates are available.", "Update", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                return;
            }

            if (_displayMessage.Invoke(
                "An update is available.\n\nWould you like to download it now?", "Update",
                MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.Yes) == MessageBoxResult.Yes)
            {
                Process.Start("explorer.exe", url);
            }
        }

19 View Source File : LaunchURL.cs
License : GNU General Public License v3.0
Project Creator : AnyStatus

protected override void Handle(Request request) => Process.Start("explorer.exe", $"\"{request.URL}\"");

19 View Source File : Program.cs
License : MIT License
Project Creator : arkane-systems

private static int Main (string[] args)
        {
            // Set default distro and shell
            string distro = Program.Distro == string.Empty ? string.Empty : "-d {Program.Distro}";
            string shell  = Program.Shell  == string.Empty ? "sh" : Program.Shell;

            // Cheap and nasty manual command parsing.
            // First check if help has been requested; if so, print it and exit.
            if (args.Length == 1 && (args[0] == "-h" || args[0] == "--help"))
            {
                Program.PrintHelp ();

                return 0;
            }

            // Second, check if a distro was specified (must be first argument).
            if (args.Length >= 1 && (args[0] == "-d" || args[0] == "--distro"))
            {
                if (args.Length == 1)
                {
                    Console.WriteLine (value: "If specifying a distro, you must specify a distro.");

                    return 1;
                }

                distro = $"-d {args[1]}";

                args = args.Skip (count: 2).ToArray ();
            }

            try
            {
                string arguments = $"{distro} genie -c {shell}";

                Process ps;

                if (args.Length > 0)
                {
                    // Check through additional arguments, one by one.
                    var param = new List<string> ();

                    foreach (var arg in args)

                        // Identify those which are probably Windows paths.
                        // And perform path translation.
                        param.Add (item: Program.IsWindowsPath (arg: arg) ? Program.TranslatePath (path: arg) : arg);

                    // Execute in WSL.
                    arguments = $"{arguments} -c \"{string.Join (separator: ' ', values: param)}\"";
                }

                ps = Process.Start (fileName: "wsl", arguments: arguments);
                ps.WaitForExit ();

                return ps.ExitCode;
            }
            catch (Exception ex)
            {
                Console.WriteLine (value: $"$: error executing command: {ex.Message}");

                return 127;
            }
        }

19 View Source File : ProcessHelper.cs
License : GNU General Public License v3.0
Project Creator : armandoalonso

public void StartProcess(string process, string args)
        {
            try
            {
                Process.Start(process, args);
            }
            catch (Exception ex)
            {
                LogManager.AddErrorLog(ex);
                NotificationManager.PublishErrorNotification(ex.Message);
            }
        }

19 View Source File : PlatformHelper.cs
License : GNU General Public License v3.0
Project Creator : Artentus

public static void OpenWebUrl(string url)
        {
#if WIN32
            Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
#elif LINUX
            Process.Start("xdg-open", url);
#elif OSX
            Process.Start("open", url);
#else
            // Code according to Microsoft
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process.Start("xdg-open", url);
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Process.Start("open", url);
            }
            else
            {
                throw new PlatformNotSupportedException();
            }
#endif
        }

19 View Source File : PlatformHelper.cs
License : GNU General Public License v3.0
Project Creator : Artentus

public static void OpenDirectory(DirectoryInfo directory)
        {
            string path = directory.FullName;
            if (!path.EndsWith(Path.DirectorySeparatorChar))
                path += Path.DirectorySeparatorChar;

#if WIN32
            Process.Start(new ProcessStartInfo()
            {
                FileName = path,
                UseShellExecute = true,
                Verb = "open"
            });
#elif LINUX
            Process.Start("xdg-open", path);
#elif OSX
            Process.Start("open", path);
#else
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start(new ProcessStartInfo()
                {
                    FileName = path,
                    UseShellExecute = true,
                    Verb = "open"
                });
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process.Start("xdg-open", path);
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Process.Start("open", path);
            }
            else
            {
                throw new PlatformNotSupportedException();
            }
#endif
        }

19 View Source File : MainForm.cs
License : MIT License
Project Creator : Ashesh3

private void LinkFwPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.MacOSX:
                case PlatformID.Unix:
                    System.Diagnostics.Process.Start($"file://{Path.GetDirectoryName(Configuration.Output.Path)}");
                    break;
                case PlatformID.Win32NT:
                    System.Diagnostics.Process.Start("explorer.exe", $"/select, \"{Configuration.Output.Path}\"");
                    break;
                default:
                    return;
            }

            e.Link.Visited = true;
        }

19 View Source File : Program.cs
License : MIT License
Project Creator : aspose-pdf

static void Main()
        {
            var producreplacedems = new List<Producreplacedem> {
                new Producreplacedem ("1", "Chocolate with Milk", 166.66M, 20),
                new Producreplacedem ("2", "Chocolate with Nuts", 166.66M, 20),
                new Producreplacedem ("3", "Chocolate with Pepper", 166.66M, 20)
            };
            var subTotal = producreplacedems.Sum(i => i.Total);
            var invoice = new Invoice
            {
                ForegroundColor = "#0000CC",
                BackgroundColor = "#FFFFFF",
                Number = "ABC-123",
                PaymentPeriod = 15,
                Logo = new LogoImage(@"C:\aspose\company-logo-design.png", 160, 120),
                BillFrom = new List<string> { "Eastern Chocolate Factory", "Eastern Chocolate House", "44 Shirley Ave.", "West Chicago", "IL 60185" },
                BillTo = new List<string> { "Eastern Chocolate Cafe", "Eastern Chocolate House", "44 Shirley Ave.", "West Chicago", "IL 60185" },
                Items = producreplacedems,
                Totals = new List<TotalRow>
                {
                    new TotalRow("Sub Total", subTotal),
                    new TotalRow("VAT @ 20%", subTotal*0.2M),
                    new TotalRow("Total", subTotal*1.2M)
                },
                Details = new List<string> {
                    "Terms & Conditions",
                    $"Payment is due within 15 days",
                    string.Empty,
                    "If you have any questions concerning this invoice, contact our sales department at [email protected]",
                     string.Empty,
                    "Thank you for your business."
                },
                Footer = "https://www.facebook.com/AsposePDF/"
            };


            var fileStream = new FileStream("C:\\tmp\\d2.pdf", FileMode.OpenOrCreate);
            invoice.Save(fileStream);
            fileStream.Close();
            System.Diagnostics.Process.Start("cmd.exe", "/c start C:\\tmp\\d2.pdf");
        }

19 View Source File : Updater.cs
License : MIT License
Project Creator : Assistant

private static void RunNew()
        {
            Process.Start(NewExe, Arguments);
            Application.Current.Dispatcher.Invoke(() => { Application.Current.Shutdown(); });
        }

19 View Source File : Runner.cs
License : Apache License 2.0
Project Creator : asynkron

public Task Kill()
        {
            Console.WriteLine("Killing external worker");
            Process.Start("kill", $"-s TERM {_process?.Id}");
            //_process.Kill(false);
            return Task.CompletedTask;
        }

19 View Source File : PageSettings.xaml.cs
License : GNU General Public License v3.0
Project Creator : AutoDarkMode

private void HyperlinkOpenAppDataFolder_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var folderpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "AutoDarkMode");
            Process.Start("explorer.exe", folderpath);
        }

19 View Source File : FileContextMenuExt.cs
License : MIT License
Project Creator : Autodesk-Forge

void OnVerbDisplayFileName(IntPtr hWnd)
    {
      // start the Translator.exe at the same folder as this DLL
      Process.Start(
        string.Format("\"{0}\"", Path.Combine(Path.GetDirectoryName(System.Reflection.replacedembly.GetExecutingreplacedembly().Location) + @"\Translator.exe")),
        string.Format("\"{0}\"", this.selectedFile));
    }

19 View Source File : CsvExporter.cs
License : MIT License
Project Creator : Autodesk-Forge

public static bool ExploreFile(string filePath)
        {
            if (!System.IO.File.Exists(filePath))
            {
                return false;
            }           
            filePath = System.IO.Path.GetFullPath(filePath);
            System.Diagnostics.Process.Start("explorer.exe", string.Format("/select,\"{0}\"", filePath));
            return true;
        }

19 View Source File : ProcessProvider.cs
License : Apache License 2.0
Project Creator : AutomateThePlanet

public static void Start(string fileName, string arguments)
        {
            Process.Start(fileName, arguments);
        }

19 View Source File : ProcessProvider.cs
License : Apache License 2.0
Project Creator : AutomateThePlanet

public static void StartCLIProcess(string arguments)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start("cmd.exe", $"/c {arguments}");
            }
            else
            {
                Process.Start("/bin/bash", $"-c {arguments}");
            }
        }

19 View Source File : Contributors.xaml.cs
License : MIT License
Project Creator : automuteus

public static void OpenBrowser(string url)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Process.Start("xdg-open", url);
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Process.Start("open", url);
            }
            else
            {
                // throw 
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : automuteus

public static void OpenBrowser(string url) {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
                Process.Start(new ProcessStartInfo(url) {UseShellExecute = true});
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
                Process.Start("xdg-open", url);
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
                Process.Start("open", url);
            }
        }

See More Examples