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>