Inheritance: RemObjects.InternetPack.Ftp.FtpSession
Esempio n. 1
0
        public override void DeleteFile(String fileName, VirtualFtpSession session)
        {
            if (!HasFile(fileName))
            {
                throw new FtpException(String.Format("A file named \"{0}\" does not exists.", fileName));
            }

            if (!AllowDeleteItems(session))
            {
                throw new FtpException(550, String.Format("Cannot delete fike \"{0}\", permission to delete from this folder denied.", fileName));
            }

            IFtpFile lFile = GetFile(fileName, session);

            if (!lFile.AllowDelete(session))
            {
                throw new FtpException(550, String.Format("Cannot delete file \"{0}\", permission to delete file denied.", fileName));
            }

            lock (this)
            {
                lFile.Invalidate();
                FileList.Remove(fileName.ToLower());
            }
        }
Esempio n. 2
0
        public override void DeleteFolder(String folder, Boolean recursive, VirtualFtpSession session)
        {
            if (!HasSubfolder(folder))
            {
                throw new FtpException(String.Format("A folder named \"{0}\" does not exists.", folder));
            }

            if (!AllowDeleteItems(session))
            {
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete from this folder denied.", folder));
            }

            IFtpFolder lFolder = GetSubFolder(folder, session);

            if (!lFolder.AllowDeleteThis(session))
            {
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete folder denied.", folder));
            }

            lock (this)
            {
                lFolder.Invalidate();
                SubFolderList.Remove(folder.ToLower());
            }
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        lListingItem.GroupWrite = GroupWrite;
        lListingItem.GroupExec = false;
        lListingItem.OtherRead = WorldRead;
        lListingItem.OtherWrite = WorldWrite;
        lListingItem.OtherExec = false;
      }
Esempio n. 5
0
    {
      if (aFullPath.Length == 0) 
        return this;
      
      int p = aFullPath.IndexOf('/');
      if (p >= 0)
      {
        string lSubFolder = aFullPath.Substring(0,p);

        IFtpFolder lFolder = GetSubFolder(lSubFolder, aSession);

        if (lFolder != null)
        {
          aFullPath = aFullPath.Substring(p+1);
          return lFolder.DigForSubFolder(aFullPath, aSession);
        }  

        else
        {
          return null;
        }
      }
      else 
      {
        return GetSubFolder(aFullPath, aSession);
      }
    }
    public void FindBaseFolderForFilename(string aPath, out IFtpFolder aFolder, out string aFilename, VirtualFtpSession aSession)
    {
Esempio n. 6
0
        protected override void InvokeOnGetListing(FtpGetListingArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            lSession.CurrentFolder.ListFolderItems(e.Listing);

            base.InvokeOnGetListing(e);
        }
Esempio n. 7
0
    }
  }

  public class UserManager: Hashtable, IFtpUserManager
	{
		public UserManager(): base ()
		{
		}
Esempio n. 8
0
 public sealed override IFtpFolder CreateFolder(String folder, VirtualFtpSession session)
 {
     if (!AllowMkDir(session))
     {
         throw new FtpException(550, String.Format("Cannot create folder \"{0}\", permission to mkdir in this folder denied.", folder));
     }
     return(DoCreateFolder(folder, session));
 }
Esempio n. 9
0
        public sealed override IFtpFile CreateFile(String fileName, VirtualFtpSession session)
        {
            if (!AllowPut(session))
            {
                throw new FtpException(550, String.Format("Cannot create file \"{0}\", permission to upload to this folder denied.", fileName));
            }

            return(DoCreateFile(fileName, session));
        }
Esempio n. 10
0
        protected override void InvokeOnCanStoreFile(FtpTransferEventArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            IFtpFolder lFolder;
            String     lFilename;

            lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession);

            e.Ok = lFolder.AllowPut(lSession);
        }
Esempio n. 11
0
 public override bool HasSubfolder(string aFolderName)
 {
   return SubFolderList.ContainsKey(aFolderName.ToLower());
 }
 public override bool HasFile(string aFileame)
 {
   return FileList.ContainsKey(aFileame.ToLower());
 }
 #endregion
            
 #region Get*
Esempio n. 12
0
 #region Get*
 public override IFtpFolder GetSubFolder(string aFolderName, VirtualFtpSession aSession)
 {
   if (!AllowBrowse(aSession))
     throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to access items in this folder denied.",aFolderName));
   
   IFtpFolder lFolder = SubFolderList[aFolderName.ToLower()] as IFtpFolder;
   if (lFolder != null && !lFolder.AllowBrowse(aSession))
     throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to browse folder denied.",aFolderName));
   return lFolder;
 }
Esempio n. 13
0
        protected override void InvokeOnUserLogin(FtpUserLoginEventArgs e)
        {
            if (UserManager == null)
            {
                return;
            }

            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            e.LoginOk = UserManager.CheckLogin(e.UserName, e.Password, lSession);
            base.InvokeOnUserLogin(e);
        }
Esempio n. 14
0
        protected override void InvokeOnRename(FtpRenameEventArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            IFtpFolder lFolder;
            String     lFilename;

            lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession);

            lFolder.RenameFileOrFolder(lFilename, e.NewFileName, lSession);
            e.Ok = true;
        }
Esempio n. 15
0
        public virtual Boolean CheckLogin(String username, String password, VirtualFtpSession session)
        {
            User lUser = (User)this[username.ToLower()];

            if (lUser == null)
                return false;

            if (lUser.Password != password)
                return false;

            return true;
        }
Esempio n. 16
0
        protected override void InvokeOnMakeDirectory(FtpFileEventArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            IFtpFolder lFolder;
            String     lFilename;

            lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession);

            lFolder.CreateFolder(lFilename, lSession);
            e.Ok = true;
        }
Esempio n. 17
0
        protected override void InvokeOnCanRetrieveFile(FtpTransferEventArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            IFtpFolder lFolder;
            String     lFilename;

            lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession);

            IFtpFile lFile = lFolder.GetFile(lFilename, lSession);

            e.Ok = (lFile != null && lFile.AllowRead(lSession));
        }
Esempio n. 18
0
        public override IFtpFolder GetSubFolder(String folder, VirtualFtpSession session)
        {
            if (!AllowBrowse(session))
            {
                throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to access items in this folder denied.", folder));
            }

            if (!HasSubfolder(folder))
            {
                throw new FtpException(550, String.Format("A folder named \"{0}\" does not exist.", folder));
            }

            return(new DiscFolder(this, folder, Path.Combine(LocalPath, folder)));
        }
Esempio n. 19
0
        public override IFtpFolder GetSubFolder(String folder, VirtualFtpSession session)
        {
            //if (!AllowBrowse(session))
            //    throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to access items in this folder denied.", folder));

            IFtpFolder lFolder = SubFolderList[folder.ToLower()] as IFtpFolder;

            if (lFolder != null && !lFolder.AllowBrowse(session))
            {
                throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to browse folder denied.", folder));
            }

            return(lFolder);
        }
Esempio n. 20
0
        public override void DeleteFolder(String folder, Boolean recursive, VirtualFtpSession session)
        {
            if (!AllowDeleteItems(session))
            {
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete from this folder denied.", folder));
            }

            if (!HasSubfolder(folder))
            {
                throw new FtpException(550, String.Format("A folder named \"{0}\" does not exist.", folder));
            }

            Directory.Delete(Path.Combine(LocalPath, folder), recursive);
        }
Esempio n. 21
0
        protected override void InvokeOnRetrieveFile(FtpTransferEventArgs e)
        {
            VirtualFtpSession lSession = (VirtualFtpSession)e.Session;

            IFtpFolder lFolder;
            String     lFilename;

            lSession.CurrentFolder.FindBaseFolderForFilename(e.FileName, out lFolder, out lFilename, lSession);

            IFtpFile lFile = lFolder.GetFile(lFilename, lSession);

            lFile.GetFile(e.DataChannel);
            e.Ok = true;
        }
Esempio n. 22
0
        public override IFtpFile GetFile(String filename, VirtualFtpSession session)
        {
            if (!AllowGet(session))
            {
                throw new FtpException(550, String.Format("Cannot retrieve file \"{0}\", permission to get files from this folder denied.", filename));
            }

            if (!HasFile(filename))
            {
                throw new FtpException(550, String.Format("A file named \"{0}\" does not exist.", filename));
            }

            return(new DiscFile(this, filename, Path.Combine(LocalPath, filename)));
        }
Esempio n. 23
0
        public override IFtpFile CreateFile(String filename, VirtualFtpSession session)
        {
            if (!AllowPut(session))
            {
                throw new FtpException(550, String.Format("Cannot upload file \"{0}\", permission to upload files to this folder denied.", filename));
            }

            if (HasFile(filename))
            {
                throw new FtpException(550, String.Format("A file named \"{0}\" already exist.", filename));
            }

            return(new DiscFile(this, filename, Path.Combine(LocalPath, filename)));
        }
Esempio n. 24
0
        public override void DeleteFile(String filename, VirtualFtpSession session)
        {
            if (!AllowDeleteItems(session))
            {
                throw new FtpException(550, String.Format("Cannot delete file \"{0}\", permission to delete from this folder denied.", filename));
            }

            if (!HasFile(filename))
            {
                throw new FtpException(550, String.Format("A file named \"{0}\" does not exist.", filename));
            }

            File.Delete(Path.Combine(LocalPath, filename));
        }
Esempio n. 25
0
        public override IFtpFolder CreateFolder(String folder, VirtualFtpSession session)
        {
            if (!AllowMkDir(session))
            {
                throw new FtpException(550, String.Format("Cannot create folder \"{0}\", permission to mkdir in this folder denied.", folder));
            }

            if (HasSubfolder(folder))
            {
                throw new FtpException(550, String.Format("A folder named \"{0}\" already exist.", folder));
            }

            Directory.CreateDirectory(Path.Combine(LocalPath, folder));
            return(new DiscFolder(this, folder, Path.Combine(LocalPath, folder)));
        }
Esempio n. 26
0
		public virtual Boolean AllowRead(VirtualFtpSession session)
		{
			if (Invalid)
				return false;

			if (session.IsFileAdmin)
				return true;

			if (session.Username == OwningUser && UserRead)
				return true;

			if (WorldRead)
				return true;

			return false;
		}
Esempio n. 27
0
        public virtual Boolean CheckLogin(String username, String password, VirtualFtpSession session)
        {
            User lUser = (User)this[username.ToLower()];

            if (lUser == null)
            {
                return(false);
            }

            if (lUser.Password != password)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 28
0
 public override IFtpFile GetFile(string aFilename, VirtualFtpSession aSession)
 {
   if (!HasFile(aFilename))
     throw new FtpException(String.Format("A file named \"{0}\" does not exists.",aFilename));
   if (!AllowBrowse(aSession))
     throw new FtpException(550,String.Format("Cannot access file \"{0}\", permission to access files in this folder denied.",aFilename));
   
   IFtpFile lFile = FileList[aFilename.ToLower()] as IFtpFile;
   if (!lFile.AllowRead(aSession))
     throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access file denied.",aFilename));
   return lFile;
 }
 #endregion
 #region Create*
 public override sealed IFtpFolder CreateFolder(string aFolderName, VirtualFtpSession aSession)
 {
   if (!AllowMkDir(aSession))
     throw new FtpException(550, String.Format("Cannot create folder \"{0}\", permission to mkdir in this folder denied.",aFolderName));
   return DoCreateFolder(aFolderName, aSession);
Esempio n. 29
0
        protected override IFtpFile DoCreateFile(string aFilename, VirtualFtpSession aSession)
        {
            if (HasFile(aFilename))
            {
                throw new FtpException(String.Format("Cannot create file \"{0}\", a file with this name already exists.", aFilename));
            }

            if (!AllowMkDir(aSession))
            {
                throw new FtpException(550, String.Format("Cannot create file \"{0}\", permission denied.", aFilename));
            }

            SecureFile lFile = new SecureFile(this, aFilename, fStorage);

            lFile.OwningUser = aSession.Username;

            Add(lFile);
            return(lFile);
        }
Esempio n. 30
0
        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  = RootFolder.DigForSubFolder(lPath.Substring(1), lSession);

            if (lFolder != null)
            {
                ((VirtualFtpSession)e.Session).CurrentFolder = lFolder;
            }

            e.ChangeDirOk = (lFolder != null);
            base.InvokeOnChangeDirectory(e);
        }
Esempio n. 31
0
        protected override IFtpFolder DoCreateFolder(string aFolderName, VirtualFtpSession aSession)
        {
            lock (this)
            {
                if (HasSubfolder(aFolderName))
                {
                    throw new FtpException(String.Format("Cannot create folder named \"{0}\", a folder with this name already exists.", aFolderName));
                }

                if (!AllowMkDir(aSession))
                {
                    throw new FtpException(550, String.Format("Cannot create folder named \"{0}\", permission denied.", aFolderName));
                }

                IFtpFolder lFolder = new SecureFolder(this, aFolderName, fStorage);
                lFolder.OwningUser = aSession.Username;
                Add(lFolder);
                return(lFolder);
            }
        }
Esempio n. 32
0
      get { return fSubFolderList; }
    }

    #region IFtpFolder implementation

    public abstract IEnumerable SubFolders { get ; }
    public abstract IEnumerable Files { get ; }
    public abstract bool HasSubfolder(string aFolderName);
    public abstract IFtpFolder GetSubFolder(string aFolderName, VirtualFtpSession aSession);
    public abstract IFtpFolder CreateFolder(string aFolderName, VirtualFtpSession aSession);
    public abstract void DeleteFolder(string aFolderName, bool aRecursive, VirtualFtpSession aSession);
    
    public abstract bool HasFile(string aFileame);
    public abstract IFtpFile GetFile(string aFilename, VirtualFtpSession aSession);
    public abstract IFtpFile CreateFile(string aFilename, VirtualFtpSession aSession);
    public abstract void DeleteFile(string aFilename, VirtualFtpSession aSession);
    public abstract void RenameFileOrFolder(string aOldFilename, string aNewFilename, VirtualFtpSession aSession);
    public abstract void RemoveItem(IFtpItem aItem);
               
    public IFtpFolder DigForSubFolder(string aFullPath, VirtualFtpSession aSession)
    {
Esempio n. 33
0
        public override IFtpFile GetFile(String fileName, VirtualFtpSession session)
        {
            if (!HasFile(fileName))
            {
                throw new FtpException(String.Format("A file named \"{0}\" does not exists.", fileName));
            }

            if (!AllowBrowse(session))
            {
                throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access files in this folder denied.", fileName));
            }

            IFtpFile lFile = FileList[fileName.ToLower()] as IFtpFile;

            if ((lFile == null) || !lFile.AllowRead(session))
            {
                throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access file denied.", fileName));
            }

            return(lFile);
        }
Esempio n. 34
0
        public virtual Boolean AllowWrite(VirtualFtpSession session)
        {
            if (Invalid)
            {
                return(false);
            }

            if (session.IsFileAdmin)
            {
                return(true);
            }

            if (session.Username == OwningUser && UserWrite)
            {
                return(true);
            }

            if (WorldWrite)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 35
0
        public virtual Boolean AllowRead(VirtualFtpSession session)
        {
            if (Invalid)
            {
                return(false);
            }

            if (session.IsFileAdmin)
            {
                return(true);
            }

            if (session.Username.ToLower().Equals(OwningUser.ToLower()) && UserRead)
            {
                return(true);
            }

            if (WorldRead)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 36
0
        int p = aPath.IndexOf('/');
Esempio n. 37
0
 while (p >= 0)
 {
Esempio n. 38
0
   aPath = aPath.Substring(1); /* remove / */
 }
Esempio n. 39
0
 else
 {
Esempio n. 40
0
 protected virtual IFtpFile DoCreateFile(String filename, VirtualFtpSession session)
 {
     throw new FtpException(550, String.Format("You cannot create files in a {0}.", this.GetType().Name));
 }
Esempio n. 41
0
        public override IFtpFile GetFile(String filename, VirtualFtpSession session)
        {
            if (!HasFile(filename))
                throw new FtpException(String.Format("A file named \"{0}\" does not exists.", filename));

            if (!AllowBrowse(session))
                throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access files in this folder denied.", filename));

            IFtpFile lFile = FileList[filename.ToLower()] as IFtpFile;
            if (!lFile.AllowRead(session))
                throw new FtpException(550, String.Format("Cannot access file \"{0}\", permission to access file denied.", filename));

            return lFile;
        }
Esempio n. 42
0
 get { return fSubFolderList; }
Esempio n. 43
0
        public override void RenameFileOrFolder(String oldFileName, String newFileName, VirtualFtpSession session)
        {
            if (HasSubfolder(oldFileName))
            {
                if (!AllowRenameItems(session))
                {
                    throw new FtpException(550, String.Format("Cannot rename folder \"{0}\", permission to rename in this folder denied.", oldFileName));
                }
            }
            else if (HasFile(oldFileName))
            {
                if (!AllowRenameItems(session))
                {
                    throw new FtpException(550, String.Format("Cannot rename file \"{0}\", permission to rename in this folder denied.", oldFileName));
                }

                IFtpFile lFile = GetFile(oldFileName, session);
                if (!lFile.AllowRename(session))
                {
                    throw new FtpException(550, String.Format("Cannot rename file \"{0}\", permission to rename file denied.", oldFileName));
                }

                lock (this)
                {
                    lFile.Name = newFileName;
                }
            }
            else
            {
                throw new FtpException(String.Format("A file or folder named \"{0}\" does not exists.", oldFileName));
            }
        }
Esempio n. 44
0
 protected override IFtpFolder DoCreateFolder(string aFolderName, VirtualFtpSession aSession)
 {
   lock(this)
   {
     if (HasSubfolder(aFolderName))
Esempio n. 45
0
   throw new FtpException(String.Format("Cannot create folder named \"{0}\", a folder with this name already exists.",aFolderName));
 if (!AllowMkDir(aSession))
   throw new FtpException(550, String.Format("Cannot create folder named \"{0}\", permission denied.",aFolderName));
Esempio n. 46
0
        public override IFtpFolder GetSubFolder(String folder, VirtualFtpSession session)
        {
            if (!AllowBrowse(session))
                throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to access items in this folder denied.", folder));

            IFtpFolder lFolder = SubFolderList[folder.ToLower()] as IFtpFolder;
            if (lFolder != null && !lFolder.AllowBrowse(session))
                throw new FtpException(550, String.Format("Cannot access folder \"{0}\", permission to browse folder denied.", folder));

            return lFolder;
        }
Esempio n. 47
0
        public override void DeleteFile(String filename, VirtualFtpSession session)
        {
            if (!HasFile(filename))
                throw new FtpException(String.Format("A file named \"{0}\" does not exists.", filename));

            if (!AllowDeleteItems(session))
                throw new FtpException(550, String.Format("Cannot delete fike \"{0}\", permission to delete from this folder denied.", filename));

            IFtpFile lFile = GetFile(filename, session);
            if (!lFile.AllowDelete(session))
                throw new FtpException(550, String.Format("Cannot delete file \"{0}\", permission to delete file denied.", filename));

            lock (this)
            {
                lFile.Invalidate();
                FileList.Remove(filename.ToLower());
            }
        }
Esempio n. 48
0
        public override void DeleteFolder(String folder, Boolean recursive, VirtualFtpSession session)
        {
            if (!HasSubfolder(folder))
                throw new FtpException(String.Format("A folder named \"{0}\" does not exists.", folder));

            if (!AllowDeleteItems(session))
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete from this folder denied.", folder));

            IFtpFolder lFolder = GetSubFolder(folder, session);
            if (!lFolder.AllowDeleteThis(session))
                throw new FtpException(550, String.Format("Cannot delete folder \"{0}\", permission to delete folder denied.", folder));

            lock (this)
            {
                lFolder.Invalidate();
                SubFolderList.Remove(folder.ToLower());
            }
        }
Esempio n. 49
0
        public virtual Boolean AllowWrite(VirtualFtpSession session)
        {
            if (Invalid)
                return false;

            if (session.IsFileAdmin)
                return true;

            if (session.Username.ToLower().Equals(OwningUser.ToLower()) && UserWrite)
                return true;

            if (WorldWrite)
                return true;

            return false;
        }
Esempio n. 50
0
 protected virtual IFtpFolder DoCreateFolder(String folder, VirtualFtpSession session)
 {
     throw new FtpException(550, String.Format("You cannot create subfolders in a {0}.", this.GetType().Name));
 }
Esempio n. 51
0
        public override IFtpFile GetFile(String filename, VirtualFtpSession session)
        {
            if (!AllowGet(session))
                throw new FtpException(550, String.Format("Cannot retrieve file \"{0}\", permission to get files from this folder denied.", filename));

            if (!HasFile(filename))
                throw new FtpException(550, String.Format("A file named \"{0}\" does not exist.", filename));

            return new DiscFile(this, filename, Path.Combine(LocalPath, filename));
        }
Esempio n. 52
0
        public override sealed IFtpFile CreateFile(String filename, VirtualFtpSession session)
        {
            if (!AllowPut(session))
                throw new FtpException(550, String.Format("Cannot create file \"{0}\", permission to upload to this folder denied.", filename));

            return DoCreateFile(filename, session);
        }
Esempio n. 53
0
 protected virtual IFtpFile DoCreateFile(String fileName, VirtualFtpSession session)
 {
     throw new FtpException(550, String.Format("You cannot create files in a {0}.", this.GetType().Name));
 }
Esempio n. 54
0
 protected virtual IFtpFolder DoCreateFolder(String folder, VirtualFtpSession session)
 {
     throw new FtpException(550, String.Format("You cannot create subfolders in a {0}.", this.GetType().Name));
 }
Esempio n. 55
0
        public override IFtpFile CreateFile(String filename, VirtualFtpSession session)
        {
            if (!AllowPut(session))
                throw new FtpException(550, String.Format("Cannot upload file \"{0}\", permission to upload files to this folder denied.", filename));

            if (HasFile(filename))
                throw new FtpException(550, String.Format("A file named \"{0}\" already exist.", filename));

            return new DiscFile(this, filename, Path.Combine(LocalPath, filename));
        }
Esempio n. 56
0
 public override sealed IFtpFolder CreateFolder(String folder, VirtualFtpSession session)
 {
     if (!AllowMkDir(session))
         throw new FtpException(550, String.Format("Cannot create folder \"{0}\", permission to mkdir in this folder denied.", folder));
     return DoCreateFolder(folder, session);
 }
Esempio n. 57
0
 public override void RenameFileOrFolder(String oldFilename, String newFilename, VirtualFtpSession session)
 {
 }
Esempio n. 58
0
 aFolder = Root;
 aPath = aPath.Substring(1); /* remove / */
Esempio n. 59
0
        public override void DeleteFile(String filename, VirtualFtpSession session)
        {
            if (!AllowDeleteItems(session))
                throw new FtpException(550, String.Format("Cannot delete file \"{0}\", permission to delete from this folder denied.", filename));

            if (!HasFile(filename))
                throw new FtpException(550, String.Format("A file named \"{0}\" does not exist.", filename));

            File.Delete(Path.Combine(LocalPath, filename));
        }
Esempio n. 60
0
 public override void RenameFileOrFolder(String oldFilename, String newFilename, VirtualFtpSession session)
 {
 }