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;
        }
 private void button2_Click(object sender, EventArgs e)
 {
     WipeReportManager man = new WipeReportManager();
     man.ReportDirectory = SecureDeleteLocations.GetReportDirectory();
     man.LoadReportCategories(SecureDeleteLocations.GetReportFilePath());
     man.DestroyDatabase();
     man.SaveReportCategories(SecureDeleteLocations.GetReportFilePath());
     UpdateReportInfo();
 }
        private void LoadReports()
        {
            // check if the file exists
            string path = SecureDeleteLocations.GetReportFilePath();

            if(File.Exists(path) == false) {
                Debug.ReportWarning("Report file not found at {0}", path);
                return;
            }

            reportManager = new WipeReportManager();
            reportManager.ReportDirectory = SecureDeleteLocations.GetReportDirectory();

            if(reportManager.LoadReportCategories(path) == false) {
                Debug.ReportWarning("Failed to load the report database from {0}", path);
                return;
            }

            LoadCategories();
        }
        private void UpdateReportInfo()
        {
            WipeReportManager man = new WipeReportManager();
            man.ReportDirectory = SecureDeleteLocations.GetReportDirectory();
            man.LoadReportCategories(SecureDeleteLocations.GetReportFilePath());
            CategoryList.Items.Clear();

            // count
            int categories = 0;
            int reports = 0;
            int errors = 0;
            int failed = 0;

            SDOptions options = new SDOptions();
            SDOptionsFile.TryLoadOptions(out options);

            foreach(KeyValuePair<Guid, ReportCategory> category in man.Categories) {
                categories++;
                ListViewItem item = new ListViewItem();
                string name = "Not found";

                if(category.Value.Guid == WipeSession.DefaultSessionGuid) {
                    name = "Default";
                    item.ImageIndex = 0;
                }
                else {
                    if(options != null && options.SessionNames != null &&
                       options.SessionNames.ContainsKey(category.Value.Guid)) {
                        name = options.SessionNames[category.Value.Guid];
                        item.ImageIndex = 1;
                    }
                    else {
                        item.ImageIndex = 2;
                    }
                }

                item.Text = name;
                item.SubItems.Add(category.Value.Reports.Count.ToString());
                CategoryList.Items.Add(item);

                // count messages
                foreach(KeyValuePair<long, ReportInfo> report in category.Value.Reports) {
                    reports++;
                    errors += report.Value.ErrorCount;
                    failed += report.Value.FailedObjectCount;
                }
            }

            ReportCountLabel.Text = "Reports: " + reports.ToString();
            ErrorCountLabel.Text = "Errors: " + errors.ToString();
            FailedCountLabel.Text = "Failed objects: " + failed.ToString();
            CategoryCountLabel.Text = "Categories: " + categories.ToString();
        }