Пример #1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Title         = "Choose BibTex database...",
                ValidateNames = true,
            };

            if (!string.IsNullOrEmpty(CustomDatabaseFilename))
            {
                try
                {
                    var fileInfo = new FileInfo(CustomDatabaseFilename);

                    openFileDialog.InitialDirectory = fileInfo.DirectoryName;
                    openFileDialog.FileName         = fileInfo.Name;
                }
                catch
                {}
            }

            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                var newDatabase = BibTexHelper.LoadBibTexDatabase(openFileDialog.FileName);
                if (newDatabase == null)
                {
                    Helper.ShowCorruptBibtexDatabaseMessage(openFileDialog.FileName);
                    return;
                }

                CustomDatabaseFilename   = openFileDialog.FileName;
                UseDocearDefaultDatabase = false;
            }
        }
Пример #2
0
        public BibTexDatabase GetDatabaseTest()
        {
            string         documentDatabaseFilename = "E:\\D4W_Test\\XML.bib";
            BibTexDatabase result = BibTexHelper.LoadBibTexDatabase(documentDatabaseFilename);

            return(result);
        }
Пример #3
0
        public void Test02()
        {
            var database = BibTexHelper.LoadBibTexDatabase(@"Sample Files\Docear.bib");
            var citeproc = new CiteProcRunner(HavardCslStyle, () => database);

            var idList = database.GetEntryNames().ToArray();

            idList = database.GetEntryNames().Take(300).ToArray();
            Console.WriteLine("Total of " + idList.Length + " items.");


            citeproc.UpdateItems(idList, false, true);

            //var bib = citeproc.MakeBibliography();

            //foreach (var entry in bib.Entries) Console.WriteLine(entry);
        }
        void btnChooseDatabase_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Title         = "Choose BibTex database...",
                ValidateNames = true,
            };

            if (database != null)
            {
                if (database.Filename != null)
                {
                    var fileInfo = new FileInfo(database.Filename);

                    openFileDialog.InitialDirectory = fileInfo.DirectoryName;
                    openFileDialog.FileName         = fileInfo.Name;
                }
            }

            if (openFileDialog.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            // If the user selected the same file we already had, then do nothing
            if (database != null && openFileDialog.FileName == database.Filename)
            {
                return;
            }

            var newDatabase = BibTexHelper.LoadBibTexDatabase(openFileDialog.FileName);

            if (newDatabase == null)
            {
                Helper.ShowCorruptBibtexDatabaseMessage(openFileDialog.FileName);

                return;
            }

            Reset(newDatabase);
        }