Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor for performance, readability and maintainability #210

Merged
merged 35 commits into from
Jul 27, 2024

Commits on Jul 25, 2024

  1. Configuration menu
    Copy the full SHA
    df5873e View commit details
    Browse the repository at this point in the history
  2. Refactor code for improved readability and maintainability

    Several changes were made to the codebase to improve code readability and maintainability. These include the restructuring of multiple conditional statements, improved logger messaging, deletion of unnecessary comments and spaces, modification of class and method visibility, and alteration of class structure and parameters for better performance and clarity.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    fa32fdb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e2b4b56 View commit details
    Browse the repository at this point in the history
  4. Refactor code for better readability and async treatment

    Several synchronous methods have been transformed into asynchronous tasks across ViewModel and utilities. All the constructors in the classes ListItem and PickedListItem were refactored into property initialization for better readability. Also, localization strings now use the LangProvider directly for language access. These significant changes will improve the codebase's maintainability.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    38c134a View commit details
    Browse the repository at this point in the history
  5. Refactor: Simplify SearchResult data load method

    Refactored the LoadData method in SearchResultViewModel.cs for better readability and logical flow. Extracted complex search result checks into a separate private method, HasSearchResult(). This makes the code cleaner and more maintainable by avoiding nested ternary operations and deep if conditions.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    73d1d3b View commit details
    Browse the repository at this point in the history
  6. Refactor media type string properties and detail-fetching logic

    The commit alters properties in the MediaTypes class to be constants rather than static getters. In the FileUtils class, it refactors the multipart conditional logic for fetching media details into a switch expression and separate helper methods for cleaner, more maintainable code.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    cdd8e6e View commit details
    Browse the repository at this point in the history
  7. Refactor: Simplify Search method in MainWindowViewModel

    Previously, item processing was complex and involved many nested conditions. This made it difficult to understand and maintain. Now, item processing is simplified by extracting it into separate methods: `ProcessItemAsync`, `ProcessResultsAsync`, `AddToFinalList`, and `ProcessSubfolders`. This change improves the code's readability and maintainability.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    363430e View commit details
    Browse the repository at this point in the history
  8. Refactor search result processing in ProSearchResultViewModel

    This update simplifies the result processing code in ProSearchResultViewModel by extracting reusable logic into separate methods. It also improves readability by breaking down complex conditions and loops into more manageable chunks. The handling of no results, processing of search results, and individual result items are now handled in their own methods.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    dab6432 View commit details
    Browse the repository at this point in the history
  9. Refactor: Make GetClientAccessTokenAsync private and awaitable

    Changed the GetClientAccessTokenAsync method from public to private as it does not need to be openly available. This method is now properly awaited in all calls to ensure sequential execution and prevent potential issues related to concurrency or incomplete tasks.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    9899d05 View commit details
    Browse the repository at this point in the history
  10. refactor: Implement auto-scroll behavior in ScrollViewers

    Extract auto-scroll logic into ScrollViewerBehavior and update XAML to use this new behavior. This cleaning encapsulates the auto-scroll functionality and removes redundant code, improving maintainability and readability.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    0415de2 View commit details
    Browse the repository at this point in the history
  11. fix total poster count

    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    b467955 View commit details
    Browse the repository at this point in the history
  12. fix: Refactor file validation logic

    Simplify the file validation process by moving exclusion logic to `FileUtils`. Combined multiple conditions into a single method for clarity and maintainability.
    DineshSolanki committed Jul 25, 2024
    Configuration menu
    Copy the full SHA
    aa013d1 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. refactor: Use MediaTypes constants for media type strings

    Replaced hardcoded media type strings with `MediaTypes` constants across the entire codebase for better maintainability and consistency. This change affects various modules including ProcessUtils, MainWindowViewModel, SearchResultViewModel, TmdbDataTransformer, DataUtils, TMDBService, and IgdbDataTransformer.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    4b86e19 View commit details
    Browse the repository at this point in the history
  2. refactor: Segregate methods to simplify ResultPicked logic

    Separated complex logic within the `ResultPicked` method into smaller methods to improve code readability and maintainability. Introduced `PrepareRating`, `PickResult`, `SelectMtvType`, `CastResult`, and `AddToPickedList` methods.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    fe1051e View commit details
    Browse the repository at this point in the history
  3. refactor: Refactor image URL generation

    created a utility method to generate poster url for IGDB, also fix the issue of poster preview not working in game mode
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    5ed8563 View commit details
    Browse the repository at this point in the history
  4. refactor: Unified image handling with a new IImage interface

    Replaced direct image handling with `IImage` interface to streamline processing. Introduced `ArtworkWrapper` and `ImageDataWrapper` classes for better abstraction. Enhanced loading and processing logic for improved code clarity and maintainability.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    22177c1 View commit details
    Browse the repository at this point in the history
  5. refactor: Simplify media type handling in PosterPickerViewModel

    Refactored PosterPickerViewModel to streamline media type handling by extracting methods for different media types. Improved readability and maintainability by reducing redundancy.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    b35e522 View commit details
    Browse the repository at this point in the history
  6. refactor: modularize SearchAndMakeMethod in MainWindowViewModel

    Refactored SearchAndMakeMethod by extracting validation and initialization logic into separate helper methods. Improved code readability and maintainability by organizing related functionalities and reducing method complexity.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    e9b9dce View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7f233db View commit details
    Browse the repository at this point in the history
  8. fix: Remove async/await from sync methods and add static modifier

    Refactored methods in PosterPickerViewModel to remove unnecessary async/await usage for synchronous operations. Made ProcessSubfolders method in MainWindowViewModel static to align it with its usage context. Added an async keyword to SearchAgainMethod to correctly await StartSearch execution in SearchResultViewModel.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    6ee179f View commit details
    Browse the repository at this point in the history
  9. refactor: Apply various code improvements and fixes

    Refined method visibility, improved formatting, and fixed minor logical issues. Specifically, adjusted method access modifiers to `static`, used concise collection initializations, and corrected string formatting issues. Reorganized namespaces and fixed inconsistency in the handling of media types and file attributes.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    eb5e32e View commit details
    Browse the repository at this point in the history
  10. refactor: readability and code style

    Replaced switch with if-else in MainWindowViewModel for readability. Added exception for invalid search mode in TMDBService. Improved readability in FileUtils by adding braces around conditional return.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    cce957f View commit details
    Browse the repository at this point in the history
  11. refactor: Extract dialog logic to ShowSearchResultDialog method

    Refactored dialog handling for search results into a separate method
    to reduce code duplication and improve readability. This change
    affects the processing of zero, single, and multiple result cases.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    c62d005 View commit details
    Browse the repository at this point in the history
  12. feature: Refactor and centralize PosterIcon code

    Unified PosterIcon classes into a base class to avoid code duplication and simplify maintenance. Updated class for different PosterIcon variants to extend from the new PosterIconBase class.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    af8f445 View commit details
    Browse the repository at this point in the history
  13. refactor: Centralize image opening logic

    Refactored the image opening logic by creating a centralized `ShowImageBrowser` method in `UiUtil` class. This reduces redundancy and improves maintainability across the `ProSearchResultViewModel`, `PosterPickerViewModel`, and `ManualExplorerViewModel` classes.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    e3480d3 View commit details
    Browse the repository at this point in the history
  14. refactor: refactor data extraction to use a common method

    Consolidate the logic for creating ListItem instances by introducing the TransformDetailsIntoListItem method. This reduces code duplication and simplifies updates.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    8684ef6 View commit details
    Browse the repository at this point in the history
  15. chore: Move ShowImageBrowser method to UiUtils

    Moved `UiUtil.ShowImageBrowser` method to `UiUtils` and updated all references to use the new location.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    cb051e5 View commit details
    Browse the repository at this point in the history
  16. refactor: Move ListView sort logic to behavior class

    Moved ListView sorting logic from code-behind to a new behavior class `ListViewClickSortBehavior`.
    DineshSolanki committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    a0eccec View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2024

  1. chore: Remove unused using directives, and move most used directives …

    …to GlobalUsing pattern
    
    Unnecessary using directives have been removed across multiple files to clean up the codebase and move frequently used directives to Usings.cs to reduce clutter
    DineshSolanki committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    49db1e2 View commit details
    Browse the repository at this point in the history
  2. fix: Improve error handling and remove unnecessary async

    Enhanced error handling in `ProcessUtils.cs` by adding detailed error messages and throwing `InvalidOperationException`. Removed the unnecessary ` async ` keyword from `LoadGameData` in `PosterPickerViewModel.cs` as the method does not contain any async operations.
    DineshSolanki committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    95d2a19 View commit details
    Browse the repository at this point in the history
  3. refactor: Refactor TMDB data handling to use SearchResultData class

    Refactored TmdbDataTransformer to encapsulate result details into a new SearchResultData class. This change simplifies the method signatures and improves code readability by reducing parameter count. Added SearchResultData.cs to define the new data structure.
    DineshSolanki committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    82584c8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9e8efd5 View commit details
    Browse the repository at this point in the history
  5. refactor: Simplify MainWindowViewModel constructor

    Refactored MainWindowViewModel constructor by extracting property tracking, culture setup, and command line processing into separate methods for better readability and maintainability. Removed redundant initialization code and reorganized method calls for logical flow.
    DineshSolanki committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    3c433c5 View commit details
    Browse the repository at this point in the history
  6. fix: Replace ProgressInfo with ProgressBarData

    Updated the codebase to replace the `ProgressInfo` class with `ProgressBarData`. This change affects all instances where progress information is handled, including UI bindings and method parameters. Additionally, added an attribute `[Localizable(false)]` to `IconUtils`.
    DineshSolanki committed Jul 27, 2024
    Configuration menu
    Copy the full SHA
    2cc7282 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e3efd42 View commit details
    Browse the repository at this point in the history