Beispiel #1
0
        public static void Export(Library library, List <PDFDocument> pdf_documents, string base_path)
        {
            try
            {
                int MAX_STEPS = 8;

                // Build the directory structure
                StatusManager.Instance.ClearCancelled("LibraryExport");

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Starting library export", 0, MAX_STEPS, true);
                Directory.CreateDirectory(base_path);
                Dictionary <string, PDFDocumentExportItem> pdf_document_export_items = Export_Docs(library, pdf_documents, base_path);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting BibTeX", 1, MAX_STEPS, true);
                LibraryExporter_BibTeX.Export(library, pdf_documents, base_path, pdf_document_export_items, true);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting html", 2, MAX_STEPS, true);
                LibraryExporter_HTML.Export(library, base_path, pdf_document_export_items);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting tabs", 3, MAX_STEPS, true);
                LibraryExporter_Tabs.Export(library, pdf_documents, base_path, pdf_document_export_items);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting BibTeX tabs", 4, MAX_STEPS, true);
                LibraryExporter_BibTeXTabs.Export(library, pdf_documents, base_path, pdf_document_export_items);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting directories", 5, MAX_STEPS, true);
                LibraryExporter_Directories.Export(library, base_path, pdf_document_export_items);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting PDF content", 6, MAX_STEPS, true);
                LibraryExporter_PDFs.Export(library, base_path, pdf_document_export_items);

                if (StatusManager.Instance.IsCancelled("LibraryExport"))
                {
                    return;
                }
                StatusManager.Instance.UpdateStatus("LibraryExport", "Exporting PDF text", 7, MAX_STEPS, true);
                LibraryExporter_PDFText.Export(library, base_path, pdf_document_export_items);

                StatusManager.Instance.UpdateStatus("LibraryExport", "Finished library export");
                Process.Start(base_path);
            }
            catch (Exception ex)
            {
                Logging.Error(ex, "There was a problem while exporting your library.");
            }
        }
Beispiel #2
0
 public static void Test1()
 {
     LibraryExporter_PDFs.Test();
 }