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; }
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; }
public AfterAdd(Database db, PwEntry entry, OnFinish finish) : base(finish) { _db = db; _entry = entry; }
public Database CreateNewDatabase() { TestDrawableFactory testDrawableFactory = new TestDrawableFactory(); _db = new Database(testDrawableFactory, this); return _db; }
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; }
public PwGroup SearchForText(Database database, string str) { SearchParameters sp = new SearchParameters {SearchString = str}; return Search(database, sp, null); }
private void SetRounds(Database db, Preference rounds) { rounds.Summary = db.KpDatabase.KeyEncryptionRounds.ToString(CultureInfo.InvariantCulture); }
private void SetAlgorithm(Database db, Preference algorithm) { algorithm.Summary = CipherPool.GlobalPool.GetCipher(db.KpDatabase.DataCipherUuid).DisplayName; }
protected void SetMembers(Context ctx, Database db) { Ctx = ctx; Db = db; }