1
- using Microsoft . Win32 ;
2
- using System ;
1
+ using System ;
2
+ using System . ComponentModel ;
3
3
using System . Diagnostics ;
4
4
using System . IO ;
5
5
using System . Linq ;
6
+ using Microsoft . Win32 ;
6
7
7
8
namespace Flow . Launcher . Plugin . SharedCommands
8
9
{
@@ -13,7 +14,7 @@ public static class SearchWeb
13
14
{
14
15
private static string GetDefaultBrowserPath ( )
15
16
{
16
- string name = string . Empty ;
17
+ var name = string . Empty ;
17
18
try
18
19
{
19
20
using var regDefault = Registry . CurrentUser . OpenSubKey ( "Software\\ Microsoft\\ Windows\\ Shell\\ Associations\\ UrlAssociations\\ http\\ UserChoice" , false ) ;
@@ -23,8 +24,7 @@ private static string GetDefaultBrowserPath()
23
24
name = regKey . GetValue ( null ) . ToString ( ) . ToLower ( ) . Replace ( "\" " , "" ) ;
24
25
25
26
if ( ! name . EndsWith ( "exe" ) )
26
- name = name . Substring ( 0 , name . LastIndexOf ( ".exe" ) + 4 ) ;
27
-
27
+ name = name [ ..( name . LastIndexOf ( ".exe" ) + 4 ) ] ;
28
28
}
29
29
catch
30
30
{
@@ -65,7 +65,8 @@ public static void OpenInBrowserWindow(this string url, string browserPath = "",
65
65
{
66
66
Process . Start ( psi ) ? . Dispose ( ) ;
67
67
}
68
- catch ( System . ComponentModel . Win32Exception )
68
+ // This error may be thrown if browser path is incorrect
69
+ catch ( Win32Exception )
69
70
{
70
71
Process . Start ( new ProcessStartInfo
71
72
{
@@ -100,7 +101,7 @@ public static void OpenInBrowserTab(this string url, string browserPath = "", bo
100
101
Process . Start ( psi ) ? . Dispose ( ) ;
101
102
}
102
103
// This error may be thrown if browser path is incorrect
103
- catch ( System . ComponentModel . Win32Exception )
104
+ catch ( Win32Exception )
104
105
{
105
106
Process . Start ( new ProcessStartInfo
106
107
{
0 commit comments