// Constructor
        public ErrorCheckForm()
        {
            // Initialize
            InitializeComponent();

            // Find all error checkers
            Type[] checkertypes = BuilderPlug.Me.FindClasses(typeof(ErrorChecker));
            foreach (Type t in checkertypes)
            {
                object[] attr = t.GetCustomAttributes(typeof(ErrorCheckerAttribute), true);
                if (attr.Length > 0)
                {
                    //mxd. Skip this check?..
                    ErrorChecker checker;

                    try
                    {
                        // Create instance
                        checker = (ErrorChecker)Assembly.GetExecutingAssembly().CreateInstance(t.FullName, false, BindingFlags.Default, null, null, CultureInfo.CurrentCulture, new object[0]);
                    }
                    catch (TargetInvocationException ex)
                    {
                        // Error!
                        General.ErrorLogger.Add(ErrorType.Error, "Failed to create class instance \"" + t.Name + "\"");
                        General.WriteLogLine(ex.InnerException.GetType().Name + ": " + ex.InnerException.Message);
                        throw;
                    }
                    catch (Exception ex)
                    {
                        // Error!
                        General.ErrorLogger.Add(ErrorType.Error, "Failed to create class instance \"" + t.Name + "\"");
                        General.WriteLogLine(ex.GetType().Name + ": " + ex.Message);
                        throw;
                    }

                    if (checker.SkipCheck)
                    {
                        continue;
                    }

                    ErrorCheckerAttribute checkerattr = (attr[0] as ErrorCheckerAttribute);

                    // Add the type to the checkbox list
                    CheckBox c = checks.Add(checkerattr.DisplayName, t);
                    c.Checked = checkerattr.DefaultChecked;
                }
            }
            checks.Sort();             //mxd

            //mxd. Store initial height
            initialsize        = this.Size;
            resultslist        = new List <ErrorResult>();
            hiddentresulttypes = new List <Type>();
        }
Exemple #2
0
        // Constructor
        public ErrorCheckForm()
        {
            // Initialize
            InitializeComponent();

            // Find all error checkers
            Type[] checkertypes = BuilderPlug.Me.FindClasses(typeof(ErrorChecker));
            foreach (Type t in checkertypes)
            {
                object[] attr = t.GetCustomAttributes(typeof(ErrorCheckerAttribute), true);
                if (attr.Length > 0)
                {
                    ErrorCheckerAttribute checkerattr = (attr[0] as ErrorCheckerAttribute);

                    // Add the type to the checkbox list
                    CheckBox c = checks.Add(checkerattr.DisplayName, t);
                    c.Checked = checkerattr.DefaultChecked;
                }
            }
        }
Exemple #3
0
 // Constructor
 // Override this to determine and set the total progress
 public ErrorChecker()
 {
     // Initialize
     object[] attrs = this.GetType().GetCustomAttributes(typeof(ErrorCheckerAttribute), true);
     attribs = (ErrorCheckerAttribute)attrs[0];
 }