コード例 #1
0
        public WebDavResponse(XElement response)
        {
            if (response == null)
                throw new ArgumentNullException ("response");

            Element = response;

            Href    = response.GetElementPathValue (WebDavNames.Href);
            Hrefs   = response.Elements (WebDavNames.Href)
                .Select (h => h.Value)
                .Skip (1);
            if (Hrefs.Any ()) {
                Status              = response.GetElementPathValue (WebDavNames.Status);
                PropertyStatuses    = new WebDavPropertyStatus [0];
            }
            else {
                PropertyStatuses = response.Elements (WebDavNames.Propstat)
                    .Select (propstat => new WebDavPropertyStatus (propstat));
            }

            Error = response.GetElementPath (WebDavNames.Error);
            if (Error != null)
                Error = Error.Elements ().FirstOrDefault ();

            ResponseDescription = response.GetElementPathValue (WebDavNames.ResponseDescription);
            Location            = response.GetElementPathValue (WebDavNames.Location, WebDavNames.Href);
        }
コード例 #2
0
        public WebDavResponse(XElement response)
        {
            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            Element = response;

            Href  = response.GetElementPathValue(WebDavNames.Href);
            Hrefs = response.Elements(WebDavNames.Href)
                    .Select(h => h.Value)
                    .Skip(1);
            if (Hrefs.Any())
            {
                Status           = response.GetElementPathValue(WebDavNames.Status);
                PropertyStatuses = new WebDavPropertyStatus [0];
            }
            else
            {
                PropertyStatuses = response.Elements(WebDavNames.Propstat)
                                   .Select(propstat => new WebDavPropertyStatus(propstat));
            }

            Error = response.GetElementPath(WebDavNames.Error);
            if (Error != null)
            {
                Error = Error.Elements().FirstOrDefault();
            }

            ResponseDescription = response.GetElementPathValue(WebDavNames.ResponseDescription);
            Location            = response.GetElementPathValue(WebDavNames.Location, WebDavNames.Href);
        }