mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-14 23:14:15 +01:00
force rescan if auto cleanup removed files
This commit is contained in:
parent
e0603df470
commit
8c535828b9
2 changed files with 6 additions and 4 deletions
|
|
@ -80,7 +80,7 @@ public class PeriodicFileScanner : IDisposable
|
||||||
{
|
{
|
||||||
while (!token.IsCancellationRequested)
|
while (!token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
RecalculateFileCacheSize();
|
isForced = RecalculateFileCacheSize();
|
||||||
if (!_pluginConfiguration.FileScanPaused || isForced)
|
if (!_pluginConfiguration.FileScanPaused || isForced)
|
||||||
{
|
{
|
||||||
isForced = false;
|
isForced = false;
|
||||||
|
|
@ -101,7 +101,7 @@ public class PeriodicFileScanner : IDisposable
|
||||||
InvokeScan();
|
InvokeScan();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RecalculateFileCacheSize()
|
public bool RecalculateFileCacheSize()
|
||||||
{
|
{
|
||||||
FileCacheSize = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder).Sum(f =>
|
FileCacheSize = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder).Sum(f =>
|
||||||
{
|
{
|
||||||
|
|
@ -115,7 +115,7 @@ public class PeriodicFileScanner : IDisposable
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (FileCacheSize < (long)_pluginConfiguration.MaxLocalCacheInGiB * 1024 * 1024 * 1024) return;
|
if (FileCacheSize < (long)_pluginConfiguration.MaxLocalCacheInGiB * 1024 * 1024 * 1024) return false;
|
||||||
|
|
||||||
var allFiles = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder)
|
var allFiles = Directory.EnumerateFiles(_pluginConfiguration.CacheFolder)
|
||||||
.Select(f => new FileInfo(f)).OrderBy(f => f.LastAccessTime).ToList();
|
.Select(f => new FileInfo(f)).OrderBy(f => f.LastAccessTime).ToList();
|
||||||
|
|
@ -126,6 +126,8 @@ public class PeriodicFileScanner : IDisposable
|
||||||
File.Delete(oldestFile.FullName);
|
File.Delete(oldestFile.FullName);
|
||||||
allFiles.Remove(oldestFile);
|
allFiles.Remove(oldestFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task PeriodicFileScan(CancellationToken ct)
|
private async Task PeriodicFileScan(CancellationToken ct)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.4.9</Version>
|
<Version>0.4.10</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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue