This commit replaces magic numbers in the retry mechanism with named constants. In "UpdateLanguageFiles", the hardcoded delay of 10ms between retries has been replaced by the variable 'delayBetweenRetries'. Similarly, in "UpdateAssemblyInfo", the number of retries set to 10 has been replaced with 'maxRetries' and 'delayBetweenRetries' is used for the time gap between each attempt. This makes the code more readable and maintainable.
This commit replaces the previous method of removing repeated line breaks in the text with a new RemoveRecursiveLineBreaks method. The previous implementation consisted of a loop that executed a Replace method each time a repeated line break was found in the text. This was not an optimal solution as it resulted in unnecessary overhead due to the continuous replacement process.
Now, the RemoveRecursiveLineBreaks method performs this operation more efficiently, without the need to continuously call the Replace method. The codebase has been updated to use the new method, improving execution speed and efficiency. Unit tests have also been added to confirm the functionality of this new method.
The redundant methods handling UI controls for subtitle timing adjustments and waveform zoom were removed. These event handler methods were replaced with a more efficient design that is controlled centrally, improving code maintainability and reducing redundancy.
This commit modifies the order of method calls in the SplitLongLines feature. The SubtitleListview1.Items.Clear() operation is now called after SubtitleListview1.BeginUpdate(). This change prevents visual glitches and improves the overall performance by delaying the UI update until all changes have been made.
Changes were made to the 'en_names.xml' and 'names.xml' dictionary files. The name '2Pac' was moved from 'en_names.xml' to 'names.xml' to enhance the correct language categorization. The name 'AI' was added to 'en_names.xml' to improve the AI related query processing. In addition, several other relevant names were also added to 'names.xml', including 'Apple Inc.', 'Rumble', 'The Matrix', 'Burger King', and 'KFC', to enhance the dictionary coverage for those specific topics. The name 'AndreasB88', which seems to be a typo, was removed.
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.