/// <summary> /// Deploy the scanner (Email Configuration) /// </summary> public void DeployEmail() { // First we need to request the tabs which work with the scanner configuration to save // any changes which they may have made but not yet saved. ScannerConfigurationTabView generalTabView = WorkItem.Items[Properties.Settings.Default.ScannerConfigurationTabView] as ScannerConfigurationTabView; generalTabView.UpdateChanges(); // //AlertMonitorSettingsTabView alertsTabView = WorkItem.Items[Properties.Settings.Default.AlertMonitorSettingsTabView] as AlertMonitorSettingsTabView; //alertsTabView.SaveChanges(); // Ensure that the scanner name has been defined if (_auditScannerDefinition.ScannerName == "") { MessageBox.Show("The scanner name is blank - please specify a unique name for this scanner"); return; } // show the folder browser dialog and then generate the Executable with the selected path FolderBrowserDialog browser = new FolderBrowserDialog(); browser.Description = "Select a path to store the AuditWizard Scanner Self Extracting Executable:"; browser.ShowNewFolderButton = true; browser.RootFolder = Environment.SpecialFolder.Desktop; DialogResult result = browser.ShowDialog(); if (result != DialogResult.OK) { return; } // Now create the executable GenerateClientExecutable(browser.SelectedPath); }
/// <summary> /// Save the current scanner configuration (to a named file) /// </summary> public bool SaveScannerConfiguration() { // First we need to request the tabs which work with the scanner configuration to save // any changes which they may have made but not yet saved. if ((ILaytonView)WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].ActiveSmartPart is AuditAgentTabView) { AuditAgentTabView generalTabView = WorkItem.Items[Properties.Settings.Default.AuditAgentTabView] as AuditAgentTabView; generalTabView.Save(); } else { ScannerConfigurationTabView generalTabView = WorkItem.Items[Properties.Settings.Default.ScannerConfigurationTabView] as ScannerConfigurationTabView; generalTabView.Save(); } return(true); }
/// <summary> /// Deploy the scanner (Network Configuration) /// </summary> public void DeployNetwork() { try { // Ensure that the scanner name has been defined if (_auditScannerDefinition.ScannerName == "") { MessageBox.Show("The scanner name is blank - please specify a unique name for this scanner"); return; } // First we need to request the tabs which work with the scanner configuration to save // any changes which they may have made but not yet saved. ScannerConfigurationTabView generalTabView = WorkItem.Items[Properties.Settings.Default.ScannerConfigurationTabView] as ScannerConfigurationTabView; _auditScannerDefinition = generalTabView.UpdateChanges(); // save the changes so that the auto-loader can pick up the scanner folder generalTabView.Save(false); // create the scann folders (scanner and data) Directory.CreateDirectory(_auditScannerDefinition.DeployPathData); Directory.CreateDirectory(_auditScannerDefinition.DeployPathScanner); // ...and deploy it if (_auditScannerDefinition.Deploy(false)) { string scannerPath = _auditScannerDefinition.DeployPathScanner; //MessageBox.Show("The Audit Scanner has been deployed to " + _auditScannerDefinition.DeployPathScanner, "Deployment Successful"); if (scannerPath.Length > 50) { scannerPath = scannerPath.Substring(0, 22) + "..~.." + scannerPath.Substring(scannerPath.Length - 22, 22); } DesktopAlert.ShowDesktopAlert("The Audit Scanner has been deployed to " + scannerPath); } } catch (Exception ex) { logger.Error("Error in DeployNetwork.", ex); Utility.DisplayApplicationErrorMessage(ex.Message); } }