コード例 #1
0
        public override int Execute([NotNull] CommandContext context, [NotNull] SftpSettings settings)
        {
            try
            {
                var fileStream = new FileStream(settings.LocalPath, FileMode.OpenOrCreate);
                UseClient(settings, a => a.DownloadFile(settings.RemotePath, fileStream));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                return(1);
            }

            return(0);
        }
コード例 #2
0
        public override int Execute(CommandContext context, SftpSettings settings)
        {
            try
            {
                var fileStream = new FileStream(settings.LocalPath, FileMode.Open);
                UseClient(settings, a => a.UploadFile(fileStream, settings.RemotePath));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                return(1);
            }

            return(0);
        }