Exemplo n.º 1
0
        private async Task <IWebDavResult> HandleAllPropAsync([CanBeNull] include include, [NotNull][ItemNotNull] IEnumerable <IEntry> entries, CancellationToken cancellationToken)
        {
            var responses = new List <response>();

            foreach (var entry in entries)
            {
                var entryPath = entry.Path.OriginalString;
                var href      = _context.PublicControllerUrl.Append(entryPath, true);
                if (!_options.UseAbsoluteHref)
                {
                    href = new Uri("/" + _context.PublicRootUrl.MakeRelativeUri(href).OriginalString, UriKind.Relative);
                }

                var collector = new PropertyCollector(this, _context, new ReadableFilter(), new CostFilter(0));
                var propStats = await collector.GetPropertiesAsync(entry, 0, cancellationToken).ConfigureAwait(false);

                var response = new response()
                {
                    href             = href.OriginalString,
                    ItemsElementName = propStats.Select(x => ItemsChoiceType2.propstat).ToArray(),
                    Items            = propStats.Cast <object>().ToArray(),
                };

                responses.Add(response);
            }

            var result = new multistatus()
            {
                response = responses.ToArray(),
            };

            return(new WebDavResult <multistatus>(WebDavStatusCode.MultiStatus, result));
        }