Exemplo n.º 1
0
 public static Task <IReadOnlyCollection <XElement> > GetPropertyElementsAsync(
     [NotNull] this IEntry entry,
     [NotNull] IWebDavDispatcher dispatcher,
     CancellationToken ct)
 {
     return(GetPropertyElementsAsync(entry, dispatcher, false, ct));
 }
Exemplo n.º 2
0
        public static async Task <IReadOnlyCollection <XElement> > GetPropertyElementsAsync(
            [NotNull] this IEntry entry,
            [NotNull] IWebDavDispatcher dispatcher,
            bool skipEtag,
            CancellationToken ct)
        {
            var result = new List <XElement>();

            using (var propEnum = entry.GetProperties(dispatcher).GetEnumerator())
            {
                while (await propEnum.MoveNext(ct).ConfigureAwait(false))
                {
                    var prop = propEnum.Current;
                    if (skipEtag && prop.Name == GetETagProperty.PropertyName)
                    {
                        continue;
                    }
                    var element = await prop.GetXmlValueAsync(ct).ConfigureAwait(false);

                    result.Add(element);
                }
            }

            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDavIndirectResult"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV HTTP method dispatcher</param>
 /// <param name="result">The result of the WebDAV operation</param>
 /// <param name="logger">The logger for a <see cref="WebDavIndirectResult"/></param>
 public WebDavIndirectResult(IWebDavDispatcher dispatcher, IWebDavResult result, [CanBeNull] ILogger <WebDavIndirectResult> logger)
     : base((int)result.StatusCode)
 {
     _dispatcher = dispatcher;
     _result     = result;
     _logger     = logger;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebDavClient"/> class.
        /// </summary>
        public WebDavClient(Uri baseAddress)
        {
            _dispatcher             = new WebDavDispatcher();
            _dispatcher.BaseAddress = baseAddress;

            var lockResponseParser = new LockResponseParser();

            SetPropfindResponseParser(new PropfindResponseParser(lockResponseParser));
            SetProppatchResponseParser(new ProppatchResponseParser());
            SetLockResponseParser(lockResponseParser);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteHttpClientTargetActions"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 /// <param name="httpClient">The <see cref="HttpClient"/> to use for the communication with the remote server</param>
 protected RemoteHttpClientTargetActions([NotNull] IWebDavDispatcher dispatcher, [NotNull] HttpClient httpClient)
 {
     Dispatcher = dispatcher;
     Client     = httpClient;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveBetweenFileSystemsTargetAction"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 public MoveBetweenFileSystemsTargetAction([NotNull] IWebDavDispatcher dispatcher)
 {
     Dispatcher = dispatcher;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteHttpClientTargetActions"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 /// <param name="httpClient">The <see cref="HttpClient"/> to use for the communication with the remote server</param>
 protected RemoteHttpClientTargetActions(IWebDavDispatcher dispatcher, HttpClient httpClient)
 {
     Dispatcher = dispatcher;
     Client     = httpClient;
 }
Exemplo n.º 8
0
 public WebDavHandlerFactory(IWebDavDispatcher webDavDispatcher)
 {
     _webDavDispatcher = webDavDispatcher;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Sets the dispatcher of WebDAV requests.
 /// </summary>
 /// <param name="dispatcher">The dispatcher of WebDAV http requests.</param>
 /// <returns>This instance of <see cref="WebDavClient" /> to support chain calls.</returns>
 internal WebDavClient SetWebDavDispatcher([NotNull] IWebDavDispatcher dispatcher)
 {
     Check.NotNull(dispatcher, nameof(dispatcher));
     _dispatcher = dispatcher;
     return(this);
 }
        /// <summary>
        /// Gets all predefined properties for the given <paramref name="entry"/>, provided by the given <paramref name="dispatcher"/>.
        /// </summary>
        /// <param name="entry">The entry to get the properties for</param>
        /// <param name="dispatcher">The dispatcher that provides the predefined properties</param>
        /// <param name="maxCost">The maximum cost for querying a properties value</param>
        /// <param name="returnInvalidProperties">Do we want to get invalid live properties?</param>
        /// <returns>The async enumerable of all property (including the property store when the <paramref name="maxCost"/> allows it)</returns>
        public static IAsyncEnumerable <IUntypedReadableProperty> GetProperties(this IEntry entry, IWebDavDispatcher dispatcher, int?maxCost = null, bool returnInvalidProperties = false)
        {
            var properties = new List <IUntypedReadableProperty>();

            foreach (var webDavClass in dispatcher.SupportedClasses)
            {
                properties.AddRange(webDavClass.GetProperties(entry));
            }

            return(new EntryProperties(entry, properties, entry.FileSystem.PropertyStore, maxCost, returnInvalidProperties));
        }
Exemplo n.º 11
0
 public WebDavHandler(IWebDavDispatcher webDavDispatcher)
 {
     _webDavDispatcher = webDavDispatcher;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MoveInFileSystemTargetAction"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 /// <param name="logger">The logger</param>
 public MoveInFileSystemTargetAction(IWebDavDispatcher dispatcher, ILogger logger)
 {
     Dispatcher = dispatcher;
     _logger    = logger;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LoggingWebDavResponse"/> class.
 /// </summary>
 /// <param name="dispatcher">The dispatcher implementation for the WebDAV server</param>
 public LoggingWebDavResponse(IWebDavDispatcher dispatcher)
 {
     Dispatcher  = dispatcher;
     ContentType = "text/xml";
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDavResponse"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV HTTP method dispatcher</param>
 /// <param name="response">The ASP.NET Core HTTP response</param>
 public WebDavResponse(IWebDavDispatcher dispatcher, HttpResponse response)
 {
     _response  = response;
     Dispatcher = dispatcher;
     Headers    = new HeadersDictionary(_response.Headers);
 }
Exemplo n.º 15
0
 public WebDavController(IWebDavContext context, IWebDavDispatcher dispatcher, ILogger <WebDavIndirectResult> responseLogger = null)
     : base(context, dispatcher, responseLogger)
 {
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebDavControllerBase"/> class.
 /// </summary>
 /// <param name="context">The WebDAV request context</param>
 /// <param name="dispatcher">The WebDAV HTTP method dispatcher</param>
 /// <param name="responseLogger">The logger for the <see cref="WebDavIndirectResult"/></param>
 public WebDavControllerBase(IWebDavContext context, IWebDavDispatcher dispatcher, ILogger <WebDavIndirectResult> responseLogger = null)
 {
     _context        = context;
     _dispatcher     = dispatcher;
     _responseLogger = responseLogger;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyRemoteHttpClientTargetActions"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 /// <param name="httpClient">The <see cref="HttpClient"/> to use</param>
 public CopyRemoteHttpClientTargetActions([NotNull] IWebDavDispatcher dispatcher, [NotNull] HttpClient httpClient)
     : base(dispatcher, httpClient)
 {
 }
Exemplo n.º 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyBetweenFileSystemsTargetAction"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 public CopyBetweenFileSystemsTargetAction(IWebDavDispatcher dispatcher)
 {
     Dispatcher = dispatcher;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyInFileSystemTargetAction"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 public CopyInFileSystemTargetAction([NotNull] IWebDavDispatcher dispatcher)
 {
     Dispatcher = dispatcher;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Sets the dispatcher of WebDAV requests.
 /// </summary>
 /// <param name="dispatcher">The dispatcher of WebDAV http requests.</param>
 /// <returns>This instance of <see cref="WebDavClient" /> to support chain calls.</returns>
 internal WebDavClient SetWebDavDispatcher(IWebDavDispatcher dispatcher)
 {
     Guard.NotNull(dispatcher, "dispather");
     _dispatcher = dispatcher;
     return(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CopyRemoteHttpClientTargetActions"/> class.
 /// </summary>
 /// <param name="dispatcher">The WebDAV dispatcher</param>
 /// <param name="httpClient">The <see cref="HttpClient"/> to use</param>
 public CopyRemoteHttpClientTargetActions(IWebDavDispatcher dispatcher, HttpClient httpClient)
     : base(dispatcher, httpClient)
 {
 }