@@ -12,7 +12,7 @@ namespace LogExpert.Core.Classes.Persister;
1212/// path. It supports validation of both local file paths and URI-based files through plugin resolution. All methods are
1313/// thread-safe and do not modify input data. Use the provided methods to check file existence, resolve canonical file
1414/// paths, and locate possible alternatives for missing files.</remarks>
15- public static class ProjectFileValidator
15+ public static class SessionFileValidator
1616{
1717 /// <summary>
1818 /// Validates the files referenced by the specified project and identifies missing or accessible files using
@@ -21,21 +21,21 @@ public static class ProjectFileValidator
2121 /// <remarks>Files are considered valid if they exist on disk or if a suitable file system plugin is
2222 /// available for URI-based files. For missing files, possible alternative paths are suggested based on the project
2323 /// file location.</remarks>
24- /// <param name="projectData ">The project data containing the list of file names to validate and the project file path. Cannot be null.</param>
24+ /// <param name="sessionData ">The project data containing the list of file names to validate and the project file path. Cannot be null.</param>
2525 /// <param name="pluginRegistry">The plugin registry used to resolve file system plugins for URI-based files. Cannot be null.</param>
26- /// <returns>A ProjectValidationResult containing lists of valid files, missing files, and possible alternative file paths
26+ /// <returns>A SessionValidationResult containing lists of valid files, missing files, and possible alternative file paths
2727 /// for missing files.</returns>
28- public static ProjectValidationResult ValidateProject ( ProjectData projectData , IPluginRegistry pluginRegistry )
28+ public static SessionValidationResult ValidateSession ( SessionData sessionData , IPluginRegistry pluginRegistry )
2929 {
30- ArgumentNullException . ThrowIfNull ( projectData ) ;
30+ ArgumentNullException . ThrowIfNull ( sessionData ) ;
3131 ArgumentNullException . ThrowIfNull ( pluginRegistry ) ;
3232
33- var result = new ProjectValidationResult ( ) ;
33+ var result = new SessionValidationResult ( ) ;
3434
3535 // Cache drive letters once to avoid repeated expensive DriveInfo.GetDrives() calls
3636 var cachedDriveLetters = GetFixedDriveLetters ( ) ;
3737
38- foreach ( var fileName in projectData . FileNames )
38+ foreach ( var fileName in sessionData . FileNames )
3939 {
4040 var normalizedPath = NormalizeFilePath ( fileName ) ;
4141
@@ -60,7 +60,7 @@ public static ProjectValidationResult ValidateProject (ProjectData projectData,
6060 {
6161 result . MissingFiles . Add ( fileName ) ;
6262
63- var alternativePaths = FindAlternativePaths ( fileName , projectData . ProjectFilePath , cachedDriveLetters ) ;
63+ var alternativePaths = FindAlternativePaths ( fileName , sessionData . SessionFilePath , cachedDriveLetters ) ;
6464 result . PossibleAlternatives [ fileName ] = alternativePaths ;
6565 }
6666 }
@@ -138,12 +138,12 @@ or DriveNotFoundException
138138 /// result.</remarks>
139139 /// <param name="fileName">The name or path of the file to search for. Can be an absolute or relative path. Cannot be null, empty, or
140140 /// whitespace.</param>
141- /// <param name="projectFilePath ">The full path to the project file used as a reference for searching related directories. Can be null or empty if
141+ /// <param name="sessionFilePath ">The full path to the project file used as a reference for searching related directories. Can be null or empty if
142142 /// project context is not available.</param>
143143 /// <param name="cachedDriveLetters">Pre-computed list of fixed drive letters to avoid repeated DriveInfo.GetDrives() calls.</param>
144144 /// <returns>A list of strings containing the full paths of files found that match the specified file name in alternative
145145 /// locations. The list will be empty if no matching files are found.</returns>
146- private static List < string > FindAlternativePaths ( string fileName , string projectFilePath , List < char > cachedDriveLetters )
146+ private static List < string > FindAlternativePaths ( string fileName , string sessionFilePath , List < char > cachedDriveLetters )
147147 {
148148 var alternatives = new List < string > ( ) ;
149149
@@ -160,21 +160,21 @@ private static List<string> FindAlternativePaths (string fileName, string projec
160160 }
161161
162162 // Search in directory of .lxj project file
163- if ( ! string . IsNullOrWhiteSpace ( projectFilePath ) )
163+ if ( ! string . IsNullOrWhiteSpace ( sessionFilePath ) )
164164 {
165165 try
166166 {
167- var projectDir = Path . GetDirectoryName ( projectFilePath ) ;
168- if ( ! string . IsNullOrEmpty ( projectDir ) && Directory . Exists ( projectDir ) )
167+ var sessionDir = Path . GetDirectoryName ( sessionFilePath ) ;
168+ if ( ! string . IsNullOrEmpty ( sessionDir ) && Directory . Exists ( sessionDir ) )
169169 {
170- var candidatePath = Path . Join ( projectDir , baseName ) ;
170+ var candidatePath = Path . Join ( sessionDir , baseName ) ;
171171 if ( File . Exists ( candidatePath ) )
172172 {
173173 alternatives . Add ( candidatePath ) ;
174174 }
175175
176176 // Also check subdirectories (one level deep)
177- var subdirs = Directory . GetDirectories ( projectDir ) ;
177+ var subdirs = Directory . GetDirectories ( sessionDir ) ;
178178 alternatives . AddRange (
179179 subdirs
180180 . Select ( subdir => Path . Join ( subdir , baseName ) )
@@ -243,14 +243,14 @@ UnauthorizedAccessException or
243243 }
244244
245245 // Try relative path resolution from project directory
246- if ( ! Path . IsPathRooted ( fileName ) && ! string . IsNullOrWhiteSpace ( projectFilePath ) )
246+ if ( ! Path . IsPathRooted ( fileName ) && ! string . IsNullOrWhiteSpace ( sessionFilePath ) )
247247 {
248248 try
249249 {
250- var projectDir = Path . GetDirectoryName ( projectFilePath ) ;
251- if ( ! string . IsNullOrEmpty ( projectDir ) )
250+ var sessionDir = Path . GetDirectoryName ( sessionFilePath ) ;
251+ if ( ! string . IsNullOrEmpty ( sessionDir ) )
252252 {
253- var relativePath = Path . Join ( projectDir , fileName ) ;
253+ var relativePath = Path . Join ( sessionDir , fileName ) ;
254254 var normalizedPath = Path . GetFullPath ( relativePath ) ;
255255
256256 if ( File . Exists ( normalizedPath ) && ! alternatives . Contains ( normalizedPath ) )
0 commit comments