Beispiel #1
0
        public override void DoListFolderItems(FtpListing listing)
        {
            String[] lNames = Directory.GetDirectories(LocalPath);

            foreach (String name in lNames)
            {
                FtpListingItem lListingItem = listing.Add();
                lListingItem.Directory  = true;
                lListingItem.FileName   = Path.GetFileName(name);
                lListingItem.FileDate   = Directory.GetLastWriteTime(Path.Combine(LocalPath, name));
                lListingItem.Size       = 0;
                lListingItem.User       = "******";
                lListingItem.Group      = "system";
                lListingItem.UserRead   = UserRead;
                lListingItem.UserWrite  = UserWrite;
                lListingItem.UserExec   = UserRead;
                lListingItem.GroupRead  = GroupRead;
                lListingItem.GroupWrite = GroupWrite;
                lListingItem.GroupExec  = GroupRead;
                lListingItem.OtherRead  = WorldRead;
                lListingItem.OtherWrite = WorldWrite;
                lListingItem.OtherExec  = WorldRead;
            }

            DirectoryInfo lDirectory = new DirectoryInfo(LocalPath);

            FileInfo[] lFiles = lDirectory.GetFiles();
            foreach (FileInfo file in lFiles)
            {
                FtpListingItem lListingItem = listing.Add();
                lListingItem.Directory  = false;
                lListingItem.FileName   = file.Name;
                lListingItem.FileDate   = file.LastWriteTime;
                lListingItem.Size       = file.Length;
                lListingItem.User       = "******";
                lListingItem.Group      = "system";
                lListingItem.UserRead   = UserRead;
                lListingItem.UserWrite  = UserWrite;
                lListingItem.UserExec   = false;
                lListingItem.GroupRead  = GroupRead;
                lListingItem.GroupWrite = GroupWrite;
                lListingItem.GroupExec  = false;
                lListingItem.OtherRead  = WorldRead;
                lListingItem.OtherWrite = WorldWrite;
                lListingItem.OtherExec  = false;
            }

            AddListingItems(listing, SubFolders);
            AddListingItems(listing, Files);
        }
Beispiel #2
0
        public override void DoListFolderItems(FtpListing listing)
        {
            String[] lNames = Directory.GetDirectories(LocalPath);

            foreach (String name in lNames)
            {
                FtpListingItem lListingItem = listing.Add();
                lListingItem.Directory = true;
                lListingItem.FileName = Path.GetFileName(name);
                lListingItem.FileDate = Directory.GetLastWriteTime(Path.Combine(LocalPath, name));
                lListingItem.Size = 0;
                lListingItem.User = "******";
                lListingItem.Group = "system";
                lListingItem.UserRead = UserRead;
                lListingItem.UserWrite = UserWrite;
                lListingItem.UserExec = UserRead;
                lListingItem.GroupRead = GroupRead;
                lListingItem.GroupWrite = GroupWrite;
                lListingItem.GroupExec = GroupRead;
                lListingItem.OtherRead = WorldRead;
                lListingItem.OtherWrite = WorldWrite;
                lListingItem.OtherExec = WorldRead;
            }

            DirectoryInfo lDirectory = new DirectoryInfo(LocalPath);
            FileInfo[] lFiles = lDirectory.GetFiles();
            foreach (FileInfo file in lFiles)
            {
                FtpListingItem lListingItem = listing.Add();
                lListingItem.Directory = false;
                lListingItem.FileName = file.Name;
                lListingItem.FileDate = file.LastWriteTime;
                lListingItem.Size = file.Length;
                lListingItem.User = "******";
                lListingItem.Group = "system";
                lListingItem.UserRead = UserRead;
                lListingItem.UserWrite = UserWrite;
                lListingItem.UserExec = false;
                lListingItem.GroupRead = GroupRead;
                lListingItem.GroupWrite = GroupWrite;
                lListingItem.GroupExec = false;
                lListingItem.OtherRead = WorldRead;
                lListingItem.OtherWrite = WorldWrite;
                lListingItem.OtherExec = false;
            }

            AddListingItems(listing, SubFolders);
            AddListingItems(listing, Files);
        }
Beispiel #3
0
        public void ListFolderItems(FtpListing listing)
        {
            /* Add this folder (.) */
            FtpListingItem lListingItem = listing.Add();

            FillFtpListingItem(lListingItem, ".");

            /* Add parent folder (..) */
            if (Parent != null)
            {
                lListingItem = listing.Add();
                Parent.FillFtpListingItem(lListingItem, "..");
            }

            DoListFolderItems(listing);
        }
Beispiel #4
0
    public string LocalPath
    {
      get { return fLocalPath; }
    }

    public override IEnumerable SubFolders { get { return null; } }
    public override IEnumerable Files { get { return null; } }
    public override void DoListFolderItems(FtpListing aListing)
    {
      string[] lNames = Directory.GetDirectories(LocalPath);
      foreach (string s in lNames)
      {
        FtpListingItem lListingItem = aListing.Add();
        lListingItem.Directory = true;
        lListingItem.FileName = Path.GetFileName(s);
        lListingItem.FileDate = Directory.GetLastWriteTime(Path.Combine(LocalPath,s));
        lListingItem.Size = 0;
        lListingItem.User = "******";
        lListingItem.Group = "system";
        lListingItem.UserRead = UserRead;
        lListingItem.UserWrite = UserWrite;
        lListingItem.UserExec = UserRead;
        lListingItem.GroupRead = GroupRead;
        lListingItem.GroupWrite = GroupWrite;
        lListingItem.GroupExec = GroupRead;
        lListingItem.OtherRead = WorldRead;
        lListingItem.OtherWrite = WorldWrite;
        lListingItem.OtherExec = WorldRead;
      }

      DirectoryInfo lDirectory = new DirectoryInfo(LocalPath);
      FileInfo[] lFiles = lDirectory.GetFiles();
      foreach (FileInfo fi in lFiles)
      {
        FtpListingItem lListingItem = aListing.Add();
        lListingItem.Directory = false;
        lListingItem.FileName = fi.Name;
        lListingItem.FileDate = fi.LastWriteTime;
        lListingItem.Size = fi.Length;
        lListingItem.User = "******";
        lListingItem.Group = "system";
        lListingItem.UserRead = UserRead;
        lListingItem.UserWrite = UserWrite;
        lListingItem.UserExec = false;
        lListingItem.GroupRead = GroupRead;
        lListingItem.GroupWrite = GroupWrite;
Beispiel #5
0
        protected void AddListingItems(FtpListing listing, IEnumerable ftpItems)
        {
            if (ftpItems == null)
            {
                return;
            }

            foreach (IFtpItem item in ftpItems)
            {
                FtpListingItem lListingItem = listing.Add();
                item.FillFtpListingItem(lListingItem);
            }
        }
Beispiel #6
0
          if (aFolder == null || !aFolder.AllowBrowse(aSession))
            throw new FtpException(550, String.Format("Folder \"{0}\" does not exists, or access denied.", aPath));
        
          aPath = aPath.Substring(p+1);
          p = aPath.IndexOf('/');
        }
      }
      else
      {
        aFolder = this;
      }

      aFilename = aPath;
Beispiel #7
0
 public string FullPath 
 { 
   get 
   {
     if (Parent != null)
     {
       return Parent.FullPath+Name+"/";
     }
     else
     {
       return "/";