File format conversion#81
Conversation
WalkthroughThis PR unifies image transformation commands under a broader ChangesImage Format Conversion Feature & Command Surface Unification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
PhotoLocator/ImageTransformCommands.cs (1)
228-234: ⚖️ Poor tradeoffConsider clearer feedback for partial conversion.
When the user cancels the overwrite-all prompt (line 232), the loop breaks immediately. Files processed before the break remain converted, but there's no explicit indication to the user that the operation completed partially. The progress bar will reflect this, but a summary message might improve clarity.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@PhotoLocator/ImageTransformCommands.cs` around lines 228 - 234, The loop that checks overwriteAll when encountering an existing targetFileName (the MessageBox.Show branch) can exit early leaving a partial conversion with no explicit summary; modify the branch inside the loop that currently breaks on cancel so that before breaking it records the partial outcome (e.g., counts of files converted vs skipped) and after the loop displays a concise summary MessageBox to the user indicating the operation was partially completed and how many files were processed/left; update variables used in the loop (overwriteAll, any processedCount/ skippedCount) and show the summary after the loop exits normally or early so users get clear feedback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@PhotoLocator/ImageTransformCommands.cs`:
- Around line 226-227: The two branches build inconsistent filenames: when
targetIsSourceDir the code uses item.GetProcessedFileName() (which may include a
postfix) but when moving to targetDir it uses item.Name; make the base filename
consistent by always using GetProcessedFileName() (e.g., compute baseName =
Path.GetFileNameWithoutExtension(item.GetProcessedFileName())) and then set
targetFileName by combining targetDir with baseName + "." + targetType (or use
Path.ChangeExtension on the processed filename when targetDir == sourceDir),
ensuring both branches derive names from GetProcessedFileName() so postfix
behavior is consistent.
- Around line 204-243: The MessageBox.Show call inside the
ConvertFileFormatCommand's RunProcessWithProgressBarAsync lambda is running on a
background thread; marshal it to the UI thread by invoking
Application.Current.Dispatcher.Invoke (or BeginInvoke) when showing the confirm
overwrite dialog and capturing its result into a local variable before using it
to break/continue; update the code around the MessageBox.Show invocation so the
dispatcher call returns the MessageBoxResult and use that result to set
overwriteAll or break the loop (keep references to ConvertFileFormatCommand,
RunProcessWithProgressBarAsync, and MessageBox.Show when locating the change).
---
Nitpick comments:
In `@PhotoLocator/ImageTransformCommands.cs`:
- Around line 228-234: The loop that checks overwriteAll when encountering an
existing targetFileName (the MessageBox.Show branch) can exit early leaving a
partial conversion with no explicit summary; modify the branch inside the loop
that currently breaks on cancel so that before breaking it records the partial
outcome (e.g., counts of files converted vs skipped) and after the loop displays
a concise summary MessageBox to the user indicating the operation was partially
completed and how many files were processed/left; update variables used in the
loop (overwriteAll, any processedCount/ skippedCount) and show the summary after
the loop exits normally or early so users get clear feedback.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7aa183fb-6a10-4943-b93f-cfcd7d56e515
📒 Files selected for processing (10)
PhotoLocator/BitmapOperations/IIRSmoothOperation.csPhotoLocator/ImageTransformCommands.csPhotoLocator/MainViewModel.csPhotoLocator/MainWindow.xamlPhotoLocator/Metadata/ExifHandler.csPhotoLocator/PictureFileFormats/GeneralFileFormatHandler.csPhotoLocator/PictureFileFormats/PhotoshopFileFormatHandler.csPhotoLocator/PictureItemViewModel.csPhotoLocatorTest/Metadata/ExifHandlerTest.csPhotoLocatorTest/PictureFileFormats/PhotoshopFileFormatHandlerTest.cs
Summary by CodeRabbit
New Features
Refactor