public override void EvaluateNode(OTreeNode node) { MethodInfo m = (MethodInfo)node.Definition; if (m.GetMethodBody() != null) { foreach (LocalVariableInfo i in m.GetMethodBody().LocalVariables) { if (!i.LocalType.IsGenericParameter && !i.LocalType.IsGenericType) { if (i.LocalType.IsArray) { if (i.LocalType.GetElementType().IsGenericParameter || i.LocalType.GetElementType().IsGenericType) { continue; } } if (i.LocalType.IsInterface) { #if DebugWarnings Log.WriteLine("Warning: " + NameBuilder.BuildMethodName(m) + " Uses an interface"); #endif if (node.SelectedImageIndex != Constants.ErrorIcon) { node.SelectedImageIndex = Constants.WarningIcon; node.ImageIndex = Constants.WarningIcon; } node.Warnings.Add(this); return; } } } } }
public override void EvaluateNode(OTreeNode node) { MethodInfo m = (MethodInfo)node.Definition; if ((m.Attributes & MethodAttributes.PinvokeImpl) != 0) { #if DebugErrors Log.WriteLine(NameBuilder.BuildMethodName(m) + " ~ PInvoke Impl"); #endif node.SelectedImageIndex = Constants.ErrorIcon; node.ImageIndex = Constants.ErrorIcon; node.Errors.Add(this); } }
public override void EvaluateNode(OTreeNode node) { MethodInfo m = (MethodInfo)node.Definition; MethodImplAttributes xImplFlags = m.GetMethodImplementationFlags(); if ((xImplFlags & MethodImplAttributes.Unmanaged) != 0) { #if DebugErrors Log.WriteLine(NameBuilder.BuildMethodName(m) + " ~ Method Implementation: Unmanaged"); #endif node.SelectedImageIndex = Constants.ErrorIcon; node.ImageIndex = Constants.ErrorIcon; node.Errors.Add(this); } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { OTreeNode n = (OTreeNode)e.Node; n.ShowNodeInfo(Rtb); bool hErr = false; bool hWarn = false; int ErrSelStart = 0; int WarnSelStart = 0; if (n.Errors.Count > 0) { ErrSelStart = Rtb.Text.Length - 1; foreach (Errors.BaseError er in n.Errors) { Rtb.Text += er.Name + ": " + er.Description + "\r\n"; } hErr = true; } if (n.Warnings.Count > 0) { WarnSelStart = Rtb.Text.Length - 1; foreach (Warnings.BaseWarning b in n.Warnings) { Rtb.Text += b.Name + ": " + b.Description + "\r\n"; } hWarn = true; } if (hErr) { Rtb.SelectionStart = ErrSelStart; Rtb.SelectionLength = Rtb.Text.Length - Rtb.SelectionStart; Rtb.SelectionColor = System.Drawing.Color.FromArgb(0xff, 0x00, 0x00); Rtb.SelectionLength = 0; } if (hWarn) { Rtb.SelectionStart = WarnSelStart; Rtb.SelectionLength = Rtb.Text.Length - Rtb.SelectionStart; Rtb.SelectionColor = System.Drawing.Color.FromArgb(0xff, 0x99, 0x00); Rtb.SelectionLength = 0; } }
public int Compare(TreeNode x, TreeNode y) { OTreeNode ox = (OTreeNode)x; OTreeNode oy = (OTreeNode)y; if (ox.Type == TreeNodeType.Assembly && oy.Type == TreeNodeType.Assembly) { return(0); } else if (ox.Type == TreeNodeType.Namespace && oy.Type == TreeNodeType.Namespace) { return(sc.Compare(ox.Text, oy.Text)); } else if (ox.Type == TreeNodeType.Module && oy.Type == TreeNodeType.Module) { return(sc.Compare(ox.Text, oy.Text)); } else { int xVal, yVal; #region Setup x if (ox.Type == TreeNodeType.Field) { xVal = 10; } else if (ox.Type == TreeNodeType.Event) { xVal = 20; } else if (ox.Type == TreeNodeType.Property) { xVal = 30; } else if (ox.Type == TreeNodeType.Method) { xVal = 40; } else if (ox.Type == TreeNodeType.Class) { xVal = 50; } else if (ox.Type == TreeNodeType.Namespace) { xVal = 60; } else if (ox.Type == TreeNodeType.Module) { xVal = 70; } else if (ox.Type == TreeNodeType.Assembly) { xVal = 80; } else { xVal = 90; } #endregion #region Setup y if (oy.Type == TreeNodeType.Field) { yVal = 10; } else if (oy.Type == TreeNodeType.Event) { yVal = 20; } else if (oy.Type == TreeNodeType.Property) { yVal = 30; } else if (oy.Type == TreeNodeType.Method) { yVal = 40; } else if (oy.Type == TreeNodeType.Class) { yVal = 50; } else if (oy.Type == TreeNodeType.Namespace) { yVal = 60; } else if (oy.Type == TreeNodeType.Module) { yVal = 70; } else if (oy.Type == TreeNodeType.Assembly) { yVal = 80; } else { yVal = 90; } #endregion if (xVal == yVal) { return(sc.Compare(ox.Text, oy.Text)); } else { return(xVal > yVal ? -1 : 1); } } }
/// <summary> /// Evaluate the given node. /// </summary> /// <param name="node">The node to evaluate.</param> public abstract void EvaluateNode(OTreeNode node);