Beispiel #1
0
 /// <summary>
 /// Add a module to this container and start it.
 /// Requires that the instance have a unique name.
 /// Don't add a single module instance to more than
 /// one container.
 /// </summary>
 /// <param name="theModule">the MEETModule to be added to this container</param>
 /// <returns>true on success</returns>
 public bool AddModule(MEETModule theModule)
 {
     if (m_modules.Contains(theModule.Name))
     {
         WriteLog(LogLevel.ERROR, String.Format(
                      "{0}: module {1} already exists", m_name, theModule.Name));
         return(false);
     }
     m_modules.Add(theModule.Name, theModule);
     WriteLog(LogLevel.DEBUG, String.Format("{0} added {1}", m_name, theModule.Name));
     return(true);
 }
Beispiel #2
0
 /// <summary>
 /// Stop and unregister a module.
 /// </summary>
 /// <param name="theModule"></param>
 /// <returns></returns>
 public bool RemoveModule(MEETModule theModule)
 {
     if (!m_modules.Contains(theModule.Name))
     {
         WriteLog(LogLevel.ERROR, String.Format(
                      "{0}: module {1} not loaded", m_name, theModule.Name));
         return(false);
     }
     if (theModule.Status != ModStatus.STOPPED)
     {
         WriteLog(LogLevel.ERROR, String.Format(
                      "{0}: module {1} still running", m_name, theModule.Name));
         return(false);
     }
     m_modules.Remove(theModule.Name);
     WriteLog(LogLevel.DEBUG, String.Format("{0} removing {1}", m_name, theModule.Name));
     return(true);
 }