Beispiel #1
0
        internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
        {
            m_headers.Clear();

            if (adaptor.ReadElement(elementName))
            {
                while (adaptor.ReadElement(Constants.Xml.HttpDetail.Headers.HeaderElement))
                {
                    string key    = adaptor.ReadAttributeString(Constants.Xml.HttpDetail.Headers.NameAttribute, null);
                    bool   isNull = adaptor.ReadXsiNilAttribute();
                    if (isNull)
                    {
                        m_headers.Add(key, null);
                    }
                    else
                    {
                        while (adaptor.ReadElement(Constants.Xml.HttpDetail.Headers.ValueElement))
                        {
                            string value = adaptor.ReadString();
                            m_headers.Add(key, value);
                            adaptor.ReadEndElement();
                        }
                    }

                    adaptor.ReadEndElement();
                }

                adaptor.ReadEndElement();
            }
        }
Beispiel #2
0
        private void ReadParameters(XmlReadAdaptor adaptor)
        {
            if (adaptor.ReadElement(Constants.Xml.ParametersElement))
            {
                // Look for the elements.

                var parameters = new ArrayList();
                while (adaptor.ReadElement(Constants.Xml.ParameterElement))
                {
                    parameters.Add(EventParameter.ReadXml(adaptor));
                    adaptor.ReadEndElement();
                }

                // Set up the real parameters.

                if (parameters.Count > 0)
                {
                    _parameters = new EventParameter[parameters.Count];
                    for (int index = 0; index < _parameters.Length; ++index)
                    {
                        _parameters[index] = (EventParameter)parameters[index];
                    }
                }

                adaptor.ReadEndElement();
            }
        }
        private static void Read(XmlReadAdaptor adaptor, ICollection <Category> categories)
        {
            if (adaptor.ReadElement(Constants.Config.RootElement, false))
            {
                if (adaptor.ReadElement(Constants.Config.SectionElement, false))
                {
                    if (adaptor.ReadElement(Constants.Xml.PerformanceCountersElement))
                    {
                        if (adaptor.ReadElement(Constants.Xml.CategoriesElement))
                        {
                            while (adaptor.ReadElement(Constants.Xml.CategoryElement))
                            {
                                ReadCategory(adaptor, categories);
                                adaptor.ReadEndElement();
                            }

                            adaptor.ReadEndElement();
                        }

                        adaptor.ReadEndElement();
                    }

                    adaptor.ReadEndElement();
                }

                adaptor.ReadEndElement();
            }
        }
Beispiel #4
0
        public void ReadXml(XmlReader xmlReader)
        {
            m_messages = new List <EventMessage>();
            XmlReadAdaptor adaptor = new XmlReadAdaptor(xmlReader, Constants.Xml.Namespace);

            ReadXml(adaptor);
        }
Beispiel #5
0
 private void ReadXml(XmlReadAdaptor adaptor)
 {
     m_processUserName    = adaptor.ReadElementString(Constants.Xml.SecurityDetail.ProcessUserNameElement);
     m_authenticationType = adaptor.ReadElementString(Constants.Xml.SecurityDetail.AuthenticationTypeElement);
     m_isAuthenticated    = XmlConvert.ToBoolean(adaptor.ReadElementString(Constants.Xml.SecurityDetail.IsAuthenticatedElement));
     m_userName           = adaptor.ReadElementString(Constants.Xml.SecurityDetail.UserNameElement);
 }
Beispiel #6
0
 internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
 {
     if (adaptor.ReadElement(elementName))
     {
         adaptor.ReadEndElement();
     }
 }
Beispiel #7
0
 private void ReadXml(XmlReadAdaptor adaptor)
 {
     _processId       = XmlConvert.ToInt32(adaptor.ReadElementString(Constants.Xml.ProcessDetail.ProcessIdElement));
     _processName     = adaptor.ReadElementString(Constants.Xml.ProcessDetail.ProcessNameElement);
     _machineName     = adaptor.ReadElementString(Constants.Xml.ProcessDetail.MachineNameElement);
     _commandLineArgs = adaptor.ReadElementString(Constants.Xml.ProcessDetail.CommandLineArgsElement);
 }
Beispiel #8
0
        private void ReadXml(XmlReadAdaptor reader)
        {
            _type = reader.ReadClass();
            reader.MoveToElement();

            _helpLink   = reader.ReadElementString("HelpLink", false, null);
            _message    = reader.ReadElementString("Message", false, null);
            _source     = reader.ReadElementString("Source", false, null);
            _stackTrace = reader.ReadElementString("StackTrace", false, null);
            _targetSite = reader.ReadElementString("TargetSite", false, null);
            _hResult    = reader.ReadElementString("HResult", false, null);

            // Additional properties

            if (reader.ReadElement("additionalProperties", false))
            {
                ReadDictionaryFromXml(reader, _properties);
                reader.ReadEndElement();
            }

            // Inner exception

            if (reader.ReadElement("innerException", false))
            {
                _innerException = new ExceptionInfo();
                _innerException.ReadXml(reader);
                reader.ReadEndElement();
            }
        }
Beispiel #9
0
 internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
 {
     if (adaptor.ReadElement(elementName))
     {
         _id = adaptor.ReadElementString(Constants.Xml.HttpDetail.Session.IdElement);
         adaptor.ReadEndElement();
     }
 }
Beispiel #10
0
        private static void ReadCounter(XmlReadAdaptor adaptor, Category category)
        {
            var name    = adaptor.ReadName();
            var help    = adaptor.ReadAttributeString(Constants.Xml.HelpAttribute, string.Empty);
            var type    = (PerformanceCounterType)adaptor.ReadAttributeEnum(Constants.Xml.TypeAttribute, typeof(PerformanceCounterType), PerformanceCounterType.NumberOfItems32);
            var counter = new Counter(name, help, type);

            category.Counters.Add(counter);
        }
Beispiel #11
0
        public void ReadOuterXml(XmlReader xmlReader)
        {
            XmlReadAdaptor adaptor = new XmlReadAdaptor(xmlReader, GetXmlNamespace());

            if (adaptor.IsReadingElement(Constants.Xml.Exception.ExceptionElement))
            {
                ReadXml(adaptor);
            }
        }
Beispiel #12
0
        public void ReadXml(XmlReader xmlReader)
        {
            Reset();

            // Create an adaptor.

            var adaptor = new XmlReadAdaptor(xmlReader);

            ReadXml(adaptor);
        }
Beispiel #13
0
 internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
 {
     if (adaptor.IsReadingElement(elementName))
     {
         _encodingName = adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.Content.EncodingNameElement, string.Empty);
         _length       = XmlConvert.ToInt32(adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.Content.LengthElement, "0"));
         _type         = adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.Content.TypeElement, string.Empty);
         adaptor.ReadEndElement();
     }
 }
Beispiel #14
0
 internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
 {
     if (adaptor.IsReadingElement(elementName))
     {
         _hostName    = adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.User.HostNameElement);
         _hostAddress = adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.User.HostAddressElement);
         _agent       = adaptor.ReadElementString(Constants.Xml.HttpDetail.Request.User.AgentElement);
         adaptor.ReadEndElement();
     }
 }
Beispiel #15
0
        public void ReadOuterXml(XmlReader reader)
        {
            XmlReadAdaptor adaptor = new XmlReadAdaptor(reader, Constants.Xml.Namespace);

            if (adaptor.IsReadingElement(Constants.Xml.NetDetail.Name))
            {
                ReadXml(adaptor);
                adaptor.ReadEndElement();
            }
        }
Beispiel #16
0
        public void ReadOuterXml(XmlReader xmlReader)
        {
            m_messages = new List <EventMessage>();
            XmlReadAdaptor adaptor = new XmlReadAdaptor(xmlReader, Constants.Xml.Namespace);

            if (adaptor.IsReadingElement(Constants.Xml.EventMessagesElement))
            {
                ReadXml(adaptor);
            }
        }
Beispiel #17
0
        public void ReadXml(XmlReader xmlReader)
        {
            Reset();

            // Create an adaptor.

            var adaptor = new XmlReadAdaptor(xmlReader, Constants.Xml.Namespace);

            ReadXml(adaptor);
        }
Beispiel #18
0
 private void ReadXml(XmlReadAdaptor adaptor)
 {
     while (adaptor.ReadElement(Constants.Xml.EventMessageElement))
     {
         IXmlSerializable message = new EventMessage();
         message.ReadXml(adaptor.XmlReader);
         adaptor.ReadEndElement();
         m_messages.Add(message as EventMessage);
     }
 }
Beispiel #19
0
 private void ReadXml(XmlReadAdaptor adaptor)
 {
     m_threadId           = XmlConvert.ToInt32(adaptor.ReadElementString(Constants.Xml.ThreadDetail.ThreadId));
     m_apartmentState     = (ApartmentState)System.Enum.Parse(typeof(ApartmentState), adaptor.ReadElementString(Constants.Xml.ThreadDetail.ApartmentState));
     m_culture            = adaptor.ReadElementString(Constants.Xml.ThreadDetail.Culture);
     m_threadName         = adaptor.ReadElementString(Constants.Xml.ThreadDetail.ThreadName);
     m_state              = (ThreadState)System.Enum.Parse(typeof(ThreadState), adaptor.ReadElementString(Constants.Xml.ThreadDetail.State));
     m_priority           = (ThreadPriority)System.Enum.Parse(typeof(ThreadPriority), adaptor.ReadElementString(Constants.Xml.ThreadDetail.Priority));
     m_isThreadPoolThread = XmlConvert.ToBoolean(adaptor.ReadElementString(Constants.Xml.ThreadDetail.IsThreadPoolThread));
     m_sequence           = XmlConvert.ToInt32(adaptor.ReadElementString(Constants.Xml.ThreadDetail.Sequence));
 }
Beispiel #20
0
 private static EventParameter ReadStringParameter(XmlReadAdaptor adaptor, string name, string className)
 {
     if (className.Length == 0)
     {
         return(new EventParameter(name, adaptor.ReadInnerXml()));
     }
     else
     {
         return(new EventParameter(name, className, adaptor.ReadInnerXml(), ValueFormat.String));
     }
 }
Beispiel #21
0
        private static System.Exception ReadSystemException(XmlReadAdaptor adaptor, string className)
        {
            // Standard properties.

            string message = adaptor.ReadElementString(Constants.Xml.Exception.MessageElement, string.Empty);
            string source  = adaptor.ReadElementString(Constants.Xml.Exception.SourceElement, string.Empty);

            System.Exception innerException = ReadInnerException(adaptor);
            string           stackTrace     = adaptor.ReadElementString(Constants.Xml.Exception.StackTraceElement, string.Empty);

            return(new SystemException(source, message, stackTrace, className, innerException));
        }
Beispiel #22
0
        private static IList <Category> Read(string filePath)
        {
            var categories = new List <Category>();

            using (var fileReader = new StreamReader(filePath))
            {
                var adaptor = new XmlReadAdaptor(fileReader, Constants.Xml.Namespace);
                Read(adaptor, categories);
            }

            return(categories);
        }
Beispiel #23
0
        public void ReadOuterXml(XmlReader xmlReader)
        {
            Reset();

            // Create an adaptor.

            var adaptor = new XmlReadAdaptor(xmlReader, Constants.Xml.Namespace);

            if (adaptor.IsReadingElement(Constants.Xml.EventMessageElement))
            {
                ReadXml(adaptor);
            }
        }
Beispiel #24
0
        private static EventParameter ReadPrimitiveTypeParameter(XmlReadAdaptor adaptor, string name)
        {
            // Look for a primitive type.

            PrimitiveTypeInfo primitiveTypeInfo = PrimitiveTypeInfo.ReadXsiTypeAttribute(adaptor);

            if (primitiveTypeInfo == null)
            {
                return(null);
            }

            return(new EventParameter(name, TypeXmlConvert.ToType(adaptor.ReadInnerXml(), primitiveTypeInfo.PrimitiveType)));
        }
Beispiel #25
0
        public void ReadOuterXml(XmlReader xmlReader)
        {
            Reset();

            // Create an adaptor.

            var adaptor = new XmlReadAdaptor(xmlReader);

            if (adaptor.IsReadingElement(OuterElement))
            {
                ReadXml(adaptor);
            }
        }
Beispiel #26
0
        public static ExceptionInfo FromXml(XmlReadAdaptor reader, string topElementName)
        {
            if (!reader.ReadElement(topElementName))
            {
                return(null);
            }

            var value = new ExceptionInfo();

            value.ReadXml(reader);
            reader.ReadEndElement();

            return(value);
        }
Beispiel #27
0
        private static EventParameter ReadNullParameter(XmlReadAdaptor adaptor, string name)
        {
            // Look for xsi:nil="true".

            bool nil = adaptor.ReadXsiNilAttribute();

            if (nil)
            {
                return(new EventParameter(name, null));
            }
            else
            {
                return(null);
            }
        }
Beispiel #28
0
        internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
        {
            _cookies.Clear();

            if (adaptor.ReadElement(elementName))
            {
                while (adaptor.IsReadingElement(Constants.Xml.HttpDetail.Cookies.CookieElement))
                {
                    var cookie = new HttpCookieDetail();
                    cookie.ReadXml(adaptor, Constants.Xml.HttpDetail.Cookies.CookieElement);
                    _cookies.Add(cookie);
                }

                adaptor.ReadEndElement();
            }
        }
Beispiel #29
0
        internal void ReadXml(XmlReadAdaptor adaptor, string elementName)
        {
            _variables.Clear();

            if (adaptor.ReadElement(elementName))
            {
                while (adaptor.IsReadingElement(Constants.Xml.HttpDetail.Form.VariableElement))
                {
                    var variable = new HttpFormVariableDetail();
                    variable.ReadXml(adaptor, Constants.Xml.HttpDetail.Form.VariableElement);
                    _variables.Add(variable);
                }

                adaptor.ReadEndElement();
            }
        }
Beispiel #30
0
        private void ReadDetails(XmlReadAdaptor adaptor)
        {
            m_details = new EventDetails();
            if (adaptor.ReadElement(Constants.Xml.Exception.DetailsElement))
            {
                while (adaptor.ReadElement())
                {
                    string name = adaptor.Name;
                    IEventDetailFactory factory = m_eventDetailFactories[name];
                    IEventDetail        detail  = factory.CreateInstance();
                    ((IXmlSerializable)detail).ReadXml(adaptor.XmlReader);
                    m_details.Add(detail);
                    adaptor.ReadEndElement();
                }

                adaptor.ReadEndElement();
            }
        }