Example #1
0
            /// <summary>
            /// Executes the job.
            /// </summary>
            /// <param name="parent">The <see cref="FtpFileUploader"/> the job is being executed on.</param>
            public void Execute(FtpFileUploader parent)
            {
                if (_attempts < byte.MaxValue)
                    _attempts++;

                // Ensure the local directory exists
                var p = Path.GetDirectoryName(LocalFile);
                if (p != null)
                {
                    if (!Directory.Exists(p))
                        Directory.CreateDirectory(p);
                }

                // Attempt to create the file before downloading anything
                if (File.Exists(LocalFile))
                    File.Delete(LocalFile);

                using (File.Create(p))
                {
                }

                // Start the download now that we know we are able to create the file
                var data = parent.FtpDownload(RemoteFile, true);

                // Write to the file
                if (File.Exists(LocalFile))
                    File.Delete(LocalFile);

                File.WriteAllBytes(LocalFile, data);
            }
Example #2
0
            /// <summary>
            /// Executes the job.
            /// </summary>
            /// <param name="parent">The <see cref="FtpFileUploader"/> the job is being executed on.</param>
            public void Execute(FtpFileUploader parent)
            {
                if (_attempts < byte.MaxValue)
                    _attempts++;

                parent.FtpCreateFile(LocalFile, RemoteFile);
            }
Example #3
0
            /// <summary>
            /// Executes the job.
            /// </summary>
            /// <param name="parent">The <see cref="FtpFileUploader"/> the job is being executed on.</param>
            public void Execute(FtpFileUploader parent)
            {
                if (_attempts < byte.MaxValue)
                    _attempts++;

                parent.FtpDeleteDir(RemotePath);
            }