mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 20:03:41 +01:00
Add a message to the plugin window when SafeMode is active
This commit is contained in:
parent
e302b3bd8f
commit
910176914e
3 changed files with 33 additions and 13 deletions
|
|
@ -21,7 +21,6 @@ using Dalamud.Plugin.Internal.Exceptions;
|
|||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Utility;
|
||||
using HarmonyLib;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Plugin.Internal
|
||||
|
|
@ -52,6 +51,7 @@ namespace Dalamud.Plugin.Internal
|
|||
public PluginManager()
|
||||
{
|
||||
var startInfo = Service<DalamudStartInfo>.Get();
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
this.pluginDirectory = new DirectoryInfo(startInfo.PluginDirectory);
|
||||
this.devPluginDirectory = new DirectoryInfo(startInfo.DefaultPluginDirectory);
|
||||
|
|
@ -62,6 +62,12 @@ namespace Dalamud.Plugin.Internal
|
|||
if (!this.devPluginDirectory.Exists)
|
||||
this.devPluginDirectory.Create();
|
||||
|
||||
if (this.SafeMode = configuration.PluginSafeMode)
|
||||
{
|
||||
configuration.PluginSafeMode = false;
|
||||
configuration.Save();
|
||||
}
|
||||
|
||||
this.PluginConfigs = new PluginConfigurations(Path.Combine(Path.GetDirectoryName(startInfo.ConfigurationPath) ?? string.Empty, "pluginConfigs"));
|
||||
|
||||
var bannedPluginsJson = File.ReadAllText(Path.Combine(startInfo.AssetDirectory, "UIRes", "bannedplugin.json"));
|
||||
|
|
@ -112,6 +118,11 @@ namespace Dalamud.Plugin.Internal
|
|||
/// </summary>
|
||||
public bool ReposReady => this.Repos.All(repo => repo.State != PluginRepositoryState.InProgress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the plugin manager started in safe mode.
|
||||
/// </summary>
|
||||
public bool SafeMode { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all IPC subscriptions.
|
||||
/// </summary>
|
||||
|
|
@ -163,18 +174,14 @@ namespace Dalamud.Plugin.Internal
|
|||
/// </summary>
|
||||
public void LoadAllPlugins()
|
||||
{
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
if (configuration.PluginSafeMode)
|
||||
if (this.SafeMode)
|
||||
{
|
||||
Log.Information("PluginSafeMode was enabled, not loading any plugins.");
|
||||
|
||||
configuration.PluginSafeMode = false;
|
||||
configuration.Save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
var pluginDefs = new List<PluginDef>();
|
||||
var devPluginDefs = new List<PluginDef>();
|
||||
|
||||
|
|
@ -326,6 +333,12 @@ namespace Dalamud.Plugin.Internal
|
|||
/// </summary>
|
||||
public void ScanDevPlugins()
|
||||
{
|
||||
if (this.SafeMode)
|
||||
{
|
||||
Log.Information("PluginSafeMode was enabled, not scanning any dev plugins.");
|
||||
return;
|
||||
}
|
||||
|
||||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
|
||||
if (!this.devPluginDirectory.Exists)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue