@@ -42,11 +42,15 @@ public List<Result> LoadContextMenus(Result selectedResult)
42
42
if ( record . Type == ResultType . File && ! string . IsNullOrEmpty ( Settings . EditorPath ) )
43
43
contextMenus . Add ( CreateOpenWithEditorResult ( record ) ) ;
44
44
45
- if ( record . Type == ResultType . Folder && record . WindowsIndexed )
45
+ if ( record . Type == ResultType . Folder )
46
46
{
47
- contextMenus . Add ( CreateAddToIndexSearchExclusionListResult ( record ) ) ;
48
47
contextMenus . Add ( CreateOpenWithShellResult ( record ) ) ;
48
+ if ( record . WindowsIndexed )
49
+ {
50
+ contextMenus . Add ( CreateAddToIndexSearchExclusionListResult ( record ) ) ;
51
+ }
49
52
}
53
+
50
54
contextMenus . Add ( CreateOpenContainingFolderResult ( record ) ) ;
51
55
52
56
if ( record . WindowsIndexed )
@@ -55,14 +59,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
55
59
}
56
60
57
61
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 ;
59
63
60
64
if ( Settings . QuickAccessLinks . All ( x => ! x . Path . Equals ( record . FullPath , StringComparison . OrdinalIgnoreCase ) ) )
61
65
{
62
66
contextMenus . Add ( new Result
63
67
{
64
68
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" ) ,
66
70
Action = ( context ) =>
67
71
{
68
72
Settings . QuickAccessLinks . Add ( new AccessLink
@@ -71,10 +75,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
71
75
} ) ;
72
76
73
77
Context . API . ShowMsg ( Context . API . GetTranslation ( "plugin_explorer_addfilefoldersuccess" ) ,
74
- string . Format (
75
78
Context . API . GetTranslation ( "plugin_explorer_addfilefoldersuccess_detail" ) ,
76
- fileOrFolder ) ,
77
- Constants . ExplorerIconImageFullPath ) ;
79
+ Constants . ExplorerIconImageFullPath ) ;
78
80
79
81
ViewModel . Save ( ) ;
80
82
@@ -91,16 +93,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
91
93
contextMenus . Add ( new Result
92
94
{
93
95
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" ) ,
95
97
Action = ( context ) =>
96
98
{
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 ) ) ) ;
98
100
99
101
Context . API . ShowMsg ( Context . API . GetTranslation ( "plugin_explorer_removefilefoldersuccess" ) ,
100
- string . Format (
101
102
Context . API . GetTranslation ( "plugin_explorer_removefilefoldersuccess_detail" ) ,
102
- fileOrFolder ) ,
103
- Constants . ExplorerIconImageFullPath ) ;
103
+ Constants . ExplorerIconImageFullPath ) ;
104
104
105
105
ViewModel . Save ( ) ;
106
106
@@ -116,7 +116,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
116
116
contextMenus . Add ( new Result
117
117
{
118
118
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" ) ,
120
120
Action = _ =>
121
121
{
122
122
try
@@ -138,8 +138,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
138
138
139
139
contextMenus . Add ( new Result
140
140
{
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" ) ,
143
143
Action = _ =>
144
144
{
145
145
try
@@ -152,7 +152,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
152
152
}
153
153
catch ( Exception e )
154
154
{
155
- var message = $ "Fail to set { fileOrFolder } in clipboard";
155
+ var message = $ "Fail to set file/folder in clipboard";
156
156
LogException ( message , e ) ;
157
157
Context . API . ShowMsg ( message ) ;
158
158
return false ;
@@ -167,35 +167,35 @@ public List<Result> LoadContextMenus(Result selectedResult)
167
167
if ( record . Type is ResultType . File or ResultType . Folder )
168
168
contextMenus . Add ( new Result
169
169
{
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" ) ,
172
172
Action = ( context ) =>
173
173
{
174
174
try
175
175
{
176
176
if ( MessageBox . Show (
177
- string . Format ( Context . API . GetTranslation ( "plugin_explorer_deletefilefolderconfirm" ) , fileOrFolder ) ,
177
+ Context . API . GetTranslation ( "plugin_explorer_deletefilefolderconfirm" ) ,
178
178
string . Empty ,
179
179
MessageBoxButton . YesNo ,
180
180
MessageBoxIcon . Warning )
181
181
== DialogResult . No )
182
182
return false ;
183
183
184
- if ( record . Type == ResultType . File )
184
+ if ( isFile )
185
185
File . Delete ( record . FullPath ) ;
186
186
else
187
187
Directory . Delete ( record . FullPath , true ) ;
188
188
189
189
_ = Task . Run ( ( ) =>
190
190
{
191
191
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 ) ,
193
193
Constants . ExplorerIconImageFullPath ) ;
194
194
} ) ;
195
195
}
196
196
catch ( Exception e )
197
197
{
198
- var message = $ "Fail to delete { fileOrFolder } at { record . FullPath } ";
198
+ var message = $ "Fail to delete { record . FullPath } ";
199
199
LogException ( message , e ) ;
200
200
Context . API . ShowMsgError ( message ) ;
201
201
return false ;
@@ -382,7 +382,7 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
382
382
SubTitle = Context . API . GetTranslation ( "plugin_explorer_path" ) + " " + record . FullPath ,
383
383
Action = _ =>
384
384
{
385
- if ( ! Settings . IndexSearchExcludedSubdirectoryPaths . Any ( x => x . Path == record . FullPath ) )
385
+ if ( ! Settings . IndexSearchExcludedSubdirectoryPaths . Any ( x => string . Equals ( x . Path , record . FullPath , StringComparison . OrdinalIgnoreCase ) ) )
386
386
Settings . IndexSearchExcludedSubdirectoryPaths . Add ( new AccessLink
387
387
{
388
388
Path = record . FullPath
0 commit comments