Added override to the Dispose method in SubtitleListView control which unregisters any tick events and disposes timer objects when control is being discarded. This helps to ensure resources are properly freed up, reducing potential memory leaks.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
Added the <WordLists>Lista de cuvinte...</WordLists> translation for Romanian. Since it was missing, the English one "Word lists..." was shown by default on the Romanian language user interface.
This commit optimizes the code in WhisperModelDownload.cs by pulling out the progress reporting into a separate variable. This new implementation enhances code readability and prevents code redundancy. Now, the 'progressReport' variable is used while calling the 'DownloadAsync' method.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The revision refactors the replacement of invalid italic tags in the HtmlUtil FixInvalidItalicTags method. The separate string replace statements were replaced with loops that iterate over arrays of predefined invalid tag variations. This change leads to cleaner, more readable, and maintainable code.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The method formerly known as "BeginsWithLetter" has been optimized and renamed to "IsFirstLetterConvertibleToUppercase". The method now directly checks if the string is not empty and its first character is lowercase, instead of doing these in separate steps.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The logic for adding names to either _namesMultiList or _namesList in the NameList class was spread widely in the method. It has now been encapsulated within a new private method called TryAdd. This commit leads to cleaner and clearer code within the class and promotes easier maintenance in the future.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The XML document creation has been refactored into a separate function to reduce repetition. Prior code for creating the XML document was repeated in several places, specifically in the 'Remove' and 'Add' functions. The new 'CreateDocument' function now contains this code, making the overall codebase cleaner and easier to maintain.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
In the SpellCheckWordLists class, the redundant XML load operation in the 'else' clause has been removed. This change simplifies the code by getting rid of an unnecessary operation that was adding complexity and potentially slowing down the application.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The condition check in the IfoParser class has been refactored for better readability and correctness. Proper grouping of conditions within parentheses has been added to ensure appropriate execution order.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The GetAllLanguages function in IfoParser.cs has been updated to improve the calculation of the variable minCount. It now takes into consideration the count of three component lists - Subtitles, SubtitleIDs, and SubtitleTypes - ensuring that the loop operates on the smallest size among them. This modification prevents potential out-of-range errors.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit optimizes the GetAllLanguages method within the IfoParser class. Instead of checking bounds within the loop, we calculate the minimum count between SubtitleIDs and SubtitleTypes before starting the iteration. This simplifies the logic and could potentially improve performance.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
Several classes, particularly the ones related to translation services, have been modified to implement IDisposable interface. Additionally, all instances of HttpClient are being disposed properly now using "using" keyword. This will help ensure that system resources are promptly released when they're no longer required, potentially improving application performance and stability.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit replaces explicit string variable declarations with the var keyword in the SpellCheckWordLists.cs file. This provides improved code readability and maintainability, as it leverages the compiler's ability to determine the variable's type automatically based on its value.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit simplifies the process of loading user and system dictionaries in SpellCheckWordLists. The modified code avoids redundant loading constructs through an iteration over the dictionary paths. It contributes to maintaining the readability and efficiency of the codebase.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The duplicated loops checking for words containing periods or dashes in different collections were replaced with a single loop. The function GetSingleUnifiedCollection was created to unify the collections using the Union method. This makes the code cleaner and more maintainable.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
Removed the '_skipAllList' variable from 'SpellCheckWordLists.cs' as it was unused. The variable was also removed from a sorting operation, which should help improve performance.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
A new test class, DimensionTest, is created and added to the test project. This class specifically tests the functionality of the Dimension object's validity and equality methods, thus enhancing our suite of unit tests.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit refactors the validation of video dimensions in GenerateVideoWithHardSubs class. Instead of checking width and height separately, a new Dimension object is created and validated with IsValid(). This simplifies the code and improves readability.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
Code for creating and validating batch video and subtitle entities has been extracted into separate methods, improving the readability of the main method. These changes also include a rectification in the logic for handling invalid video dimensions.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The struct, Dimension which represents the dimensions of an object, is created. This contains basic properties for height and width, and methods for checking equality, validity and providing a string representation. The Dimension can later be used throughout the project for managing sizes of different objects.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The properties VideoWidth and VideoHeight in FfmpegMediaInfo class have been replaced with a Dimension object. This modification leads to simpler and more readable code by encapsulating width and height information within the Dimension class. Any resolution information extracted is now directly assigned to the Dimension property.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
This commit simplifies the subtitle file location code in FileUtil by removing unnecessary nested functions. It changes the way the search is done in known subtitle directories and handles the case if a video file is sent with a full path. This results in cleaner and more manageable code.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
A typo in the comment for the subtitle file location function was corrected. Previously, the comment read "try locate subtitle file for the input vide file", and now it reads "try to locate subtitle file for the input vide file". Other changes include removal of an unused variable "fileNameNoExt".
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The method TryLocateSubtitleFile in FileUtil.cs was refactored to receive the complete video file name, rather than just the file name without its extension. This change should enhance file locating accuracy as it now considers the file's full name, including its extension.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
A method 'TryLocateSubtitleFile' was implemented in FileUtil. It attempts to locate matching subtitle files for video files in known directories. The method was integrated into 'AddInputFile' of 'GenerateVideoWithHardSubs' and simplifies the earlier implementation for finding subtitles. This change will make the process of matching video files to subtitles more efficient and cleaner.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>
The list view item checking actions, such as "Select All" and "Invert Selection", have been refactored to their own methods (CheckAll, InvertCheck) to reduce repetition. These methods have been implemented in numerous forms across the code. This makes the codebase cleaner and more maintainable as the operations are abstracted out to separate methods.
Signed-off-by: Ivandro Jao <ivandrofly@gmail.com>