Improve documents

This commit is contained in:
Jack251970 2025-06-15 01:25:34 +08:00
parent b6b45d495a
commit 4df7264c8a
2 changed files with 11 additions and 11 deletions

View file

@ -593,13 +593,13 @@ namespace Flow.Launcher.Plugin
/// <remarks>
/// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator.
/// </remarks>
/// <param name="filePath">File path</param>
/// <param name="fileName">File name</param>
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
/// <param name="arguments">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">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 = false, string verb = "");
public bool StartProcess(string fileName, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = "");
/// <summary>
/// Start a process with support for handling administrative privileges
@ -607,12 +607,12 @@ namespace Flow.Launcher.Plugin
/// <remarks>
/// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator.
/// </remarks>
/// <param name="filePath">File path</param>
/// <param name="fileName">File name</param>
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
/// <param name="argumentList">Optional argument list 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">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 = false, string verb = "");
public bool StartProcess(string fileName, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = false, string verb = "");
}
}

View file

@ -575,7 +575,7 @@ namespace Flow.Launcher
public Task<long> StopwatchLogInfoAsync(string className, string message, Func<Task> action, [CallerMemberName] string methodName = "") =>
Stopwatch.InfoAsync(className, message, action, methodName);
public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = "")
public bool StartProcess(string fileName, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = "")
{
try
{
@ -587,13 +587,13 @@ namespace Flow.Launcher
var result = Win32Helper.RunAsDesktopUser(
Constant.CommandExecutablePath,
Environment.CurrentDirectory,
$"-StartProcess -FileName {AddDoubleQuotes(filePath)} -WorkingDirectory {AddDoubleQuotes(workingDirectory)} -Arguments {AddDoubleQuotes(arguments)} -UseShellExecute {useShellExecute} -Verb {AddDoubleQuotes(verb)}",
$"-StartProcess -FileName {AddDoubleQuotes(fileName)} -WorkingDirectory {AddDoubleQuotes(workingDirectory)} -Arguments {AddDoubleQuotes(arguments)} -UseShellExecute {useShellExecute} -Verb {AddDoubleQuotes(verb)}",
false,
true, // Do not show the command window
out var errorInfo);
if (!string.IsNullOrEmpty(errorInfo))
{
LogError(ClassName, $"Failed to start process {filePath} with error: {errorInfo}");
LogError(ClassName, $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}: {errorInfo}");
}
return result;
@ -601,7 +601,7 @@ namespace Flow.Launcher
var info = new ProcessStartInfo
{
FileName = filePath,
FileName = fileName,
WorkingDirectory = workingDirectory,
Arguments = arguments,
UseShellExecute = useShellExecute,
@ -612,13 +612,13 @@ namespace Flow.Launcher
}
catch (Exception e)
{
LogException(ClassName, $"Failed to start process {filePath} with arguments {arguments} under {workingDirectory}", e);
LogException(ClassName, $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}", e);
return false;
}
}
public bool StartProcess(string filePath, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = false, string verb = "") =>
StartProcess(filePath, workingDirectory, JoinArgumentList(argumentList), useShellExecute, verb);
public bool StartProcess(string fileName, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = false, string verb = "") =>
StartProcess(fileName, workingDirectory, JoinArgumentList(argumentList), useShellExecute, verb);
private static string AddDoubleQuotes(string arg)
{