Пример #1
0
        public ParseResult ParseProjectFiles()
        {
            IEnumerable<string> files = Directory.GetFiles(ProjectPath, "*", SearchOption.AllDirectories)
                                                 .Where(file => PHPSettings.PHPFileExtensions.Contains(Path.GetExtension(file)))
                                                 .Select(file => file.Replace(@"\\", @"\"));

            var result = new ParseResult();

            var phpFileParser = new FileParser(PHPSettings.PHPParserPath);

            var progrssIndicator = ProgressIndicatorFactory.CreateProgressIndicator(files.Count());

            foreach (var file in files)
            {
                progrssIndicator.Step();
                try
                {
                    XmlDocument parseResult = phpFileParser.ParsePHPFile(file);
                    result.ParsedFiles.Add(file, parseResult);
                }
                catch (XmlException)
                {
                    result.FilesThatFailedToParse.Add(file);
                }
            }
            return result;
        }
Пример #2
0
 private static ParseResult ParseFile(Config configuration, Arguments arguments)
 {
     var fileParser = new FileParser (configuration.PHPSettings.PHPParserPath);
     var result = fileParser.ParsePHPFile (arguments.Target);
     var parseResult = new ParseResult ();
     parseResult.ParsedFiles.Add (arguments.Target, result);
     return parseResult;
 }