private void GetOTPEntry(bool bCreate, out bool Created) { Created = false; m_peOTP = null; if (!OTPDB_Opened) { return; } string uuid = m_pe.Uuid.ToHexString(); m_peOTP = OTPDB.RootGroup.GetEntries(true).Where(x => x.Strings.ReadSafe(UUID) == uuid).FirstOrDefault(); if (m_peOTP != null) { string s = "Found OTP entry for main entry " + m_pe.Uuid.ToHexString(); if (!PluginDebug.HasMessage(PluginDebug.LogLevelFlags.Info, s)) { PluginDebug.AddInfo(s); } } if ((m_peOTP != null) || !bCreate) { return; } m_peOTP = new PwEntry(true, true); OTPDB.RootGroup.AddEntry(m_peOTP, true); m_peOTP.Strings.Set(UUID, new ProtectedString(false, uuid)); UpdateString(PwDefs.TitleField); UpdateString(PwDefs.UserNameField); UpdateString(PwDefs.UrlField); Created = true; if (m_peOTP != null) { PluginDebug.AddInfo("Created OTP entry for main entry " + m_pe.Uuid.ToHexString()); } }
private void Lv_DrawSubItem_Standard(DrawListViewSubItemEventArgs e, Color cBackcolor) { e.Item.BackColor = e.SubItem.BackColor = cBackcolor; e.DrawDefault = true; string m = "m_lvEntries: Standard display for column '" + e.Header.Text + "'"; if (!PluginDebug.HasMessage(PluginDebug.LogLevelFlags.Info, m)) { PluginDebug.AddInfo(m, 0); } }
private void Lv_DrawSubItem_NoPassword(DrawListViewSubItemEventArgs e, Color cItemForeground, Color cItemBackground, Font fFont, int iPaddingX, int iPaddingY) { e.DrawDefault = false; //Other plugins might have set this to true string m = "m_lvEntries: Draw text for column '" + e.Header.Text + "'"; if (!PluginDebug.HasMessage(PluginDebug.LogLevelFlags.Info, m)) { PluginDebug.AddInfo(m, 0); } StringFormat sf = StringFormat.GenericDefault; sf.FormatFlags = StringFormatFlags.FitBlackBox | StringFormatFlags.LineLimit | StringFormatFlags.NoClip; sf.Trimming = StringTrimming.EllipsisCharacter; Rectangle r = new Rectangle(e.Bounds.X + iPaddingX, e.Bounds.Y + iPaddingY, e.Bounds.Width - (2 * iPaddingX), e.Bounds.Height - (2 * iPaddingY)); e.Graphics.DrawString(e.SubItem.Text, fFont, new SolidBrush(cItemForeground), r, sf); }