Ejemplo n.º 1
0
        private void GroupPickIcon_Click(object sender, EventArgs e)
        {
            Util.Log("Group Context Menu -> PickExeIcon clicked");

            if (CheckMono())
            {
                return;
            }

            PwGroup group = pluginHost.MainWindow.GetSelectedGroup();

            if (group == null)
            {
                Util.Log("No group selected");
                return;
            }

            // Get all entries from the group
            bool subEntries = KeePass.Program.Config.MainWindow.ShowEntriesOfSubGroups;
            PwObjectList <PwEntry> entriesInGroup = group.GetEntries(subEntries);

            if (entriesInGroup == null)
            {
                Util.Log("No entries in group are null");
                return;
            }

            // Copy PwObjectList<PwEntry> to PwEntry[]
            PwEntry[] entries = entriesInGroup.CloneShallowToList().ToArray();
            Execute(entries, group);
        }
Ejemplo n.º 2
0
        private void DownloadFaviconsGroup_Click(object sender, EventArgs e)
        {
            Util.Log("Group Context Menu -> Download Favicons clicked");

            PwGroup group = pluginHost.MainWindow.GetSelectedGroup();

            if (group == null)
            {
                Util.Log("No group selected");
                return;
            }

            // Get all entries from the group
            PwObjectList <PwEntry> entriesInGroup = group.GetEntries(true);

            if (entriesInGroup == null || entriesInGroup.UCount == 0)
            {
                Util.Log("No entries in group");
                return;
            }

            // Copy PwObjectList<PwEntry> to PwEntry[]
            PwEntry[] entries = entriesInGroup.CloneShallowToList().ToArray();
            DownloadFavicons(entries);
        }
        private static string GetValueFromDB(ref KeePassLib.PwDatabase pdb, string searchString = "")
        {
            if (string.IsNullOrWhiteSpace(searchString))
            {
                throw new ArgumentException("Search String Cannot be blank");
            }

            SearchProcessor processor = new SearchProcessor();

            processor.Database = pdb;
            //byte[] keyBytes = System.Text.Encoding.Default.GetBytes(key); //new []{ System.Text.EncodingInfo}
            //Guid i = Guid.Parse(key);
            //var pwUuID = new PwUuid(i.ToByteArray());

            //SearchParameters sp = new SearchParameters();
            //sp.SearchInStringNames = true;
            //sp.SearchString = searchString;
            //PwObjectList<PwEntry> pwl = new PwObjectList<PwEntry>();
            //pdb.RootGroup.SearchEntries(sp, pwl);

            PwObjectList <PwEntry> pwl = processor.GetListOfEntriesBySearchByString(searchString);

            System.Diagnostics.Debug.WriteLine($"Entries Found: {pwl.Count()}");
            string k = string.Empty;

            foreach (var entry in pwl.CloneShallowToList())
            {
                foreach (var l in entry.Strings.ToList())
                {
                    if (l.Key == "Password")
                    {
                        k = l.Value.ReadString();
                    }
                }
            }
            return(k);
        }