Derive plugin from another plugin? (1 Viewer)

bartmanson

MP Donator
  • Premium Supporter
  • December 28, 2004
    127
    35
    Nuremberg
    Home Country
    Germany Germany
    Hi everybody,

    first of all: Many thanks to the mp team (developers, testers, docu writers). You are doing an awesome job!

    I think that some of MPs very few problems that users still experience come from standby or hibernate issues due to faulty drivers or whatever. At least this is what I experience... So I decided to program a plugin that replaces PowerScheduler. It would allow to shutdown the computer completely and call an external program (CMOSTimer - see: http://www.boraxsoft.de/CMOSTimer_eng.html). This program would write the wakeup time to my pc's BIOS (like nvram-wakeup in linux). But I did not want to program everything from scratch because I thought that I would only have to override PowerSchedulers "Stop()" method in order to achieve my goals. The body of the Stop() method would call the external program CMOSTimer with the protected PowerScheduler variable "_wakeupTime" as parameter.

    So I decided to derive a class called "BIOSScheduler" from "MediaPortal.PowerScheduler.Powerscheduler" and overrode some methods with the "new" keyword (e.g. PluginName(), Stop(), ...). But it seems that the respective methods from the base class "PowerScheduler" are called when configuration.exe and mediaportal.exe load the plugins. I think this is because the methods in the base classes are not declared as "virtual" and thus i cannot use the "override" keyword when I define the methods in the derived class (cf. Knowing When to Use Override and New Keywords (C# Programming Guide) in C# Visual Express Online Help).

    Question to the mp team:
    Am I doing something wrong or do you agree that it is currently not possible to derive a plugin from another plugin? If so: Would it be possible or do you think it is desirable to change maybe the IPlugin interface so that all methods are declared as virtual? I want to avoid copying the entire powerscheduler source just to add a small change to its functionality.

    Hope that is not too confusing. Do you get my point?

    Thanks in advance!
    BartManson
     

    bartmanson

    MP Donator
  • Premium Supporter
  • December 28, 2004
    127
    35
    Nuremberg
    Home Country
    Germany Germany
    Hi Guys,

    anyone? Does no one else think that it would be nice if we could create new plugins by deriving them from existing plugins?

    Ciao,
    BartManson
     

    Users who are viewing this thread

    Top Bottom