Commit 5bf8015
authored
Merge pull request #519 from LogExperts/514-loading-as-session-file-leads-to-broken-ui-if-a-log-file-in-session-is-not-found
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]](diffhunk://#diff-c97308928b24e1acaf08b01001575c38fde84c91fd58a08ec8f0f0dc724dd32cR1-R34) `src/LogExpert.Core/Classes/Persister/ProjectFileValidator.cs` [[2]](diffhunk://#diff-25f80a76f76ad97c518796ad90a24c99899d5333c15ce34773dd4d52369f594aR1-R251)
* 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](diffhunk://#diff-81f8d066d1d4e13a51237b6d95b0a0f887b86309d110527010010592e32b0996R1-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]](diffhunk://#diff-3ef68afcef4c2dd062a4eac57011dd212a9b67cbec4d3d536d3147fde607ac42R3-R4) [[2]](diffhunk://#diff-3ef68afcef4c2dd062a4eac57011dd212a9b67cbec4d3d536d3147fde607ac42L16-R24)
* 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](diffhunk://#diff-b2b14f679e01b1ca86200e829986b5b05e21178471200d744f3f688de5715f9eR18-R22))
### File Reference Resolution Helpers
* Added `PersisterHelpers` with methods to resolve `.lxp` settings files to their contained log file paths, supporting plugin-based file systems and collections of file names. (`src/LogExpert.Core/Classes/Persister/PersisterHelpers.cs` [src/LogExpert.Core/Classes/Persister/PersisterHelpers.csR1-R71](diffhunk://#diff-9f15d9ff4e5401af8904f6820f7925779dcf6a8695eef85c558ea48fdb749c0dR1-R71))
### 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]](diffhunk://#diff-82e64762f3f98762e436cfbe90148c10be3527395d43c7f4182c274020abb63cL810-R849) `src/LogExpert.Core/Classes/Persister/PersisterXML.cs` [[2]](diffhunk://#diff-344fe0500e61ba45bffd7be7db326b8af8860bfc091f9512646e25d7fd26ba39L604-R605)
* 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]](diffhunk://#diff-82e64762f3f98762e436cfbe90148c10be3527395d43c7f4182c274020abb63cR49) [[2]](diffhunk://#diff-82e64762f3f98762e436cfbe90148c10be3527395d43c7f4182c274020abb63cR255-R291)
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.File tree
28 files changed
+3115
-252
lines changed- src
- LogExpert.Configuration
- LogExpert.Core
- Classes/Persister
- Interface
- LogExpert.Persister.Tests
- LogExpert.Resources
- LogExpert.Tests
- LogExpert.UI/Dialogs
- LogTabWindow
- PluginRegistry
- FileSystem
28 files changed
+3115
-252
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
251 | 252 | | |
252 | 253 | | |
253 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
254 | 292 | | |
255 | 293 | | |
256 | 294 | | |
| |||
807 | 845 | | |
808 | 846 | | |
809 | 847 | | |
810 | | - | |
| 848 | + | |
| 849 | + | |
811 | 850 | | |
812 | 851 | | |
813 | 852 | | |
| |||
1060 | 1099 | | |
1061 | 1100 | | |
1062 | 1101 | | |
| 1102 | + | |
1063 | 1103 | | |
1064 | 1104 | | |
1065 | 1105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
601 | 601 | | |
602 | 602 | | |
603 | 603 | | |
604 | | - | |
| 604 | + | |
| 605 | + | |
605 | 606 | | |
606 | 607 | | |
607 | 608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
0 commit comments