/// <summary>
        /// Configures FTP
        /// </summary>
        /// <param name="opts">The options</param>
        /// <returns>The result</returns>
        int FTPConfig(FTPConfigOptions opts)
        {
            string server = Properties.Settings.Default.FTPServer;

            server = Interaction.InputBox("Please enter the FTP server:", "Mist of Time Publisher", server);
            Properties.Settings.Default.FTPServer = server;

            string username = Properties.Settings.Default.FTPUsername;

            username = Interaction.InputBox("Please enter the FTP username:"******"Mist of Time Publisher", username);
            Properties.Settings.Default.FTPUsername = username;

            System.Security.SecureString password = CommandLineSecurity.DecryptString(Properties.Settings.Default.FTPPassword);
            password = CommandLineSecurity.ToSecureString(Interaction.InputBox("Please enter the FTP password:"******"Mist of Time Publisher", CommandLineSecurity.ToInsecureString(password)));
            Properties.Settings.Default.FTPPassword = CommandLineSecurity.EncryptString(password);

            Properties.Settings.Default.Save();

            return(0);
        }
        /// <summary>
        /// Adds a file to FTP
        /// </summary>
        /// <param name="opts">The options</param>
        /// <returns>The result</returns>
        int FTPAddFile(FTPAddFileOptions opts)
        {
            using (Ftp ftp = new Ftp())
            {
                try
                {
                    ftp.Connect(Properties.Settings.Default.FTPServer);
                    ftp.Login(Properties.Settings.Default.FTPUsername, CommandLineSecurity.ToInsecureString(CommandLineSecurity.DecryptString(Properties.Settings.Default.FTPPassword)));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(new Form(), ex.Message, "Mist of Time Publisher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(1);
                }

                try
                {
                    if (!ftp.FolderExists("cdn"))
                    {
                        ftp.CreateFolder("cdn");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(new Form(), ex.Message, "Mist of Time Publisher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(1);
                }

                try
                {
                    if (!opts.ServerPath.StartsWith("/"))
                    {
                        opts.ServerPath = "/" + opts.ServerPath;
                    }
                    ftp.Upload("cdn" + opts.ServerPath, opts.LocalPath);
                    string oldPath = Path.GetDirectoryName("cdn" + opts.ServerPath).Replace('\\', '/') + "/FtpTrial-" + Path.GetFileName("cdn" + opts.ServerPath);
                    if (ftp.FileExists(oldPath))
                    {
                        ftp.Rename(oldPath, "cdn" + opts.ServerPath);
                    }
                }
                catch (Exception)
                {
                    return(2);
                }
            }

            return(0);
        }
        /// <summary>
        /// Deletes a directory from FTP
        /// </summary>
        /// <param name="opts">The options</param>
        /// <returns>The result</returns>
        int FTPDeleteDirectory(FTPDeleteDirectoryOptions opts)
        {
            using (Ftp ftp = new Ftp())
            {
                try
                {
                    ftp.Connect(Properties.Settings.Default.FTPServer);
                    ftp.Login(Properties.Settings.Default.FTPUsername, CommandLineSecurity.ToInsecureString(CommandLineSecurity.DecryptString(Properties.Settings.Default.FTPPassword)));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(new Form(), ex.Message, "Mist of Time Publisher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(1);
                }

                try
                {
                    if (!ftp.FolderExists("cdn"))
                    {
                        ftp.CreateFolder("cdn");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(new Form(), ex.Message, "Mist of Time Publisher", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(1);
                }

                try
                {
                    if (!opts.ServerPath.StartsWith("/"))
                    {
                        opts.ServerPath = "/" + opts.ServerPath;
                    }
                    ftp.DeleteFolder("cdn" + opts.ServerPath);
                }
                catch (Exception)
                {
                    return(2);
                }
            }

            return(0);
        }