コード例 #1
0
        private void bExport_Click(object sender, EventArgs e)
        {
            PwDatabase db = m_dDB.ElementAt(lbDB.SelectedIndex).Key;

            RefreshHandler(db);
            //if (!m_handler.SetDB(db, false)) return;
            if (!AppPolicy.Current.ExportNoKey && !m_handler.ReAskKey())
            {
                return;
            }

            db = m_handler.OTPDB;
            PwGroup      pg     = db.RootGroup;
            PwExportInfo pwInfo = new PwExportInfo(pg, db, false);

            MessageService.ExternalIncrementMessageCount();
            ShowWarningsLogger swLogger = KeePass.Program.MainForm.CreateShowWarningsLogger();

            swLogger.StartLogging(KPRes.ExportingStatusMsg, true);

            ExportUtil.Export(pwInfo, swLogger);
            swLogger.SetText(string.Empty, KeePassLib.Interfaces.LogStatusType.Info);
            swLogger.EndLogging();
            MessageService.ExternalDecrementMessageCount();
        }
コード例 #2
0
ファイル: Options.cs プロジェクト: biack519/KeePassOTP
        private void bExport_Click(object sender, EventArgs e)
        {
            PwDatabase db = m_dDB.ElementAt(lbDB.SelectedIndex).Key;

            RefreshHandler(db);
            //if (!m_handler.SetDB(db, false)) return;
            //If configured, KeePass 2.46 will ask for the masterkey during the export
            //No need to ask here
            if (Tools.KeePassVersion < new Version(2, 46))
            {
                if (!AppPolicy.Current.ExportNoKey && !m_handler.ReAskKey())
                {
                    return;
                }
            }

            db = m_handler.OTPDB;
            PwGroup      pg     = db.RootGroup;
            PwExportInfo pwInfo = new PwExportInfo(pg, db, false);

            MessageService.ExternalIncrementMessageCount();
            ShowWarningsLogger swLogger = KeePass.Program.MainForm.CreateShowWarningsLogger();

            swLogger.StartLogging(KPRes.ExportingStatusMsg, true);
            try
            {
                ExportUtil.Export(pwInfo, swLogger);
                swLogger.SetText(string.Empty, KeePassLib.Interfaces.LogStatusType.Info);
            }
            finally
            {
                swLogger.EndLogging();
                MessageService.ExternalDecrementMessageCount();
            }
        }