Example #1
0
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }

            m_host         = host;
            m_config       = new KPSimpleBackupConfig(m_host.CustomConfig);
            m_PluginLogger = new Logger(m_config.LogToFile);

            BackupManager.SetConfig(m_config);
            BackupManager.SetPluginLogger(m_PluginLogger);

            // add backup action event handlers for when db is being saved and closed
            m_host.MainWindow.FileSaved      += this.OnDatabaseSaveAction;
            m_host.MainWindow.FileClosingPre += this.OnDatabaseCloseAction;

            // initialization successful
            return(true);
        }
        public override bool Initialize(IPluginHost host)
        {
            if (host == null)
            {
                return(false);
            }

            m_host         = host;
            m_config       = new KPSimpleBackupConfig(m_host.CustomConfig);
            m_PluginLogger = new Logger(m_config.LogToFile);

            BackupManager.SetConfig(m_config);
            BackupManager.SetPluginLogger(m_PluginLogger);
            CleanupManager.config = m_config;

            // add handler for KeePass events this plugin reacts to (file saving, closing, etc.)
            m_host.MainWindow.FileSaving      += this.OnDatabaseSavingPreAction;
            m_host.MainWindow.FileSaved       += this.OnDatabaseSaveAction;
            m_host.MainWindow.FileClosingPost += this.OnDatabaseCloseAction;

            // initialization successful
            return(true);
        }