Skip to content

Lib-Loader v1.3.1.5

Choose a tag to compare

@riistar riistar released this 15 May 12:26
· 10 commits to main since this release

Refactored Core_LibLoader for improved file search, loading, and compatibility checks.

  • Removed WriteLog Function:

    • Eliminated the WriteLog function as Core_Log unit is imported for the Log class.
    • Ensured all logging operations use the Log class directly.
  • Improved Recursive File Loading:

    • Added LoadFileFromFolder nested procedure within LibLoader.Execute to handle file loading from a specified folder.
    • Ensured proper logging for each step in the recursive file search.
    • Tracked successfully loaded files using a new FilesLoaded list.
  • Enhanced Error Handling:

    • Logged errors for files not found in both mod directories and application/client directory.
    • Prevented duplicate entries in the FailedFiles list by checking if the file already exists in the list before adding.
    • Removed files from FailedFiles if they were successfully loaded from the application/client directory.
  • Unified Loaded Files Tracking:

    • Introduced a FilesLoaded TStringList to maintain a list of all successfully loaded files across both the recursive search and application/client directory search.
    • Ensured FilesLoaded is updated immediately when a file is successfully loaded from any directory.
    • Added checks to prevent duplicates in the FilesLoaded list.
  • Managed TStringList Lifecycle:

    • Created and properly freed all TStringLists (ModFolders, FailedFiles, FilesToProcess, FilesToRemove, FilesLoaded) to avoid memory leaks and ensure stability.
    • Cleared FilesToRemove before each new directory search to prevent carrying over entries.
  • General Code Cleanup:

    • Improved readability and maintainability by organizing the code into nested procedures and clearly commenting on each significant operation.
    • Removed redundant log messages and ensured consistency in logging format.
  • Bug Fixes:

    • Fixed issue where files could be skipped or incorrectly removed during the search process.
    • Ensured the application does not crash when accessing Files2Load.CommaText by checking Files2Load.Count before accessing it.
    • Ensured accurate reporting of loaded and failed files at the end of the operation.
    • Fixed issue where FilesLoaded list had duplicate entries by checking for duplicates before adding.
  • Improved LibLoader.WhereIs Function:

    • Refactored LibLoader.WhereIs to recursively search for a file in specified directories.
    • Added appropriate comments for better understanding and maintenance.
    • Ensured proper returning of the result after the recursive search is complete.
  • Commented Code for Better Understanding:

    • Added comments to all major code sections and procedures to explain their functionality and flow.
    • Provided detailed comments in LibLoader.Execute and LibLoader.WhereIs functions.
  • New Usage of Core_Log Unit:

    • Utilized the Core_Log unit for logging operations throughout the unit.
    • Ensured consistent logging format and levels using the Log class from Core_Log.
  • Compatibility Checks:

    • Added checks to ensure DLL compatibility with the host architecture (x86/x64).
    • Ensured only compatible DLLs are loaded to prevent runtime errors.