rebuild project & update internal names

This commit is contained in:
Abelfreyja
2025-08-22 13:07:48 +09:00
parent 3d9bf49d7f
commit 7d3de5361a
190 changed files with 851 additions and 851 deletions

View File

@@ -0,0 +1,40 @@
using LightlessSync.API.Data;
using System.Text.RegularExpressions;
namespace LightlessSync.PlayerData.Data;
public partial class FileReplacement
{
public FileReplacement(string[] gamePaths, string filePath)
{
GamePaths = gamePaths.Select(g => g.Replace('\\', '/').ToLowerInvariant()).ToHashSet(StringComparer.Ordinal);
ResolvedPath = filePath.Replace('\\', '/');
}
public HashSet<string> GamePaths { get; init; }
public bool HasFileReplacement => GamePaths.Count >= 1 && GamePaths.Any(p => !string.Equals(p, ResolvedPath, StringComparison.Ordinal));
public string Hash { get; set; } = string.Empty;
public bool IsFileSwap => !LocalPathRegex().IsMatch(ResolvedPath) && GamePaths.All(p => !LocalPathRegex().IsMatch(p));
public string ResolvedPath { get; init; }
public FileReplacementData ToFileReplacementDto()
{
return new FileReplacementData
{
GamePaths = [.. GamePaths],
Hash = Hash,
FileSwapPath = IsFileSwap ? ResolvedPath : string.Empty,
};
}
public override string ToString()
{
return $"HasReplacement:{HasFileReplacement},IsFileSwap:{IsFileSwap} - {string.Join(",", GamePaths)} => {ResolvedPath}";
}
[GeneratedRegex(@"^[a-zA-Z]:(/|\\)", RegexOptions.ECMAScript)]
private static partial Regex LocalPathRegex();
}