Settings Configuration questions (dev purpose) (1 Viewer)

framug

Super Moderator
  • Team MediaPortal
  • January 31, 2005
    6,234
    2,388
    South of France
    Home Country
    France France
    Hello,

    I found something weird in Settings Configuration but may be can you help me ?

    In external MP plugins, when using this for saving parameters :

    Code:
    using (Settings xmlwriter = new Settings(Config.GetFile(Config.Dir.Config, "plugin_name.xml")))
    {
         xmlwriter.SetValue("plugin", "label", label.ToString());
    }

    It appears that the effective write (real I/O) on xmlfile appears only when hiting OK button from main MP config window.
    Then, if we have our own "save" button in our plugin, users can believe plugin's params are saved wrongly if they hit on cancel button after.

    Maybe this was created this way only for internal MP plugins, for performance purpose or, for lock files problems ? Don't know.

    Is it possible to correct that (if any) ?
    Is there something missing in the plugin's code ?
    Or, is it better to write directly own plugin xml file in this case ?
    Many questions (sorry) but I would like to know.

    Regards.
     

    and-81

    Retired Team Member
  • Premium Supporter
  • March 7, 2005
    2,257
    183
    Melbourne
    Home Country
    Australia Australia
    Having written a few plugins myself I can say that I haven't had any problem with this behaviour.

    I can also tell you that it is unlikely to be changed, so if it bothers you then you should store your configuration in your own xml files, which is not hard.

    Hope that helps,
     

    framug

    Super Moderator
  • Team MediaPortal
  • January 31, 2005
    6,234
    2,388
    South of France
    Home Country
    France France
    • Thread starter
    • Moderator
    • #4
    Just for information :

    I created a (very little) xml config file management (MediaPortal xml compatible).
    If by chance, people meet same problem, then, they could use it.

    download link

    How to use is commented in class.
    Hope this could help someone.

    Regards.
     

    Users who are viewing this thread

    Top Bottom