Skip to content

Commit 4ebfb3c

Browse files
committed
Add api function
1 parent 898dbb8 commit 4ebfb3c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
34
using System.ComponentModel;
45
using System.IO;
56
using System.Runtime.CompilerServices;
@@ -585,7 +586,7 @@ public interface IPublicAPI
585586
/// Start a process with the given file path and arguments
586587
/// </summary>
587588
/// <remarks>
588-
/// It can help to start a deelevated process when Flow is running as administrator.
589+
/// It can help to start a deelevated process and show user account control dialog when Flow is running as administrator.
589590
/// </remarks>
590591
/// <param name="filePath">Absolute file path. It can be an executable file or a script file</param>
591592
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
@@ -594,5 +595,19 @@ public interface IPublicAPI
594595
/// <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>
595596
/// <returns>Whether process is started successfully</returns>
596597
public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool useShellExecute = true, string verb = "");
598+
599+
/// <summary>
600+
/// Start a process with the given file path and arguments
601+
/// </summary>
602+
/// <remarks>
603+
/// It can help to start a deelevated process and show user account control dialog when Flow is running as administrator.
604+
/// </remarks>
605+
/// <param name="filePath">Absolute file path. It can be an executable file or a script file</param>
606+
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
607+
/// <param name="argumentList">Optional arguments to pass to the process. If not specified, no arguments will be passed</param>
608+
/// <param name="useShellExecute">Whether to use shell to execute the process.</param>
609+
/// <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>
610+
/// <returns>Whether process is started successfully</returns>
611+
public bool StartProcess(string filePath, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = true, string verb = "");
597612
}
598613
}

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Concurrent;
33
using System.Collections.Generic;
4+
using System.Collections.ObjectModel;
45
using System.Collections.Specialized;
56
using System.ComponentModel;
67
using System.Diagnostics;
@@ -617,6 +618,9 @@ public bool StartProcess(string filePath, string workingDirectory = "", string a
617618
}
618619
}
619620

621+
public bool StartProcess(string filePath, string workingDirectory = "", Collection<string> argumentList = null, bool useShellExecute = true, string verb = "") =>
622+
StartProcess(filePath, workingDirectory, argumentList == null ? string.Empty : string.Join(" ", argumentList), useShellExecute, verb);
623+
620624
#endregion
621625

622626
#region Private Methods

0 commit comments

Comments
 (0)