Exemplo n.º 1
0
        void ReadXml(XmlReader reader)
        {
            reader.Read();

            if (reader.NodeType == XmlNodeType.Comment)
            {
                reader.Read();
            }

            reader.ReadStartElement("RequestResult");

            this.httpStatusCode    = int.Parse(General.ReadElementAsString("HTTPStatusCode", reader));
            this.HttpStatusMessage = General.ReadElementAsString("HttpStatusMessage", reader);
            this.ServiceRequestID  = General.ReadElementAsString("ServiceRequestID", reader);

            this.ContentMd5  = General.ReadElementAsString("ContentMd5", reader);
            this.Etag        = General.ReadElementAsString("Etag", reader);
            this.RequestDate = General.ReadElementAsString("RequestDate", reader);
#if RTMD
            this.StartTime = DateTimeOffset.Parse(General.ReadElementAsString("StartTime", reader));
            this.EndTime   = DateTimeOffset.Parse(General.ReadElementAsString("EndTime", reader));
#else
            this.StartTime = DateTime.Parse(General.ReadElementAsString("StartTime", reader));
            this.EndTime   = DateTime.Parse(General.ReadElementAsString("EndTime", reader));
#endif
            this.ExtendedErrorInformation = new StorageExtendedErrorInformation();
            this.ExtendedErrorInformation.ReadXml(reader);

#if RTMD
            this.ExceptionInfo = ExceptionInfo.ReadFromXMLReader(reader);
#endif
            // End request Result
            reader.ReadEndElement();
        }
Exemplo n.º 2
0
        void ReadXml(XmlReader reader)
        {
            CommonUtility.AssertNotNull("reader", reader);

            reader.Read();

            if (reader.NodeType == XmlNodeType.Comment)
            {
                reader.Read();
            }

            reader.ReadStartElement("RequestResult");

            this.HttpStatusCode    = int.Parse(CommonUtility.ReadElementAsString("HTTPStatusCode", reader), CultureInfo.InvariantCulture);
            this.HttpStatusMessage = CommonUtility.ReadElementAsString("HttpStatusMessage", reader);

            StorageLocation targetLocation;

            if (Enum.TryParse <StorageLocation>(CommonUtility.ReadElementAsString("TargetLocation", reader), out targetLocation))
            {
                this.TargetLocation = targetLocation;
            }

            this.ServiceRequestID = CommonUtility.ReadElementAsString("ServiceRequestID", reader);
            this.ContentMd5       = CommonUtility.ReadElementAsString("ContentMd5", reader);
            this.Etag             = CommonUtility.ReadElementAsString("Etag", reader);
            this.RequestDate      = CommonUtility.ReadElementAsString("RequestDate", reader);
            try
            {
                this.ErrorCode = CommonUtility.ReadElementAsString("ErrorCode", reader);
            }
            catch (XmlException)
            {
                /* The ErrorCode property only exists after service version 07-17.
                 * If it is not present, we are reading an old version and can ignore this property.
                 */
            }
#if WINDOWS_RT || NETCORE
            this.StartTime = DateTimeOffset.Parse(CommonUtility.ReadElementAsString("StartTime", reader), CultureInfo.InvariantCulture);
            this.EndTime   = DateTimeOffset.Parse(CommonUtility.ReadElementAsString("EndTime", reader), CultureInfo.InvariantCulture);
#else
            this.StartTime = DateTime.Parse(CommonUtility.ReadElementAsString("StartTime", reader), CultureInfo.InvariantCulture);
            this.EndTime   = DateTime.Parse(CommonUtility.ReadElementAsString("EndTime", reader), CultureInfo.InvariantCulture);
#endif
            this.ExtendedErrorInformation = new StorageExtendedErrorInformation();
            this.ExtendedErrorInformation.ReadXml(reader);

#if WINDOWS_RT || NETCORE
            this.ExceptionInfo = ExceptionInfo.ReadFromXMLReader(reader);
#endif
            // End request Result
            reader.ReadEndElement();
        }
Exemplo n.º 3
0
        void ReadXml(XmlReader reader)
        {
            CommonUtility.AssertNotNull("reader", reader);

            reader.Read();

            if (reader.NodeType == XmlNodeType.Comment)
            {
                reader.Read();
            }

            reader.ReadStartElement("RequestResult");

            this.HttpStatusCode    = int.Parse(CommonUtility.ReadElementAsString("HTTPStatusCode", reader), CultureInfo.InvariantCulture);
            this.HttpStatusMessage = CommonUtility.ReadElementAsString("HttpStatusMessage", reader);

            StorageLocation targetLocation;

            if (Enum.TryParse <StorageLocation>(CommonUtility.ReadElementAsString("TargetLocation", reader), out targetLocation))
            {
                this.TargetLocation = targetLocation;
            }

            this.ServiceRequestID = CommonUtility.ReadElementAsString("ServiceRequestID", reader);
            this.ContentMd5       = CommonUtility.ReadElementAsString("ContentMd5", reader);
            this.Etag             = CommonUtility.ReadElementAsString("Etag", reader);
            this.RequestDate      = CommonUtility.ReadElementAsString("RequestDate", reader);
#if WINDOWS_RT || ASPNET_K
            this.StartTime = DateTimeOffset.Parse(CommonUtility.ReadElementAsString("StartTime", reader), CultureInfo.InvariantCulture);
            this.EndTime   = DateTimeOffset.Parse(CommonUtility.ReadElementAsString("EndTime", reader), CultureInfo.InvariantCulture);
#else
            this.StartTime = DateTime.Parse(CommonUtility.ReadElementAsString("StartTime", reader), CultureInfo.InvariantCulture);
            this.EndTime   = DateTime.Parse(CommonUtility.ReadElementAsString("EndTime", reader), CultureInfo.InvariantCulture);
#endif
            this.ExtendedErrorInformation = new StorageExtendedErrorInformation();
            this.ExtendedErrorInformation.ReadXml(reader);

#if WINDOWS_RT || ASPNET_K
            this.ExceptionInfo = ExceptionInfo.ReadFromXMLReader(reader);
#endif
            // End request Result
            reader.ReadEndElement();
        }