internal static ProjectScanStatuses BindProject(Entities.Project project) { Logger.Create().Debug("BindProjectByType in"); ProjectScanStatuses status = ProjectScanStatuses.CanceledByUser; try { status = LoginAndBindSelectedProject(project); if (status == ProjectScanStatuses.Success) { ShowResultLogic showResultLogic = new ShowResultLogic(); showResultLogic.Act(); status = ProjectScanStatuses.Success; } else if (status == ProjectScanStatuses.CanceledByUser) { //Do nothing... } else { TopMostMessageBox.Show("Unable to retrieve results.", "Error", System.Windows.Forms.MessageBoxButtons.OK); } CommonActionsInstance.getInstance().ClearScanProgressView(); CommonActionsInstance.getInstance().CloseScanProgressView(); } catch (Exception err) { Logger.Create().Error(err); } return(status); }
public ActionStatus Act() { LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(ActionStatus.Failed); } if (login != null && login.BindedProjects != null) { LoginData.BindProject bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp) { return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath); } ); if (bindPro != null) { CommonData.ProjectId = bindPro.BindedProjectId; CommonData.SelectedScanId = bindPro.SelectedScanId; } } CommonActionsInstance.getInstance().BuildFileMapping(); ShowSavedResults(); CommonData.IsWorkingOffline = true; return(ActionStatus.Success); }
public ActionStatus Act() { CommonActionsInstance.getInstance().BuildFileMapping(); DoPrevResult(); CommonData.IsWorkingOffline = false; return(ActionStatus.Success); }
void DoRetrieveResults(Entities.Project project) { try { // First call save all command to save project changes CommonActionsInstance.getInstance().ExecuteSystemCommand("File.SaveAll", string.Empty); // verify that was selected correct project System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state) { try { Helpers.BindProjectHelper.BindProject(project); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); } }); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); } }
private void ShowSavedResults() { LoginData login = LoginHelper.LoadSaved(); CxViewerAction.CxVSWebService.CxWSQueryVulnerabilityData[] scanData = null; long scanId = 0; scanId = CommonData.SelectedScanId; if (scanId == 0) { TopMostMessageBox.Show("No Stored Results Found", "Information"); return; } scanData = SavedResultsManager.Instance.LoadStoredScanData(scanId); if (scanData.Length > 0) { PerspectiveHelper.ShowStored(scanData, login, scanId); CommonActionsInstance.getInstance().ShowReportView(); } else { TopMostMessageBox.Show("No Stored Results Found", "Information"); } }
public CommandStatus GetStatus() { CommandStatus status = CommandStatus.CommandStatusNull; _isBinded = false; status = (CommandStatus)CommandStatus.CommandStatusSupported | CommandStatus.CommandStatusEnabled; LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(CommandStatus.CommandStatusNull); } if (login != null && login.BindedProjects != null) { LoginData.BindProject bindPro = login.BindedProjects.Find(project => project.ProjectName == selectedProject.ProjectName && project.RootPath == selectedProject.RootPath && project.IsBound == true); if (bindPro != null) { _isBinded = true; status = (CommandStatus)CommandStatus.CommandStatusUnsupported; //bind is unsupported -> unbind is supported } } return(status); }
public ActionStatus Act() { if (!_isBinded) { //bind if (PerspectiveHelper.LoginToServer() == null) { return(ActionStatus.Failed); } Entities.Project project = CommonActionsInstance.getInstance().GetSelectedProject(); CommonData.ProjectName = project.ProjectName; CommonData.ProjectRootPath = project.RootPath; if (!setBindProject(true)) { return(ActionStatus.Failed); } CommonData.IsProjectBound = true; DoRetrieveResults(project); CommonData.IsWorkingOffline = false; return(ActionStatus.Success); } else { //unbind if (!setBindProject(false)) { return(ActionStatus.Failed); } CommonData.IsProjectBound = false; CommonData.IsWorkingOffline = false; return(ActionStatus.Success); } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> protected virtual void MenuItemCallback(object sender, EventArgs e) { CommonActions ca = CommonActionsInstance.getInstance(); ca.ScanProgressWin = _package.FindToolWindow(typeof(ScanProcessToolWindow), ScanProcessToolWindow.ID, true); ca.ResultWin = _package.FindToolWindow(typeof(ResultsToolWindow), ResultsToolWindow.ID, true); ca.ReportWin = _package.FindToolWindow(typeof(ReportToolWindow), ReportToolWindow.ID, true); ca.PathWin = _package.FindToolWindow(typeof(PathToolWindow), PathToolWindow.ID, true); ca.GraphWin = _package.FindToolWindow(typeof(GraphToolWindow), GraphToolWindow.ID, true); }
private void ShowScanProgressBar() { if (_scan != null && _scan.UploadSettings != null && (_scan.ScanView == null || _scan.ScanView.Visibility == false)) { var scanStatusBar = new ScanStatusBar(true, string.Format("Scaning project {0}: {1}", _scan.UploadSettings.ProjectName, "..."), 0, 100); CommonActionsInstance.getInstance().UpdateScanProgress(scanStatusBar); } }
/// <summary> /// Show previous scanned result for selected project /// </summary> private void DoPrevResult() { System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state) { try { CommonActionsInstance.getInstance().ReportDoPrevResults(); CommonActionsInstance.getInstance().ShowReportView(); } catch (Exception ex) { Logger.Create().Error(ex.ToString()); } }); }
private void DoScan(Entities.Project project) { try { if (!LoginHelper.IsScanner) { TopMostMessageBox.Show("User is not allowed to scan", "Error"); return; } // verify that was selected correct project if (!string.IsNullOrEmpty(project.RootPath)) { System.Threading.ThreadPool.QueueUserWorkItem(delegate(object state) { try { CxViewerAction.CxVSWebService.CxWSQueryVulnerabilityData[] scanData = null; long scanId = 0; ProjectScanStatuses status = _scanHelper.DoScan(project, IsIncremental, ref scanData, ref scanId); if (status == ProjectScanStatuses.Success) { LoginData login = LoginHelper.LoadSaved(); PerspectiveHelper.ShowStored(scanData, login, scanId); CommonActionsInstance.getInstance().ShowReportView(); } CommonActionsInstance.getInstance().ClearScanProgressView(); CommonActionsInstance.getInstance().CloseScanProgressView(); } catch (Exception err) { Logger.Create().Error(err); LoginHelper.DoLogout(); } }); } } catch (Exception ex) { TopMostMessageBox.Show(ex.Message, "Error"); Logger.Create().Error(ex.ToString()); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); ScanCommand.Initialize(this); BindCommand.Initialize(this); ShowStoredResultsCommand.Initialize(this); RetrieveResultsCommand.Initialize(this); IncrementalScanCommand.Initialize(this); Connect connect = new Connect(); connect.OnConnection(GetDTE()); CommonActions ca = CommonActionsInstance.getInstance(); ca.ApplicationObject = GetDTE(); }
private bool setBindProject(bool isBound) { LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(false); } foreach (LoginData.BindProject project in login.BindedProjects) { if (selectedProject.RootPath == project.RootPath && selectedProject.ProjectName == project.ProjectName) { project.IsBound = isBound; } } LoginHelper.Save(login); return(true); }
public ActionStatus Act() { if (PerspectiveHelper.LoginToServer() == null) { return(ActionStatus.Failed); } LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(ActionStatus.Failed); } CommonData.ProjectName = selectedProject.ProjectName; CommonData.ProjectRootPath = selectedProject.RootPath; if (login != null && login.BindedProjects != null) { LoginData.BindProject bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp) { return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath); } ); if (bindPro != null) { CommonData.ProjectId = bindPro.BindedProjectId; CommonData.SelectedScanId = bindPro.SelectedScanId; CommonData.IsProjectBound = bindPro.IsBound; CommonData.IsProjectPublic = bindPro.IsPublic; } else { CommonData.IsProjectBound = false; } } CommonActionsInstance.getInstance().BuildFileMapping(); CommonActionsInstance.getInstance().ExecuteSystemCommand("File.SaveAll", string.Empty); DoScan(selectedProject); CommonData.IsWorkingOffline = false; return(ActionStatus.Success); }
public ActionStatus Act() { if (PerspectiveHelper.LoginToServer() == null) { return(ActionStatus.Failed); } LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(ActionStatus.Failed); } LoginData.BindProject bindPro = null; if (login != null && login.BindedProjects != null) { bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp) { return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath && bp.IsBound == true); } ); if (bindPro != null) { CommonData.ProjectId = bindPro.BindedProjectId; CommonData.ProjectName = selectedProject.ProjectName; CommonData.ProjectRootPath = selectedProject.RootPath; } else { return(ActionStatus.Failed); } } RetrieveResultsFromServer(bindPro, login); return(ActionStatus.Success); }
public CommandStatus GetStatus() { LoginData login = LoginHelper.LoadSaved(); Entities.Project selectedProject = CommonActionsInstance.getInstance().GetSelectedProject(); if (selectedProject == null) { return(CommandStatus.CommandStatusNull); } if (login != null && login.BindedProjects != null) { LoginData.BindProject bindPro = login.BindedProjects.Find(delegate(LoginData.BindProject bp) { return(bp.ProjectName == selectedProject.ProjectName && bp.RootPath == selectedProject.RootPath); }); if (bindPro != null) { return((CommandStatus)CommandStatus.CommandStatusSupported | CommandStatus.CommandStatusEnabled); } } return((CommandStatus)CommandStatus.CommandStatusSupported); }
/// <summary> /// Execute scan /// </summary> /// <param name="project">Upload project folder</param> /// <param name="scanData"></param> /// <param name="scanId"></param> /// <returns></returns> private ProjectScanStatuses ExecuteScan(Project project, ref CxWSQueryVulnerabilityData[] scanData, ref long scanId) { Logger.Create().Debug("DoScan in"); bool bCancel = false; bool backgroundMode = _scan.LoginResult.AuthenticationData.IsRunScanInBackground == SimpleDecision.Yes; if (_dispatcher == null) { _dispatcher = ServiceLocators.ServiceLocator.GetDispatcher(); } if (_dispatcher != null) { IScanView view = null; var waitEnd = new ManualResetEvent(false); //if was selected "always run in background" checkbox - hide dialog if (!backgroundMode) { ICommandResult commandResult = _dispatcher.Dispatch(_scan); view = ((ScanPresenter)commandResult).View; } _scan.ScanView = view; BackgroundWorkerHelper bg = new BackgroundWorkerHelper(_scan.LoginResult.AuthenticationData.ReconnectInterval * 1000, _scan.LoginResult.AuthenticationData.ReconnectCount); CxWebServiceClient client = new CxWebServiceClient(_scan.LoginResult.AuthenticationData); client.ServiceClient.Timeout = 1800000; bool isIISStoped = false; bool isScanningEror = false; //User click cancel while info dialog was showed if (!bCancel) { ShowScanProgressBar(); ConfigurationResult configuration = _configurationHelper.GetConfigurationList(_scan.LoginResult.SessionId, bg, client); if (configuration == null) { _cancelPressed = true; } if (!configuration.IsSuccesfull) { LoginHelper.DoLogout(); if (client != null) { client.Close(); } if (view != null) { view.CloseView(); } _scan.InProcess = false; return(ProjectScanStatuses.CanceledByUser); } //User click cancel while info dialog was showed if (!bCancel) { byte[] zippedProject = ZipProject(_scan, project, bg); if (!_scan.IsCancelPressed && zippedProject != null) { if (configuration.Configurations.Count > 0) { RunScanResult runScanResult = null; if (!CommonData.IsProjectBound) { if (_uploadSettings.IsPublic) { _scan.IsPublic = SetScanPrivacy(); } runScanResult = RunScan(bg, client, configuration, zippedProject); } else { if (_scan.UploadSettings.IsPublic) { _scan.IsPublic = SetScanPrivacy(); } runScanResult = RunBoundedProjectScan(_scan, bg, client, zippedProject); } if (runScanResult == null || !runScanResult.IsSuccesfull) { bCancel = true; isIISStoped = true; isScanningEror = true; } // Continue if project uploaded succesfull and cancel button while process wasn't pressed if (runScanResult != null && runScanResult.IsSuccesfull) { _scan.RunScanResult = runScanResult; //perform scan work in separated thread to improve UI responsibility System.Threading.ThreadPool.QueueUserWorkItem(delegate(object stateInfo) { try { // Wait while scan operation complete while (true) { StatusScanResult statusScan = UpdateScanStatus(ref bCancel, backgroundMode, view, bg, client, ref isIISStoped); // if scan complete with sucess or failure or cancel button was pressed // operation complete bCancel = bCancel ? bCancel : _scan.WaitForCancel(); if (isIISStoped || bCancel || (statusScan != null && statusScan.RunStatus == CurrentStatusEnum.Finished) || (statusScan != null && statusScan.RunStatus == CurrentStatusEnum.Failed)) { break; } } waitEnd.Set(); } catch (Exception err) { Logger.Create().Error(err.ToString()); // show error waitEnd.Set(); isIISStoped = true; Logger.Create().Debug(err); } if (_scan.ScanView == null || _scan.ScanView.Visibility == false) { var scanStatusBar = new ScanStatusBar(false, "", 0, 0, true); CommonActionsInstance.getInstance().UpdateScanProgress(scanStatusBar); //ObserversManager.Instance.Publish(typeof (ScanStatusBar), scanStatusBar); } }); while (!waitEnd.WaitOne(0, false)) { Application.DoEvents(); Thread.Sleep(10); } } } #region [Scan completed. Open perspective] if (!bCancel && !isIISStoped) { ShowScanData(ref scanData, ref scanId, client); } else { #region [Stop scan in cancel pressed] if (_scan.RunScanResult != null && !isIISStoped) { bg.DoWorkFunc = delegate { if (!isIISStoped) { client.ServiceClient.CancelScan(_scan.LoginResult.SessionId, _scan.RunScanResult.ScanId); } }; bg.DoWork("Stop scan..."); } #endregion } #endregion client.Close(); } else { client.Close(); bCancel = true; } } else { } } else { } if (!backgroundMode && view != null) { view.CloseView(); } if (isIISStoped) { if (isScanningEror) { return(ProjectScanStatuses.Error); } else { return(ProjectScanStatuses.CanceledByUser); } } if (!bCancel) { return(ProjectScanStatuses.Success); } else { if (isScanningEror) { return(ProjectScanStatuses.Error); } else { return(ProjectScanStatuses.CanceledByUser); } } } return(ProjectScanStatuses.CanceledByUser); }
/// <summary> /// Execute 'Show Stored' command /// </summary> /// <param name="queries"></param> /// <param name="login"></param> /// <param name="scanId"></param> public static void ShowStored(CxWSQueryVulnerabilityData[] queries, LoginData login, long scanId) { Dictionary <ReportQuerySeverityType, List <CxWSQueryVulnerabilityData> > queriesGroups = new Dictionary <ReportQuerySeverityType, List <CxWSQueryVulnerabilityData> >(); List <CxWSQueryVulnerabilityData> sev0 = new List <CxWSQueryVulnerabilityData>(); List <CxWSQueryVulnerabilityData> sev1 = new List <CxWSQueryVulnerabilityData>(); List <CxWSQueryVulnerabilityData> sev2 = new List <CxWSQueryVulnerabilityData>(); List <CxWSQueryVulnerabilityData> sev3 = new List <CxWSQueryVulnerabilityData>(); for (int i = 0; i < queries.Length; i++) { CxWSQueryVulnerabilityData cur = queries[i]; switch (cur.Severity) { case 0: sev0.Add(cur); break; case 1: sev1.Add(cur); break; case 2: sev2.Add(cur); break; case 3: sev3.Add(cur); break; } } if (sev3.Count > 0) { queriesGroups.Add(ReportQuerySeverityType.High, sev3); } if (sev2.Count > 0) { queriesGroups.Add(ReportQuerySeverityType.Medium, sev2); } if (sev1.Count > 0) { queriesGroups.Add(ReportQuerySeverityType.Low, sev1); } if (sev0.Count > 0) { queriesGroups.Add(ReportQuerySeverityType.Information, sev0); } Dictionary <ReportQuerySeverityType, List <ReportQueryResult> > tree = new Dictionary <ReportQuerySeverityType, List <ReportQueryResult> >(); foreach (var queryGroup in queriesGroups) { List <ReportQueryResult> list = new List <ReportQueryResult>(); for (int i = 0; i < queryGroup.Value.Count; i++) { CxWSQueryVulnerabilityData query = queryGroup.Value[i]; ReportQueryResult queryResult = new ReportQueryResult() { CweId = (int)query.CWE, Group = query.GroupName, Id = (int)query.QueryId, Name = query.QueryName, Paths = null, Report = null, Severity = (ReportQuerySeverityType)query.Severity, AmountOfResults = query.AmountOfResults, ScanId = scanId, QueryVersionCode = query.QueryVersionCode }; list.Add(queryResult); } tree.Add(queryGroup.Key, list); } ReportResult report = new ReportResult(); report.Tree = tree; var reportWinObject = CommonActionsInstance.getInstance().ReportPersepectiveView; reportWinObject.Report = report; reportWinObject.BindData(); }
/// <summary> /// Execute scan /// </summary> /// <param name="project">Upload project folder</param> /// <param name="isIncremental"></param> /// <param name="scanData"></param> /// <param name="scanId"></param> /// <returns></returns> public ProjectScanStatuses DoScan(Project project, bool isIncremental, ref CxWSQueryVulnerabilityData[] scanData, ref long scanId) { if (_scan != null && _scan.InProcess) { return(ProjectScanStatuses.CanceledByUser); } LoginResult loginResult = new LoginResult(); try { //Release old view data CommonActionsInstance.getInstance().ClearScanProgressView(); LoginData logindata = LoginHelper.LoadSaved(); OidcLoginData oidcLoginData = OidcLoginData.GetOidcLoginDataInstance(); //Execute login if (oidcLoginData.AccessToken == null) { loginResult = Login(); if (loginResult == null || loginResult.AuthenticationData == null) { LoginHelper.ShowLoginErrorMessage(loginResult); return(ProjectScanStatuses.Error); } } else { loginResult.AuthenticationData = logindata; loginResult.IsSuccesfull = true; } if (_cancelPressed) { return(ProjectScanStatuses.CanceledByUser); } if (loginResult.IsSuccesfull) { _scan = new Scan(loginResult, onScanInBackground, onCancel, onDetails) { InProcess = true, DockView = CommonActionsInstance.getInstance().ScanProgressView, ScanProject = project, IsIncremental = isIncremental }; //Execute setting upload project properties _uploadSettings = GetUploadSettings(project, loginResult); if (_uploadSettings == null || _cancelPressed) { return(ProjectScanStatuses.CanceledByUser); } if (_uploadSettings.IsUploading) { _scan.UploadSettings = _uploadSettings; return(ExecuteScan(project, ref scanData, ref scanId)); } } else if (!_cancelPressed) { TopMostMessageBox.Show("Unable to connect to server or user creadentials are invalid. Please verify data", "Log in problem"); return(ProjectScanStatuses.Error); } } finally { if (_scan != null) { _scan.InProcess = false; } } return(ProjectScanStatuses.CanceledByUser); }
/// <summary> /// Execute 'Previous Result' command /// </summary> public static void DoPrevResult() { Logger.Create().Debug("DoPrevResult in"); // Get logged user credentials and project relation data LoginData login = Helpers.LoginHelper.Load(0); CxWSQueryVulnerabilityData[] perspective = null; login.IsOpenPerspective = Entities.Enum.SimpleDecision.Yes; LoginData.BindProject bindProject = login.BindedProjects.Find(delegate(LoginData.BindProject bp) { return(bp.BindedProjectId == CommonData.ProjectId && bp.ProjectName == CommonData.ProjectName && bp.RootPath == CommonData.ProjectRootPath); } ); if (bindProject != null && bindProject.ScanReports != null && bindProject.ScanReports.Count > 0) { ScanReportInfo tmp = bindProject.ScanReports.Find(delegate(ScanReportInfo sri) { return(sri.Id == CommonData.SelectedScanId); } ); if (tmp == null || tmp.Id == 0) { tmp = bindProject.ScanReports[0]; CommonData.SelectedScanId = tmp.Id; } perspective = GetScanResultsPath(tmp.Id); bindProject.SelectedScanId = tmp.Id; if (!string.IsNullOrEmpty(tmp.Path)) { StorageHelper.Delete(tmp.Path); } BackgroundWorkerHelper bgWork = new BackgroundWorkerHelper(delegate { tmp.Path = PerspectiveHelper.GetScanXML(CommonData.SelectedScanId); LoginHelper.Save(login); }); bgWork.DoWork(); Dictionary <string, long> list = new Dictionary <string, long>(); foreach (ScanReportInfo item in bindProject.ScanReports) { if (!list.ContainsKey(item.Name)) { list.Add(item.Name, item.Id); } } CommonActionsInstance.getInstance().ReportPersepectiveView.SetScanList(list, tmp.Id); if (perspective != null) { ShowStored(perspective, login, tmp.Id); } } }
private StatusScanResult UpdateScanStatus(ref bool bCancel, bool backgroundMode, IScanView view, BackgroundWorkerHelper bg, CxWebServiceClient client, ref bool isIISStoped) { // Get current scan status CxWSResponseScanStatus cxWSResponseScanStatus = null; StatusScanResult statusScan = null; bg.DoWorkFunc = delegate(object obj) { cxWSResponseScanStatus = client.ServiceClient.GetStatusOfSingleScan(_scan.LoginResult.SessionId, _scan.RunScanResult.ScanId); statusScan = new StatusScanResult(); statusScan.CurrentStage = cxWSResponseScanStatus.CurrentStage; statusScan.CurrentStagePercent = cxWSResponseScanStatus.CurrentStagePercent; statusScan.Details = cxWSResponseScanStatus.StepDetails; statusScan.IsSuccesfull = cxWSResponseScanStatus.IsSuccesfull; statusScan.QueuePosition = cxWSResponseScanStatus.QueuePosition; statusScan.RunId = cxWSResponseScanStatus.RunId; statusScan.RunStatus = cxWSResponseScanStatus.CurrentStatus; statusScan.StageMessage = cxWSResponseScanStatus.StageMessage; statusScan.StageName = cxWSResponseScanStatus.StageName; statusScan.StepMessage = cxWSResponseScanStatus.StepMessage; statusScan.TimeFinished = cxWSResponseScanStatus.TimeFinished != null?cxWSResponseScanStatus.TimeFinished.ToString() : null; statusScan.TimeStarted = cxWSResponseScanStatus.TimeScheduled != null?cxWSResponseScanStatus.TimeScheduled.ToString() : null; statusScan.TotalPercent = cxWSResponseScanStatus.TotalPercent; }; bCancel = !bg.DoWork(null); if (!BackgroundWorkerHelper.IsReloginInvoked) { isIISStoped = !_scan.LoginResult.AuthenticationData.SaveSastScan; } else { BackgroundWorkerHelper.IsReloginInvoked = false; } if (!bCancel && cxWSResponseScanStatus != null && !isIISStoped) { ScanProgress progress = new ScanProgress( _scan.UploadSettings.ProjectName, statusScan.RunStatus.ToString(), statusScan.StageName, statusScan.StepMessage, statusScan.CurrentStagePercent, 0, 100, statusScan.TotalPercent); if (!backgroundMode) { view.Progress = progress; } try { CommonActionsInstance.getInstance().ScanProgressView.Progress = progress; } catch (Exception ex) { Logger.Create().Error(ex.ToString()); } if (statusScan.RunStatus == CurrentStatusEnum.Failed) { TopMostMessageBox.Show(statusScan.StageMessage, "Scan Error"); bCancel = true; } if (_scan.ScanView == null || _scan.ScanView.Visibility == false) { var scanStatusBar = new ScanStatusBar(true, string.Format("Scaning project {0}: {1} {2}", _scan.UploadSettings.ProjectName, statusScan.StepMessage, statusScan.RunStatus), statusScan.TotalPercent, 100); CommonActionsInstance.getInstance().UpdateScanProgress(scanStatusBar); } } return(statusScan); }