fix some minor stuff

This commit is contained in:
Stanley Dimant
2022-06-28 02:09:08 +02:00
parent 51db0e54f2
commit 1021cca912
5 changed files with 31 additions and 12 deletions

View File

@@ -67,8 +67,9 @@ namespace MareSynchronos.Factories
FileReplacement cachedMdlResource = CreateBaseFileReplacement();
cachedMdlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mdlPath, _dalamudUtil.PlayerName);
//Logger.Debug("Model " + string.Join(", ", cachedMdlResource.GamePaths));
cachedMdlResource.SetResolvedPath(mdlPath);
//PluginLog.Verbose("Resolving for model " + mdlPath);
//Logger.Debug("\t\t=> " + cachedMdlResource.ResolvedPath);
cache.AddAssociatedResource(cachedMdlResource, null!, null!);
@@ -79,11 +80,12 @@ namespace MareSynchronos.Factories
//var mtrlFileResource = factory.CreateBaseFileReplacement();
var mtrlPath = new Utf8String(mtrl->ResourceHandle->FileName()).ToString().Split("|")[2];
//PluginLog.Verbose("Resolving for material " + mtrlPath);
var cachedMtrlResource = CreateBaseFileReplacement();
cachedMtrlResource.GamePaths = _ipcManager.PenumbraReverseResolvePath(mtrlPath, _dalamudUtil.PlayerName);
//Logger.Debug("\tMaterial " + string.Join(", ", cachedMtrlResource.GamePaths));
cachedMtrlResource.SetResolvedPath(mtrlPath);
cache.AddAssociatedResource(cachedMtrlResource, cachedMdlResource, null!);
//Logger.Debug("\t\t\t=> " + cachedMtrlResource.ResolvedPath);
var mtrlResource = (MtrlResource*)mtrl->ResourceHandle;
for (int resIdx = 0; resIdx < mtrlResource->NumTex; resIdx++)
@@ -106,6 +108,8 @@ namespace MareSynchronos.Factories
cachedTexResource.SetResolvedPath(reResolvedPath);
}
}
//Logger.Debug("\t\tTexture " + string.Join(", ", cachedTexResource.GamePaths));
//Logger.Debug("\t\t\t\t=> " + cachedTexResource.ResolvedPath);
cache.AddAssociatedResource(cachedTexResource, cachedMdlResource, cachedMtrlResource);
}
}

View File

@@ -65,7 +65,7 @@ namespace MareSynchronos.Managers
FileInfo fileInfo = new(file);
while (IsFileLocked(fileInfo))
{
Thread.Sleep(100);
Thread.Sleep(1000);
Logger.Debug("Waiting for file release " + fileInfo.FullName);
}
var sha1Hash = Crypto.GetFileHash(fileInfo.FullName);
@@ -110,7 +110,7 @@ namespace MareSynchronos.Managers
_penumbraDirWatcher = new FileSystemWatcher(_ipcManager.PenumbraModDirectory()!)
{
IncludeSubdirectories = true,
InternalBufferSize = 65536
InternalBufferSize = 1048576
};
_penumbraDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
_penumbraDirWatcher.Deleted += OnDeleted;
@@ -123,9 +123,8 @@ namespace MareSynchronos.Managers
_cacheDirWatcher = new FileSystemWatcher(_pluginConfiguration.CacheFolder)
{
EnableRaisingEvents = true,
IncludeSubdirectories = true,
InternalBufferSize = 65536
InternalBufferSize = 1048576
};
_cacheDirWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size;
_cacheDirWatcher.Deleted += OnDeleted;
@@ -217,7 +216,14 @@ namespace MareSynchronos.Managers
FileCacheSize = 0;
foreach (var file in Directory.EnumerateFiles(_pluginConfiguration.CacheFolder))
{
FileCacheSize += new FileInfo(file).Length;
try
{
FileCacheSize += new FileInfo(file).Length;
}
catch
{
// whatever
}
}
}

View File

@@ -3,6 +3,7 @@ using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
using System;
using System.Collections.Generic;
using System.Linq;
using MareSynchronos.Utils;
namespace MareSynchronos.Managers
@@ -198,6 +199,12 @@ namespace MareSynchronos.Managers
Logger.Debug("Assigning temp mods for " + collectionName);
Logger.Debug("ManipulationString: " + manipulationData);
var orderedModPaths = modPaths.OrderBy(p => p.Key.EndsWith(".mdl") ? 0 : p.Key.EndsWith(".mtrl") ? 1 : 2)
.ToDictionary(k => k.Key, k => k.Value);
foreach (var item in orderedModPaths)
{
//Logger.Debug(item.Key + " => " + item.Value);
}
var ret = _penumbraSetTemporaryMod.InvokeFunc("MareSynchronos", collectionName, modPaths, manipulationData, 0);
Logger.Debug("Penumbra Ret: " + ret.ToString());
}

View File

@@ -95,11 +95,10 @@ public class CachedPlayer
{
Logger.Debug("Downloading missing files for player " + PlayerName);
await _apiController.DownloadFiles(toDownloadReplacements, downloadToken);
}
if (downloadToken.IsCancellationRequested)
{
return;
if (downloadToken.IsCancellationRequested)
{
return;
}
}
ApplyCharacterData(_cache[_lastAppliedEquipmentHash], moddedPaths);

View File

@@ -2,6 +2,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
@@ -251,8 +252,10 @@ namespace MareSynchronos.WebAPI
await using var fs = File.OpenWrite(fileName);
await foreach (var data in reader.WithCancellation(ct))
{
//Logger.Debug("Getting chunk of " + hash);
CurrentDownloads[hash] = (CurrentDownloads[hash].Item1 + data.Length, CurrentDownloads[hash].Item2);
await fs.WriteAsync(data, ct);
Debug.WriteLine("Wrote chunk " + data.Length + " into " + fileName);
}
return fileName;
}