Hashtable pluginNameLookup = new Hashtable(); // relative path = plugin name
 internal void addServerPlugin(ServerPlugin ServerPlugin)
 {
     ServerPlugin.onQuit          += new LogDelegate(ServerPlugin_onQuit);
     ServerPlugin.onLog           += new LogDelegate(delegate(string s) { log("[" + ServerPlugin.Name() + "]: " + s); });
     ServerPlugin.onOutboxMessage += new ServerPlugin.outboxDelegate(plugin_onOutboxMessage);
     ServerClasses.Add(ServerPlugin);
 }
 public void detectPluginChanges()
 {
     //string pluginPath = ThingReferences.ThingPath.path_base +
     //                    System.IO.Path.DirectorySeparatorChar +
     //                    "plugins";
     foreach (DirectoryInfo di in new DirectoryInfo(path_cache).GetDirectories())
     {
         string pluginFolderPath = di.FullName;
         foreach (FileInfo fi in new DirectoryInfo(pluginFolderPath).GetFiles("*.*"))
         {
             string ext = Path.GetExtension(fi.Name);
             if (fi.Name.ToLower().Contains("_server") && (ext == ".cs" || ext == ".vb" || ext == ".js"))
             {
                 string path_plugin = fi.FullName;
                 try
                 {
                     string md5_plugin = Encryption.md5_file(path_plugin);
                     bool   doCompile  = false;
                     if (!pluginFileHashes.ContainsKey(path_plugin))
                     {
                         doCompile = true;
                     }
                     else
                     if (((string)pluginFileHashes[path_plugin]) != md5_plugin)
                     {
                         doCompile = true;
                     }
                     if (doCompile)
                     {
                         ServerPlugin plugin = compiler.CompileCode(path_plugin);
                         if (!object.Equals(null, plugin))
                         {
                             if (pluginFileHashes.ContainsKey(path_plugin))
                             {
                                 ServerClasses.RemoveAt(plugin.Name());
                             }
                             pluginFileHashes[path_plugin] = md5_plugin;
                             //pluginAddResourceFolderPath(pluginFolderPath);
                             addServerPlugin(plugin);
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     log(ex.Message);
                 }
             }
         }
     }
 }
 public void delPlugin(string pathRel)
 {
     ServerClasses.RemoveAt((string)pluginNameLookup[pathRel]);
 }