@@ -20,304 +20,155 @@ public JsonRPCPublicAPI(IPublicAPI api)
20
20
_api = api ;
21
21
}
22
22
23
- /// <summary>
24
- /// Change Flow.Launcher query
25
- /// </summary>
26
- /// <param name="query">query text</param>
27
- /// <param name="requery">
28
- /// Force requery. By default, Flow Launcher will not fire query if your query is same with existing one.
29
- /// Set this to <see langword="true"/> to force Flow Launcher requerying
30
- /// </param>
31
23
public void ChangeQuery ( string query , bool requery = false )
32
24
{
33
25
_api . ChangeQuery ( query , requery ) ;
34
26
}
35
27
36
- /// <summary>
37
- /// Restart Flow Launcher
38
- /// </summary>
39
28
public void RestartApp ( )
40
29
{
41
30
_api . RestartApp ( ) ;
42
31
}
43
32
44
- /// <summary>
45
- /// Run a shell command
46
- /// </summary>
47
- /// <param name="cmd">The command or program to run</param>
48
- /// <param name="filename">the shell type to run, e.g. powershell.exe</param>
49
- /// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>
50
- /// <exception cref="Win32Exception">Thrown when error occurs during the execution of the command </exception>
51
33
public void ShellRun ( string cmd , string filename = "cmd.exe" )
52
34
{
53
35
_api . ShellRun ( cmd , filename ) ;
54
36
}
55
37
56
- /// <summary>
57
- /// Copies the passed in text and shows a message indicating whether the operation was completed successfully.
58
- /// When directCopy is set to true and passed in text is the path to a file or directory,
59
- /// the actual file/directory will be copied to clipboard. Otherwise the text itself will still be copied to clipboard.
60
- /// </summary>
61
- /// <param name="text">Text to save on clipboard</param>
62
- /// <param name="directCopy">When true it will directly copy the file/folder from the path specified in text</param>
63
- /// <param name="showDefaultNotification">Whether to show the default notification from this method after copy is done.
64
- /// It will show file/folder/text is copied successfully.
65
- /// Turn this off to show your own notification after copy is done.</param>>
66
38
public void CopyToClipboard ( string text , bool directCopy = false , bool showDefaultNotification = true )
67
39
{
68
40
_api . CopyToClipboard ( text , directCopy , showDefaultNotification ) ;
69
41
}
70
42
71
- /// <summary>
72
- /// Save everything, all of Flow Launcher and plugins' data and settings
73
- /// </summary>
74
43
public void SaveAppAllSettings ( )
75
44
{
76
45
_api . SaveAppAllSettings ( ) ;
77
46
}
78
47
79
- /// <summary>
80
- /// Save all Flow's plugins settings
81
- /// </summary>
82
48
public void SavePluginSettings ( )
83
49
{
84
50
_api . SavePluginSettings ( ) ;
85
51
}
86
52
87
- /// <summary>
88
- /// Reloads any Plugins that have the
89
- /// IReloadable implemented. It refeshes
90
- /// Plugin's in memory data with new content
91
- /// added by user.
92
- /// </summary>
93
53
public Task ReloadAllPluginDataAsync ( )
94
54
{
95
55
return _api . ReloadAllPluginData ( ) ;
96
56
}
97
57
98
- /// <summary>
99
- /// Check for new Flow Launcher update
100
- /// </summary>
101
58
public void CheckForNewUpdate ( )
102
59
{
103
60
_api . CheckForNewUpdate ( ) ;
104
61
}
105
62
106
- /// <summary>
107
- /// Show the error message using Flow's standard error icon.
108
- /// </summary>
109
- /// <param name="title">Message title</param>
110
- /// <param name="subTitle">Optional message subtitle</param>
111
63
public void ShowMsgError ( string title , string subTitle = "" )
112
64
{
113
65
_api . ShowMsgError ( title , subTitle ) ;
114
66
}
115
67
116
- /// <summary>
117
- /// Show the MainWindow when hiding
118
- /// </summary>
119
68
public void ShowMainWindow ( )
120
69
{
121
70
_api . ShowMainWindow ( ) ;
122
71
}
123
72
124
- /// <summary>
125
- /// Hide MainWindow
126
- /// </summary>
127
73
public void HideMainWindow ( )
128
74
{
129
75
_api . HideMainWindow ( ) ;
130
76
}
131
77
132
- /// <summary>
133
- /// Representing whether the main window is visible
134
- /// </summary>
135
- /// <returns></returns>
136
78
public bool IsMainWindowVisible ( )
137
79
{
138
80
return _api . IsMainWindowVisible ( ) ;
139
81
}
140
82
141
- /// <summary>
142
- /// Show message box
143
- /// </summary>
144
- /// <param name="title">Message title</param>
145
- /// <param name="subTitle">Message subtitle</param>
146
- /// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
147
83
public void ShowMsg ( string title , string subTitle = "" , string iconPath = "" )
148
84
{
149
85
_api . ShowMsg ( title , subTitle , iconPath ) ;
150
86
}
151
87
152
- /// <summary>
153
- /// Show message box
154
- /// </summary>
155
- /// <param name="title">Message title</param>
156
- /// <param name="subTitle">Message subtitle</param>
157
- /// <param name="iconPath">Message icon path (relative path to your plugin folder)</param>
158
- /// <param name="useMainWindowAsOwner">when true will use main windows as the owner</param>
159
88
public void ShowMsg ( string title , string subTitle , string iconPath , bool useMainWindowAsOwner = true )
160
89
{
161
90
_api . ShowMsg ( title , subTitle , iconPath , useMainWindowAsOwner ) ;
162
91
}
163
92
164
- /// <summary>
165
- /// Open setting dialog
166
- /// </summary>
167
93
public void OpenSettingDialog ( )
168
94
{
169
95
_api . OpenSettingDialog ( ) ;
170
96
}
171
97
172
- /// <summary>
173
- /// Get translation of current language
174
- /// You need to implement IPluginI18n if you want to support multiple languages for your plugin
175
- /// </summary>
176
- /// <param name="key"></param>
177
- /// <returns></returns>
178
98
public string GetTranslation ( string key )
179
99
{
180
100
return _api . GetTranslation ( key ) ;
181
101
}
182
102
183
- /// <summary>
184
- /// Get all loaded plugins
185
- /// </summary>
186
- /// <returns></returns>
187
103
public List < PluginPair > GetAllPlugins ( )
188
104
{
189
105
return _api . GetAllPlugins ( ) ;
190
106
}
191
107
192
108
193
- /// <summary>
194
- /// Fuzzy Search the string with the given query. This is the core search mechanism Flow uses
195
- /// </summary>
196
- /// <param name="query">Query string</param>
197
- /// <param name="stringToCompare">The string that will be compared against the query</param>
198
- /// <returns>Match results</returns>
199
109
public MatchResult FuzzySearch ( string query , string stringToCompare )
200
110
{
201
111
return _api . FuzzySearch ( query , stringToCompare ) ;
202
112
}
203
113
204
- /// <summary>
205
- /// Http download the spefic url and return as string
206
- /// </summary>
207
- /// <param name="url">URL to call Http Get</param>
208
- /// <param name="token">Cancellation Token</param>
209
- /// <returns>Task to get string result</returns>
210
114
public Task < string > HttpGetStringAsync ( string url , CancellationToken token = default )
211
115
{
212
116
return _api . HttpGetStringAsync ( url , token ) ;
213
117
}
214
118
215
- /// <summary>
216
- /// Http download the spefic url and return as stream
217
- /// </summary>
218
- /// <param name="url">URL to call Http Get</param>
219
- /// <param name="token">Cancellation Token</param>
220
- /// <returns>Task to get stream result</returns>
221
119
public Task < Stream > HttpGetStreamAsync ( string url , CancellationToken token = default )
222
120
{
223
121
return _api . HttpGetStreamAsync ( url , token ) ;
224
122
}
225
123
226
- /// <summary>
227
- /// Download the specific url to a cretain file path
228
- /// </summary>
229
- /// <param name="url">URL to download file</param>
230
- /// <param name="filePath">path to save downloaded file</param>
231
- /// <param name="token">place to store file</param>
232
- /// <returns>Task showing the progress</returns>
233
124
public Task HttpDownloadAsync ( [ NotNull ] string url , [ NotNull ] string filePath ,
234
125
CancellationToken token = default )
235
126
{
236
127
return _api . HttpDownloadAsync ( url , filePath , token ) ;
237
128
}
238
129
239
- /// <summary>
240
- /// Add ActionKeyword for specific plugin
241
- /// </summary>
242
- /// <param name="pluginId">ID for plugin that needs to add action keyword</param>
243
- /// <param name="newActionKeyword">The actionkeyword that is supposed to be added</param>
244
130
public void AddActionKeyword ( string pluginId , string newActionKeyword )
245
131
{
246
132
_api . AddActionKeyword ( pluginId , newActionKeyword ) ;
247
133
}
248
134
249
- /// <summary>
250
- /// Remove ActionKeyword for specific plugin
251
- /// </summary>
252
- /// <param name="pluginId">ID for plugin that needs to remove action keyword</param>
253
- /// <param name="oldActionKeyword">The actionkeyword that is supposed to be removed</param>
254
135
public void RemoveActionKeyword ( string pluginId , string oldActionKeyword )
255
136
{
256
137
_api . RemoveActionKeyword ( pluginId , oldActionKeyword ) ;
257
138
}
258
139
259
- /// <summary>
260
- /// Check whether specific ActionKeyword is assigned to any of the plugin
261
- /// </summary>
262
- /// <param name="actionKeyword">The actionkeyword for checking</param>
263
- /// <returns>True if the actionkeyword is already assigned, False otherwise</returns>
264
140
public bool ActionKeywordAssigned ( string actionKeyword )
265
141
{
266
142
return _api . ActionKeywordAssigned ( actionKeyword ) ;
267
143
}
268
144
269
- /// <summary>
270
- /// Log debug message
271
- /// Message will only be logged in Debug mode
272
- /// </summary>
273
145
public void LogDebug ( string className , string message , [ CallerMemberName ] string methodName = "" )
274
146
{
275
147
_api . LogDebug ( className , message , methodName ) ;
276
148
}
277
149
278
- /// <summary>
279
- /// Log info message
280
- /// </summary>
281
150
public void LogInfo ( string className , string message , [ CallerMemberName ] string methodName = "" )
282
151
{
283
152
_api . LogInfo ( className , message , methodName ) ;
284
153
}
285
154
286
- /// <summary>
287
- /// Log warning message
288
- /// </summary>
289
155
public void LogWarn ( string className , string message , [ CallerMemberName ] string methodName = "" )
290
156
{
291
157
_api . LogWarn ( className , message , methodName ) ;
292
158
}
293
159
294
-
295
- /// <summary>
296
- /// Open directory in an explorer configured by user via Flow's Settings. The default is Windows Explorer
297
- /// </summary>
298
- /// <param name="DirectoryPath">Directory Path to open</param>
299
- /// <param name="FileNameOrFilePath">Extra FileName Info</param>
300
160
public void OpenDirectory ( string DirectoryPath , string FileNameOrFilePath = null )
301
161
{
302
162
_api . OpenDirectory ( DirectoryPath , FileNameOrFilePath ) ;
303
163
}
304
164
305
165
306
- /// <summary>
307
- /// Opens the URL with the given string.
308
- /// The browser and mode used is based on what's configured in Flow's default browser settings.
309
- /// Non-C# plugins should use this method.
310
- /// </summary>
311
166
public void OpenUrl ( string url , bool ? inPrivate = null )
312
167
{
313
168
_api . OpenUrl ( url , inPrivate ) ;
314
169
}
315
170
316
171
317
- /// <summary>
318
- /// Opens the application URI with the given string, e.g. obsidian://search-query-example
319
- /// Non-C# plugins should use this method
320
- /// </summary>
321
172
public void OpenAppUri ( string appUri )
322
173
{
323
174
_api . OpenAppUri ( appUri ) ;
0 commit comments