@@ -138,34 +138,33 @@ on existingPlugin.Metadata.ID equals pluginFromManifest.ID
138138 var results = resultsForUpdate
139139 . Select ( x =>
140140 new Result
141+ {
142+ Title = $ "{ x . Name } by { x . Author } ",
143+ SubTitle = $ "Update from version { x . CurrentVersion } to { x . NewVersion } ",
144+ IcoPath = x . IcoPath ,
145+ Action = e =>
141146 {
142- Title = $ "{ x . Name } by { x . Author } ",
143- SubTitle = $ "Update from version { x . CurrentVersion } to { x . NewVersion } ",
144- IcoPath = x . IcoPath ,
145- Action = e =>
146- {
147- string message = string . Format ( Context . API . GetTranslation ( "plugin_pluginsmanager_update_prompt" ) ,
148- x . Name , x . Author ,
149- Environment . NewLine , Environment . NewLine ) ;
150-
151- if ( MessageBox . Show ( message , Context . API . GetTranslation ( "plugin_pluginsmanager_update_title" ) ,
152- MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
153- {
154- Uninstall ( x . PluginExistingMetadata ) ;
147+ string message = string . Format ( Context . API . GetTranslation ( "plugin_pluginsmanager_update_prompt" ) ,
148+ x . Name , x . Author ,
149+ Environment . NewLine , Environment . NewLine ) ;
155150
156- var downloadToFilePath = Path . Combine ( DataLocation . PluginsDirectory , $ "{ x . Name } -{ x . NewVersion } .zip") ;
157- Http . Download ( x . PluginNewUserPlugin . UrlDownload , downloadToFilePath ) ;
158- Install ( x . PluginNewUserPlugin , downloadToFilePath ) ;
151+ if ( MessageBox . Show ( message , Context . API . GetTranslation ( "plugin_pluginsmanager_update_title" ) ,
152+ MessageBoxButton . YesNo ) == MessageBoxResult . Yes )
153+ {
154+ Uninstall ( x . PluginExistingMetadata ) ;
159155
160- Context . API . RestartApp ( ) ;
156+ var downloadToFilePath = Path . Combine ( DataLocation . PluginsDirectory , $ "{ x . Name } -{ x . NewVersion } .zip") ;
157+ Http . Download ( x . PluginNewUserPlugin . UrlDownload , downloadToFilePath ) ;
158+ Install ( x . PluginNewUserPlugin , downloadToFilePath ) ;
161159
162- return true ;
163- }
160+ Context . API . RestartApp ( ) ;
164161
165- return false ;
162+ return true ;
166163 }
167- } )
168- . ToList ( ) ;
164+
165+ return false ;
166+ }
167+ } ) ;
169168
170169 return Search ( results , uninstallSearch ) ;
171170 }
@@ -175,10 +174,10 @@ internal bool PluginExists(string id)
175174 return Context . API . GetAllPlugins ( ) . Any ( x => x . Metadata . ID == id ) ;
176175 }
177176
178- internal List < Result > Search ( List < Result > results , string searchName )
177+ internal List < Result > Search ( IEnumerable < Result > results , string searchName )
179178 {
180179 if ( string . IsNullOrEmpty ( searchName ) )
181- return results ;
180+ return results . ToList ( ) ;
182181
183182 return results
184183 . Where ( x =>
@@ -211,8 +210,7 @@ internal List<Result> RequestInstallOrUpdate(string searchName)
211210 return ShouldHideWindow ;
212211 } ,
213212 ContextData = x
214- } )
215- . ToList ( ) ;
213+ } ) ;
216214
217215 return Search ( results , searchName ) ;
218216 }
@@ -265,7 +263,7 @@ internal List<Result> RequestUninstall(string search)
265263
266264 var uninstallSearch = search . Replace ( Settings . HotkeyUninstall , string . Empty ) . TrimStart ( ) ;
267265
268- var results = Context . API
266+ var results = Context . API
269267 . GetAllPlugins ( )
270268 . Select ( x =>
271269 new Result
@@ -291,8 +289,7 @@ internal List<Result> RequestUninstall(string search)
291289
292290 return false ;
293291 }
294- } )
295- . ToList ( ) ;
292+ } ) ;
296293
297294 return Search ( results , uninstallSearch ) ;
298295 }
0 commit comments