コード例 #1
0
ファイル: FtpServer.cs プロジェクト: rajeshwarn/FtpServer
 /// <summary>
 /// Initializes a new instance of the <see cref="FtpServer"/> class.
 /// </summary>
 /// <param name="fileSystemClassFactory">The <see cref="IFileSystemClassFactory"/> to use to create the <see cref="IUnixFileSystem"/> for the logged in user.</param>
 /// <param name="membershipProvider">The <see cref="IMembershipProvider"/> used to validate a login attempt</param>
 /// <param name="serverAddress">The public IP address (required for <code>PASV</code> and <code>EPSV</code>)</param>
 /// <param name="port">The port of the FTP server (usually 21)</param>
 /// <param name="handlerFactory">The handler factories to create <see cref="FtpCommandHandler"/> and <see cref="FtpCommandHandlerExtension"/> instances for new <see cref="FtpConnection"/> objects</param>
 public FtpServer([NotNull] IFileSystemClassFactory fileSystemClassFactory, [NotNull] IMembershipProvider membershipProvider, [NotNull] string serverAddress, int port, [NotNull, ItemNotNull] IFtpCommandHandlerFactory handlerFactory)
 {
     ServerAddress          = serverAddress;
     DefaultEncoding        = Encoding.UTF8;
     OperatingSystem        = "UNIX";
     FileSystemClassFactory = fileSystemClassFactory;
     MembershipProvider     = membershipProvider;
     Port = port;
     CommandsHandlerFactory   = handlerFactory;
     BackgroundTransferWorker = new BackgroundTransferWorker(this);
     BackgroundTransferWorker.Start(_cancellationTokenSource);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FtpServer"/> class.
 /// </summary>
 /// <param name="serverOptions">The server options.</param>
 /// <param name="serviceProvider">The service provider used to query services.</param>
 /// <param name="logger">The FTP server logger.</param>
 /// <param name="loggerFactory">Factory for loggers.</param>
 public FtpServer(
     [NotNull] IOptions <FtpServerOptions> serverOptions,
     [NotNull] IServiceProvider serviceProvider,
     [CanBeNull] ILogger <FtpServer> logger   = null,
     [CanBeNull] ILoggerFactory loggerFactory = null)
 {
     _serviceProvider         = serviceProvider;
     _log                     = logger;
     ServerAddress            = serverOptions.Value.ServerAddress;
     Port                     = serverOptions.Value.Port;
     BackgroundTransferWorker = new BackgroundTransferWorker(loggerFactory?.CreateLogger <BackgroundTransferWorker>());
     BackgroundTransferWorker.Start(_cancellationTokenSource);
 }
コード例 #3
0
ファイル: FtpServer.cs プロジェクト: mutac/FtpServer
 /// <summary>
 /// Initializes a new instance of the <see cref="FtpServer"/> class.
 /// </summary>
 /// <param name="fileSystemClassFactory">The <see cref="IFileSystemClassFactory"/> to use to create the <see cref="IUnixFileSystem"/> for the logged in user.</param>
 /// <param name="membershipProvider">The <see cref="IMembershipProvider"/> used to validate a login attempt</param>
 /// <param name="serverAddress">The public IP address (required for <code>PASV</code> and <code>EPSV</code>)</param>
 /// <param name="port">The port of the FTP server (usually 21)</param>
 /// <param name="handlerFactory">The handler factories to create <see cref="FtpCommandHandler"/> and <see cref="FtpCommandHandlerExtension"/> instances for new <see cref="FtpConnection"/> objects</param>
 public FtpServer([NotNull] IFileSystemClassFactory fileSystemClassFactory, [NotNull] IMembershipProvider membershipProvider, [NotNull] string serverAddress, int port, [NotNull, ItemNotNull] IFtpCommandHandlerFactory handlerFactory)
 {
     ServerAddress = serverAddress;
     DefaultEncoding = Encoding.UTF8;
     OperatingSystem = "UNIX";
     FileSystemClassFactory = fileSystemClassFactory;
     MembershipProvider = membershipProvider;
     Port = port;
     CommandsHandlerFactory = handlerFactory;
     BackgroundTransferWorker = new BackgroundTransferWorker(this);
     BackgroundTransferWorker.Start(_cancellationTokenSource);
 }