public static void SaveOTP(KPOTP myOTP, PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); h.SaveOTP(myOTP, pe); myOTP.ResetSanitizedChange(); Program.MainForm.RefreshEntriesList(); bool bModified = (h is OTPHandler_DB) ? (h as OTPHandler_DB).DB == Program.MainForm.ActiveDatabase : true; Program.MainForm.UpdateUI(false, null, false, null, true, null, bModified); }
public static void SaveOTP(KPOTP myOTP, PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); h.SaveOTP(myOTP, pe); myOTP.ResetSanitizedChange(); bool bModified = (h is OTPHandler_DB) ? (h as OTPHandler_DB).DB == Program.MainForm.ActiveDatabase : true; System.Windows.Forms.ListView lv = (System.Windows.Forms.ListView)Tools.GetControl("m_lvEntries"); Tools.RefreshEntriesList(bModified); }
public static OTPHandler_Base GetOTPHandler(PwEntry pe) { if (pe == null) { return(null); } PwDatabase db = pe.GetDB(); OTPHandler_Base h = GetOTPHandler(db); if (h != null) { return(h); } if (!m_EntryOTPDAOHandler.ContainsKey(ENTRYHANDLER)) { m_EntryOTPDAOHandler[ENTRYHANDLER] = new OTPHandler_Entry(); } return(m_EntryOTPDAOHandler[ENTRYHANDLER]); }
private static int ProcessReferences(PwDatabase db) { //Get DB to work on PwDatabase otpdb = db; OTPDAO.OTPHandler_DB h = GetOTPHandler(db); if (h != null) { if (!h.EnsureOTPUsagePossible(null)) { return(-1); } otpdb = h.OTPDB; } if (otpdb == null || !otpdb.IsOpen) { return(-1); } int i = 0; var b = new OTPHandler_Base(); foreach (PwEntry pe in otpdb.RootGroup.GetEntries(true)) { KPOTP otp = OTPDAO.GetOTP(pe); if (!otp.Valid) { continue; } if (!otp.Issuer.ToLowerInvariant().Contains("{ref:") && !otp.Label.ToLowerInvariant().EndsWith("{ref")) { continue; } PwEntry peMain = h is OTPHandler_DB ? (h as OTPHandler_DB).GetMainPwEntry(pe) : pe; b.InitIssuerLabel(otp, peMain); pe.CreateBackup(otpdb); pe.Strings.Set(Config.OTPFIELD, otp.OTPAuthString); i++; } return(i); }
public static KPOTP GetOTP(PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); return(h.GetOTP(pe)); }
public static OTPDefinition OTPDefined(PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); return(h.OTPDefined(pe)); }
public static string GetReadableOTP(PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); return(h.GetReadableOTP(pe)); }
public static bool EnsureOTPUsagePossible(PwEntry pe) { OTPHandler_Base h = GetOTPHandler(pe); return(h.EnsureOTPUsagePossible(pe)); }