mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 21:27:21 +01:00
add migration to file extensions for mare storage
This commit is contained in:
parent
176fc9560b
commit
f512552fe7
3 changed files with 43 additions and 8 deletions
|
|
@ -665,6 +665,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
|||
List<FileReplacementData> missingFiles = new();
|
||||
moddedDictionary = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
ConcurrentDictionary<string, string> outputDict = new(StringComparer.Ordinal);
|
||||
bool hasMigrationChanges = false;
|
||||
try
|
||||
{
|
||||
var replacementList = charaData.FileReplacements.SelectMany(k => k.Value.Where(v => string.IsNullOrEmpty(v.FileSwapPath))).ToList();
|
||||
|
|
@ -679,6 +680,12 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
|||
var fileCache = _fileDbManager.GetFileCacheByHash(item.Hash);
|
||||
if (fileCache != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(new FileInfo(fileCache.ResolvedFilepath).Extension))
|
||||
{
|
||||
hasMigrationChanges = true;
|
||||
fileCache = _fileDbManager.MigrateFileHashToExtension(fileCache, item.GamePaths[0].Split(".").Last());
|
||||
}
|
||||
|
||||
foreach (var gamePath in item.GamePaths)
|
||||
{
|
||||
outputDict[gamePath] = fileCache.ResolvedFilepath;
|
||||
|
|
@ -706,6 +713,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
|
|||
{
|
||||
PluginLog.Error(ex, "Something went wrong during calculation replacements");
|
||||
}
|
||||
if (hasMigrationChanges) _fileDbManager.WriteOutFullCsv();
|
||||
st.Stop();
|
||||
Logger.LogDebug("ModdedPaths calculated in {time}ms, missing files: {count}, total files: {total}", st.ElapsedMilliseconds, missingFiles.Count, moddedDictionary.Keys.Count);
|
||||
return missingFiles;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue