Skip to content

Commit 277197c

Browse files
authored
Merge pull request #591 from LogExperts/rename-project-to-session
Rename Project -> Session across code, resources, and locales
2 parents 7347827 + b8de228 commit 277197c

32 files changed

Lines changed: 555 additions & 554 deletions

src/LogExpert.Core/Classes/Persister/ProjectData.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/LogExpert.Core/Classes/Persister/ProjectPersister.cs

Lines changed: 0 additions & 133 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Newtonsoft.Json;
2+
3+
namespace LogExpert.Core.Classes.Persister;
4+
5+
/// <summary>
6+
/// Persisted workspace contents of a Session (.lxj): a list of log file paths
7+
/// plus a tab/window layout XML blob. See CONTEXT.md "Sessions".
8+
/// </summary>
9+
[Serializable]
10+
public class SessionData
11+
{
12+
#region Fields
13+
14+
/// <summary>
15+
/// Gets or sets the list of log file paths included in this Session.
16+
/// May contain references to Session File (.lxp) entries that resolve to logs.
17+
/// </summary>
18+
public List<string> FileNames { get; set; } = [];
19+
20+
/// <summary>
21+
/// Gets or sets the XML representation of the tab layout configuration.
22+
/// </summary>
23+
public string TabLayoutXml { get; set; }
24+
25+
/// <summary>
26+
/// Gets or sets the full file path to the Session (.lxj) on disk.
27+
/// </summary>
28+
/// <remarks>
29+
/// JSON property name pinned to "SessionFilePath" so existing .lxj files (which
30+
/// were written under the previous "Project" terminology) continue to deserialize
31+
/// without migration. The value is also re-set at load time from the file path,
32+
/// so even old files without this key load correctly.
33+
/// </remarks>
34+
[JsonProperty("SessionFilePath")]
35+
public string SessionFilePath { get; set; }
36+
37+
#endregion
38+
}

src/LogExpert.Core/Classes/Persister/ProjectFileResolver.cs renamed to src/LogExpert.Core/Classes/Persister/SessionFileResolver.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
namespace LogExpert.Core.Classes.Persister;
66

77
/// <summary>
8-
/// Helper class to resolve project file references to actual log files.
9-
/// Handles .lxp (persistence) files by extracting the actual log file path.
8+
/// Helper class to resolve Session file references to actual log files.
9+
/// Handles Session File (.lxp) entries by extracting the actual log file path.
1010
/// </summary>
11-
public static class ProjectFileResolver
11+
public static class SessionFileResolver
1212
{
1313
/// <summary>
14-
/// Resolves project file names to actual log files.
15-
/// If a file is a .lxp persistence file, extracts the log file path from it.
14+
/// Resolves Session file names to actual log files.
15+
/// If a file is a Session File (.lxp) entry, extracts the log file path from it.
1616
/// </summary>
17-
/// <param name="projectData">The project data containing file references</param>
17+
/// <param name="sessionData">The Session data containing file references</param>
1818
/// <param name="pluginRegistry">Plugin registry for file system resolution (optional)</param>
1919
/// <returns>List of tuples containing (logFilePath, originalFilePath)</returns>
20-
public static ReadOnlyCollection<(string LogFile, string OriginalFile)> ResolveProjectFiles (ProjectData projectData, IPluginRegistry pluginRegistry = null)
20+
public static ReadOnlyCollection<(string LogFile, string OriginalFile)> ResolveSessionFiles (SessionData sessionData, IPluginRegistry pluginRegistry = null)
2121
{
22-
ArgumentNullException.ThrowIfNull(projectData);
22+
ArgumentNullException.ThrowIfNull(sessionData);
2323

2424
var resolved = new List<(string LogFile, string OriginalFile)>();
2525

26-
foreach (var fileName in projectData.FileNames)
26+
foreach (var fileName in sessionData.FileNames)
2727
{
2828
var logFile = PersisterHelpers.FindFilenameForSettings(fileName, pluginRegistry);
2929
resolved.Add((logFile, fileName));
3030
}
3131

3232
return resolved.AsReadOnly();
3333
}
34-
}
34+
}

src/LogExpert.Core/Classes/Persister/ProjectFileValidator.cs renamed to src/LogExpert.Core/Classes/Persister/SessionFileValidator.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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))

src/LogExpert.Core/Classes/Persister/ProjectLoadResult.cs renamed to src/LogExpert.Core/Classes/Persister/SessionLoadResult.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ namespace LogExpert.Core.Classes.Persister;
33
/// <summary>
44
/// Represents the result of loading a project file, including validation information.
55
/// </summary>
6-
public class ProjectLoadResult
6+
public class SessionLoadResult
77
{
88
/// <summary>
99
/// The loaded project data (contains resolved log file paths).
1010
/// </summary>
11-
public ProjectData ProjectData { get; set; }
11+
public SessionData SessionData { get; set; }
1212

1313
/// <summary>
1414
/// Validation result containing valid, missing, and alternative file paths.
1515
/// </summary>
16-
public ProjectValidationResult ValidationResult { get; set; }
16+
public SessionValidationResult ValidationResult { get; set; }
1717

1818
/// <summary>
1919
/// Mapping of original file references to resolved log files.

0 commit comments

Comments
 (0)