public Launchables Launchables() { var bookmarks = new Launchables(); if (!IsAvailable) return bookmarks; foreach (var profileFolder in profilesFolder.GetFolders()) { var bookmarksFile = profileFolder.GetFile(ff2Bookmarks); if (bookmarksFile.Exists()) bookmarks.AddRange(LoadFF2Bookmarks(bookmarksFile)); bookmarksFile = profileFolder.GetFile(ff3Bookmarks); if (bookmarksFile.Exists()) bookmarks.AddRange(LoadFF3Bookmarks(bookmarksFile.Copy("places_copy.sqlite"))); bookmarksFile = profileFolder.GetFile(deliciousBookmarks); if (bookmarksFile.Exists()) bookmarks.AddRange(LoadFFDeliciousBookmarks(bookmarksFile.Copy("ybookmarks_copy.sqlite"))); } return bookmarks; }
private static Launchables LoadFFDeliciousBookmarks(File file) { using (var connection = new Connection(file)) { SQLiteDataReader keywordsReader = connection.ExecuteQuery("SELECT name as title, url, shortcut as keyword FROM bookmarks where title is not null and keyword <> ''"); var bookmarks = new Launchables(); while (keywordsReader.Read()) bookmarks.AddRange(CreateBookmarks(keywordsReader["title"].ToString(), keywordsReader["url"].ToString(), keywordsReader["keyword"].ToString())); var tagsReader = connection.ExecuteQuery("SELECT name, rowid from tags"); while (tagsReader.Read()) { if (!tagsReader["name"].ToString().StartsWith("shortcut:")) bookmarks.Add(new DeliciousTag(tagsReader["name"].ToString(), int.Parse(tagsReader["rowid"].ToString()), file)); } return bookmarks; } }
private static Launchables LoadFF3Bookmarks(File file) { using (var connection = new Connection(file)) { var reader = connection.ExecuteQuery( "select b.title, p.url,k.keyword from moz_places p join moz_bookmarks b on p.id = b.fk left outer join moz_keywords k on keyword_id = k.id where b.title is not null"); var bookmarks = new Launchables(); while (reader.Read()) { if (!reader["url"].ToString().StartsWith("place:")) bookmarks.AddRange(CreateBookmarks(reader["title"].ToString(), reader["url"].ToString(), reader["keyword"].ToString())); } return bookmarks; } }