public static TopicInfo GetTopicInfo(NotificationMessageHolderType msg, XmlElement rawMsg) { XmlNamespaceManager manager = EventsMainHelper.CreateNamespaceManager(rawMsg.OwnerDocument); XmlText text = null; if (msg.Topic.Any != null) { foreach (XmlNode any in msg.Topic.Any) { var current = any as XmlText; if (any != null) { text = current; break; } } } XmlNode topicNode = rawMsg.SelectSingleNode("b2:Topic", manager); string topic = text != null ? text.Value : ""; return(TopicInfo.ExtractTopicInfoPACS(topic, topicNode)); }
bool IsBeginMessage(Dictionary <NotificationMessageHolderType, XmlElement> NotificationMessages) { try { NotificationMessageHolderType Message = null; foreach (NotificationMessageHolderType l in NotificationMessages.Keys) { Message = l; } TopicInfo Topic = TopicInfo.ExtractTopicInfoPACS(Message.Topic.Any[0].InnerText, NotificationMessages[Message]); bool match = TopicInfo.TopicsMatch(Topic, BeginTopic); return(match); } catch (Exception) { return(false); } }
public static TopicInfo GetTopicInfo(NotificationMessageHolderType msg) { var rawMsg = msg.Topic.Any.First().OwnerDocument; XmlNamespaceManager manager = EventsMainHelper.CreateNamespaceManager(rawMsg); XmlText text = null; if (msg.Topic.Any != null) { foreach (XmlNode any in msg.Topic.Any) { var current = any as XmlText; if (any != null) { text = current; break; } } } string topic = text != null ? text.Value : ""; return(TopicInfo.ExtractTopicInfoPACS(topic, msg.Topic)); }
void VerifyBeginType(Dictionary <NotificationMessageHolderType, XmlElement> NotificationMessages) { bool match = false; NotificationMessageHolderType Message = null; try { foreach (NotificationMessageHolderType l in NotificationMessages.Keys) { Message = l; } TopicInfo Topic = TopicInfo.ExtractTopicInfoPACS(Message.Topic.Any[0].InnerText, NotificationMessages[Message]); match = TopicInfo.TopicsMatch(Topic, BeginTopic); } catch (Exception) { Assert(false, "Message topic undefind", "Check if first message is " + BeginPath); } Assert(match, "Message topic is wrong (topic or namespace)", "Check if first message is " + BeginPath); }