Ejemplo n.º 1
0
		private void STOR(string argsText)
		{
            if(m_SessionRejected){
                WriteLine("500 Bad sequence of commands: Session rejected.");

                return;
            }
            if(!this.IsAuthenticated){
				WriteLine("530 Please authenticate firtst !");

				return;
			}
            if(string.IsNullOrEmpty(argsText)){
                WriteLine("501 Invalid file name.");
            }

			/*
				This command causes the server-DTP to transfer a copy of the
				file, specified in the pathname, to the server- or user-DTP
				at the other end of the data connection.  The status and
				contents of the file at the server site shall be unaffected.
			*/

            FTP_e_Stor eArgs = new FTP_e_Stor(argsText);
            OnStor(eArgs);

            // Opearation failed.
            if(eArgs.Error != null){
                foreach(FTP_t_ReplyLine reply in eArgs.Error){
                    WriteLine(reply.ToString());
                }
            }
            // Opearation succeeded.
            else{
                if(eArgs.FileStream == null){
                    WriteLine("500 Internal server error: File stream not provided by server.");

                    return;
                }

                m_pDataConnection = new DataConnection(this,eArgs.FileStream,true);
                m_pDataConnection.Start();
            }
		}
Ejemplo n.º 2
0
 /// <summary>
 /// Raises <b>Stor</b> event.
 /// </summary>
 /// <param name="e">Event data.</param>
 private void OnStor(FTP_e_Stor e)
 {
     if(this.Stor != null){
         this.Stor(this,e);
     }
 }