Skip to content

Commit 47a06ef

Browse files
refactor: primary constructors, file-scoped namespaces
1 parent b850af8 commit 47a06ef

3 files changed

Lines changed: 441 additions & 457 deletions

File tree

src/TagBites.IO.Ftp/FtpFileSystem.cs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,42 @@
22
using System;
33
using System.Text;
44

5-
namespace TagBites.IO.Ftp
5+
namespace TagBites.IO.Ftp;
6+
7+
/// <summary>
8+
/// Exposes static method for creating ftp file system.
9+
/// </summary>
10+
public static class FtpFileSystem
611
{
712
/// <summary>
8-
/// Exposes static method for creating ftp file system.
13+
/// Creates a Ftp file system.
914
/// </summary>
10-
public static class FtpFileSystem
15+
/// <param name="address">The ftp host address.</param>
16+
/// <param name="username">The user name.</param>
17+
/// <param name="password">The password.</param>
18+
/// <param name="encoding">The encoding applied to the contents of files.</param>
19+
/// <param name="connectionType">The Ftp Data connection type.</param>
20+
/// <returns>A Ftp file system contains the procedures that are used to perform file and directory operations.</returns>
21+
public static FileSystem Create(string address, string username, string password, Encoding encoding = null, FtpDataConnectionType connectionType = FtpDataConnectionType.AutoPassive)
1122
{
12-
/// <summary>
13-
/// Creates a Ftp file system.
14-
/// </summary>
15-
/// <param name="address">The ftp host address.</param>
16-
/// <param name="username">The user name.</param>
17-
/// <param name="password">The password.</param>
18-
/// <param name="encoding">The encoding applied to the contents of files.</param>
19-
/// <param name="connectionType">The Ftp Data connection type.</param>
20-
/// <returns>A Ftp file system contains the procedures that are used to perform file and directory operations.</returns>
21-
public static FileSystem Create(string address, string username, string password, Encoding encoding = null, FtpDataConnectionType connectionType = FtpDataConnectionType.AutoPassive)
23+
var connectionConfig = new FtpConnectionConfig(address, username, password)
2224
{
23-
var connectionConfig = new FtpConnectionConfig(address, username, password)
24-
{
25-
DataConnectionType = connectionType,
26-
Encoding = encoding
27-
};
28-
return new FileSystem(new FtpFileSystemOperations(connectionConfig));
29-
}
25+
DataConnectionType = connectionType,
26+
Encoding = encoding
27+
};
28+
return new FileSystem(new FtpFileSystemOperations(connectionConfig));
29+
}
3030

31-
/// <summary>
32-
/// Creates a Ftp file system.
33-
/// </summary>
34-
/// <param name="connectionConfig">FTP connection config.</param>
35-
/// <returns>A Ftp file system contains the procedures that are used to perform file and directory operations.</returns>
36-
public static FileSystem Create(FtpConnectionConfig connectionConfig)
37-
{
38-
if (connectionConfig == null)
39-
throw new ArgumentNullException(nameof(connectionConfig));
31+
/// <summary>
32+
/// Creates a Ftp file system.
33+
/// </summary>
34+
/// <param name="connectionConfig">FTP connection config.</param>
35+
/// <returns>A Ftp file system contains the procedures that are used to perform file and directory operations.</returns>
36+
public static FileSystem Create(FtpConnectionConfig connectionConfig)
37+
{
38+
if (connectionConfig == null)
39+
throw new ArgumentNullException(nameof(connectionConfig));
4040

41-
return new FileSystem(new FtpFileSystemOperations(connectionConfig));
42-
}
41+
return new FileSystem(new FtpFileSystemOperations(connectionConfig));
4342
}
44-
}
43+
}

0 commit comments

Comments
 (0)