Пример #1
0
        public int FindGroups(string name, string uuid, out Group[] groups)
        {
            // if uniqueID is supplied, match just that one group. if not found, move on to search the content of the logins...
            if (uuid != null && uuid.Length > 0)
            {
                // Make sure there is an active database
                if (!ensureDBisOpen()) { groups = null; return -1; }

                PwUuid pwuuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(uuid));

                PwGroup matchedGroup = host.Database.RootGroup.Uuid == pwuuid ? host.Database.RootGroup : host.Database.RootGroup.FindGroup(pwuuid, true);

                if (matchedGroup == null)
                    throw new Exception("Could not find requested group.");

                groups = new Group[1];
                groups[0] = GetGroupFromPwGroup(matchedGroup);
                if (groups[0] != null)
                    return 1;
            }

            groups = null;

            return 0;
        }
Пример #2
0
 public Entry(
     string[] urls,
     string formActionURL,
     string hTTPRealm,
     string title,
     FormField[] formFieldList,
     string uniqueID,
     bool alwaysAutoFill,
     bool neverAutoFill,
     bool alwaysAutoSubmit,
     bool neverAutoSubmit,
     int priority,
     Group parent,
     string iconImageData,
     Database db)
 {
     URLs = urls;
     FormActionURL = formActionURL;
     HTTPRealm = hTTPRealm;
     Title = title;
     FormFieldList = formFieldList;
     UniqueID = uniqueID;
     AlwaysAutoFill = alwaysAutoFill;
     NeverAutoFill = neverAutoFill;
     AlwaysAutoSubmit = alwaysAutoSubmit;
     NeverAutoSubmit = neverAutoSubmit;
     Priority = priority;
     Parent = parent;
     IconImageData = iconImageData;
     Db = db;
 }
Пример #3
0
        /*
         * public static void ReorderEntriesAsInDatabase(PwObjectList<PwEntry> v,
            PwDatabase pd)
        {
            if((v == null) || (pd == null)) { Debug.Assert(false); return; }

            PwObjectList<PwEntry> vRem = v.CloneShallow();
            v.Clear();

            EntryHandler eh = delegate(PwEntry pe)
            {
                int p = vRem.IndexOf(pe);
                if(p >= 0)
                {
                    v.Add(pe);
                    vRem.RemoveAt((uint)p);
                }

                return true;
            };

            pd.RootGroup.TraverseTree(TraversalMethod.PreOrder, null, eh);

            foreach(PwEntry peRem in vRem) v.Add(peRem); // Entries not found
        }
         * */
        private Group GetGroupFromPwGroup(PwGroup pwg)
        {
            //Debug.Indent();
            //Stopwatch sw = Stopwatch.StartNew();

            string imageData = iconToBase64(pwg.CustomIconUuid, pwg.IconId);

            Group kpg = new Group(pwg.Name, KeePassLib.Utility.MemUtil.ByteArrayToHexString(pwg.Uuid.UuidBytes), imageData, pwg.GetFullPath("/", false));

            //sw.Stop();
            //Debug.WriteLine("GetGroupFromPwGroup execution time: " + sw.Elapsed);
            //Debug.Unindent();
            return kpg;
        }
Пример #4
0
 public Database(string name,
     string fileName,
     Group root,
     bool active)
 {
     Name = name;
     Root = root;
     FileName = fileName;
     Active = active;
 }