Esempio n. 1
0
 public static void EvaluateOOMetrics(MetricsContext ctx, ProjectProperties projprop)
 {
     foreach (var cls in projprop.Classes)
     {
         ObjectOrientedMetrics.ClassEvaluateInheritanceTree(ctx, cls.Value);
     }
     foreach (var namesp in projprop.Namespaces)
     {
         foreach (var cls in namesp.Value.Classes)
         {
             ObjectOrientedMetrics.ClassEvaluateInheritanceTree(ctx, cls.Value);
         }
     }
 }
            protected override void InnerRun()
            {
                int counter       = 0;
                int totalProjects = widget.projects.Count;

                try {
                    foreach (ProjectProperties projectprop in widget.projects)
                    {
                        CodeMetricsService.AddTypes(projectprop, widget.ctx);
                    }

                    foreach (ProjectProperties projectprop in widget.projects)
                    {
                        ObjectOrientedMetrics.EvaluateOOMetrics(widget.ctx, projectprop);
                        ComplexityMetrics.EvaluateComplexityMetrics(widget.ctx, projectprop);
                        CodeMetricsService.ProcessInnerTypes(projectprop);

                        Gtk.Application.Invoke(delegate {
                            FillTree(projectprop);
                        });
                        if (base.IsStopping)
                        {
                            return;
                        }
                        lock (lockCounter)
                        {
                            counter++;
                            DispatchService.GuiSyncDispatch(delegate {
                                IdeApp.Workbench.StatusBar.SetProgressFraction(counter / (double)totalProjects);
                            });
                        }
                    }
                } catch (Exception e) {
                    Console.WriteLine("Error : " + e.ToString());
                    base.Stop();
                }


                Gtk.Application.Invoke(delegate {
                    IdeApp.Workbench.StatusBar.ShowMessage("Finished calculating metrics\n");
                    IdeApp.Workbench.StatusBar.EndProgress();
                    widget.textviewReport.Buffer.Text  = GettextCatalog.GetString("Finished calculating metrics\n");
                    widget.textviewReport.Buffer.Text += CodeMetricsService.GenerateAssemblyMetricText();
                });

                base.Stop();
            }