public static bool ReAskKey(PwDatabase pwDatabase, bool bFailWithUI) { if (pwDatabase == null) { Debug.Assert(false); return(false); } KeyPromptForm dlg = new KeyPromptForm(); dlg.InitEx(pwDatabase.IOConnectionInfo, false, true, KPRes.EnterCurrentCompositeKey); if (UIUtil.ShowDialogNotValue(dlg, DialogResult.OK)) { return(false); } CompositeKey ck = dlg.CompositeKey; bool bResult = ck.EqualsValue(pwDatabase.MasterKey); if (!bResult) { MessageService.ShowWarning(KLRes.InvalidCompositeKey, KLRes.InvalidCompositeKeyHint); } UIUtil.DestroyForm(dlg); return(bResult); }
public static bool ReAskKey(PwDatabase pd, bool bFailWithUI) { if (pd == null) { Debug.Assert(false); return(false); } KeyPromptFormResult r; DialogResult dr = KeyPromptForm.ShowDialog(pd.IOConnectionInfo, false, KPRes.EnterCurrentCompositeKey, out r); if ((dr != DialogResult.OK) || (r == null)) { return(false); } CompositeKey ck = r.CompositeKey; bool bEqual = ck.EqualsValue(pd.MasterKey); if (!bEqual && bFailWithUI) { MessageService.ShowWarning(KLRes.InvalidCompositeKey, KLRes.InvalidCompositeKeyHint); } return(bEqual); }