Skip to content

Plugin settings

Robert Peters edited this page Oct 23, 2013 · 1 revision

A lot of plugins have settings. How the settings are stored and retrieved is up to the plugin itself, but there are some standards the plugin needs to meet.

Storing settings in custom file

If a plugin stores its settings in a custom file (like myplugin.xml), then the file should be placed in Core.PluginDataPath or in a sub folder of that path. The Core.PluginDataPath is always present, but if a sub folder is used, the plugin should create the sub folder itself when it doesn't exists.

Standard .NET settings

If a plugin uses the default settings mechanism of .NET, the settings are automatically stored in Core.PluginDataPath folder. However, to support upgrading the settings (from older plugin version to current version), it is manditory to use the UpgradeNeeded settings which is by default True. When initializing the plugin, you have to check if the settings should be upgraded.

example:

            if (Properties.Settings.Default.UpgradeNeeded)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeNeeded = false;
                Properties.Settings.Default.Save();
            }

The Core is handling UpgradeNeeded property as an exception and therefore this should be the name for the setting to check if an upgrade is needed.

Clone this wiki locally