コード例 #1
0
        /// <summary>
        /// Unloads a module with the specified id.
        /// </summary>
        /// <param name='id'>
        /// The identifier of the module to unload.
        /// </param>
        public virtual void Unload(Guid id)
        {
            lock (ScannerList)
            {
                try
                {
                    Debugger.Status("Attempt to remove module: " + id.ToString());

                    //Remove the scanner items and invoke garbage collection.
                    if (ScannerList.ContainsKey(id))
                    {
                        ScannerList.Remove(id);
                        ScheduledList.Remove(id);
                    }
                    else if (HandlerList.ContainsKey(id))
                    {
                        HandlerList.Remove(id);
                    }
                    else
                    {
                        throw new Exception("Module not found.");
                    }

                    GC.Collect();
                    Debugger.Success();
                }
                catch (Exception e)
                {
                    Debugger.Failure(e);
                }
            }
        }
コード例 #2
0
 private void OnUpdate(object src, CommandRecievedEventArgs e)
 {
     if (e.CommandID == (int)CommandStateEnum.GET_APP_CONFIG)
     {
         NewConfiguration(e);
     }
     else if (e.CommandID == (int)CommandStateEnum.CLOSE_HANDLER)
     {
         HandlerList.Remove(e.Args[0]);
     }
     Changed?.Invoke();
 }