ABB.SrcML.SrcMLGenerator.GenerateSrcMLFromDirectory C# (CSharp) Method

GenerateSrcMLFromDirectory() public method

Generate a SrcML document from the given path and place it in the XML file. The file will only contain source files classified as languageFilter.
public GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude, System.Language languageFilter ) : void
directoryPath string The directory path.
xmlFileName string The path of the xml file.
filesToExclude IEnumerable A collection of files to exclude from .
languageFilter System.Language The language to include.
return void
        public void GenerateSrcMLFromDirectory(string directoryPath, string xmlFileName, IEnumerable<string> filesToExclude, Language languageFilter) {
            if(!Directory.Exists(directoryPath)) {
                throw new DirectoryNotFoundException(String.Format("{0} does not exist.", directoryPath));
            }

            var dir = new DirectoryInfo(directoryPath);
            var fileObjectsToExclude = from f in filesToExclude
                                       select new FileInfo(f);
            var files = (from filePath in dir.GetFiles("*", SearchOption.AllDirectories)
                         where extensionMapping.ContainsKey(filePath.Extension)
                         select filePath).Except(fileObjectsToExclude, new FileInfoComparer());

            IEnumerable<string> reducedFileList;
            if(languageFilter == Language.Any) {
                reducedFileList = from f in files
                                  select f.FullName;
            } else {
                reducedFileList = from f in files
                                  where extensionMapping.ContainsKey(f.Extension) && extensionMapping[f.Extension] == languageFilter
                                  select f.FullName;
            }
            GenerateSrcMLFileFromFiles(reducedFileList, xmlFileName);
        }

Same methods

SrcMLGenerator::GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName ) : void
SrcMLGenerator::GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, IEnumerable filesToExclude ) : void
SrcMLGenerator::GenerateSrcMLFromDirectory ( string directoryPath, string xmlFileName, System.Language languageFilter ) : void