mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-12 05:34:06 +02:00
Remove legacy configuration for list of disabled plugins
This commit is contained in:
parent
2b9a910533
commit
d7bba22e19
@ -45,8 +45,7 @@ public override Type BindToType(string assemblyName, string typeName){
|
||||
|
||||
public bool EnableUpdateCheck { get; set; }
|
||||
public string DismissedUpdate { get; set; }
|
||||
|
||||
[Obsolete] public PluginConfig Plugins { get; set; } // TODO remove eventually
|
||||
|
||||
public WindowState PluginsWindow { get; set; }
|
||||
|
||||
public string CustomCefArgs { get; set; }
|
||||
|
@ -5,9 +5,7 @@
|
||||
using TweetDuck.Plugins.Events;
|
||||
|
||||
namespace TweetDuck.Plugins{
|
||||
[Serializable]
|
||||
sealed class PluginConfig{
|
||||
[field:NonSerialized]
|
||||
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
||||
|
||||
public IEnumerable<string> DisabledPlugins => Disabled;
|
||||
@ -18,14 +16,6 @@ sealed class PluginConfig{
|
||||
"official/reply-account"
|
||||
};
|
||||
|
||||
public void ImportLegacy(PluginConfig config){
|
||||
Disabled.Clear();
|
||||
|
||||
foreach(string plugin in config.Disabled){
|
||||
Disabled.Add(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEnabled(Plugin plugin, bool enabled){
|
||||
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
|
||||
InternalPluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||
|
@ -42,29 +42,14 @@ public PluginManager(string rootPath, string configPath){
|
||||
this.Config = new PluginConfig();
|
||||
this.Bridge = new PluginBridge(this);
|
||||
|
||||
LoadConfig();
|
||||
Config.Load(configPath);
|
||||
|
||||
Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
||||
Program.UserConfigReplaced += Program_UserConfigReplaced;
|
||||
}
|
||||
|
||||
private void LoadConfig(){
|
||||
#pragma warning disable 612
|
||||
if (Program.UserConfig.Plugins != null){
|
||||
Config.ImportLegacy(Program.UserConfig.Plugins);
|
||||
Config.Save(configPath);
|
||||
|
||||
Program.UserConfig.Plugins = null;
|
||||
Program.UserConfig.Save();
|
||||
}
|
||||
#pragma warning restore 612
|
||||
else{
|
||||
Config.Load(configPath);
|
||||
}
|
||||
}
|
||||
|
||||
private void Program_UserConfigReplaced(object sender, EventArgs e){
|
||||
LoadConfig();
|
||||
Config.Load(configPath);
|
||||
Reload();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user