Example #1
0
        private void ProcessSourceFile(ProcessPath process, ScanResult result)
        {
            ScannedSourceFile sourceFile = null;
            string            fileKey    = ScannedSourceFile.CalculateKey(process.Path, process.Properties);

            if (!result.SourceFiles.TryGetValue(fileKey, out sourceFile) && !result.UnknownFiles.Contains(process.Path))
            {
                try
                {
                    sourceFile = new ScannedSourceFile(process.Path, process.Properties);
                    if (this.AddSymbols(result, sourceFile))
                    {
                        result.SourceFiles.Add(sourceFile.Key, sourceFile);
                    }
                    else
                    {
                        result.UnknownFiles.Add(process.Path);
                    }
                }
                catch (Exception e)
                {
                    this.OnMessage(ScannerMessageType.Warning, "Skipping non-XML file: {0} - reason: {1}", process.Path, e.Message);
                    result.UnknownFiles.Add(process.Path);
                }
            }

            if (sourceFile != null && process.Project != null)
            {
                process.Project.SourceFiles.Add(sourceFile);
                sourceFile.SourceProjects.Add(process.Project);
                //result.ProjectToSourceFileReferences.Add(new ScannedProjectSourceFileReference() { SourceProject = process.Project, TargetSourceFile = sourceFile });
            }
        }
Example #2
0
        public ScannedSourceFile(string path, IDictionary <string, string> preprocessorDefines)
        {
            StringBuilder keyBuilder = new StringBuilder();

            keyBuilder.Append(path.ToLowerInvariant());

            this.Path = path;

            this.PreprocessorDefines = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            if (null != preprocessorDefines)
            {
                foreach (KeyValuePair <string, string> kvp in preprocessorDefines)
                {
                    this.PreprocessorDefines.Add(kvp.Key, kvp.Value);
                }
            }

            this.Key            = ScannedSourceFile.CalculateKey(this.Path, this.PreprocessorDefines);
            this.SourceProjects = new List <ScannedProject>();
            this.TargetSymbols  = new List <ScannedSymbol>();
        }