public static void Clear() { Database = null; _standards.Clear(); _appSettings.Remove(KEY_DATABASE); _appSettings.Save(); }
public static void CacheDb(DatabaseInfo info, string name, Database database) { _info = info; _standards.Clear(); Database = database; _appSettings[KEY_DATABASE] = name; _appSettings.Save(); }
private void ListHistory(Database database) { var dispatcher = Dispatcher; var recents = Cache.GetRecents() .Select(database.GetEntry) .Select(x => new GroupItem(x, dispatcher)) .ToList(); if (recents.Count > 0) Display(recents, _recents); }
private Group GetGroup(Database database) { string groupId; var queries = NavigationContext.QueryString; if (queries.TryGetValue("id", out groupId)) return database.GetGroup(groupId); _cmdHome.IsEnabled = false; return database.Root; }
private void txtSearch_TextChanged( object sender, TextChangedEventArgs e) { if (_database == null) { _database = Cache.Database; if (_database == null) { GoBack<MainPage>(); return; } } PerformSearch(); _cmdSearch.IsEnabled = txtSearch.Text.Length > 0; }
public Database Parse() { var settings = new XmlReaderSettings { CloseInput = false, IgnoreComments = true, IgnoreWhitespace = true, IgnoreProcessingInstructions = true, }; using (var reader = XmlReader.Create(_stream, settings)) { if (!reader.ReadToFollowing("KeePassFile")) return null; if (!reader.ReadToDescendant("Meta")) return null; string recycleBinId = null; var icons = new Dictionary<string, ImageSource>(); using (var subReader = reader.ReadSubtree()) { subReader.ReadToFollowing("Generator"); while (!string.IsNullOrEmpty(subReader.Name)) { subReader.Skip(); switch (subReader.Name) { case "RecycleBinUUID": recycleBinId = subReader .ReadElementContentAsString(); break; case "CustomIcons": ParseIcons(subReader, _dispatcher, icons); break; } } } if (reader.Name != "Root" && !reader.ReadToNextSibling("Root")) { return null; } if (!reader.ReadToDescendant("Group")) return null; using (var subReader = reader.ReadSubtree()) { var root = ParseGroup(subReader); var database = new Database(root, icons); if (!string.IsNullOrEmpty(recycleBinId)) { database.RecycleBin = database .GetGroup(recycleBinId); } return database; } } }