heave fewer redraws as main method for data application, minor fixes
This commit is contained in:
@@ -24,30 +24,6 @@ public sealed class TransientResourceManager : DisposableMediatorSubscriberBase
|
||||
_configurationService = configurationService;
|
||||
_dalamudUtil = dalamudUtil;
|
||||
|
||||
PlayerPersistentDataKey = _dalamudUtil.GetPlayerNameAsync().GetAwaiter().GetResult() + "_" + _dalamudUtil.GetWorldIdAsync().GetAwaiter().GetResult();
|
||||
|
||||
SemiTransientResources.TryAdd(ObjectKind.Player, new HashSet<string>(StringComparer.Ordinal));
|
||||
if (_configurationService.Current.PlayerPersistentTransientCache.TryGetValue(PlayerPersistentDataKey, out var gamePaths))
|
||||
{
|
||||
int restored = 0;
|
||||
foreach (var gamePath in gamePaths)
|
||||
{
|
||||
if (string.IsNullOrEmpty(gamePath)) continue;
|
||||
|
||||
try
|
||||
{
|
||||
Logger.LogDebug("Loaded persistent transient resource {path}", gamePath);
|
||||
SemiTransientResources[ObjectKind.Player].Add(gamePath);
|
||||
restored++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "Error during loading persistent transient resource {path}", gamePath);
|
||||
}
|
||||
}
|
||||
Logger.LogDebug("Restored {restored}/{total} semi persistent resources", restored, gamePaths.Count);
|
||||
}
|
||||
|
||||
Mediator.Subscribe<PenumbraResourceLoadMessage>(this, Manager_PenumbraResourceLoadEvent);
|
||||
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, (_) => Manager_PenumbraModSettingChanged());
|
||||
Mediator.Subscribe<FrameworkUpdateMessage>(this, (_) => DalamudUtil_FrameworkUpdate());
|
||||
@@ -68,8 +44,41 @@ public sealed class TransientResourceManager : DisposableMediatorSubscriberBase
|
||||
});
|
||||
}
|
||||
|
||||
private string PlayerPersistentDataKey { get; }
|
||||
private ConcurrentDictionary<ObjectKind, HashSet<string>> SemiTransientResources { get; } = new();
|
||||
private string PlayerPersistentDataKey => _dalamudUtil.GetPlayerNameAsync().GetAwaiter().GetResult() + "_" + _dalamudUtil.GetHomeWorldIdAsync().GetAwaiter().GetResult();
|
||||
private ConcurrentDictionary<ObjectKind, HashSet<string>>? _semiTransientResources = null;
|
||||
private ConcurrentDictionary<ObjectKind, HashSet<string>> SemiTransientResources
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_semiTransientResources == null)
|
||||
{
|
||||
_semiTransientResources = new();
|
||||
_semiTransientResources.TryAdd(ObjectKind.Player, new HashSet<string>(StringComparer.Ordinal));
|
||||
if (_configurationService.Current.PlayerPersistentTransientCache.TryGetValue(PlayerPersistentDataKey, out var gamePaths))
|
||||
{
|
||||
int restored = 0;
|
||||
foreach (var gamePath in gamePaths)
|
||||
{
|
||||
if (string.IsNullOrEmpty(gamePath)) continue;
|
||||
|
||||
try
|
||||
{
|
||||
Logger.LogDebug("Loaded persistent transient resource {path}", gamePath);
|
||||
SemiTransientResources[ObjectKind.Player].Add(gamePath);
|
||||
restored++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogWarning(ex, "Error during loading persistent transient resource {path}", gamePath);
|
||||
}
|
||||
}
|
||||
Logger.LogDebug("Restored {restored}/{total} semi persistent resources", restored, gamePaths.Count);
|
||||
}
|
||||
}
|
||||
|
||||
return _semiTransientResources;
|
||||
}
|
||||
}
|
||||
private ConcurrentDictionary<IntPtr, HashSet<string>> TransientResources { get; } = new();
|
||||
|
||||
public void CleanUpSemiTransientResources(ObjectKind objectKind, List<FileReplacement>? fileReplacement = null)
|
||||
|
||||
Reference in New Issue
Block a user