private void CallbackSaveContactDetailsCsvReport( object sender, EventArgs e, MacroscopeCsvContactDetailsReport.OutputWorksheet SelectedOutputWorksheet, string OutputFilename ) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "csv"; Dialog.AddExtension = true; Dialog.FileName = OutputFilename; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeCsvContactDetailsReport CsvReport = new MacroscopeCsvContactDetailsReport(); try { if (Macroscope.MemoryGuard(RequiredMegabytes: CsvReportMegabytesRamRequired)) { Cursor.Current = Cursors.WaitCursor; CsvReport.WriteCsv( JobMaster: this.JobMaster, SelectedOutputWorksheet: SelectedOutputWorksheet, OutputFilename: Path ); Cursor.Current = Cursors.Default; } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Contact Details CSV Report", ex.Message); } catch (MacroscopeSaveCsvFileException ex) { this.DialogueBoxError("Error saving Contact Details CSV Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Contact Details CSV Report", ex.Message); } finally { Cursor.Current = Cursors.Default; } } Dialog.Dispose(); }
/** -------------------------------------------------------------------- **/ private void CallbackSaveDataExtractorsExcelReport(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "xlsx"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Data-Extractors.xlsx"; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeExcelDataExtractorReport msExcelReport; msExcelReport = new MacroscopeExcelDataExtractorReport( NewDataExtractorCssSelectors: this.DataExtractorCssSelectors, NewDataExtractorRegexes: this.DataExtractorRegexes, NewDataExtractorXpaths: this.DataExtractorXpaths ); try { if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired)) { Cursor.Current = Cursors.WaitCursor; msExcelReport.WriteXslx(this.JobMaster, Path); Cursor.Current = Cursors.Default; } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Data Extractors Excel Report", ex.Message); } catch (MacroscopeSaveExcelFileException ex) { this.DialogueBoxError("Error saving Data Extractors Excel Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Data Extractors Excel Report", ex.Message); } finally { Cursor.Current = Cursors.Default; } } Dialog.Dispose(); }
/** -------------------------------------------------------------------- **/ private void CallbackSaveGeneratorSitemapXmlPerHost(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Sitemap XML files (*.xml)|*.xml|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "xml"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Sitemap.xml"; MacroscopeSitemapGenerator SitemapGenerator; if (Dialog.ShowDialog() == DialogResult.OK) { string Pathname = Dialog.FileName; SitemapGenerator = new MacroscopeSitemapGenerator( NewDocCollection: this.JobMaster.GetDocCollection() ); try { if (Macroscope.MemoryGuard(RequiredMegabytes: 256)) { Cursor.Current = Cursors.WaitCursor; SitemapGenerator.WriteSitemapXmlPerHost(NewPath: Pathname); Cursor.Current = Cursors.Default; } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Sitemap XML", ex.Message); GC.Collect(); } catch (XmlException ex) { this.DialogueBoxError("Error saving Sitemap XML", ex.Message); GC.Collect(); } catch (Exception ex) { this.DialogueBoxError("Error saving Sitemap XML", ex.Message); GC.Collect(); } } GC.Collect(); Dialog.Dispose(); }
/** -------------------------------------------------------------------- **/ private void CallbackSaveDuplicateContentExcelReport(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "xlsx"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Duplicate-Content.xlsx"; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeTriplePercentageProgressForm ProgressForm = new MacroscopeTriplePercentageProgressForm(MainForm: this); MacroscopeExcelDuplicateContent msExcelReport = new MacroscopeExcelDuplicateContent( ProgressFormDialogue: ProgressForm ); try { if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired)) { Cursor.Current = Cursors.WaitCursor; msExcelReport.WriteXslx(JobMaster: this.JobMaster, OutputFilename: Path); Cursor.Current = Cursors.Default; } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message); } catch (MacroscopeSaveExcelFileException ex) { this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message); } finally { ProgressForm.DoClose(); Cursor.Current = Cursors.Default; } } Dialog.Dispose(); }
/**************************************************************************/ private void CallbackExportListViewToExcelReport(object sender, EventArgs e) { KeyValuePair <string, ListView> SelectedListView = this.GetTabPageListView(); SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "xlsx"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Report.xlsx"; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeExcelExportListViewReport msExcelReport; msExcelReport = new MacroscopeExcelExportListViewReport( SelectedWorksheetName: SelectedListView.Key, SelectedListView: SelectedListView.Value ); try { if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired)) { msExcelReport.WriteXslx(this.JobMaster, Path); } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Excel Report", ex.Message); } catch (MacroscopeSaveExcelFileException ex) { this.DialogueBoxError("Error saving Excel Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Excel Report", ex.Message); } } Dialog.Dispose(); }
/** -------------------------------------------------------------------- **/ private void CallbackSaveCustomFilterCsvReport(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "csv"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Custom-Filters.csv"; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeCsvCustomFilterReport CsvReport = new MacroscopeCsvCustomFilterReport(NewCustomFilter: this.CustomFilter); try { if (Macroscope.MemoryGuard(RequiredMegabytes: CsvReportMegabytesRamRequired)) { Cursor.Current = Cursors.WaitCursor; CsvReport.WriteCsv(this.JobMaster, Path); Cursor.Current = Cursors.Default; } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Custom Filters CSV Report", ex.Message); } catch (MacroscopeSaveCsvFileException ex) { this.DialogueBoxError("Error saving Custom Filters CSV Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Custom Filters CSV Report", ex.Message); } finally { Cursor.Current = Cursors.Default; } } Dialog.Dispose(); }
/** -------------------------------------------------------------------- **/ private void CallbackSaveOverviewExcelReport(object sender, EventArgs e) { SaveFileDialog Dialog = new SaveFileDialog(); Dialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"; Dialog.FilterIndex = 2; Dialog.RestoreDirectory = true; Dialog.DefaultExt = "xlsx"; Dialog.AddExtension = true; Dialog.FileName = "Macroscope-Overview.xlsx"; if (Dialog.ShowDialog() == DialogResult.OK) { string Path = Dialog.FileName; MacroscopeExcelOverviewReport msExcelReport = new MacroscopeExcelOverviewReport(); try { if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired)) { msExcelReport.WriteXslx(this.JobMaster, Path); } } catch (MacroscopeInsufficientMemoryException ex) { this.DialogueBoxError("Error saving Overview Excel Report", ex.Message); } catch (MacroscopeSaveExcelFileException ex) { this.DialogueBoxError("Error saving Overview Excel Report", ex.Message); } catch (Exception ex) { this.DialogueBoxError("Error saving Overview Excel Report", ex.Message); } } Dialog.Dispose(); }