예제 #1
0
 /// <summary>Raise the <see cref="RenamingFile"/> event.</summary>
 /// <param name="e">Event arguments.</param>
 protected internal void RaiseRenamingFile(FTPFileRenameEventArgs e)
 {
     if (areEventsEnabled && RenamingFile != null)
         InvokeEventHandler(RenamingFile, this, e);
 }
예제 #2
0
 protected internal void RaiseRenamedFile(FTPFileRenameEventArgs e)
 {
     if (this.areEventsEnabled && (this.RenamedFile != null))
     {
         this.InvokeEventHandler(this.RenamedFile, this, e);
     }
 }
예제 #3
0
 /// <summary>
 /// Called when a file is about to be renamed.
 /// </summary>
 /// <param name="from">Current name.</param>
 /// <param name="to">New name.</param>
 /// <returns><c>true</c> if the operation is to continue.</returns>
 protected virtual bool OnRenaming(string from, string to)
 {
     if (areEventsEnabled && RenamingFile != null)
     {
         if (!PathUtil.IsAbsolute(from))
             from = PathUtil.Combine(ServerDirectory, from);
         if (!PathUtil.IsAbsolute(to))
             to = PathUtil.Combine(ServerDirectory, to);
         FTPFileRenameEventArgs e = new FTPFileRenameEventArgs(true, from, to, false, null);
         RaiseRenamingFile(e);
         return !e.Cancel;
     }
     else
         return true;
 }
예제 #4
0
 protected virtual bool OnRenaming(string from, string to)
 {
     if (!this.areEventsEnabled || (this.RenamingFile == null))
     {
         return true;
     }
     if (!PathUtil.IsAbsolute(from))
     {
         from = PathUtil.Combine(this.ServerDirectory, from);
     }
     if (!PathUtil.IsAbsolute(to))
     {
         to = PathUtil.Combine(this.ServerDirectory, to);
     }
     FTPFileRenameEventArgs e = new FTPFileRenameEventArgs(true, from, to, false, null);
     this.RaiseRenamingFile(e);
     return !e.Cancel;
 }