diff --git a/UploadersLib/Enums.cs b/UploadersLib/Enums.cs index 5cf5dee45..9b1ecec63 100644 --- a/UploadersLib/Enums.cs +++ b/UploadersLib/Enums.cs @@ -175,23 +175,23 @@ public enum FTPProtocol public enum BrowserProtocol { [Description("http://")] - Http, + http, [Description("https://")] - Https, + https, [Description("ftp://")] - Ftp, + ftp, [Description("ftps://")] - Ftps, + ftps, [Description("file://")] - File + file } public enum ServerProtocol { [Description("ftp://")] - Ftp, + ftp, [Description("ftps://")] - Ftps + ftps } public enum Privacy diff --git a/UploadersLib/FileUploaders/FTP/FTPAccount.cs b/UploadersLib/FileUploaders/FTP/FTPAccount.cs index 7bdc3b09f..849273a75 100644 --- a/UploadersLib/FileUploaders/FTP/FTPAccount.cs +++ b/UploadersLib/FileUploaders/FTP/FTPAccount.cs @@ -52,13 +52,13 @@ public class FTPAccount : ICloneable [Category("FTP"), PasswordPropertyText(true)] public string Password { get; set; } - [Category("FTP"), Description("Choose an appropriate protocol to be accessed by the server. This affects the server address."), DefaultValue(ServerProtocol.Ftp)] + [Category("FTP"), Description("Choose an appropriate protocol to be accessed by the server. This affects the server address."), DefaultValue(ServerProtocol.ftp)] public ServerProtocol ServerProtocol { get; set; } [Category("FTP"), Description("FTP sub folder path, example: Screenshots.\r\nYou can use name parsing: %y = year, %mo = month.")] public string SubFolderPath { get; set; } - [Category("FTP"), Description("Choose an appropriate protocol to be accessed by the browser"), DefaultValue(BrowserProtocol.Http)] + [Category("FTP"), Description("Choose an appropriate protocol to be accessed by the browser"), DefaultValue(BrowserProtocol.http)] public BrowserProtocol BrowserProtocol { get; set; } [Category("FTP"), Description("URL = HttpHomePath + SubFolderPath + FileName\r\nIf HttpHomePath is empty then URL = Host + SubFolderPath + FileName\r\n%host = Host")] @@ -127,9 +127,9 @@ public FTPAccount() Name = "New account"; Host = "host"; Port = 21; - ServerProtocol = ServerProtocol.Ftp; + ServerProtocol = ServerProtocol.ftp; SubFolderPath = string.Empty; - BrowserProtocol = BrowserProtocol.Http; + BrowserProtocol = BrowserProtocol.http; HttpHomePath = string.Empty; HttpHomePathAutoAddSubFolderPath = true; HttpHomePathNoExtension = false; diff --git a/UploadersLib/FileUploaders/Localhost/LocalhostAccount.cs b/UploadersLib/FileUploaders/Localhost/LocalhostAccount.cs index 3be40ac21..07e76be23 100644 --- a/UploadersLib/FileUploaders/Localhost/LocalhostAccount.cs +++ b/UploadersLib/FileUploaders/Localhost/LocalhostAccount.cs @@ -61,7 +61,7 @@ public class LocalhostAccount : ICloneable [Category("Localhost"), Description("Don't add file extension to URL"), DefaultValue(false)] public bool HttpHomePathNoExtension { get; set; } - [Category("Localhost"), Description("Choose an appropriate protocol to be accessed by the browser. Use 'file' for Shared Folders. RemoteProtocol will always be 'file' if HTTP Home Path is empty. "), DefaultValue(BrowserProtocol.File)] + [Category("Localhost"), Description("Choose an appropriate protocol to be accessed by the browser. Use 'file' for Shared Folders. RemoteProtocol will always be 'file' if HTTP Home Path is empty. "), DefaultValue(BrowserProtocol.file)] public BrowserProtocol RemoteProtocol { get; set; } [Category("Localhost"), Description("file://Host:Port"), Browsable(false)] @@ -107,7 +107,7 @@ public LocalhostAccount() HttpHomePath = string.Empty; HttpHomePathAutoAddSubFolderPath = true; HttpHomePathNoExtension = false; - RemoteProtocol = BrowserProtocol.File; + RemoteProtocol = BrowserProtocol.file; } public string GetSubFolderPath() @@ -154,7 +154,7 @@ public string GetUriPath(string filename) if (string.IsNullOrEmpty(httpHomePath)) { - RemoteProtocol = BrowserProtocol.File; + RemoteProtocol = BrowserProtocol.file; path = LocalUri.Replace("file://", ""); } else diff --git a/UploadersLib/FileUploaders/SFTP.cs b/UploadersLib/FileUploaders/SFTP.cs index 85958262f..0baacdf75 100644 --- a/UploadersLib/FileUploaders/SFTP.cs +++ b/UploadersLib/FileUploaders/SFTP.cs @@ -145,16 +145,7 @@ public bool DirectoryExists(string path) { if (Connect()) { - try - { - string workingDirectory = client.WorkingDirectory; - client.ChangeDirectory(path); - client.ChangeDirectory(workingDirectory); - return true; - } - catch (SftpPathNotFoundException) - { - } + return client.Exists(path); } return false; @@ -171,6 +162,7 @@ public List CreateMultiDirectory(string path) if (!DirectoryExists(directory)) { CreateDirectory(directory); + DebugHelper.WriteLine("FTP directory created: " + path); directoryList.Add(directory); } } diff --git a/UploadersLib/GUI/UploadersConfigForm.Designer.cs b/UploadersLib/GUI/UploadersConfigForm.Designer.cs index edb5b9bf8..c7946995a 100644 --- a/UploadersLib/GUI/UploadersConfigForm.Designer.cs +++ b/UploadersLib/GUI/UploadersConfigForm.Designer.cs @@ -1715,7 +1715,7 @@ private void InitializeComponent() this.ucFTPAccounts.Location = new System.Drawing.Point(8, 40); this.ucFTPAccounts.Margin = new System.Windows.Forms.Padding(4); this.ucFTPAccounts.Name = "ucFTPAccounts"; - this.ucFTPAccounts.Size = new System.Drawing.Size(792, 516); + this.ucFTPAccounts.Size = new System.Drawing.Size(792, 416); this.ucFTPAccounts.TabIndex = 6; // // tpMega diff --git a/UploadersLib/GUI/UploadersConfigForm.cs b/UploadersLib/GUI/UploadersConfigForm.cs index 4f0a36f72..318d75dd5 100644 --- a/UploadersLib/GUI/UploadersConfigForm.cs +++ b/UploadersLib/GUI/UploadersConfigForm.cs @@ -1228,7 +1228,7 @@ private void FTPAccountDuplicateButton_Click(object sender, EventArgs e) private void FTPAccountTestButton_Click(object sender, EventArgs e) { - TestFTPAccount(Config.FTPAccountList[ucFTPAccounts.lbAccounts.SelectedIndex]); + TestFTPAccountAsync(Config.FTPAccountList[ucFTPAccounts.lbAccounts.SelectedIndex]); } private void FtpAccountSettingsGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) diff --git a/UploadersLib/GUI/UploadersConfigFormHelper.cs b/UploadersLib/GUI/UploadersConfigFormHelper.cs index 645acd023..6251518e9 100644 --- a/UploadersLib/GUI/UploadersConfigFormHelper.cs +++ b/UploadersLib/GUI/UploadersConfigFormHelper.cs @@ -895,7 +895,7 @@ private void FTPOpenClient() { if (CheckFTPAccounts()) { - //new FTPClientForm(Config.FTPAccountList[ucFTPAccounts.lbAccounts.SelectedIndex]).Show(); + new FTPClientForm(Config.FTPAccountList[ucFTPAccounts.lbAccounts.SelectedIndex]).Show(); } }