Esempio n. 1
0
 private static ParseResult ParseDirectoryFiles(Config configuration, Arguments arguments)
 {
     var projectParser = new ProjectParser (arguments.Target, configuration.PHPSettings);
     ParseResult parseResult = projectParser.ParseProjectFiles ();
     return parseResult;
 }
Esempio n. 2
0
        private static void WPGotoAnalysis(Arguments arguments, Config configuration)
        {
            var v = Stopwatch.StartNew();
            var folders = Directory.GetDirectories(@"G:\WP");
            int counter = 0;

            var progress = new BikeGuyRidingAnimation(folders.Count());

            var locker = new object();

            Parallel.ForEach(folders, new ParallelOptions() { MaxDegreeOfParallelism = 7 },
                folder =>
                {
                    int myNumber = Interlocked.Increment(ref counter);
                    arguments.Target = Path.Combine(arguments.Target, folder);
                    if (!Directory.Exists(arguments.Target))
                        return;

                    var projectParser = new ProjectParser(arguments.Target, configuration.PHPSettings);
                    ParseResult parseResult = projectParser.ParseProjectFiles();

                    foreach (var parsedFile in parseResult.ParsedFiles)
                    {
                        //Console.WriteLine("File: " + parsedFile.Key);
                        var traverser = new XmlTraverser();
                        var metricVisitor = new MetricVisitor();
                        traverser.AddVisitor(metricVisitor);
                        traverser.Traverse(parsedFile.Value);

                        if (metricVisitor.Gotos > 0)
                        {
                            lock (locker)
                            {
                                System.IO.File.AppendAllLines(@"C:/pluginDLMessages.txt", new [] { "Goto found in " + parsedFile.Key});
                            }
                        }
                    }

                    //Console.WriteLine(folder);

                    if ((myNumber % 250) == 0)
                    {
                        Console.WriteLine(myNumber + " plugins scanned..");
                    }
                });
            Console.WriteLine(v.Elapsed);
            Environment.Exit(1);
        }