示例#1
0
        public LockResponse Parse(string response, int statusCode, string description)
        {
            var xresponse = XDocumentExt.TryParse(response);

            if (xresponse?.Root == null)
            {
                return(new LockResponse(statusCode, description));
            }

            var lockdiscovery = xresponse.Root.LocalNameElement("lockdiscovery", StringComparison.OrdinalIgnoreCase);
            var activeLocks   = ParseLockDiscovery(lockdiscovery);

            return(new LockResponse(statusCode, description, activeLocks));
        }
        public ProppatchResponse Parse(string response, int statusCode, string description)
        {
            if (string.IsNullOrEmpty(response))
            {
                return(new ProppatchResponse(statusCode, description));
            }

            var xresponse = XDocumentExt.TryParse(response);

            if (xresponse?.Root == null)
            {
                return(new ProppatchResponse(statusCode, description));
            }

            var propStatuses = xresponse.Root.LocalNameElements("response", StringComparison.OrdinalIgnoreCase)
                               .SelectMany(MultiStatusParser.GetPropertyStatuses)
                               .ToList();

            return(new ProppatchResponse(statusCode, description, propStatuses));
        }
        public PropfindResponse Parse(string response, int statusCode, string description)
        {
            if (string.IsNullOrEmpty(response))
            {
                return(new PropfindResponse(statusCode, description));
            }

            var xresponse = XDocumentExt.TryParse(response);

            if (xresponse == null || xresponse.Root == null)
            {
                return(new PropfindResponse(statusCode, description));
            }

            var resources = xresponse.Root.LocalNameElements("response", StringComparison.OrdinalIgnoreCase)
                            .Select(ParseResource)
                            .ToList();

            return(new PropfindResponse(statusCode, description, resources));
        }