@@ -1104,47 +1104,39 @@ public void UpdateResultView(IEnumerable<ResultsForUpdate> resultsForUpdates)
1104
1104
}
1105
1105
1106
1106
/// <summary>
1107
- /// This is the global copy method for an individual result. If no text is passed,
1108
- /// the method will work out what is to be copied based on the result, so plugin can offer the text
1109
- /// to be copied via the result model. If the text is a directory/file path,
1110
- /// then actual file/folder will be copied instead.
1111
- /// The result's subtitle text is the default text to be copied
1107
+ /// Copies the specified file or folder path to the clipboard, or the specified text if it is not a valid file or folder path.
1108
+ /// Shows a message indicating whether the operation was completed successfully.
1112
1109
/// </summary>
1110
+ /// <param name="stringToCopy">The file or folder path, or text to copy to the clipboard.</param>
1111
+ /// <returns>Nothing.</returns>
1113
1112
public void ResultCopy ( string stringToCopy )
1114
1113
{
1115
1114
if ( string . IsNullOrEmpty ( stringToCopy ) )
1116
1115
{
1117
- var result = Results . SelectedItem ? . Result ;
1118
- if ( result != null )
1119
- {
1120
- string copyText = result . CopyText ;
1121
- var isFile = File . Exists ( copyText ) ;
1122
- var isFolder = Directory . Exists ( copyText ) ;
1123
- if ( isFile || isFolder )
1124
- {
1125
- var paths = new StringCollection
1126
- {
1127
- copyText
1128
- } ;
1129
-
1130
- Clipboard . SetFileDropList ( paths ) ;
1131
- App . API . ShowMsg (
1132
- $ "{ App . API . GetTranslation ( "copy" ) } { ( isFile ? App . API . GetTranslation ( "fileTitle" ) : App . API . GetTranslation ( "folderTitle" ) ) } ",
1133
- App . API . GetTranslation ( "completedSuccessfully" ) ) ;
1134
- }
1135
- else
1136
- {
1137
- Clipboard . SetDataObject ( copyText ) ;
1138
- App . API . ShowMsg (
1139
- $ "{ App . API . GetTranslation ( "copy" ) } { App . API . GetTranslation ( "textTitle" ) } ",
1140
- App . API . GetTranslation ( "completedSuccessfully" ) ) ;
1141
- }
1142
- }
1143
-
1144
1116
return ;
1145
1117
}
1118
+ var isFile = File . Exists ( stringToCopy ) ;
1119
+ var isFolder = Directory . Exists ( stringToCopy ) ;
1120
+ if ( isFile || isFolder )
1121
+ {
1122
+ var paths = new StringCollection
1123
+ {
1124
+ stringToCopy
1125
+ } ;
1146
1126
1147
- Clipboard . SetDataObject ( stringToCopy ) ;
1127
+ Clipboard . SetFileDropList ( paths ) ;
1128
+ App . API . ShowMsg (
1129
+ $ "{ App . API . GetTranslation ( "copy" ) } { ( isFile ? App . API . GetTranslation ( "fileTitle" ) : App . API . GetTranslation ( "folderTitle" ) ) } ",
1130
+ App . API . GetTranslation ( "completedSuccessfully" ) ) ;
1131
+ }
1132
+ else
1133
+ {
1134
+ Clipboard . SetDataObject ( stringToCopy ) ;
1135
+ App . API . ShowMsg (
1136
+ $ "{ App . API . GetTranslation ( "copy" ) } { App . API . GetTranslation ( "textTitle" ) } ",
1137
+ App . API . GetTranslation ( "completedSuccessfully" ) ) ;
1138
+ }
1139
+ return ;
1148
1140
}
1149
1141
1150
1142
#endregion
0 commit comments