public void UpdateTypeInfo(Type type, [CanBeNull] Action <UmlEntity, bool> modification) { var created = false; if (!_entities.TryGetValue(type, out var info)) { created = true; _entities[type] = info = new UmlEntity(type, GetTypeName); } if (modification != null) { modification(info, created); } if (!created) { return; } var handler = OnAddTypeToDiagram; if (handler == null) { return; } var args = new AddTypeToDiagramEventArgs { Info = info, Diagram = this }; handler.Invoke(this, args); }
private void ProjectOnOnAddTypeToDiagram(object sender, AddTypeToDiagramEventArgs e) { foreach (var v in NewTypeVisitors) { v.Visit(e.Diagram, e.Info); } }
private void XOnOnAddTypeToDiagram(object sender, AddTypeToDiagramEventArgs e) { var handler = OnAddTypeToDiagram; if (handler == null) { return; } handler(this, e); }
public void Visit(UmlDiagram diagram, UmlEntity info) { var type = info.Type; var properties = ScanProperties(type, ScanFlags); info.Members.AddRange(properties); var r = BindingFlags.Public | BindingFlags.NonPublic; if (ScanFlags.HasFlag(ReflectionFlags.InstanceMethod)) { r |= BindingFlags.Instance; } if (ScanFlags.HasFlag(ReflectionFlags.StaticMethod)) { r |= BindingFlags.Static; } var methodInfos = type.GetMethods(r); { var h = SortAndPrepareMethods; if (h != null) { var args = new SortAndPrepareMethodsEventArgs { Methods = methodInfos }; h.Invoke(this, args); methodInfos = args.Methods; } } foreach (var mi in methodInfos) { var add = CheckSkipDefault(mi); var flag = GetMFlag(mi, ReflectionFlags.PublicMethod, ReflectionFlags.ProtectedMethod, ReflectionFlags.PrivateMethod); if (add) { if (!H(flag, ScanFlags)) { add = false; } } var h = AddTypeToDiagram; if (h is null && !add) { continue; } var member = new MethodUmlMember { Group = 20, Name = mi.Name, Method = mi, Visibility = GetVisibilityFromFlags(flag) }; if (mi.IsAbstract) { member.Kind = UmlMemberKind.Abstract; } if (mi.IsStatic) { member.Kind = UmlMemberKind.Static; } if (h != null) { var args = new AddTypeToDiagramEventArgs { Decision = add ? AddDecision.Add : AddDecision.Skip, Member = mi, UmlMember = member }; h(this, args); if (args.Decision != AddDecision.Default) { add = args.Decision == AddDecision.Add; } } if (!add) { continue; } info.Members.Add(member); } }