Skip to content

Conversation

@Hirogen
Copy link
Collaborator

@Hirogen Hirogen commented Dec 16, 2025

This pull request introduces several enhancements and new utilities for managing and validating project file references, especially in the context of handling .lxp persistence files and improving file history and error handling. The changes add robust helpers for resolving, validating, and mapping project file references, provide mechanisms for suggesting alternative file locations, and improve error resilience in file operations.

Key changes include new helpers for file resolution and validation, improvements to project file loading, and enhanced error handling.

Project File Resolution & Validation

  • Added ProjectFileResolver and ProjectFileValidator utility classes to resolve project file references (including .lxp persistence files) to actual log files and to validate file existence, suggest alternatives, and handle plugin-based file systems. (src/LogExpert.Core/Classes/Persister/ProjectFileResolver.cs [1] src/LogExpert.Core/Classes/Persister/ProjectFileValidator.cs [2]
  • Introduced ProjectLoadResult to encapsulate project loading results, including validation status, mappings from log files to original references, and user intervention flags. (src/LogExpert.Core/Classes/Persister/ProjectLoadResult.cs src/LogExpert.Core/Classes/Persister/ProjectLoadResult.csR1-R35)

Project Persistence and Data Model

  • Enhanced ProjectPersister.LoadProjectData to use the new validation and resolution helpers, returning a ProjectLoadResult instead of raw ProjectData. (src/LogExpert.Core/Classes/Persister/ProjectPersister.cs [1] [2]
  • Updated ProjectData to include a ProjectFilePath property for improved context in file validation and alternative search. (src/LogExpert.Core/Classes/Persister/ProjectData.cs src/LogExpert.Core/Classes/Persister/ProjectData.csR18-R22)

File Reference Resolution Helpers

Configuration and Error Handling Improvements

  • Improved error handling in config and persistence loading by including additional exception types (e.g., JsonSerializationException, FileNotFoundException) in catch blocks. (src/LogExpert.Configuration/ConfigManager.cs [1] src/LogExpert.Core/Classes/Persister/PersisterXML.cs [2]
  • Added methods to manage file history in ConfigManager, including limiting history size and clearing the last open files list. (src/LogExpert.Configuration/ConfigManager.cs [1] [2]

These changes collectively make project file handling more robust, user-friendly, and extensible, especially in environments with diverse file systems and potential for missing or relocated files.

Comment on lines +105 to +111
foreach (var filePath in fileNames.Select(fileName => Path.Join(_testDirectory, fileName)))
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
Comment on lines +202 to +209
foreach (var drive in driveLetters.Where(drive => drive != originalDrive && !string.IsNullOrEmpty(pathWithoutDrive)))
{
var alternatePath = $"{drive}:\\{pathWithoutDrive}";
if (File.Exists(alternatePath) && !alternatives.Contains(alternatePath))
{
alternatives.Add(alternatePath);
}
}
@Hirogen Hirogen merged commit 5bf8015 into Development Dec 16, 2025
1 check passed
@Hirogen Hirogen deleted the 514-loading-as-session-file-leads-to-broken-ui-if-a-log-file-in-session-is-not-found branch December 16, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants