This class is used for loading and processing of plugins. It acts as a handle for control between the assemblies.
コード例 #1
0
 /// <summary>
 /// Constructs a new RegistryEntry object
 /// </summary>
 /// <param name="plugin">The plugin the entry is from</param>
 /// <param name="type">The invokable type found in the plugin</param>
 /// <param name="name">The simple name of the entry</param>
 /// <param name="className">The full class name, including namespaces of the type</param>
 public RegistryEntry(Plugin plugin, Type type, string name, string className)
 {
     this.Plugin = plugin;
     this.Host = plugin.Host;
     this.ClassType = type;
     this.Name = name;
     this.ClassName = className;
     this.Description = "";
 }
コード例 #2
0
ファイル: Registry.cs プロジェクト: borisblizzard/arcreator
 /// <summary>
 /// Loads a a plugin from file. The assembly is searched for useable content and 
 /// registered with the Editor
 /// </summary>
 /// <param name="filename"></param>
 public static void Load(string filename)
 {
     if (Host == null)
         return;
     var ext = Path.GetExtension(filename);
     if (File.Exists(filename) && (ext == ".exe" || ext == ".dll"))
     {
         var plugin = new Plugin(filename, Host);
         if (plugin.IsLoaded)
         {
             Plugins.Add(plugin);
             Entries.AddRange(plugin.GetEntries());
             return;
         }
     }
     MessageBox.Show(String.Format("Plugin \"{0}\" failed to load.", filename),
         "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 }
コード例 #3
0
ファイル: Registry.cs プロジェクト: borisblizzard/arcreator
 /// <summary>
 /// Unloads the given plugin and all associated registry entries
 /// </summary>
 /// <param name="plugin">Plugin to remove</param>
 public static void Unload(Plugin plugin)
 {
     foreach (var entry in plugin.GetEntries())
         Entries.Remove(entry);
     Plugins.Remove(plugin);
 }