diff --git a/Penumbra/Collections/ModCollectionSave.cs b/Penumbra/Collections/ModCollectionSave.cs index 4cc7706e..f2cb4ada 100644 --- a/Penumbra/Collections/ModCollectionSave.cs +++ b/Penumbra/Collections/ModCollectionSave.cs @@ -1,32 +1,21 @@ using Newtonsoft.Json.Linq; -using Penumbra.Mods; using Penumbra.Services; using Newtonsoft.Json; using Penumbra.Mods.Manager; using Penumbra.Mods.Subclasses; -using Penumbra.Util; namespace Penumbra.Collections; /// /// Handle saving and loading a collection. /// -internal readonly struct ModCollectionSave : ISavable +internal readonly struct ModCollectionSave(ModStorage modStorage, ModCollection modCollection) : ISavable { - private readonly ModStorage _modStorage; - private readonly ModCollection _modCollection; - - public ModCollectionSave(ModStorage modStorage, ModCollection modCollection) - { - _modStorage = modStorage; - _modCollection = modCollection; - } - public string ToFilename(FilenameService fileNames) - => fileNames.CollectionFile(_modCollection); + => fileNames.CollectionFile(modCollection); public string LogName(string _) - => _modCollection.AnonymizedName; + => modCollection.AnonymizedName; public string TypeName => "Collection"; @@ -40,20 +29,20 @@ internal readonly struct ModCollectionSave : ISavable j.WritePropertyName("Version"); j.WriteValue(ModCollection.CurrentVersion); j.WritePropertyName(nameof(ModCollection.Name)); - j.WriteValue(_modCollection.Name); + j.WriteValue(modCollection.Name); j.WritePropertyName(nameof(ModCollection.Settings)); // Write all used and unused settings by mod directory name. j.WriteStartObject(); - var list = new List<(string, ModSettings.SavedSettings)>(_modCollection.Settings.Count + _modCollection.UnusedSettings.Count); - for (var i = 0; i < _modCollection.Settings.Count; ++i) + var list = new List<(string, ModSettings.SavedSettings)>(modCollection.Settings.Count + modCollection.UnusedSettings.Count); + for (var i = 0; i < modCollection.Settings.Count; ++i) { - var settings = _modCollection.Settings[i]; + var settings = modCollection.Settings[i]; if (settings != null) - list.Add((_modStorage[i].ModPath.Name, new ModSettings.SavedSettings(settings, _modStorage[i]))); + list.Add((modStorage[i].ModPath.Name, new ModSettings.SavedSettings(settings, modStorage[i]))); } - list.AddRange(_modCollection.UnusedSettings.Select(kvp => (kvp.Key, kvp.Value))); + list.AddRange(modCollection.UnusedSettings.Select(kvp => (kvp.Key, kvp.Value))); list.Sort((a, b) => string.Compare(a.Item1, b.Item1, StringComparison.OrdinalIgnoreCase)); foreach (var (modDir, settings) in list) @@ -66,7 +55,7 @@ internal readonly struct ModCollectionSave : ISavable // Inherit by collection name. j.WritePropertyName("Inheritance"); - x.Serialize(j, _modCollection.InheritanceByName ?? _modCollection.DirectlyInheritsFrom.Select(c => c.Name)); + x.Serialize(j, modCollection.InheritanceByName ?? modCollection.DirectlyInheritsFrom.Select(c => c.Name)); j.WriteEndObject(); } diff --git a/Penumbra/Interop/ResourceLoading/CreateFileWHook.cs b/Penumbra/Interop/ResourceLoading/CreateFileWHook.cs index 7d94b1d5..8a5e779b 100644 --- a/Penumbra/Interop/ResourceLoading/CreateFileWHook.cs +++ b/Penumbra/Interop/ResourceLoading/CreateFileWHook.cs @@ -100,7 +100,7 @@ public unsafe class CreateFileWHook : IDisposable { // Use static storage. var ptr = WriteFileName(name); - Penumbra.Log.Verbose($"[ResourceHooks] Calling CreateFileWDetour with {ByteString.FromSpanUnsafe(name, false)}."); + Penumbra.Log.Excessive($"[ResourceHooks] Calling CreateFileWDetour with {ByteString.FromSpanUnsafe(name, false)}."); return _createFileWHook.OriginalDisposeSafe(ptr, access, shareMode, security, creation, flags, template); }