WriteFiles() public method

Write information about scanned files to the log. This information may appear after the results, as the full list of scanned files might not be known until all results have been generated.
public WriteFiles ( FileData>.IDictionary fileDictionary ) : void
fileDictionary FileData>.IDictionary /// A dictionary whose keys are the URIs of scanned files and whose values provide /// information about those files. ///
return void
Exemplo n.º 1
0
        public void Dispose()
        {
            // Disposing the json writer closes the stream but the textwriter
            // still needs to be disposed or closed to write the results
            if (_issueLogJsonWriter != null)
            {
                _issueLogJsonWriter.CloseResults();

                if (_run != null && _run.ConfigurationNotifications != null)
                {
                    _issueLogJsonWriter.WriteConfigurationNotifications(_run.ConfigurationNotifications);
                }

                if (_run != null && _run.ToolNotifications != null)
                {
                    _issueLogJsonWriter.WriteToolNotifications(_run.ToolNotifications);
                }

                if (_run != null &&
                    _run.Invocation != null &&
                    _run.Invocation.StartTime != new DateTime())
                {
                    _run.Invocation.EndTime = DateTime.UtcNow;
                }

                // Note: we write out the backing rules
                // to prevent the property accessor from populating
                // this data with an empty collection.
                if (_rules != null)
                {
                    _issueLogJsonWriter.WriteRules(_rules);
                }

                if (_run != null && _run.Files != null)
                {
                    _issueLogJsonWriter.WriteFiles(_run.Files);
                }

                if (_run != null && _run.Invocation != null)
                {
                    _issueLogJsonWriter.WriteInvocation(invocation: _run.Invocation);
                }

                _issueLogJsonWriter.Dispose();
            }

            if (_textWriter != null)
            {
                _textWriter.Dispose();
            }

            if (_jsonTextWriter == null)
            {
                _jsonTextWriter.Close();
            }

            GC.SuppressFinalize(this);
        }