I am designing a plugin system by my own to meet my needs.
There is the "interface" for all plugins that is like this:
then here is a plugin's 'RawCommandReceived' function:Code:public abstract class IrcPluginBase { private IrcClient _parent; public IrcClient Parent { get { return _parent; } set { _parent = value; } } public void SetParent(IrcClient parent) { _parent = parent; } public virtual void RawCommandReceived(string command) {} public void SendRawCommand(string command) { _parent.SocketRef.Send(command); } public void SendText(string nick, string channel, string txt) { } }
My main class should then do this:Code:public void RawCommandReceived(string command) { MessageBox.Show("hey"); } }
The problem is that this last line is calling the abstract class' 'RawCommandReceived' and not the plugin's overrided oneCode:foreach (IrcPluginBase plugin in _plugins) { plugin.RawCommandReceived(msg); }
How should I go around this? I also tried removing the virtual/override keywords and put "new" but still the same problem![]()




Reply With Quote