Add api function

This commit is contained in:
Jack251970 2025-06-13 13:39:13 +08:00
parent 898dbb8402
commit 4ebfb3c5fd
2 changed files with 20 additions and 1 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
@ -585,7 +586,7 @@ namespace Flow.Launcher.Plugin
/// Start a process with the given file path and arguments
/// </summary>
/// <remarks>
/// It can help to start a deelevated process when Flow is running as administrator.
/// It can help to start a deelevated process and show user account control dialog when Flow is running as administrator.
/// </remarks>
/// <param name="filePath">Absolute file path. It can be an executable file or a script file</param>
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
@ -594,5 +595,19 @@ namespace Flow.Launcher.Plugin
/// <param name="verb">The verb to use when starting the process, e.g. "runas" for elevated permissions. If not specified, no verb will be used.</param>
/// <returns>Whether process is started successfully</returns>
public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool useShellExecute = true, string verb = "");
/// <summary>
/// Start a process with the given file path and arguments
/// </summary>
/// <remarks>
/// It can help to start a deelevated process and show user account control dialog when Flow is running as administrator.
/// </remarks>
/// <param name="filePath">Absolute file path. It can be an executable file or a script file</param>
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
/// <param name="argumentList">Optional arguments to pass to the process. If not specified, no arguments will be passed</param>
/// <param name="useShellExecute">Whether to use shell to execute the process.</param>
/// <param name="verb">The verb to use when starting the process, e.g. "runas" for elevated permissions. If not specified, no verb will be used.</param>
/// <returns>Whether process is started successfully</returns>
public bool StartProcess(string filePath, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = true, string verb = "");
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
@ -617,6 +618,9 @@ namespace Flow.Launcher
}
}
public bool StartProcess(string filePath, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = true, string verb = "") =>
StartProcess(filePath, workingDirectory, argumentList == null ? string.Empty : string.Join(" ", argumentList), useShellExecute, verb);
#endregion
#region Private Methods