bool ReadDatabaseFromFile(string filename) { if (string.IsNullOrEmpty(filename)) { return(false); } var fileInfo = new FileInfo(filename); // If we are looking at the same file and it hasn't been updated then just reuse it if (lastLoadedDatabase != null && fileInfo.FullName == lastLoadedDatabase.Filename && fileInfo.LastWriteTime == lastLoadedDatabase.Timestamp) { Debug.Assert(lastLoadedDatabase != null); return(true); } try { lastLoadedDatabase = BibTexHelper.LoadBibTexDatabase(filename); return(lastLoadedDatabase != null); } catch {} return(false); }
public BibTexDatabase GetDatabase() { if (Settings.Instance.AllowPerDocumentDatabases) { try { var documentDatabaseFilename = GetDocumentDatabaseFilename(); if (documentDatabaseFilename != null) { var result = BibTexHelper.LoadBibTexDatabase(documentDatabaseFilename); if (result != null) { return(result); } } } catch {} } return(Settings.Instance.GetDefaultDatabase()); }