public IFtpFolder DigForSubFolder(String fullPath, VirtualFtpSession session) { if (fullPath.Length == 0) { return(this); } Int32 lSeparatorIndex = fullPath.IndexOf('/'); if (lSeparatorIndex < 0) { return(this.GetSubFolder(fullPath, session)); } String lSubFolder = fullPath.Substring(0, lSeparatorIndex); IFtpFolder lFolder = GetSubFolder(lSubFolder, session); if (lFolder == null) { return(null); } fullPath = fullPath.Substring(lSeparatorIndex + 1); return(lFolder.DigForSubFolder(fullPath, session)); }
protected override void InvokeOnChangeDirectory(FtpChangeDirectoryArgs e) { String lPath = e.NewDirectory; if (lPath.IndexOf('/') != 0) { throw new Exception(String.Format("Not an absolute path: \"{0}\"", lPath)); } VirtualFtpSession lSession = (VirtualFtpSession)e.Session; IFtpFolder lFolder = fRootFolder.DigForSubFolder(lPath.Substring(1), lSession); if (lFolder != null) { ((VirtualFtpSession)e.Session).CurrentFolder = lFolder; } e.ChangeDirOk = (lFolder != null); base.InvokeOnChangeDirectory(e); }