Ref to Config.DevSettings was not updating

This commit is contained in:
Raymond 2021-07-15 21:27:38 -04:00
parent 2302f15c84
commit bfc7d634ce
3 changed files with 7 additions and 25 deletions

View file

@ -85,9 +85,12 @@ namespace Dalamud.Configuration.Internal
public List<string> HiddenPluginInternalName { get; set; } = new();
/// <summary>
/// Gets or sets a list of additional settings for devPlugins.
/// Gets or sets a list of additional settings for devPlugins. The key is the absolute path
/// to the plugin DLL. This is automatically generated for any plugins in the devPlugins folder.
/// However by specifiying this value manually, you can add arbitrary files outside the normal
/// file paths.
/// </summary>
public List<DevPluginSettings> DevPluginSettings { get; set; } = new();
public Dictionary<string, DevPluginSettings> DevPluginSettings { get; set; } = new();
/// <summary>
/// Gets or sets the global UI scale.

View file

@ -5,21 +5,6 @@ namespace Dalamud.Configuration.Internal
/// </summary>
internal sealed class DevPluginSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="DevPluginSettings"/> class.
/// </summary>
/// <param name="dllFile">Filename of the DLL representing this plugin.</param>
public DevPluginSettings(string dllFile)
{
this.DllFile = dllFile;
}
/// <summary>
/// Gets or sets the path to a plugin DLL. This is automatically generated for any plugins in the devPlugins folder. However by
/// specifiying this value manually, you can add arbitrary files outside the normal file paths.
/// </summary>
public string DllFile { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this plugin should automatically start when Dalamud boots up.
/// </summary>

View file

@ -33,18 +33,12 @@ namespace Dalamud.Plugin.Internal
public LocalDevPlugin(Dalamud dalamud, FileInfo dllFile, LocalPluginManifest manifest)
: base(dalamud, dllFile, manifest)
{
// base is called first, ensuring that this is a valid plugin assembly
var devSettings = dalamud.Configuration.DevPluginSettings.FirstOrDefault(cfg => cfg.DllFile == dllFile.FullName);
if (devSettings == default)
if (!dalamud.Configuration.DevPluginSettings.TryGetValue(dllFile.FullName, out this.devSettings))
{
devSettings = new DevPluginSettings(dllFile.FullName);
dalamud.Configuration.DevPluginSettings.Add(devSettings);
dalamud.Configuration.DevPluginSettings[dllFile.FullName] = this.devSettings = new DevPluginSettings();
dalamud.Configuration.Save();
}
this.devSettings = devSettings;
if (this.AutomaticReload)
{
this.EnableReloading();