some fixes

This commit is contained in:
Stanley Dimant
2022-09-26 14:59:19 +02:00
parent e40ea323e4
commit a32209c2e1
2 changed files with 5 additions and 5 deletions

View File

@@ -168,9 +168,8 @@ public class PeriodicFileScanner : IDisposable
string[] ext = { ".mdl", ".tex", ".mtrl", ".tmb", ".pap", ".avfx", ".atex", ".sklb", ".eid", ".phyb", ".scd", ".skp" }; string[] ext = { ".mdl", ".tex", ".mtrl", ".tmb", ".pap", ".avfx", ".atex", ".sklb", ".eid", ".phyb", ".scd", ".skp" };
var penumbraFiles = Directory.EnumerateDirectories(penumbraDir) var penumbraFiles = Directory.EnumerateDirectories(penumbraDir)
.SelectMany(d => Directory.EnumerateFiles(d, "*.*", SearchOption.AllDirectories) .SelectMany(d => Directory.EnumerateFiles(d, "*.*", SearchOption.AllDirectories)
.Select(s => new FileInfo(s)) .Select(s => new FileInfo(s).FullName.ToLowerInvariant())
.Where(f => ext.Contains(f.Extension) && !f.FullName.Contains(@"\bg\") && !f.FullName.Contains(@"\bgcommon\") && !f.FullName.Contains(@"\ui\")) .Where(f => ext.Any(e => f.EndsWith(e)) && !f.Contains(@"\bg\") && !f.Contains(@"\bgcommon\") && !f.Contains(@"\ui\"))).ToList();
.Select(f => f.FullName.ToLowerInvariant())).ToList();
var cacheFiles = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder, "*.*", SearchOption.TopDirectoryOnly) var cacheFiles = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder, "*.*", SearchOption.TopDirectoryOnly)
.Where(f => new FileInfo(f).Name.Length == 40) .Where(f => new FileInfo(f).Name.Length == 40)
@@ -189,7 +188,7 @@ public class PeriodicFileScanner : IDisposable
ConcurrentBag<FileCacheEntity> entitiesToRemove = new(); ConcurrentBag<FileCacheEntity> entitiesToRemove = new();
try try
{ {
foreach (var entry in db.FileCaches.AsNoTracking()) foreach (var entry in db.FileCaches.AsNoTracking().ToArray())
{ {
var idx = Task.WaitAny(dbTasks, ct); var idx = Task.WaitAny(dbTasks, ct);
dbTasks[idx] = Task.Run(() => dbTasks[idx] = Task.Run(() =>
@@ -210,6 +209,7 @@ public class PeriodicFileScanner : IDisposable
{ {
Logger.Warn("Failed validating " + entry.Filepath); Logger.Warn("Failed validating " + entry.Filepath);
Logger.Warn(ex.Message); Logger.Warn(ex.Message);
Logger.Warn(ex.StackTrace);
entitiesToRemove.Add(entry); entitiesToRemove.Add(entry);
} }

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<Authors></Authors> <Authors></Authors>
<Company></Company> <Company></Company>
<Version>0.4.16</Version> <Version>0.4.17</Version>
<Description></Description> <Description></Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl> <PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>