@@ -42,11 +42,15 @@ public List<Result> LoadContextMenus(Result selectedResult)
4242 if ( record . Type == ResultType . File && ! string . IsNullOrEmpty ( Settings . EditorPath ) )
4343 contextMenus . Add ( CreateOpenWithEditorResult ( record ) ) ;
4444
45- if ( record . Type == ResultType . Folder && record . WindowsIndexed )
45+ if ( record . Type == ResultType . Folder )
4646 {
47- contextMenus . Add ( CreateAddToIndexSearchExclusionListResult ( record ) ) ;
4847 contextMenus . Add ( CreateOpenWithShellResult ( record ) ) ;
48+ if ( record . WindowsIndexed )
49+ {
50+ contextMenus . Add ( CreateAddToIndexSearchExclusionListResult ( record ) ) ;
51+ }
4952 }
53+
5054 contextMenus . Add ( CreateOpenContainingFolderResult ( record ) ) ;
5155
5256 if ( record . WindowsIndexed )
@@ -55,14 +59,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
5559 }
5660
5761 var icoPath = ( record . Type == ResultType . File ) ? Constants . FileImagePath : Constants . FolderImagePath ;
58- var fileOrFolder = ( record . Type == ResultType . File ) ? "file" : "folder" ;
62+ bool isFile = record . Type == ResultType . File ;
5963
6064 if ( Settings . QuickAccessLinks . All ( x => ! x . Path . Equals ( record . FullPath , StringComparison . OrdinalIgnoreCase ) ) )
6165 {
6266 contextMenus . Add ( new Result
6367 {
6468 Title = Context . API . GetTranslation ( "plugin_explorer_add_to_quickaccess_title" ) ,
65- SubTitle = string . Format ( Context . API . GetTranslation ( "plugin_explorer_add_to_quickaccess_subtitle" ) , fileOrFolder ) ,
69+ SubTitle = Context . API . GetTranslation ( "plugin_explorer_add_to_quickaccess_subtitle" ) ,
6670 Action = ( context ) =>
6771 {
6872 Settings . QuickAccessLinks . Add ( new AccessLink
@@ -71,10 +75,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
7175 } ) ;
7276
7377 Context . API . ShowMsg ( Context . API . GetTranslation ( "plugin_explorer_addfilefoldersuccess" ) ,
74- string . Format (
7578 Context . API . GetTranslation ( "plugin_explorer_addfilefoldersuccess_detail" ) ,
76- fileOrFolder ) ,
77- Constants . ExplorerIconImageFullPath ) ;
79+ Constants . ExplorerIconImageFullPath ) ;
7880
7981 ViewModel . Save ( ) ;
8082
@@ -91,16 +93,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
9193 contextMenus . Add ( new Result
9294 {
9395 Title = Context . API . GetTranslation ( "plugin_explorer_remove_from_quickaccess_title" ) ,
94- SubTitle = string . Format ( Context . API . GetTranslation ( "plugin_explorer_remove_from_quickaccess_subtitle" ) , fileOrFolder ) ,
96+ SubTitle = Context . API . GetTranslation ( "plugin_explorer_remove_from_quickaccess_subtitle" ) ,
9597 Action = ( context ) =>
9698 {
97- Settings . QuickAccessLinks . Remove ( Settings . QuickAccessLinks . FirstOrDefault ( x => x . Path == record . FullPath ) ) ;
99+ Settings . QuickAccessLinks . Remove ( Settings . QuickAccessLinks . FirstOrDefault ( x => string . Equals ( x . Path , record . FullPath , StringComparison . OrdinalIgnoreCase ) ) ) ;
98100
99101 Context . API . ShowMsg ( Context . API . GetTranslation ( "plugin_explorer_removefilefoldersuccess" ) ,
100- string . Format (
101102 Context . API . GetTranslation ( "plugin_explorer_removefilefoldersuccess_detail" ) ,
102- fileOrFolder ) ,
103- Constants . ExplorerIconImageFullPath ) ;
103+ Constants . ExplorerIconImageFullPath ) ;
104104
105105 ViewModel . Save ( ) ;
106106
@@ -116,7 +116,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
116116 contextMenus . Add ( new Result
117117 {
118118 Title = Context . API . GetTranslation ( "plugin_explorer_copypath" ) ,
119- SubTitle = $ "Copy the current { fileOrFolder } path to clipboard" ,
119+ SubTitle = Context . API . GetTranslation ( "plugin_explorer_copypath_subtitle" ) ,
120120 Action = _ =>
121121 {
122122 try
@@ -138,8 +138,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
138138
139139 contextMenus . Add ( new Result
140140 {
141- Title = Context . API . GetTranslation ( "plugin_explorer_copyfilefolder" ) + $ " { fileOrFolder } " ,
142- SubTitle = $ "Copy the { fileOrFolder } to clipboard" ,
141+ Title = Context . API . GetTranslation ( "plugin_explorer_copyfilefolder" ) ,
142+ SubTitle = isFile ? Context . API . GetTranslation ( "plugin_explorer_copyfile_subtitle" ) : Context . API . GetTranslation ( "plugin_explorer_copyfolder_subtitle" ) ,
143143 Action = _ =>
144144 {
145145 try
@@ -152,7 +152,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
152152 }
153153 catch ( Exception e )
154154 {
155- var message = $ "Fail to set { fileOrFolder } in clipboard";
155+ var message = $ "Fail to set file/folder in clipboard";
156156 LogException ( message , e ) ;
157157 Context . API . ShowMsg ( message ) ;
158158 return false ;
@@ -167,35 +167,35 @@ public List<Result> LoadContextMenus(Result selectedResult)
167167 if ( record . Type is ResultType . File or ResultType . Folder )
168168 contextMenus . Add ( new Result
169169 {
170- Title = Context . API . GetTranslation ( "plugin_explorer_deletefilefolder" ) + $ " { fileOrFolder } " ,
171- SubTitle = Context . API . GetTranslation ( "plugin_explorer_deletefilefolder_subtitle " ) + $ " { fileOrFolder } " ,
170+ Title = Context . API . GetTranslation ( "plugin_explorer_deletefilefolder" ) ,
171+ SubTitle = isFile ? Context . API . GetTranslation ( "plugin_explorer_deletefile_subtitle " ) : Context . API . GetTranslation ( "plugin_explorer_deletefolder_subtitle" ) ,
172172 Action = ( context ) =>
173173 {
174174 try
175175 {
176176 if ( MessageBox . Show (
177- string . Format ( Context . API . GetTranslation ( "plugin_explorer_deletefilefolderconfirm" ) , fileOrFolder ) ,
177+ Context . API . GetTranslation ( "plugin_explorer_deletefilefolderconfirm" ) ,
178178 string . Empty ,
179179 MessageBoxButton . YesNo ,
180180 MessageBoxIcon . Warning )
181181 == DialogResult . No )
182182 return false ;
183183
184- if ( record . Type == ResultType . File )
184+ if ( isFile )
185185 File . Delete ( record . FullPath ) ;
186186 else
187187 Directory . Delete ( record . FullPath , true ) ;
188188
189189 _ = Task . Run ( ( ) =>
190190 {
191191 Context . API . ShowMsg ( Context . API . GetTranslation ( "plugin_explorer_deletefilefoldersuccess" ) ,
192- string . Format ( Context . API . GetTranslation ( "plugin_explorer_deletefilefoldersuccess_detail" ) , fileOrFolder ) ,
192+ string . Format ( Context . API . GetTranslation ( "plugin_explorer_deletefilefoldersuccess_detail" ) , record . FullPath ) ,
193193 Constants . ExplorerIconImageFullPath ) ;
194194 } ) ;
195195 }
196196 catch ( Exception e )
197197 {
198- var message = $ "Fail to delete { fileOrFolder } at { record . FullPath } ";
198+ var message = $ "Fail to delete { record . FullPath } ";
199199 LogException ( message , e ) ;
200200 Context . API . ShowMsgError ( message ) ;
201201 return false ;
@@ -382,7 +382,7 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
382382 SubTitle = Context . API . GetTranslation ( "plugin_explorer_path" ) + " " + record . FullPath ,
383383 Action = _ =>
384384 {
385- if ( ! Settings . IndexSearchExcludedSubdirectoryPaths . Any ( x => x . Path == record . FullPath ) )
385+ if ( ! Settings . IndexSearchExcludedSubdirectoryPaths . Any ( x => string . Equals ( x . Path , record . FullPath , StringComparison . OrdinalIgnoreCase ) ) )
386386 Settings . IndexSearchExcludedSubdirectoryPaths . Add ( new AccessLink
387387 {
388388 Path = record . FullPath
0 commit comments