/// <summary> /// Installs a per channel module. /// </summary> /// <param name="channel"></param> public void Install(ISockNetChannel channel) { ISockNetChannelModule module = NewPerChannelModule(); if (channel.SetAttribute(ModuleName, module, false)) { module.Install(channel); } }
/// <summary> /// Removes a module from this channel. /// </summary> /// <param name="module"></param> /// <returns></returns> public ISockNetChannel RemoveModule(ISockNetChannelModule module) { if (modules.Remove(module.GetType().Name)) { SockNetLogger.Log(SockNetLogger.LogLevel.DEBUG, this, "Uninstalling module: [{0}]", module); module.Uninstall(this); } else { throw new Exception("Module [" + module + "] not installed."); } return(this); }
/// <summary> /// Adds a module into this channel. /// </summary> /// <param name="module"></param> /// <returns></returns> public ISockNetChannel AddModule(ISockNetChannelModule module) { ISockNetChannelModule tmp; if (modules.TryAdd(module.GetType().Name, module, out tmp, false)) { SockNetLogger.Log(SockNetLogger.LogLevel.DEBUG, this, "Adding module: [{0}]", module); if (ShouldInstallModule(module)) { SockNetLogger.Log(SockNetLogger.LogLevel.DEBUG, this, "Installing module: [{0}]", module); module.Install(this); } } else { throw new Exception("Module [" + module + "] already installed."); } return(this); }
public bool HasModule(ISockNetChannelModule module) { return(false); }
public ISockNetChannel RemoveModule(ISockNetChannelModule module) { module.Uninstall(this); return(this); }
public ISockNetChannel AddModule(ISockNetChannelModule module) { module.Install(this); return(this); }
/// <summary> /// Always reuturns false. /// </summary> /// <param name="module"></param> /// <returns></returns> public override bool ShouldInstallModule(ISockNetChannelModule module) { return(false); }
public ISockNetChannel RemoveModule(ISockNetChannelModule module) { module.Uninstall(this); return this; }
public bool HasModule(ISockNetChannelModule module) { return false; }
public ISockNetChannel AddModule(ISockNetChannelModule module) { module.Install(this); return this; }
/// <summary> /// Check to see if we should install this module when it gets added. /// </summary> /// <param name="module"></param> /// <returns></returns> public abstract bool ShouldInstallModule(ISockNetChannelModule module);
/// <summary> /// Returns true if the module is active in this channel; /// </summary> /// <param name="module"></param> /// <returns></returns> public bool HasModule(ISockNetChannelModule module) { return(modules.Contains(module)); }