Implement move to recycle bin feature

VI
2mo ago
+87-9

Move files and folders to recycle bin instead of permanent delete and an option to show delete confirmation dialog. Both are default to true.


Summary by cubic

Summary of changes

Changes the Explorer plugin's delete action to send files and folders to the Recycle Bin instead of permanently deleting them. Two new settings control whether the recycle bin is used and whether a confirmation prompt appears.

  • The delete context menu now calls MoveToRecycleBin when DeleteToRecycleBin is enabled; when disabled, it falls back to the existing File.Delete/Directory.Delete permanent delete path (no existing code removed).
  • The confirmation dialog now only appears when ConfirmBeforeDeleting is true (previously always shown), and subtitles and success messages change to reflect the chosen destination.
  • Added the MoveToRecycleBin extension method, which uses the IFileOperation COM API with FOF_ALLOWUNDO; two new settings (DeleteToRecycleBin, ConfirmBeforeDeleting, both default true) come with checkboxes in the Explorer settings UI and new localization strings in en.xaml.
  • COM objects created in MoveToRecycleBin are released via Marshal.FinalReleaseComObject in a finally block, so memory usage impact is minimal.
  • No new security risks: the change uses the standard Windows shell API with no privilege escalation, and the default confirmation prompt helps prevent accidental deletions.
  • No unit tests are included; manual verification of the shell integration is required.

Release Note

Deleted files and folders now go to the Recycle Bin instead of being permanently removed, and you can skip the confirmation prompt if you prefer.