Пример #1
0
        public void OnAssembly(object sender, RunnerEventArgs e)
        {
            // If the assembly defines ThreadModelAttribute then we need to
            // check all of the methods within it.
            foreach (ModuleDefinition module in e.CurrentAssembly.Modules)
            {
                if (LookForThreadModelAttribute(module.GetAllTypes()))
                {
                    Log.WriteLine(this, "assembly defines ThreadModelAttribute");
                    Active = true;
                    return;
                }
                else if (LookForThreadModelAttribute(module.GetTypeReferences()))
                {
                    Log.WriteLine(this, "assembly references ThreadModelAttribute");
                    Active = true;
                    return;
                }
            }

            // If the assembly does not define ThreadModelAttribute then we don't
            // want to check methods but we do want to report (one) defect to inform
            // people about the rule.
            Active = false;

            if (!displayed_no_attribute_defect)
            {
                string mesg = "The assembly does not use ThreadModelAttribute (this defect will be reported only once).";
                Log.WriteLine(this, mesg);
                ReportDefect(e.CurrentAssembly, Severity.Medium, Confidence.Low, mesg);

                displayed_no_attribute_defect = true;
            }
        }
 /// <summary>
 /// Update UI before analyzing an assembly.
 /// </summary>
 /// <param name="e">RunnerEventArgs that contains the Assembly being analyzed and the Runner</param>
 internal void PreAssemblyUpdate(RunnerEventArgs e)
 {
     progress_bar.Value        = counter++;
     analyze_status_label.Text = String.Format(CultureInfo.CurrentCulture,
                                               "Processing assembly {0} of {1}",
                                               counter, e.Runner.Assemblies.Count);
     analyze_assembly_label.Text = "Assembly: " + e.CurrentAssembly.Name.FullName;
 }
Пример #3
0
        protected override void OnAssembly(RunnerEventArgs e)
        {
            if (!quiet)
            {
                if (local.IsRunning)
                {
                    local.Stop();
                    Console.WriteLine(": {0}", TimeToString(local.Elapsed));
                    local.Reset();
                }

                // next assembly
                Console.Write(Path.GetFileName(e.CurrentAssembly.MainModule.FullyQualifiedName));
                local.Start();
            }

            base.OnAssembly(e);
        }
 /// <summary>
 /// Update UI after analyzing an assembly.
 /// </summary>
 /// <param name="e">RunnerEventArgs that contains the Assembly being analyzed and the Runner</param>
 internal void PostTypeUpdate(RunnerEventArgs e)
 {
     analyze_defect_label.Text = String.Format(CultureInfo.CurrentCulture,
                                               "Defects Found: {0}", e.Runner.Defects.Count);
 }
Пример #5
0
 // rule suggest HierarchicalEventArgs but we can't change the event definition
 public void OnAssembly(object sender, RunnerEventArgs e)
 {
     Console.WriteLine(e.CurrentAssembly);
 }
Пример #6
0
 protected override void OnType(RunnerEventArgs e)
 {
     base.OnType(e);
 }
Пример #7
0
 protected override void OnMethod(RunnerEventArgs e)
 {
     base.OnMethod(e);
 }
Пример #8
0
 protected override void OnAssembly(RunnerEventArgs e)
 {
     base.OnAssembly(e);
 }
Пример #9
0
 protected override void OnType(RunnerEventArgs e)
 {
     base.OnType(e);
     wizard.BeginInvoke((Action)(() => wizard.PostTypeUpdate(e)));
 }
Пример #10
0
 protected override void OnAssembly(RunnerEventArgs e)
 {
     // update wizard UI on the main, i.e. UI, thread
     wizard.BeginInvoke((Action)(() => wizard.PreAssemblyUpdate(e)));
     base.OnAssembly(e);
 }