Exemple #1
0
        /// <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);
        }
Exemple #2
0
        /// <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);
            }
        }