FTP changes

This commit is contained in:
Jaex 2014-05-30 18:24:43 +03:00
parent 25d5f07f47
commit 739f4243a3
7 changed files with 19 additions and 27 deletions

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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<string> CreateMultiDirectory(string path)
if (!DirectoryExists(directory))
{
CreateDirectory(directory);
DebugHelper.WriteLine("FTP directory created: " + path);
directoryList.Add(directory);
}
}

View file

@ -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

View file

@ -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)

View file

@ -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();
}
}