コード例 #1
0
        private void ReadStandard(XmlReadAdaptor adaptor)
        {
            // Source.

            if (adaptor.ReadElement(Constants.Xml.SourceElement))
            {
                _source = adaptor.ReadName();
                adaptor.ReadEndElement();
            }

            // Event.

            if (adaptor.ReadElement(Constants.Xml.EventElement))
            {
                _event = adaptor.ReadName();
                adaptor.ReadEndElement();
            }

            // Type, Method, Message, Time, Sequence.

            _type    = adaptor.ReadElementString(Constants.Xml.TypeElement, string.Empty);
            _method  = adaptor.ReadElementString(Constants.Xml.MethodElement, string.Empty);
            _message = adaptor.ReadElementString(Constants.Xml.MessageElement, string.Empty);
            string timeXml = adaptor.ReadElementString(Constants.Xml.TimeElement, string.Empty);

            // The time is in the LinkMe.Framework.Type.DateTime format and should always be in UTC.

            DateTime time = TypeXmlConvert.ToDateTime(timeXml);

            Debug.Assert(time.TimeZone == TimeZone.UTC, "time.TimeZone == TimeZone.UTC");

            _time = time.ToSystemDateTime();

            string sequence = adaptor.ReadElementString(Constants.Xml.SequenceElement, string.Empty);

            _sequence = (sequence.Length == 0 ? 0 : TypeXmlConvert.ToInt32(sequence));

            // Exception.

            _exception = ExceptionInfo.FromXml(adaptor, Constants.Xml.ExceptionElement);
        }