Game Development Reference
In-Depth Information
fileSystemWatcher = new FileSystemWatcher(pluginDirectory);
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.Changed
+= new FileSystemEventHandler(fileSystemWatcher_Changed);
fileSystemWatcher.Deleted
+= new FileSystemEventHandler(fileSystemWatcher_Changed);
fileSystemWatcher.Created
+= new FileSystemEventHandler(fileSystemWatcher_Changed);
pluginReloadThread
= new Thread(new ThreadStart(this.ReloadPluginsThread));
pluginReloadThread.Start();
}
The following method is used to get a listing of valid plugin files from the plugin
directory. Then the plugins themselves are loaded, initialized, and added to the
plugin list.
private void LoadPluginDirectory()
{
UnloadPluginDirectory();
DirectoryInfo pluginDirectoryInfo
= new DirectoryInfo(pluginDirectory);
foreach (FileInfo pluginFile
in GetPluginFiles(pluginDirectoryInfo))
{
PluginLibrary plugin = LoadPlugin(pluginDirectoryInfo,
pluginFile);
if (plugin != null)
{
plugin.Initialize();
plugins.Add(plugin);
}
}
}
Search Nedrilad ::




Custom Search