public void AddResult(IScanResult result, string projectFile)
        {
            string fullPath = result.FilePath;
            if (!Path.IsPathRooted(fullPath))
            {
                fullPath = Utilities.AbsolutePathFromRelative(fullPath, Path.GetDirectoryName(projectFile));
            }

            if (result.Scanned)
            {
                foreach (IScanHit hit in result.Results)
                {
                    if (!string.IsNullOrEmpty(hit.Warning))
                    {
                        // See if we've warned about this term before; if so, don't warn again.
                        if (null == _termsWithDuplicateWarning.Find(
                            item => string.Compare(item, hit.Term.Text, StringComparison.OrdinalIgnoreCase) == 0))
                        {
                            _tasks.Add(new Task(hit.Term.Text, hit.Term.Severity, hit.Term.Class, hit.Warning, string.Empty, string.Empty, -1, -1, string.Empty, string.Empty, this, _serviceProvider, _currentProject));
                            _termsWithDuplicateWarning.Add(hit.Term.Text);
                        }
                    }

                    _tasks.Add(new Task(hit.Term.Text, hit.Term.Severity, hit.Term.Class, hit.Term.Comment, hit.Term.RecommendedTerm, fullPath, hit.Line, hit.Column, projectFile, hit.LineText, this, _serviceProvider, _currentProject));
                }
            }
            else
            {
                _tasks.Add(new Task(string.Empty, 1, string.Empty, string.Format(CultureInfo.CurrentUICulture, Resources.FileNotScannedError, fullPath), string.Empty, fullPath, -1, -1, projectFile, string.Empty, this, _serviceProvider, _currentProject));
            }
            Refresh();
        }
        /// <summary>
        /// Appends the results of a single-file scan to this multi-file result.
        /// </summary>
        /// <param name="fileResult">The results of the single-file scan.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if <c>fileResult</c> is null.</exception>
        /// <remarks>
        /// As a result of a successfull call to this method:
        ///   * 'Attempted' will be incremented by one.
        ///   * One of 'PassedScan', 'FailedScan', or 'UnableToScan' will be incremented by one.
        ///   * An entry will be added to 'Results'.
        /// </remarks>
        public void Append(IScanResult fileResult)
        {
            if (fileResult == null)
            {
                throw new ArgumentNullException("fileResult");
            }

            _fileResults.Add(fileResult);
        }
        private void OutputScanResults(IScanResult result)
        {
            if (result.Scanned)
            {
                if (!result.Passed)
                {
                    foreach (IScanHit hit in result.Results)
                    {
                        IIgnoreInstance thisIgnoreInstance = Factory.GetIgnoreInstance(result.FilePath, hit.LineText, hit.Term.Text, hit.Column);

                        if (_ignoreInstancesList.Contains(thisIgnoreInstance))
                            continue;

                        if (hit.Warning != null)
                        {
                            if (!_duplicateTerms.Any(
                                item => string.Compare(item, hit.Term.Text, StringComparison.OrdinalIgnoreCase) == 0))
                            {
                                Log.LogWarning(hit.Warning);
                                _duplicateTerms.Add(hit.Term.Text);
                            }
                        }

                        string outputText;

                        if (hit.Term.RecommendedTerm != null && hit.Term.RecommendedTerm.Length > 0)
                        {
                            outputText = string.Format(CultureInfo.CurrentUICulture, Resources.HitFormatWithReplacement, result.FilePath, hit.Line + 1, hit.Column + 1, hit.Term.Text, hit.Term.Severity, hit.Term.Class, hit.Term.Comment, hit.Term.RecommendedTerm);
                        }
                        else
                        {
                            outputText = string.Format(CultureInfo.CurrentUICulture, Resources.HitFormat, result.FilePath, hit.Line + 1, hit.Column + 1, hit.Term.Text, hit.Term.Severity, hit.Term.Class, hit.Term.Comment);
                        }

                        if (_host != null)
                        {
                            // We're piping the results to the task list, so we don't want to use
                            // LogWarning, which would create an entry in the error list.
                            Log.LogMessage(MessageImportance.High, outputText);
                        }
                        else
                        {
                            Log.LogWarning(outputText);
                        }
                    } // foreach (IScanHit hit in result.Results)
                } // if (!result.Passed)
            } // if (result.Scanned)
            else
            {
                Log.LogWarning(string.Format(CultureInfo.CurrentUICulture, Resources.FileNotScannedError, result.FilePath));
            }

            if (_host != null)
            {
                _host.AddResult(result, Project);
            }
        }
 public void AddResult(IScanResult result, string projectFile)
 {
     Factory.GetTaskProvider().AddResult(result, projectFile);
 }
 void ScanResultRecieved(IScanResult result)
 {
     if (!_stopPending)
     {
         var taskProvider = Factory.GetTaskProvider() as TaskProvider;
         taskProvider.SetCurrentProject(_projectList[_currentProject]);
         Factory.GetTaskProvider().AddResult(result, _projectsToScan[_currentProject].ProjectPath);
         ++_filesProcessed;
         UpdateStatusBar(true, Resources.AppName, _filesProcessed, _totalFiles);
     }
 }