本文整理汇总了C#中PwGroup.GetEntries方法的典型用法代码示例。如果您正苦于以下问题:C# PwGroup.GetEntries方法的具体用法?C# PwGroup.GetEntries怎么用?C# PwGroup.GetEntries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PwGroup
的用法示例。
在下文中一共展示了PwGroup.GetEntries方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSummaryList
public static string CreateSummaryList(PwGroup pgItems, bool bStartWithNewPar)
{
List<PwEntry> l = pgItems.GetEntries(true).CloneShallowToList();
string str = CreateSummaryList(pgItems, l.ToArray());
if((str.Length == 0) || !bStartWithNewPar) return str;
return (MessageService.NewParagraph + str);
}
示例2: GetChildEntries
/// <summary>
/// Returns a list of every entry contained within a group (not recursive)
/// </summary>
/// <param name="uuid">the unique ID of the group we're interested in.</param>
/// <param name="current__"></param>
/// <returns>the list of every entry directly inside the group.</returns>
private LightEntry[] GetChildEntries(PwDatabase pwd, PwGroup group, bool fullDetails)
{
List<Entry> allEntries = new List<Entry>();
List<LightEntry> allLightEntries = new List<LightEntry>();
if (group != null)
{
KeePassLib.Collections.PwObjectList<PwEntry> output;
output = group.GetEntries(false);
foreach (PwEntry pwe in output)
{
if (pwd.RecycleBinUuid.EqualsValue(pwe.ParentGroup.Uuid))
continue; // ignore if it's in the recycle bin
if (pwe.Strings.Exists("Hide from KeeFox") || pwe.Strings.Exists("Hide from KPRPC") || string.IsNullOrEmpty(pwe.Strings.ReadSafe("URL")))
continue;
if (fullDetails)
{
Entry kpe = (Entry)GetEntryFromPwEntry(pwe, false, true, pwd);
allEntries.Add(kpe);
}
else
{
LightEntry kpe = GetEntryFromPwEntry(pwe, false, false, pwd);
allLightEntries.Add(kpe);
}
}
if (fullDetails)
{
allEntries.Sort(delegate(Entry e1, Entry e2)
{
return e1.Title.CompareTo(e2.Title);
});
return allEntries.ToArray();
}
else
{
allLightEntries.Sort(delegate(LightEntry e1, LightEntry e2)
{
return e1.Title.CompareTo(e2.Title);
});
return allLightEntries.ToArray();
}
}
return null;
}
示例3: GetChildEntries
/// <summary>
/// Returns a list of every entry contained within a group (not recursive)
/// </summary>
/// <param name="uuid">the unique ID of the group we're interested in.</param>
/// <param name="current__"></param>
/// <returns>the list of every entry directly inside the group.</returns>
private LightEntry[] GetChildEntries(PwDatabase pwd, PwGroup group, bool fullDetails)
{
List<Entry> allEntries = new List<Entry>();
List<LightEntry> allLightEntries = new List<LightEntry>();
if (group != null)
{
KeePassLib.Collections.PwObjectList<PwEntry> output;
output = group.GetEntries(false);
foreach (PwEntry pwe in output)
{
if (EntryIsInRecycleBin(pwe, pwd))
continue; // ignore if it's in the recycle bin
if (string.IsNullOrEmpty(pwe.Strings.ReadSafe("URL")))
continue;
if (fullDetails)
{
Entry kpe = (Entry)GetEntryFromPwEntry(pwe, MatchAccuracy.None, true, pwd, true);
if (kpe != null) // is null if entry is marked as hidden from KPRPC
allEntries.Add(kpe);
}
else
{
LightEntry kpe = GetEntryFromPwEntry(pwe, MatchAccuracy.None, false, pwd, true);
if (kpe != null) // is null if entry is marked as hidden from KPRPC
allLightEntries.Add(kpe);
}
}
if (fullDetails)
{
allEntries.Sort(delegate(Entry e1, Entry e2)
{
return e1.Title.CompareTo(e2.Title);
});
return allEntries.ToArray();
}
else
{
allLightEntries.Sort(delegate(LightEntry e1, LightEntry e2)
{
return e1.Title.CompareTo(e2.Title);
});
return allLightEntries.ToArray();
}
}
return null;
}
示例4: GetListEntriesUserStrings
// Get all user defined strings
internal static List<string> GetListEntriesUserStrings(PwGroup pwg)
{
List<string> strl = new List<string>();
// Add all known pwentry strings
foreach (PwEntry pe in pwg.GetEntries(true))
{
foreach (KeyValuePair<string, ProtectedString> pstr in pe.Strings)
{
if (!strl.Contains(pstr.Key))
{
if (!PwDefs.IsStandardField(pstr.Key))
{
strl.Add(pstr.Key);
}
}
}
}
strl.Sort();
return strl;
}
示例5: AddItemsToMenu
private void AddItemsToMenu(ToolStripMenuItem Parent, PwGroup RootGroup)
{
//s² - 2009/06/21 - Sorting of PW-Entries in FloatingPanel
List<PwEntry> myList = RootGroup.GetEntries(is_searching).CloneShallowToList();
DateTime now = DateTime.Now;
if (FOptions.sortAlphabetical) {
myList.Sort((X, Y) => X.Strings.ReadSafe(PwDefs.TitleField).CompareTo(Y.Strings.ReadSafe(PwDefs.TitleField)));
}
//End s² - 2009/06/21 - Sorting of PW-Entries in FloatingPanel
foreach (PwEntry Entry in myList) {
ToolStripMenuItem Item = new ToolStripMenuItem();
Item.Tag = Entry;
Item.Text = Entry.Strings.ReadSafe(PwDefs.TitleField);
Item.BackColor = Entry.BackgroundColor;
Item.DropDownOpening += miItem_DropDownOpening;
Item.DoubleClick += miItem_OpenURL;
Item.DoubleClickEnabled = true;
PwIcon IconIndex = Entry.IconId;
PwUuid CustomIconID = Entry.CustomIconUuid;
if (CustomIconID != PwUuid.Zero)
Item.Image = Host.Database.GetCustomIcon(CustomIconID);
else
Item.Image = Host.MainWindow.ClientIcons.Images[(int)IconIndex];
if (Item.Image == null)
Item.Image = ilIcons.Images[5];
if (Entry.Expires){
if (Entry.ExpiryTime <= now)
{
Item.Image = ilIcons.Images[7];
Item.Font = new Font(Item.Font, Item.Font.Style | FontStyle.Strikeout);
}
Item.ToolTipText = KPRes.ExpiryTime + ": " + Entry.ExpiryTime;
}
if (Parent == null)
pmPasswords.Items.Add(Item);
else
Parent.DropDownItems.Add(Item);
ToolStripMenuItem Dummy = new ToolStripMenuItem();
Dummy.Tag = null;
Dummy.Text = "dummy";
Dummy.Enabled = false;
Item.DropDownItems.Add(Dummy);
}
}
示例6: loadSubMenuItems
private void loadSubMenuItems(PwGroup group, MenuItem currMenu)
{
const string UserName = "UserName";
const string Title = "Title";
const string URL = "URL";
const string Password = "Password";
const string CopyPwdCaption = "Copy Password";
const string CopyUrlPwdCaption = "Launch URL && Copy Password";
const string EditItemCaption = "Edit this item";
uint grpCount = 0, entryCount = 0;
group.GetCounts(false, out grpCount, out entryCount);
if (entryCount > 0) {
foreach (var j in group.GetEntries(false)) {
var titleMenu = new MenuItem(j.Strings.ReadSafe(Title));
currMenu.MenuItems.Add(titleMenu);
titleMenu.MenuItems.Add(new MenuItem(j.Strings.ReadSafe(UserName)));
var name = j.ParentGroup.Name + MenuSeparator + j.Strings.ReadSafe(Title) + MenuSeparator + j.Strings.ReadSafe(UserName);
var pwMnu = new MenuItem(CopyPwdCaption, onPwdMenuClick);
pwMnu.Name = name;
titleMenu.MenuItems.Add(pwMnu);
var pwlMnu = new MenuItem(CopyUrlPwdCaption, onUrlPwdMenuClick);
pwlMnu.Name = name;
titleMenu.MenuItems.Add(pwlMnu);
currMenu.MenuItems.Add(new MenuItem(MenuSeparator));
var editMnu = new MenuItem(EditItemCaption, OnEditItemClick);
editMnu.Name = name;
titleMenu.MenuItems.Add(editMnu);
try {
localPwdHash.Add(name, j.Strings.ReadSafe(Password));
localURLHash.Add(name, j.Strings.ReadSafe(URL));
} catch (Exception e) {
MessageBox.Show("Dupe found: " + name + MenuSeparator + j.Strings.ReadSafe(URL));
}
}
}
// are there any group children
if (grpCount > 0) {
foreach (var j in group.Groups) {
var newGroupMenu = new MenuItem(j.Name);
currMenu.MenuItems.Add(newGroupMenu);
loadSubMenuItems(j, newGroupMenu);
}
}
}