Ejemplo n.º 1
0
        private UploaderFTP GetUploaderFTP()
        {
            var uploader = new UploaderFTP();

            uploader.FTPSettings  = FTPConnection.FTPConnectionSettings.LoadSettings();
            uploader.UploadFolder = UploadFolderName;
            return(uploader);
        }
Ejemplo n.º 2
0
        private void FileUploader_DoWork(object sender, DoWorkEventArgs e)
        {
            FTPConnectionSettings ftp = FTPConnectionSettings.LoadSettings();

            if (ftp == null)
            {
                throw new Exception("Не указаны параметры подключения к FTP");
            }

            Uploaders.UploaderFTP uploader = new Uploaders.UploaderFTP(ftp, "quickUploads");
            uploader.Initialize();

            ImageResizer.ImageInfo image = e.Argument as ImageResizer.ImageInfo;

            string pictureName = $"{Guid.NewGuid()}.{image.SourceExtention}";
            Uri    result      = uploader.SaveImage(image.SourceBitmap, pictureName);

            e.Result = result;
        }