/// <summary> /// The <c>Terminate</c> method is called by KeePass when /// you should free all resources, close files/streams, /// remove event handlers, etc. /// </summary> public override void Terminate() { if (this.host != null) { this.host.PwGeneratorPool.Remove(this.generator.Uuid); this.generator = null; this.host = null; } }
/// <summary> /// The <c>Initialize</c> method is called by KeePass when /// you should initialize your plugin. /// </summary> /// <param name="host">Plugin host interface. Through this /// interface you can access the KeePass main window, the /// currently open database, etc.</param> /// <returns>You must return <c>true</c> in order to signal /// successful initialization. If you return <c>false</c>, /// KeePass unloads your plugin (without calling the /// <c>Terminate</c> method of your plugin).</returns> public override bool Initialize(IPluginHost host) { if (host == null) { return(false); } this.host = host; this.generator = new DicewarePwGenerator(); this.host.PwGeneratorPool.Add(this.generator); return(true); }