/// <summary> /// Clone the current object. /// </summary> /// <returns></returns> public virtual FtpItem Clone() { FtpItem c = new FtpItem(_name, _modified, _size, _itemType, _attributes, _mode, _symbolicLink, _rawText); return(c); }
/// <summary> /// Convert an FtpItem to a ClientItem /// </summary> private static ClientItem ConvertItem(FtpItem f) { var fullPath = f.FullPath; if (fullPath.StartsWith("./")) { var cwd = WorkingDirectory; var wd = cwd.Equals("/") || cwd.Equals(Profile.HomePath)? cwd : Common.GetCommonPath(cwd, false); fullPath = fullPath.Substring(2); if (wd != "/") fullPath = string.Format("{0}/{1}", wd, fullPath); } return new ClientItem { Name = f.Name, FullPath = fullPath, Type = _ItemTypeOf(f.ItemType), Size = f.Size, LastWriteTime = f.Modified }; }
/// <summary> /// Convert an FtpItem to a ClientItem /// </summary> private ClientItem ConvertItem(FtpItem f) { var fullPath = f.FullPath; if (fullPath.StartsWith("./")) { var cwd = WorkingDirectory; var wd = (controller.Paths.Remote != null && cwd.StartsWithButNotEqual(controller.Paths.Remote) && cwd != "/") ? cwd : controller.GetCommonPath(cwd, false); fullPath = fullPath.Substring(2); if (wd != "/") fullPath = string.Format("/{0}/{1}", wd, fullPath); fullPath = fullPath.Replace("//", "/"); } return new ClientItem { Name = f.Name, FullPath = fullPath, Type = _ItemTypeOf(f.ItemType), Size = f.Size, LastWriteTime = f.Modified }; }
public static void FtpRecursiveListInside(FtpItem f, ref List<ClientItem> list) { if (f.ItemType != FtpItemType.Directory) return; list.Add(new ClientItem(f.Name, f.FullPath, _ItemTypeOf(f.ItemType), f.Size, f.Modified)); //TODO: get this shit working #region not yet /* string cd = WorkingDirectory; string fpath = (f.FullPath.StartsWith("./")) ? f.FullPath.Substring(2) : f.FullPath; Log.Write(l.Client, "Listing recursively inside: {0}", fpath); ftpc.ChangeDirectoryMultiPath(f.FullPath); //Log.Write(l.Client, "Recursive listing inside: {0}", path); foreach (FtpItem fi in ftpc.GetDirListDeep(".")) { if (Common.ParentFolderHasSpace(Common.GetComPath(fi.FullPath, false)) && fi.ItemType != FtpItemType.Directory) FtpRecursiveListInside(fi, ref list); else list.Add(new ClientItem(fi.Name, fi.FullPath, _ItemTypeOf(f.ItemType), fi.Size, fi.Modified)); } while (WorkingDirectory != cd) ftpc.ChangeDirectoryUp(); */ #endregion }