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>