コード例 #1
0
        private void CallbackSaveDuplicateContentCsvReport(
            object sender,
            EventArgs e,
            MacroscopeCsvDuplicateContentReport.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;

            this.Enabled = false;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;
                MacroscopeTriplePercentageProgressForm ProgressForm;
                MacroscopeCsvDuplicateContentReport    CsvReport;

                ProgressForm = new MacroscopeTriplePercentageProgressForm(MainForm: this);

                CsvReport = new MacroscopeCsvDuplicateContentReport(
                    ProgressFormDialogue: ProgressForm
                    );

                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    CsvReport.WriteCsv(
                        JobMaster: this.JobMaster,
                        SelectedOutputWorksheet: SelectedOutputWorksheet,
                        OutputFilename: Path
                        );

                    Cursor.Current = Cursors.Default;
                }
                catch (MacroscopeSaveCsvFileException ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content CSV Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content CSV Report", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            Dialog.Dispose();

            this.Enabled = true;
        }
コード例 #2
0
        public void TestWriteCsv()
        {
            MacroscopeJobMaster JobMaster = new MacroscopeJobMaster(MacroscopeConstants.RunTimeMode.LIVE);
            MacroscopeCsvDuplicateContentReport ReportFile = new MacroscopeCsvDuplicateContentReport();
            List <MacroscopeCsvDuplicateContentReport.OutputWorksheet> SelectedOutputWorksheets = new List <MacroscopeCsvDuplicateContentReport.OutputWorksheet>();

            SelectedOutputWorksheets.Add(MacroscopeCsvDuplicateContentReport.OutputWorksheet.CHECKSUMS);
            SelectedOutputWorksheets.Add(MacroscopeCsvDuplicateContentReport.OutputWorksheet.ETAGS);
            SelectedOutputWorksheets.Add(MacroscopeCsvDuplicateContentReport.OutputWorksheet.PAGES);
            SelectedOutputWorksheets.Add(MacroscopeCsvDuplicateContentReport.OutputWorksheet.TITLES);
            foreach (MacroscopeCsvDuplicateContentReport.OutputWorksheet SelectedOutputWorksheet in SelectedOutputWorksheets)
            {
                string Filename = string.Join(".", Path.GetTempFileName(), ".csv");
                ReportFile.WriteCsv(JobMaster: JobMaster, SelectedOutputWorksheet: SelectedOutputWorksheet, OutputFilename: Filename);
                Assert.IsTrue(File.Exists(Filename));
                File.Delete(Filename);
            }
        }