示例#1
0
        public static NodeRule <MessageInfo, DefaultLinkStyle> GetRule()
        {
            return(new NodeRule <MessageInfo, DefaultLinkStyle>((node, nodeRules, map) =>
            {
                var attr = node.Info.Node.Attributes.FirstOrDefault(x => CompilerUtils.AttributeIs(x, typeof(ServiceNameAttribute)));
                if (attr != null)
                {
                    var a = (ServiceNameAttribute)attr;
                    var rank = (string)a._groupName;

                    DefaultTheme.ServiceNames.SetValueIfNotExists(rank, new List <string>());
                    DefaultTheme.ServiceNames[rank].Add(node.Name);
                }
            }));
        }
示例#2
0
        public static NodeRule <MessageInfo, DefaultLinkStyle> GetRule()
        {
            return(new NodeRule <MessageInfo, DefaultLinkStyle>((node, nodeRules, map) =>
            {
                var attr = node.Info.Node.Attributes.FirstOrDefault(x => CompilerUtils.AttributeIs(x, typeof(LabelAltAttribute)));
                if (attr != null)
                {
                    var a = (LabelAltAttribute)attr;
                    var label = a._label;

                    if (null != label)
                    {
                        node.Attributes.SetValue(GraphvizAttribute.Xlabel.ToString(), label);
                    }
                }
            }));
        }
示例#3
0
 public static NodeRule <MessageInfo, DefaultLinkStyle> GetRule()
 {
     return(new NodeRule <MessageInfo, DefaultLinkStyle>((node, nodeRules, map) =>
     {
         var attr = node.Info.Node.Attributes.FirstOrDefault(x => CompilerUtils.AttributeIs(x, typeof(TTLAttribute)));
         if (attr != null)
         {
             var a = (TTLAttribute)attr;
             var seconds = (double)a._seconds;
             var val = TimeSpan.FromSeconds(seconds);
             if (val.TotalMilliseconds >= 1)
             {
                 var labelText = node.Attributes[GraphvizAttribute.Label.ToString()];
                 labelText = DefaultTheme.CheckAndWrapToHtmlTable(labelText);
                 var newRowText = $"<font color='red' point-size='6'>TTL {val.TotalSeconds:F2} sec</font>";
                 labelText = DefaultTheme.AddNewRow(labelText, newRowText);
                 node.Attributes[GraphvizAttribute.Label.ToString()] = labelText;
             }
         }
     }));
 }
示例#4
0
        public static NodeRule <MessageInfo, DefaultLinkStyle> GetRule()
        {
            return(new NodeRule <MessageInfo, DefaultLinkStyle>((node, nodeRules, map) =>
            {
                var attr = node.Info.Node.Attributes.FirstOrDefault(x => CompilerUtils.AttributeIs(x, typeof(TagsAltAttribute)));
                if (attr != null)
                {
                    var a = (TagsAltAttribute)attr;
                    var tags = a._tags;

                    if (tags.Any())
                    {
                        var labelText = node.Attributes[GraphvizAttribute.Label.ToString()];
                        labelText = DefaultTheme.CheckAndWrapToHtmlTable(labelText);
                        var newRowText = $"<font color='gray' point-size='6'><i>{string.Join(", ", tags.Select(x => "#" + x).ToArray())}</i></font>";
                        labelText = DefaultTheme.AddNewRow(labelText, newRowText);
                        node.Attributes[GraphvizAttribute.Label.ToString()] = labelText;
                    }
                }
            }));
        }