コード例 #1
0
        private static async Task <IFileClient> CreateFtpClient(TargetParam param)
        {
            var client = new FtpFileClient(param.Host, param.UserName, param.Password, param.EncodingName);
            await client.ConnectAsync();

            return(client);
        }
コード例 #2
0
        private static IFileClient CreateSftpClient(TargetParam param)
        {
            SftpFileClient client;

            if (string.IsNullOrWhiteSpace(param.Password))
            {
                client = SftpFileClient.CreateWithKeyFile(param.Host, param.UserName, param.KeyPath);
            }
            else
            {
                client = SftpFileClient.CreateWithPassword(param.Host, param.UserName, param.Password);
            }
            client.Connect();
            return(client);
        }