Exemplo n.º 1
0
        public PwGroup Search(Database database, SearchParameters sp, IDictionary<PwUuid, KeyValuePair<string, string>> resultContexts)
        {
            if(sp.RegularExpression) // Validate regular expression
            {
                new Regex(sp.SearchString);
            }

            string strGroupName = _app.GetResourceString(UiStringKey.search_results) + " (\"" + sp.SearchString + "\")";
            PwGroup pgResults = new PwGroup(true, true, strGroupName, PwIcon.EMailSearch) {IsVirtual = true};

            PwObjectList<PwEntry> listResults = pgResults.Entries;

            database.Root.SearchEntries(sp, listResults, resultContexts, new NullStatusLogger());

            return pgResults;
        }
Exemplo n.º 2
0
        public PwGroup SearchForExactUrl(Database database, string url)
        {
            SearchParameters sp = SearchParameters.None;
            sp.SearchInUrls = true;
            sp.SearchString = url;

            if(sp.RegularExpression) // Validate regular expression
            {
                new Regex(sp.SearchString);
            }

            string strGroupName = _app.GetResourceString(UiStringKey.search_results) + " (\"" + sp.SearchString + "\")";
            PwGroup pgResults = new PwGroup(true, true, strGroupName, PwIcon.EMailSearch) {IsVirtual = true};

            PwObjectList<PwEntry> listResults = pgResults.Entries;

            database.Root.SearchEntries(sp, listResults, new NullStatusLogger());

            return pgResults;
        }
Exemplo n.º 3
0
 public AfterAdd(Database db, PwEntry entry, OnFinish finish)
     : base(finish)
 {
     _db = db;
     _entry = entry;
 }
Exemplo n.º 4
0
 public Database CreateNewDatabase()
 {
     TestDrawableFactory testDrawableFactory = new TestDrawableFactory();
     _db = new Database(testDrawableFactory, this);
     return _db;
 }
Exemplo n.º 5
0
 public PwGroup SearchForHost(Database database, String url, bool allowSubdomains)
 {
     String host = ExtractHost(url);
     string strGroupName = _app.GetResourceString(UiStringKey.search_results) + " (\"" + host + "\")";
     PwGroup pgResults = new PwGroup(true, true, strGroupName, PwIcon.EMailSearch) {IsVirtual = true};
     if (String.IsNullOrWhiteSpace(host))
         return pgResults;
     foreach (PwEntry entry in database.Entries.Values)
     {
         string otherUrl = entry.Strings.ReadSafe(PwDefs.UrlField);
         otherUrl = SprEngine.Compile(otherUrl, new SprContext(entry, database.KpDatabase, SprCompileFlags.References));
         String otherHost = ExtractHost(otherUrl);
         if ((allowSubdomains) && (otherHost.StartsWith("www.")))
             otherHost = otherHost.Substring(4); //remove "www."
         if (String.IsNullOrWhiteSpace(otherHost))
         {
             continue;
         }
         if (host.IndexOf(otherHost, StringComparison.InvariantCultureIgnoreCase) > -1)
         {
             pgResults.AddEntry(entry, false);
         }
     }
     return pgResults;
 }
Exemplo n.º 6
0
        public PwGroup SearchForText(Database database, string str)
        {
            SearchParameters sp = new SearchParameters {SearchString = str};

            return Search(database, sp, null);
        }
Exemplo n.º 7
0
 private void SetRounds(Database db, Preference rounds)
 {
     rounds.Summary = db.KpDatabase.KeyEncryptionRounds.ToString(CultureInfo.InvariantCulture);
 }
Exemplo n.º 8
0
 private void SetAlgorithm(Database db, Preference algorithm)
 {
     algorithm.Summary = CipherPool.GlobalPool.GetCipher(db.KpDatabase.DataCipherUuid).DisplayName;
 }
Exemplo n.º 9
0
 protected void SetMembers(Context ctx, Database db)
 {
     Ctx = ctx;
     Db = db;
 }