Beispiel #1
0
        private void SaveReport()
        {
            if(_session.Status == SessionStatus.Stopped) {
                WipeReport report = _session.GenerateReport();

                // don't save if there are no erros
                if(_options.SaveReportOnErrors && report.Errors.Count == 0) {
                    return;
                }

                WipeReportManager manager = new WipeReportManager();
                string reportFilePath = SecureDeleteLocations.GetReportFilePath();
                string reportDirectory = SecureDeleteLocations.GetReportDirectory();

                if(File.Exists(reportFilePath)) {
                    manager.LoadReportCategories(reportFilePath);
                }

                manager.ReportDirectory = reportDirectory;

                if(_options.MaximumReportsPerSession > 0) {
                    manager.MaximumReportsPerSession = _options.MaximumReportsPerSession;
                }

                // add and save the report
                ReportInfo info;
                manager.AddReport(report, out info);
                manager.SaveReport(report, info);
                manager.SaveReportCategories(reportFilePath);
                SaveReportLabel.Visible = false;
            }
        }
        private ReportInfo SaveSessionReport()
        {
            if(session == null) {
                return null;
            }

            if(session.Status == SessionStatus.Stopped) {
                WipeReport report = session.GenerateReport();

                if(report != null) {
                    // save it
                    WipeReportManager manager = new WipeReportManager();
                    string reportFilePath = SecureDeleteLocations.GetReportFilePath();
                    string reportDirectory = SecureDeleteLocations.GetReportDirectory();

                    if(File.Exists(reportFilePath)) {
                        manager.LoadReportCategories(reportFilePath);
                    }

                    manager.ReportDirectory = reportDirectory;

                    if(_options.MaximumReportsPerSession > 0) {
                        manager.MaximumReportsPerSession = _options.MaximumReportsPerSession;
                    }

                    // add the report
                    ReportInfo info;
                    manager.AddReport(report, out info);

                    // save
                    manager.SaveReport(report, info);
                    manager.SaveReportCategories(reportFilePath);
                    return info;
                }
            }

            return null;
        }