Compare commits

..

3 Commits

Author SHA1 Message Date
defnotken
16f8bf6611 Version 2025-09-12 00:10:11 -05:00
f75d99701d Added changable color bar, check on cache on the UID fetching. (#27)
Co-authored-by: CakeAndBanana <admin@cakeandbanana.nl>
Co-authored-by: defnotken <defnotken@noreply.git.lightless-sync.org>
Reviewed-on: #27
Co-authored-by: cake <cake@noreply.git.lightless-sync.org>
Co-committed-by: cake <cake@noreply.git.lightless-sync.org>
2025-09-12 07:03:05 +02:00
defnotken
3750e307e6 Cache null reference potential fix. 2025-09-11 23:37:24 -05:00
2 changed files with 7 additions and 25 deletions

View File

@@ -583,14 +583,7 @@ public sealed class CacheMonitor : DisposableMediatorSubscriberBase
} }
catch (Exception ex) catch (Exception ex)
{ {
if (workload != null) Logger.LogWarning(ex, "Failed validating {path}", workload.ResolvedFilepath);
{
Logger.LogWarning(ex, "Failed validating {path}", workload.ResolvedFilepath);
}
else
{
Logger.LogWarning(ex, "Failed validating unknown workload");
}
} }
Interlocked.Increment(ref _currentFileProgress); Interlocked.Increment(ref _currentFileProgress);
} }

View File

@@ -180,32 +180,21 @@ public sealed class FileCacheManager : IHostedService
try try
{ {
var cleanedPaths = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var cleanedPaths = paths.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(p => p,
foreach (var p in paths) p => p.Replace("/", "\\", StringComparison.OrdinalIgnoreCase)
{
var cleaned = p.Replace("/", "\\", StringComparison.OrdinalIgnoreCase)
.Replace(_ipcManager.Penumbra.ModDirectory!, _ipcManager.Penumbra.ModDirectory!.EndsWith('\\') ? PenumbraPrefix + '\\' : PenumbraPrefix, StringComparison.OrdinalIgnoreCase) .Replace(_ipcManager.Penumbra.ModDirectory!, _ipcManager.Penumbra.ModDirectory!.EndsWith('\\') ? PenumbraPrefix + '\\' : PenumbraPrefix, StringComparison.OrdinalIgnoreCase)
.Replace(_configService.Current.CacheFolder, _configService.Current.CacheFolder.EndsWith('\\') ? CachePrefix + '\\' : CachePrefix, StringComparison.OrdinalIgnoreCase) .Replace(_configService.Current.CacheFolder, _configService.Current.CacheFolder.EndsWith('\\') ? CachePrefix + '\\' : CachePrefix, StringComparison.OrdinalIgnoreCase)
.Replace("\\\\", "\\", StringComparison.Ordinal); .Replace("\\\\", "\\", StringComparison.Ordinal),
StringComparer.OrdinalIgnoreCase);
if (!cleanedPaths.ContainsValue(cleaned))
{
_logger.LogDebug("Adding to cleanedPaths: {cleaned}", cleaned);
cleanedPaths[p] = cleaned;
} else
{
_logger.LogWarning("Duplicated found: {cleaned}", cleaned);
}
}
Dictionary<string, FileCacheEntity?> result = new(StringComparer.OrdinalIgnoreCase); Dictionary<string, FileCacheEntity?> result = new(StringComparer.OrdinalIgnoreCase);
var dict = _fileCaches.SelectMany(f => f.Value).Distinct() var dict = _fileCaches.SelectMany(f => f.Value)
.ToDictionary(d => d.PrefixedFilePath, d => d, StringComparer.OrdinalIgnoreCase); .ToDictionary(d => d.PrefixedFilePath, d => d, StringComparer.OrdinalIgnoreCase);
foreach (var entry in cleanedPaths) foreach (var entry in cleanedPaths)
{ {
_logger.LogDebug("Checking if in cache: {path}", entry.Value); //_logger.LogDebug("Checking {path}", entry.Value);
if (dict.TryGetValue(entry.Value, out var entity)) if (dict.TryGetValue(entry.Value, out var entity))
{ {