Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WebDAV-Client-Solution.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Blazor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Propfind/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=WASM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=WEBASSEMBLY/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
47 changes: 22 additions & 25 deletions src/WebDAV-Client/ApiParams/UnlockParameters.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
using System.Threading;
using JetBrains.Annotations;
using Stef.Validation;

namespace WebDav
namespace WebDav;

/// <summary>
/// Represents parameters for the UNLOCK WebDAV method.
/// </summary>
public class UnlockParameters
{
/// <summary>
/// Represents parameters for the UNLOCK WebDAV method.
/// Initializes a new instance of the <see cref="UnlockParameters"/> class.
/// <param name="lockToken">The resource lock token.</param>
/// </summary>
public class UnlockParameters
public UnlockParameters(string lockToken)
{
/// <summary>
/// Initializes a new instance of the <see cref="UnlockParameters"/> class.
/// <param name="lockToken">The resource lock token.</param>
/// </summary>
public UnlockParameters([NotNull] string lockToken)
{
Check.NotNull(lockToken, nameof(lockToken));

LockToken = lockToken;
CancellationToken = CancellationToken.None;
}
LockToken = Guard.NotNull(lockToken);
CancellationToken = CancellationToken.None;
}

/// <summary>
/// Gets the resource lock token.
/// </summary>
public string LockToken { get; private set; }
/// <summary>
/// Gets the resource lock token.
/// </summary>
public string LockToken { get; }

/// <summary>
/// Gets or sets the cancellation token.
/// </summary>
public CancellationToken CancellationToken { get; set; }
}
}
/// <summary>
/// Gets or sets the cancellation token.
/// </summary>
public CancellationToken CancellationToken { get; set; }
}
132 changes: 66 additions & 66 deletions src/WebDAV-Client/ApiParams/WebDavClientParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,82 +3,82 @@
using System.Net;
using System.Net.Http;

namespace WebDav
// ReSharper disable once CheckNamespace
namespace WebDav;

/// <summary>
/// Represents parameters for the <see cref="WebDavClient"/> class.
/// </summary>
public class WebDavClientParams
{
/// <summary>
/// Represents parameters for the <see cref="WebDavClient"/> class.
/// Initializes a new instance of the <see cref="WebDavClientParams"/> class.
/// </summary>
public class WebDavClientParams
public WebDavClientParams()
{
/// <summary>
/// Initializes a new instance of the <see cref="WebDavClientParams"/> class.
/// </summary>
public WebDavClientParams()
{
UseDefaultCredentials = true;
DefaultRequestHeaders = new Dictionary<string, string>();
Timeout = TimeSpan.FromMilliseconds(-1); // Infinite timespan is nothing but TimeSpan with milliseconds set to -1
UseProxy = true;
PreAuthenticate = true;
}
UseDefaultCredentials = true;
DefaultRequestHeaders = new Dictionary<string, string>();
Timeout = TimeSpan.FromMilliseconds(-1); // Infinite timespan is nothing but TimeSpan with milliseconds set to -1
UseProxy = true;
PreAuthenticate = true;
}

/// <summary>
/// Gets or sets the HTTP message handler. Note that this overrides some other properties in this class like:
/// - PreAuthenticate
/// - UseDefaultCredentials
/// - UseProxy
/// - Credentials
/// - Proxy
/// </summary>
public HttpMessageHandler HttpMessageHandler { get; set; }
/// <summary>
/// Gets or sets the HTTP message handler. Note that this overrides some other properties in this class like:
/// - PreAuthenticate
/// - UseDefaultCredentials
/// - UseProxy
/// - Credentials
/// - Proxy
/// </summary>
public HttpMessageHandler? HttpMessageHandler { get; set; }

/// <summary>
/// Gets or sets a value that controls whether default credentials are sent.
/// </summary>
/// <value>
/// <c>true</c> if the default credentials are used; otherwise <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool UseDefaultCredentials { get; set; }
/// <summary>
/// Gets or sets a value that controls whether default credentials are sent.
/// </summary>
/// <value>
/// <c>true</c> if the default credentials are used; otherwise <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool UseDefaultCredentials { get; set; }

/// <summary>
/// Gets or sets the base address of the resource's URI used when sending requests.
/// </summary>
public Uri BaseAddress { get; set; }
/// <summary>
/// Gets or sets the base address of the resource's URI used when sending requests.
/// </summary>
public Uri BaseAddress { get; set; }

/// <summary>
/// Gets or sets authentication information used by the WebDavClient.
/// </summary>
public ICredentials Credentials { get; set; }
/// <summary>
/// Gets or sets authentication information used by the WebDavClient.
/// </summary>
public ICredentials? Credentials { get; set; }

/// <summary>
/// Gets or sets the headers which should be sent with each request.
/// </summary>
public IDictionary<string, string> DefaultRequestHeaders { get; set; }
/// <summary>
/// Gets or sets the headers which should be sent with each request.
/// </summary>
public IDictionary<string, string> DefaultRequestHeaders { get; set; }

/// <summary>
/// Gets or sets a value that indicates whether an Authorization header should be sent with the request.
/// </summary>
/// <value>
/// <c>true</c> if an HTTP Authorization header should be send with requests after authentication has taken place; otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool PreAuthenticate { get; set; }
/// <summary>
/// Gets or sets a value that indicates whether an Authorization header should be sent with the request.
/// </summary>
/// <value>
/// <c>true</c> if an HTTP Authorization header should be send with requests after authentication has taken place; otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool PreAuthenticate { get; set; }

/// <summary>
/// Gets or sets proxy information used by the WebDavClient.
/// </summary>
public IWebProxy Proxy { get; set; }
/// <summary>
/// Gets or sets proxy information used by the WebDavClient.
/// </summary>
public IWebProxy? Proxy { get; set; }

/// <summary>
/// Gets or sets a timeout for WebDAV operations.
/// </summary>
public TimeSpan Timeout { get; set; }
/// <summary>
/// Gets or sets a timeout for WebDAV operations.
/// </summary>
public TimeSpan Timeout { get; set; }

/// <summary>
/// Gets or sets a value indicating whether a proxy should be used for requests.
/// </summary>
/// <value>
/// <c>true</c> if a proxy should be used for requests; otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool UseProxy { get; set; }
}
}
/// <summary>
/// Gets or sets a value indicating whether a proxy should be used for requests.
/// </summary>
/// <value>
/// <c>true</c> if a proxy should be used for requests; otherwise, <c>false</c>. The default value is <c>true</c>.
/// </value>
public bool UseProxy { get; set; }
}
35 changes: 17 additions & 18 deletions src/WebDAV-Client/Domain/PrincipalLockOwner.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
using JetBrains.Annotations;
using Stef.Validation;

namespace WebDav
namespace WebDav;

/// <summary>
/// Represents a lock owner identified by principal name.
/// </summary>
public class PrincipalLockOwner : LockOwner
{
/// <summary>
/// Represents a lock owner identified by principal name.
/// Initializes a new instance of the <see cref="PrincipalLockOwner"/> class.
/// </summary>
public class PrincipalLockOwner : LockOwner
/// <param name="principalName">Name of the principal.</param>
public PrincipalLockOwner(string principalName)
{
/// <summary>
/// Initializes a new instance of the <see cref="PrincipalLockOwner"/> class.
/// </summary>
/// <param name="principalName">Name of the principal.</param>
public PrincipalLockOwner([NotNull] string principalName)
{
Check.NotNull(principalName, nameof(principalName));
Value = principalName;
}

/// <summary>
/// Gets a value representing an owner.
/// </summary>
public override string Value { get; }
Value = Guard.NotNull(principalName);
}
}

/// <summary>
/// Gets a value representing an owner.
/// </summary>
public override string Value { get; }
}
54 changes: 26 additions & 28 deletions src/WebDAV-Client/Domain/WebDavProperty.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
using System.Xml.Linq;
using Stef.Validation;

namespace WebDav
namespace WebDav;

/// <summary>
/// Represents a WebDAV resource property.
/// </summary>
public class WebDavProperty
{
/// <summary>
/// Represents a WebDAV resource property.
/// Initializes a new instance of the <see cref="WebDavProperty"/> class.
/// </summary>
public class WebDavProperty
/// <param name="name">The property name.</param>
/// <param name="value">The property value.</param>
public WebDavProperty(XName name, string value)
{
/// <summary>
/// Initializes a new instance of the <see cref="WebDavProperty"/> class.
/// </summary>
/// <param name="name">The property name.</param>
/// <param name="value">The property value.</param>
public WebDavProperty(XName name, string value)
{
Check.NotEmpty((name ?? "").ToString(), nameof(name));

Name = name;
Value = value;
}
Name = Guard.NotNullOrEmpty((name ?? "").ToString());
Value = value;
}

/// <summary>
/// Gets the property name.
/// </summary>
public XName Name { get; private set; }
/// <summary>
/// Gets the property name.
/// </summary>
public XName Name { get; private set; }

/// <summary>
/// Gets the property value.
/// </summary>
public string Value { get; private set; }
/// <summary>
/// Gets the property value.
/// </summary>
public string Value { get; private set; }

public override string ToString()
{
return string.Format("{{ Name: {0}, Value: {1} }}", Name, Value);
}
public override string ToString()
{
return string.Format("{{ Name: {0}, Value: {1} }}", Name, Value);
}
}
}
Loading