public void Load() { var test = AppDomain.CurrentDomain; PluginLoader loader = (PluginLoader)_domain.CreateInstanceAndUnwrap(typeof(PluginLoader).Assembly.FullName, typeof(PluginLoader).FullName); _plugin = loader.Load(_client, _name); if (_plugin != null) { _plugin.PropertyChanged += _plugin_PropertyChanged; } }
public void Dispose() { if (_plugin == null) { return; } var temp = _plugin; _plugin = null; try { temp.Dispose(); } catch (Exception e) { UnhandledException(this, new UnhandledExceptionEventArgs(e, true)); } AppDomain.Unload(_domain); }
public bool Load() { try { if (!File.Exists(Path)) { LastError = $"Could not find file: {Path}"; return(false); } Assembly asm = Assembly.LoadFile(Path); Type loader; Type[] types; if ((types = TryGetTypes(asm)) == null) { LastError = "Unable to retrieve any types in the assembly."; return(false); } if ((loader = types.FirstOrDefault(t => t.IsDefined(typeof(BotPluginEntry)))) == null) { LastError = "Unable to retrieve types in plugin"; return(false); } _plugin = (IBotPlugin)Activator.CreateInstance(loader); _plugin.Load(); Plugins.Add(this); return(true); } catch (Exception e) { LastError = "This is not a bot plugin.\n" + e.Message + "\n" + e.StackTrace; return(false); } }
public void AddPlugin(string name, IBotPlugin plugin) { plugins.Add(name, plugin); }
public bool Equals(IBotPlugin other) { return(Author == other.Author && Name == other.Name && Version == other.Version); }
/// <summary> /// Returns whether this instance of the Ennerbot class is equal to the specified instance /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(IBotPlugin other) { return other.WantButton == this.WantButton && other.Author == this.Author && other.ButtonText == this.ButtonText && other.Description == this.Description && other.Name == this.Name && other.Version.Equals(this.Version); }
public bool Equals(IBotPlugin other) { return other.Name == this.Name; }
public bool Equals(IBotPlugin other) { throw new NotImplementedException(); }
public bool Equals(IBotPlugin other) { return(other.Name == Name && other.Author == Author); }