Everything's a service.

This commit is contained in:
Ottermandias 2023-03-17 17:51:05 +01:00
parent 2670ba52c1
commit dd8c910597
45 changed files with 2155 additions and 2212 deletions

View file

@ -27,7 +27,7 @@ public class CommunicatorService : IDisposable
/// <item>Parameter is the affected mod. </item>
/// <item>Parameter is either null or the old name of the mod. </item>
/// </list> </summary>
public readonly EventWrapper<ModDataChangeType, IModReadable, string?> ModMetaChange = new(nameof(ModMetaChange));
public readonly EventWrapper<ModDataChangeType, Mod, string?> ModMetaChange = new(nameof(ModMetaChange));
public void Dispose()
{

View file

@ -306,7 +306,7 @@ public class ConfigMigrationService
return;
var defaultCollection = ModCollection.CreateNewEmpty(ModCollection.DefaultCollection);
var defaultCollectionFile = defaultCollection.FileName;
var defaultCollectionFile = new FileInfo(_fileNames.CollectionFile(defaultCollection));
if (defaultCollectionFile.Exists)
return;
@ -339,7 +339,7 @@ public class ConfigMigrationService
dict = dict.ToDictionary(kvp => kvp.Key, kvp => kvp.Value with { Priority = maxPriority - kvp.Value.Priority });
defaultCollection = ModCollection.MigrateFromV0(ModCollection.DefaultCollection, dict);
defaultCollection.Save();
Penumbra.SaveService.ImmediateSave(defaultCollection);
}
catch (Exception e)
{

View file

@ -37,7 +37,7 @@ public class FilenameService
/// <summary> Obtain the path of the local data file given a mod directory. Returns an empty string if the mod is temporary. </summary>
public string LocalDataFile(IModReadable mod)
public string LocalDataFile(Mod mod)
=> mod.IsTemporary ? string.Empty : LocalDataFile(mod.ModPath.FullName);
/// <summary> Obtain the path of the local data file given a mod directory. </summary>
@ -65,7 +65,7 @@ public class FilenameService
}
/// <summary> Obtain the path of the meta file for a given mod. Returns an empty string if the mod is temporary. </summary>
public string ModMetaPath(IModReadable mod)
public string ModMetaPath(Mod mod)
=> mod.IsTemporary ? string.Empty : ModMetaPath(mod.ModPath.FullName);
/// <summary> Obtain the path of the meta file given a mod directory. </summary>

View file

@ -38,7 +38,7 @@ public class ValidityChecker
public void LogExceptions()
{
if( ImcExceptions.Count > 0 )
ChatUtil.NotificationMessage( $"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.", "Warning", NotificationType.Warning );
Penumbra.ChatService.NotificationMessage( $"{ImcExceptions} IMC Exceptions thrown during Penumbra load. Please repair your game files.", "Warning", NotificationType.Warning );
}
// Because remnants of penumbra in devPlugins cause issues, we check for them to warn users to remove them.