本文整理汇总了C#中NodeInfo.GetAnalysisObject方法的典型用法代码示例。如果您正苦于以下问题:C# NodeInfo.GetAnalysisObject方法的具体用法?C# NodeInfo.GetAnalysisObject怎么用?C# NodeInfo.GetAnalysisObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeInfo
的用法示例。
在下文中一共展示了NodeInfo.GetAnalysisObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewNode
/// <summary>
/// Creates a new nodeInfo that is expandable, and will contain nodeInfo that are added when expanded
/// </summary>
/// <param name="nodeInfo">The nodeInfo info.</param>
/// <returns>The new nodeInfo</returns>
internal virtual TreeNode NewNode(NodeInfo nodeInfo)
{
if (nodeInfo.Lazy && (this is ClassTree))
{
MethodContainer mc = nodeInfo.GetAnalysisObject<MethodContainer>();
if ((mc != null) && mc.Complete)
{
nodeInfo.Lazy = mc.UnhandledExceptions.Count > 0;
}
}
if (nodeInfo.Lazy)
{
this.InvokeIfRequired(() =>
{
// add a dummy nodeInfo to show the '+' next to this one
nodeInfo.Node.Nodes.Add(this.CreateLazyDummyNode());
});
}
return nodeInfo.Node;
}
示例2: CreateSubNodes
/// <summary>Creates the sub nodeInfo.</summary>
/// <param name="nodeInfo">The nodeInfo info.</param>
public TreeNode[] CreateSubNodes(NodeInfo nodeInfo, CancellationToken cancelToken)
{
TreeNode node = new TreeNode();
if (nodeInfo.Type.HasFlag(NodeType.Class))
{
Class cls = nodeInfo.GetAnalysisObject<Class>();
Type type = cls.ClassType;
if (this.Controller.Settings.SeparateBaseClassItem.Value)
{
// add a node for the base class
Type baseType = type.BaseType;
if (baseType != null)
{
Class baseClass = Class.GetClass(baseType);
if (this.ShouldAnalyse(baseClass, type))
{
TreeNode baseClassNode = this.NewNode(Class.GetClass(baseType), NodeType.BaseClass);
node.Nodes.Add(baseClassNode);
}
}
}
// add the nested classes
foreach (Type t in type.GetNestedTypes(Binding))
{
Class c = Class.GetClass(t);
if (this.ShouldAnalyse(c, type))
{
TreeNode classNode = this.NewNode(c, NodeType.Class);
classNode.Nodes.AddRange(this.CreateSubNodes(classNode.GetInfo(), cancelToken));
node.Nodes.Add(classNode);
}
}
HashSet<string> done = new HashSet<string>();
// handle properties first
PropertyInfo[] properties = type.GetProperties(Binding);
foreach (PropertyInfo propInfo in properties)
{
if (!(propInfo.CanRead || propInfo.CanWrite))
{
continue;
}
Property prop = new Property(propInfo);
if (this.ShouldAnalyse(prop, type))
{
string name = (propInfo.DeclaringType == type) ? propInfo.Name : String.Format("{0}.{1}", propInfo.DeclaringType, propInfo.Name);
TreeNode propNode = this.NewNode(prop, NodeType.Property);
propNode.Nodes.Clear();
if (propInfo.CanRead)
{
propNode.Nodes.Add(this.NewNode("get", prop.Get, NodeType.Method));
}
if (propInfo.CanWrite)
{
propNode.Nodes.Add(this.NewNode("set", prop.Set, NodeType.Method));
}
node.Nodes.Add(propNode);
}
}
// do the constructors
ConstructorInfo[] ctors = type.GetConstructors(Binding);
foreach (ConstructorInfo ctor in ctors)
{
Method m = Method.GetMethod(ctor);
if (this.ShouldAnalyse(m, type))
{
node.Nodes.Add(this.NewNode(m, NodeType.Ctor));
}
}
// the rest of the methods
MethodInfo[] methods = type.GetMethods(Binding);
foreach (MethodInfo method in methods)
{
if (method.IsConstructor || method.IsProperty() || method.IsEvent())
{
continue;
}
Method m = Method.GetMethod(method);
if (this.ShouldAnalyse(m, type))
{
node.Nodes.Add(this.NewNode(m, NodeType.Method));
}
}
//.........这里部分代码省略.........