fixes for cache
This commit is contained in:
@@ -73,7 +73,7 @@ public class Configuration : IPluginConfiguration
|
|||||||
public string CacheFolder { get; set; } = string.Empty;
|
public string CacheFolder { get; set; } = string.Empty;
|
||||||
public Dictionary<string, string> ClientSecret { get; set; } = new(StringComparer.Ordinal);
|
public Dictionary<string, string> ClientSecret { get; set; } = new(StringComparer.Ordinal);
|
||||||
public Dictionary<string, string> CustomServerList { get; set; } = new(StringComparer.Ordinal);
|
public Dictionary<string, string> CustomServerList { get; set; } = new(StringComparer.Ordinal);
|
||||||
public int MaxLocalCacheInGiB { get; set; } = 20;
|
public double MaxLocalCacheInGiB { get; set; } = 20;
|
||||||
public bool ReverseUserSort { get; set; } = false;
|
public bool ReverseUserSort { get; set; } = false;
|
||||||
|
|
||||||
public int TimeSpanBetweenScansInSeconds { get; set; } = 30;
|
public int TimeSpanBetweenScansInSeconds { get; set; } = 30;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ using MareSynchronos.Utils;
|
|||||||
using Penumbra.GameData.ByteString;
|
using Penumbra.GameData.ByteString;
|
||||||
using Penumbra.Interop.Structs;
|
using Penumbra.Interop.Structs;
|
||||||
using Object = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.Object;
|
using Object = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.Object;
|
||||||
|
using Weapon = MareSynchronos.Interop.Weapon;
|
||||||
|
|
||||||
namespace MareSynchronos.Factories;
|
namespace MareSynchronos.Factories;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Authors></Authors>
|
<Authors></Authors>
|
||||||
<Company></Company>
|
<Company></Company>
|
||||||
<Version>0.5.3</Version>
|
<Version>0.5.4</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>
|
||||||
|
|||||||
@@ -525,8 +525,8 @@ public class UiShared : IDisposable
|
|||||||
"Restrict yourself to latin letters (A-Z), underscores (_), dashes (-) and arabic numbers (0-9).", ImGuiColors.DalamudRed);
|
"Restrict yourself to latin letters (A-Z), underscores (_), dashes (-) and arabic numbers (0-9).", ImGuiColors.DalamudRed);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxCacheSize = _pluginConfiguration.MaxLocalCacheInGiB;
|
float maxCacheSize = (float)_pluginConfiguration.MaxLocalCacheInGiB;
|
||||||
if (ImGui.SliderInt("Maximum Cache Size in GB", ref maxCacheSize, 1, 50, "%d GB"))
|
if (ImGui.SliderFloat("Maximum Cache Size in GiB", ref maxCacheSize, 1f, 200f, "%.2f GiB"))
|
||||||
{
|
{
|
||||||
_pluginConfiguration.MaxLocalCacheInGiB = maxCacheSize;
|
_pluginConfiguration.MaxLocalCacheInGiB = maxCacheSize;
|
||||||
_pluginConfiguration.Save();
|
_pluginConfiguration.Save();
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ public partial class ApiController
|
|||||||
var filePath = Path.Combine(_pluginConfiguration.CacheFolder, file.Hash);
|
var filePath = Path.Combine(_pluginConfiguration.CacheFolder, file.Hash);
|
||||||
await File.WriteAllBytesAsync(filePath, extractedFile, token).ConfigureAwait(false);
|
await File.WriteAllBytesAsync(filePath, extractedFile, token).ConfigureAwait(false);
|
||||||
var fi = new FileInfo(filePath);
|
var fi = new FileInfo(filePath);
|
||||||
Func<DateTime> RandomDayFunc()
|
Func<DateTime> RandomDayInThePast()
|
||||||
{
|
{
|
||||||
DateTime start = new(1995, 1, 1);
|
DateTime start = new(1995, 1, 1);
|
||||||
Random gen = new();
|
Random gen = new();
|
||||||
@@ -147,9 +147,9 @@ public partial class ApiController
|
|||||||
return () => start.AddDays(gen.Next(range));
|
return () => start.AddDays(gen.Next(range));
|
||||||
}
|
}
|
||||||
|
|
||||||
fi.CreationTime = RandomDayFunc().Invoke();
|
fi.CreationTime = RandomDayInThePast().Invoke();
|
||||||
fi.LastAccessTime = RandomDayFunc().Invoke();
|
fi.LastAccessTime = DateTime.Today;
|
||||||
fi.LastWriteTime = RandomDayFunc().Invoke();
|
fi.LastWriteTime = RandomDayInThePast().Invoke();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_ = _fileDbManager.CreateCacheEntry(filePath);
|
_ = _fileDbManager.CreateCacheEntry(filePath);
|
||||||
|
|||||||
Reference in New Issue
Block a user