private void EnlistProperties(XmlNode node, InternalMessageTraceInfo info)
 {
     if (node != null && info != null && node.HasChildNodes)
     {
         List <TraceDetailedProcessParameter.TraceProperty> list = new List <TraceDetailedProcessParameter.TraceProperty>();
         TraceDetailedProcessParameter.EnlistRecognizedElements(node, list, false, 0);
         if (node.Name != "Properties")
         {
             foreach (TraceDetailedProcessParameter.TraceProperty item in list)
             {
                 if (string.Compare(Utilities.TradeOffXmlPrefixForName(item.PropertyName), "ActivityId", true, CultureInfo.CurrentUICulture) == 0)
                 {
                     string text = TraceRecord.NormalizeActivityId(item.PropertyValue);
                     if (!string.IsNullOrEmpty(text) && TraceViewerForm.IsActivityDisplayNameInCache(text))
                     {
                         info.properties.Add(new TraceDetailedProcessParameter.TraceProperty(SR.GetString("FV_MSG2_LeftQ") + SR.GetString("FV_MSG2_ActivityName2") + SR.GetString("FV_MSG2_RightQ") + item.PropertyName, TraceViewerForm.GetActivityDisplayName(text), item.IsXmlAttribute, item.IsXmlFormat));
                     }
                     else
                     {
                         info.properties.Add(new TraceDetailedProcessParameter.TraceProperty(SR.GetString("FV_MSG2_LeftQ") + "ActivityId" + SR.GetString("FV_MSG2_RightQ") + item.PropertyName, text, item.IsXmlAttribute, item.IsXmlFormat));
                     }
                 }
                 else
                 {
                     info.properties.Add(new TraceDetailedProcessParameter.TraceProperty(SR.GetString("FV_MSG2_LeftQ") + node.Name + SR.GetString("FV_MSG2_RightQ") + item.PropertyName, item.PropertyValue, item.IsXmlAttribute, item.IsXmlFormat));
                 }
             }
         }
         else
         {
             info.properties.AddRange(list);
         }
     }
 }
Exemplo n.º 2
0
 private void ReloadKnownMessageHeaders(InternalMessageHeaders headers)
 {
     if (headers != null)
     {
         if (!string.IsNullOrEmpty(headers.messageId))
         {
             lblMessageID.Text = SR.GetString("FV_MSG_MSGID");
             txtMessageID.Text = headers.messageId;
         }
         else if (!string.IsNullOrEmpty(headers.relatesTo))
         {
             lblMessageID.Text = SR.GetString("FV_MSG_RelatesTo");
             txtMessageID.Text = headers.relatesTo;
         }
         txtAction.Text = headers.action;
         if (!string.IsNullOrEmpty(headers.activityId))
         {
             if (TraceViewerForm.IsActivityDisplayNameInCache(headers.activityId))
             {
                 lblActivityID.Text = SR.GetString("FV_MSG2_ActivityName");
                 txtActivityID.Text = TraceViewerForm.GetActivityDisplayName(headers.activityId);
             }
             else
             {
                 lblActivityID.Text = SR.GetString("FV_MSG2_ActivityId");
                 txtActivityID.Text = headers.activityId;
             }
         }
         else
         {
             lblActivityID.Text = SR.GetString("FV_MSG2_ActivityId");
             txtActivityID.Text = string.Empty;
         }
         txtFrom.Text    = headers.from;
         txtTo.Text      = headers.to;
         txtReplyTo.Text = headers.replyTo;
     }
 }
 public static void EnlistRecognizedElements(XmlNode node, List <TraceProperty> listProperty, bool ignoreSubTreeNodes, int depth)
 {
     if (depth < 10 && node != null && !ExcludedXmlNodes.Contains(node.Name))
     {
         string text = Utilities.TradeOffXmlPrefixForName(node.Name);
         if (ignoreSubTreeNodes && SubTreeRootXmlNodes.Contains(text) && SubTreeRootXmlNodeValidator(node, text))
         {
             listProperty.Add(new TraceProperty(node.Name, node.OuterXml, isAttribute: false, isXmlFormat: true));
         }
         else
         {
             if (node.Attributes != null)
             {
                 foreach (XmlAttribute attribute in node.Attributes)
                 {
                     if (!ExcludedXmlAttributes.Contains(Utilities.TradeOffXmlPrefixForName(attribute.Name)))
                     {
                         listProperty.Add(new TraceProperty(SR.GetString("FV_MSG2_LeftQ") + node.Name + SR.GetString("FV_MSG2_RightQ") + attribute.Name, attribute.Value, isAttribute: false, isXmlFormat: false));
                     }
                 }
             }
             if (node.HasChildNodes)
             {
                 foreach (XmlNode childNode in node.ChildNodes)
                 {
                     if (string.Compare(childNode.Name, "#text", true, CultureInfo.CurrentUICulture) == 0 && !string.IsNullOrEmpty(childNode.Value))
                     {
                         if (string.Compare(Utilities.TradeOffXmlPrefixForName(node.Name), "ActivityId", true, CultureInfo.CurrentUICulture) == 0)
                         {
                             string text2 = TraceRecord.NormalizeActivityId(childNode.InnerText);
                             if (!string.IsNullOrEmpty(text2) && TraceViewerForm.IsActivityDisplayNameInCache(text2))
                             {
                                 listProperty.Add(new TraceProperty(SR.GetString("FV_Basic_ActivityName"), TraceViewerForm.GetActivityDisplayName(text2), isAttribute: false, isXmlFormat: false));
                             }
                             else
                             {
                                 listProperty.Add(new TraceProperty(SR.GetString("FV_Basic_ActivityID"), text2, isAttribute: false, isXmlFormat: false));
                             }
                         }
                         else
                         {
                             listProperty.Add(new TraceProperty(node.Name, childNode.InnerText, isAttribute: false, isXmlFormat: false));
                         }
                     }
                     else
                     {
                         EnlistRecognizedElements(childNode, listProperty, ignoreSubTreeNodes, depth + 1);
                     }
                 }
             }
             else if (!string.IsNullOrEmpty(node.Value) && !ExcludedXmlNodes.Contains(Utilities.TradeOffXmlPrefixForName(node.Name)))
             {
                 if (string.Compare(Utilities.TradeOffXmlPrefixForName(node.Name), "ActivityId", true, CultureInfo.CurrentUICulture) == 0)
                 {
                     listProperty.Add(new TraceProperty(node.Name, TraceViewerForm.GetActivityDisplayName(TraceRecord.NormalizeActivityId(node.InnerText)), isAttribute: false, isXmlFormat: false));
                 }
                 else
                 {
                     listProperty.Add(new TraceProperty(node.Name, node.Value, isAttribute: false, isXmlFormat: false));
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public void ReloadTrace(TraceRecord trace)
 {
     CleanUp();
     if (trace != null)
     {
         ListViewItem listViewItem = null;
         string       text         = TraceRecord.NormalizeActivityId(trace.ActivityID);
         listViewItem = ((!TraceViewerForm.IsActivityDisplayNameInCache(text)) ? new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_ActivityID"),
             text
         }) : new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_ActivityName"),
             TraceViewerForm.GetActivityDisplayName(text)
         }));
         listView.Items.Add(listViewItem);
         if (trace.IsTransfer && !string.IsNullOrEmpty(trace.RelatedActivityID))
         {
             string text2 = TraceRecord.NormalizeActivityId(trace.RelatedActivityID);
             listViewItem = ((!TraceViewerForm.IsActivityDisplayNameInCache(text2)) ? new ListViewItem(new string[2]
             {
                 SR.GetString("FV_Basic_RelatedActivityID"),
                 text2
             }) : new ListViewItem(new string[2]
             {
                 SR.GetString("FV_Basic_RelatedActivityName"),
                 TraceViewerForm.GetActivityDisplayName(text2)
             }));
             listView.Items.Add(listViewItem);
         }
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Time"),
             trace.Time.ToString(dateTimeFormat, CultureInfo.CurrentUICulture)
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Level"),
             trace.Level.ToString()
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Source"),
             trace.SourceName
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Process"),
             trace.ProcessName
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Thread"),
             trace.ThreadId.ToString(CultureInfo.CurrentCulture)
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_Computer"),
             (trace.Execution != null) ? trace.Execution.ComputerName : string.Empty
         });
         listView.Items.Add(listViewItem);
         listViewItem = new ListViewItem(new string[2]
         {
             SR.GetString("FV_Basic_TraceIdentifier"),
             trace.TraceCode
         });
         listView.Items.Add(listViewItem);
     }
 }
Exemplo n.º 5
0
 private void EnlistMessageHeadersTree(XmlNode xmlNode, TreeNode treeNode, InternalMessageHeaders headers, int depth)
 {
     if (depth < 10 && xmlNode != null && treeNode != null && !TraceDetailedProcessParameter.ExcludedXmlNodes.Contains(Utilities.TradeOffXmlPrefixForName(xmlNode.Name)))
     {
         if (xmlNode.Attributes != null)
         {
             foreach (XmlAttribute attribute in xmlNode.Attributes)
             {
                 if (!TraceDetailedProcessParameter.ExcludedXmlAttributes.Contains(Utilities.TradeOffXmlPrefixForName(attribute.Name)))
                 {
                     treeNode.Nodes.Add(SR.GetString("FV_PROPERTY_HEADER") + attribute.Name + SR.GetString("FV_EQUAL") + attribute.Value);
                 }
             }
         }
         string text  = Utilities.TradeOffXmlPrefixForName(xmlNode.Name);
         bool   flag  = false;
         bool   flag2 = false;
         string b     = null;
         if (generalPropertyNodeValuePair.ContainsKey(text))
         {
             flag = true;
             if (generalPropertyNodeValuePair[text] == "this")
             {
                 flag2 = true;
             }
             else
             {
                 b = generalPropertyNodeValuePair[text];
             }
         }
         if (xmlNode.HasChildNodes)
         {
             foreach (XmlNode childNode in xmlNode.ChildNodes)
             {
                 if (string.Compare(childNode.Name, "#text", true, CultureInfo.CurrentUICulture) == 0 && !string.IsNullOrEmpty(childNode.Value))
                 {
                     if (string.Compare(Utilities.TradeOffXmlPrefixForName(xmlNode.Name), "ActivityId", true, CultureInfo.CurrentUICulture) == 0)
                     {
                         string text2 = TraceRecord.NormalizeActivityId(xmlNode.ChildNodes[0].Value);
                         if (!string.IsNullOrEmpty(text2) && TraceViewerForm.IsActivityDisplayNameInCache(text2))
                         {
                             treeNode.Text = SR.GetString("FV_MSG2_ActivityName2") + SR.GetString("FV_EQUAL") + TraceViewerForm.GetActivityDisplayName(text2);
                         }
                         else
                         {
                             treeNode.Text = "ActivityId" + SR.GetString("FV_EQUAL") + text2;
                         }
                     }
                     else
                     {
                         treeNode.Text = xmlNode.Name + SR.GetString("FV_EQUAL") + xmlNode.ChildNodes[0].Value;
                     }
                     if (flag && flag2)
                     {
                         AssignHeaderInfo(headers, text, childNode.Value);
                     }
                 }
                 else
                 {
                     TreeNode treeNode2 = new TreeNode(childNode.Name);
                     treeNode.Nodes.Add(treeNode2);
                     EnlistMessageHeadersTree(childNode, treeNode2, headers, depth + 1);
                     if (flag && Utilities.TradeOffXmlPrefixForName(childNode.Name) == b && childNode.HasChildNodes)
                     {
                         foreach (XmlNode childNode2 in childNode.ChildNodes)
                         {
                             if (string.Compare(childNode2.Name, "#text", true, CultureInfo.CurrentUICulture) == 0 && !string.IsNullOrEmpty(childNode2.Value))
                             {
                                 AssignHeaderInfo(headers, text, childNode2.Value);
                             }
                         }
                     }
                 }
             }
         }
         else if (!string.IsNullOrEmpty(xmlNode.Value) && !TraceDetailedProcessParameter.ExcludedXmlNodes.Contains(Utilities.TradeOffXmlPrefixForName(xmlNode.Name)))
         {
             if (string.Compare(Utilities.TradeOffXmlPrefixForName(xmlNode.Name), "ActivityId", true, CultureInfo.CurrentUICulture) == 0)
             {
                 string text3 = TraceRecord.NormalizeActivityId(xmlNode.ChildNodes[0].Value);
                 if (!string.IsNullOrEmpty(text3) && TraceViewerForm.IsActivityDisplayNameInCache(text3))
                 {
                     treeNode.Text = SR.GetString("FV_MSG2_ActivityName2") + SR.GetString("FV_EQUAL") + TraceViewerForm.GetActivityDisplayName(text3);
                 }
                 else
                 {
                     treeNode.Text = "ActivityId" + SR.GetString("FV_EQUAL") + text3;
                 }
             }
             else
             {
                 treeNode.Text = xmlNode.Name + SR.GetString("FV_EQUAL") + xmlNode.ChildNodes[0].Value;
             }
         }
     }
 }