The two existing implementations of SaveWithRetry were similar except for the action taken. This commit eliminates code redundancy by making SaveWithRetry accept a delegate for the save action and handle the retries. This approach makes the code more readable and easier to maintain in the future. It also makes the number of retries and delay between them configurable, opening possibilities for future improvements.
Removed multiple identical if statements and adjusted it with a while loop to find the template file. The change avoids duplicate code and adds a retry limit to prevent infinite looping if the file is not found.
Eliminated extraneous 'using' directives from FixEmptyLines.cs, FixUnneededPeriods.cs, and SplitLongLinesHelper.cs. These namespaces are not utilized in the respective files and thus their removal helps to maintain cleaner, less cluttered code.
Multiple redundant using directives were removed from various files, contributing to the cleaner and more efficient codebase. These were no longer needed due to previous refactoring operations, where dependencies on these namespaces were eliminated.
The method 'GetInstallerPath' in 'Configuration.cs' has been updated to check both 32-bit and 64-bit registry paths for the 'SubtitleEdit_is1' uninstall key. This was changed to enhance compatibility with different system architectures, ensuring that the correct path is found in both scenarios. Changes involve replacing separate read commands with an array of paths and a loop to sift through them.
The ListView population code within WordLists.cs has been optimized. Previously, a new List of ListViewItems was created each time without a predefined size. This diff changes the initialization of 'list' to include a size parameter which equals the count of '_wordListNames'. This change ensures the list has a fixed size upon creation, reducing memory allocation overhead for large '_wordListNames' collections.
Deleted the IsTagFollowIndex method from the EffectKaraoke form. This method was no longer being used in the project, making it redundant. This removal helps to clean up the code base and reduces the overall code complexity.
The method `IsFontPresent` in `UiUtil` class was refactored. Previously it was catching the exception for each font style individually. Now, we iterate over each font style, try to create a new font with said style, and return false if any fail to be created. This change improves the readability of the code and also makes sure to dispose any created font resources to avoid potential memory leaks.
The previous implementation of BookmarkPersistence.cs had redundant null checks and exception handling. The new code has been refactored to improve readability and catch exceptions more effectively. Null checks and the write or delete operation on the file are now within a single try-catch block, simplifying the flow and improving execution speed by reducing unnecessary null check and File.Exists call for file deletion.
Removed an unnecessary if-statement in the StringExtensions.cs file that was not executing any actions. This increases readability and maintains the logic of the code by preventing potential confusion caused by having an empty code block.
The previous implementation of the SplitToLines method was lengthy and contained redundant code. To improve readability and maintainability, the method was refactored. The same functionality is maintained but the code is cleaner and more understandable now.