示例#1
0
        internal static EventSourceElement Read(XElement element)
        {
            var instance = new EventSourceElement()
            {
                Name            = (string)element.Attribute(NameAttributeKey),
                EventId         = (Guid?)element.Attribute(EventIdAttributeKey) ?? Guid.Empty,
                Level           = (EventLevel)Enum.Parse(typeof(EventLevel), (string)element.Attribute(LevelAttributeKey) ?? default(EventLevel).ToString()),
                MatchAnyKeyword = (EventKeywords)long.Parse((string)element.Attribute(MatchAnyKeywordAttributeKey) ?? ((long)default(EventKeywords)).ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture)
            };

            return(instance);
        }
        internal static EventSourceElement Read(XElement element)
        {
            var instance = new EventSourceElement()
            {
                Name = (string)element.Attribute(NameAttributeKey),
                EventId = (Guid?)element.Attribute(EventIdAttributeKey) ?? Guid.Empty,
                Level = (EventLevel)Enum.Parse(typeof(EventLevel), (string)element.Attribute(LevelAttributeKey) ?? default(EventLevel).ToString()),
                MatchAnyKeyword = (EventKeywords)long.Parse((string)element.Attribute(MatchAnyKeywordAttributeKey) ?? ((long)default(EventKeywords)).ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture)
            };

            return instance;
        }
示例#3
0
        internal static EventSourceElement Read(XElement element)
        {
            var instance = new EventSourceElement
            {
                Name               = (string)element.Attribute(NameAttributeKey),
                EventId            = (Guid?)element.Attribute(EventIdAttributeKey) ?? Guid.Empty,
                Level              = (EventLevel)Enum.Parse(typeof(EventLevel), (string)element.Attribute(LevelAttributeKey) ?? default(EventLevel).ToString()),
                MatchAnyKeyword    = (EventKeywords)long.Parse((string)element.Attribute(MatchAnyKeywordAttributeKey) ?? ((long)default(EventKeywords)).ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture),
                Arguments          = element.Elements(ArgumentsElementName).Elements().Select(e => EventSourceArgumentElement.Read(e)).ToArray(),
                ProcessNameFilters = element.Elements(FilterElementName).Elements().Select(e => EventSourceProcessFilterElement.Read(e)).ToArray()
            };

            return(instance);
        }
        internal static EventSourceElement Read(XElement element)
        {
            var instance = new EventSourceElement
            {
                Name = (string)element.Attribute(NameAttributeKey),
                EventId = (Guid?)element.Attribute(EventIdAttributeKey) ?? Guid.Empty,
                Level = (EventLevel)Enum.Parse(typeof(EventLevel), (string)element.Attribute(LevelAttributeKey) ?? default(EventLevel).ToString()),
                MatchAnyKeyword = (EventKeywords)long.Parse((string)element.Attribute(MatchAnyKeywordAttributeKey) ?? ((long)default(EventKeywords)).ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture),
                Arguments = element.Elements(ArgumentsElementName).Elements().Select(e => EventSourceArgumentElement.Read(e)).ToArray(),
                ProcessNameFilters = element.Elements(FilterElementName).Elements().Select(e => EventSourceProcessFilterElement.Read(e)).ToArray()
            };

            return instance;
        }
示例#5
0
        private IEnumerable <EventSourceElement> ReadEventSources(XElement element)
        {
            List <EventSourceElement> sources = new List <EventSourceElement>();

            foreach (var eventSource in element.Elements(this.sourcesName).Elements(this.eventSourceName))
            {
                sources.Add(EventSourceElement.Read(eventSource));
            }

            if (sources.Count == 0)
            {
                throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.NoEventSourcesError, element.Name.LocalName));
            }

            return(sources);
        }