fix crash on logout, change several logger.debug to verbose, adjustments to player cache generation, fixes to file scan manager, better handling disconnects, some refactoring, adjustments to intro UI, correct display of server state
This commit is contained in:
@@ -9,20 +9,6 @@ namespace MareSynchronos.Models
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class CharacterData
|
||||
{
|
||||
[JsonProperty]
|
||||
public List<FileReplacement> AllReplacements => FileReplacements.Where(f => f.HasFileReplacement).GroupBy(f => f.Hash).Select(g =>
|
||||
{
|
||||
return new FileReplacement("")
|
||||
{
|
||||
ResolvedPath = g.First().ResolvedPath,
|
||||
GamePaths = g.SelectMany(g => g.GamePaths).Distinct().ToList(),
|
||||
Hash = g.First().Hash
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
[JsonProperty]
|
||||
public string CacheHash { get; set; } = string.Empty;
|
||||
|
||||
public List<FileReplacement> FileReplacements { get; set; } = new();
|
||||
|
||||
[JsonProperty]
|
||||
@@ -54,9 +40,15 @@ namespace MareSynchronos.Models
|
||||
{
|
||||
return new CharacterCacheDto()
|
||||
{
|
||||
FileReplacements = AllReplacements.Select(f => f.ToFileReplacementDto()).ToList(),
|
||||
FileReplacements = FileReplacements.Where(f => f.HasFileReplacement).GroupBy(f => f.Hash).Select(g =>
|
||||
{
|
||||
return new FileReplacementDto()
|
||||
{
|
||||
GamePaths = g.SelectMany(g => g.GamePaths).Distinct().ToArray(),
|
||||
Hash = g.First().Hash
|
||||
};
|
||||
}).ToList(),
|
||||
GlamourerData = GlamourerString,
|
||||
Hash = CacheHash,
|
||||
JobId = JobId,
|
||||
ManipulationData = ManipulationString
|
||||
};
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using MareSynchronos.FileCacheDB;
|
||||
using System.IO;
|
||||
using MareSynchronos.API;
|
||||
@@ -12,29 +11,23 @@ using MareSynchronos.Utils;
|
||||
|
||||
namespace MareSynchronos.Models
|
||||
{
|
||||
[JsonObject(MemberSerialization.OptIn)]
|
||||
public class FileReplacement
|
||||
{
|
||||
private readonly string _penumbraDirectory;
|
||||
|
||||
private Task? _computationTask = null;
|
||||
|
||||
public FileReplacement(string penumbraDirectory)
|
||||
{
|
||||
this._penumbraDirectory = penumbraDirectory;
|
||||
_penumbraDirectory = penumbraDirectory;
|
||||
}
|
||||
|
||||
public bool Computed => (_computationTask == null || (_computationTask?.IsCompleted ?? true));
|
||||
public bool Computed => !HasFileReplacement || !string.IsNullOrEmpty(Hash);
|
||||
|
||||
[JsonProperty]
|
||||
public List<string> GamePaths { get; set; } = new();
|
||||
|
||||
public bool HasFileReplacement => GamePaths.Count >= 1 && GamePaths.Any(p => p != ResolvedPath);
|
||||
|
||||
[JsonProperty]
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty]
|
||||
public string ResolvedPath { get; set; } = string.Empty;
|
||||
|
||||
public void SetResolvedPath(string path)
|
||||
@@ -42,7 +35,7 @@ namespace MareSynchronos.Models
|
||||
ResolvedPath = path.ToLower().Replace('/', '\\').Replace(_penumbraDirectory, "").Replace('\\', '/');
|
||||
if (!HasFileReplacement) return;
|
||||
|
||||
_computationTask = Task.Run(() =>
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
FileCache? fileCache;
|
||||
using (FileCacheContext db = new())
|
||||
|
||||
Reference in New Issue
Block a user