Exemplo n.º 1
0
        private void RunAnalysis(Lifetime lifetime, ISolution solution)
        {
            Console.WriteLine("Starting analysis... ({0})", DateTime.Now);

            using (var wa = new WritingArchive(_zipName))
            {
                var countWithMethods       = 0;
                Action <Context> cbContext = ctx =>
                {
                    _logger.Info("\t> {0}".FormatEx(ctx.SST.EnclosingType));
                    // ReSharper disable once AccessToDisposedClosure
                    wa.Add(ctx);
                    if (ctx.SST.Methods.Count > 0)
                    {
                        countWithMethods++;
                    }
                };

                new ContextSolutionAnalysis(solution, _logger, cbContext).AnalyzeAllProjects();

                _logger.EndPossibleErrorBlock();

                Console.WriteLine("Analysis finished! ({0})", DateTime.Now);
                Console.WriteLine(
                    "found {0} context(s), {1} contain(s) method declarations",
                    wa.NumItemsAdded,
                    countWithMethods);
            }
        }
        private void RunAnalysis(Lifetime lifetime, ISolution solution)
        {
            try
            {
                Console.WriteLine("Starting analysis... ({0})", DateTime.Now);

                new TypeShapeSolutionAnalysis(solution, _logger, Add).AnalyzeAllProjects();
            }
            finally
            {
                foreach (var writingArchive in _writingArchives)
                {
                    writingArchive.Value.Dispose();
                }
            }

            _logger.EndPossibleErrorBlock();

            Console.WriteLine("Analysis finished! ({0})", DateTime.Now);
            Console.WriteLine(
                "Generated {0} Assembly Zips, {1} additional ones already existed",
                _writingArchives.Count,
                _existingAssemblies.Count);
        }