示例#1
0
        /// <summary>Executes the command</summary>
        /// <param name="args">string array - args </param>
        /// <param name="result"> out bool - result</param>
        /// <returns>returns back a string that describes what the command does</returns>
        public string Execute(string[] args, out bool result)
        {
            // The String Will Return the New Path if result = true, and if not will return the error message
            try
            {
                //First check if there are arguments
                //Adds the gile to the outputDir using the modal.
                string path = args[0];
                if (args.Length == 0)
                {
                    throw new Exception("NO ARGUMENTS");
                }
                //Else ifhecks if the file exists
                else if (File.Exists(path))
                {
                    return(m_modal.AddFile(path, out result));
                }

                //Since nothing has returned, return an empty string.
                result = true;
                string empty = string.Empty;
                return(empty);
            }
            //Catches the exception
            catch (Exception e)
            {
                result = false;
                return(e.ToString());
            }
        }
示例#2
0
 /// <summary>
 /// NewFile recevied into logged folder, we need to execute something (in this case AddFile method)
 /// </summary>
 /// <param name="args">args for the command</param>
 /// <param name="result">reference to result flag to update</param>
 /// <returns>an *error message* / image path (if you use it it will open the image)</returns>
 public string Execute(string[] args, out bool result)
 {
     // The String Will Return the New Path if result = true, and will return the error message otherwise
     // args[0] - since we need only the first parameter
     // out result will update the given result flag to true/false according to AddFile
     return(m_modal.AddFile(args[0], out result));
 }
示例#3
0
 /// <summary>
 /// Executes the specified arguments.
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="result">if set to <c>true</c> [result].</param>
 /// <returns>System.String.</returns>
 public string Execute(string[] args, out bool result)
 {
     {
         // the string will return the new path if result = true,
         //and will return the error message if the result = false
         return(m_modal.AddFile(args[0], out result));
     }
 }
        public string Execute(string[] args, out bool result)
        {
            // The string Will Return the New Path if result = true, and will return the error message
            result = false;
            string filepath = args[0];

            return(m_modal.AddFile(filepath, out result));
        }
示例#5
0
 public string Execute(string[] args, out bool result)
 {
     /// <summary>
     /// executes command to move new file in directory to output directory.
     /// </summary>
     /// <param name="args"> string arguments that include file path to be moved. </param>
     /// <returns> The String Will Return the New Path if result = true, and will return the error message. </returns>
     return(m_modal.AddFile(args[0], out result));
 }
示例#6
0
        public string Execute(string[] args, out bool result)
        {
            string newPath = m_modal.AddFile(args[0], out result);

            if (result)
            {
                return(String.Format(MessageInfrastructure.INFO_AddFileCommandSucc, args[0], newPath)); // Return The Message
            }
            return(newPath);                                                                            // Return The Message
        }
示例#7
0
 /// <summary>
 /// Executing the command add file
 /// </summary>
 /// <param name="args">args for the command</param>
 /// <param name="result">result of the command</param>
 /// <returns></returns>
 public string Execute(string[] args, out bool result)
 {
     try
     {
         return(m_modal.AddFile(args, out result));
     } catch (Exception e)
     {
         result = false;
         return(e.ToString());
     }
 }
示例#8
0
        /// <summary>
        /// Makes a new file in location args[0].
        /// </summary>
        /// <param name="args">The target location is in args[0].</param>
        /// <param name="result">True if the command was executed succsusfully, false otherwise.</param>
        /// <returns>The commands output.</returns>
        public string Execute(string[] args, out bool result)
        {
            string answer = MyModal.AddFile(args[0], out result);

            if (result)
            {
                InformNewFile(this, null);
            }
            // The String Will Return the New Path if result = true, and will return the error message
            return(answer);
        }
示例#9
0
        /*
         * converts the data that we will send to AddFile(...)
         * suppose that args[0] is sourcePath    args[1] is destPath
         * result is true if succedded and false otherwise
         */
        public string Execute(string[] args, out bool result)
        {
            // The String Will Return the New Path if result = true, and will return the error message
            string msg = m_modal.AddFile(args[0], out result);

            if (!result)
            {
                return(msg);
            }
            return(args[0]);
        }
示例#10
0
        public string Execute(string[] args, out bool result)
        {
            if (args.Length < 1)
            {
                result = false;
                return("Ilegal arguments for command");
            }
            string path = args[0];

            return(m_modal.AddFile(path, out result));
        }
示例#11
0
 /// <summary>
 /// executing command
 /// </summary>
 /// <param name="args">args</param>
 /// <param name="result">result of operation. ture in succes and false on failure</param>
 /// <returns>result message</returns>
 public string Execute(string[] args, out bool result)
 {
     try
     {
         // The String Will Return the New Path if result = true, and will return the error message
         return(m_modal.AddFile(args[0], out result));
     } catch (Exception e)
     {
         result = false;
         return(e.ToString());
     }
 }
        /// <summary>
        /// Makes a new file in location args[0].
        /// </summary>
        /// <param name="args">The target location is in args[0].</param>
        /// <param name="result">True if the command was executed succsusfully, false otherwise.</param>
        /// <returns>The commands output.</returns>
        public string Execute(string[] args, out bool result)
        {
            string answer = MyModal.AddFile(args[0], out result);

            if (result)
            {
                InformNewFile(this, new LogChangedEventArgs("", Logging.Modal.MessageTypeEnum.INFO));
                //InformNewFile(this, null); //TODO: this change might not work
            }
            // The String Will Return the New Path if result = true, and will return the error message
            return(answer);
        }
示例#13
0
        public string Execute(string[] args, out bool result)
        {
            // The String Will Return the New Path if result = true else will return the error message
            result = false;
            // args[0] = file path , args[1] = file name
            string newPath = m_modal.AddFile(args[0], args[1], out result);

            if (result == false)
            {
                return("Error: executing new file command has failed");
            }
            return(newPath);
        }
 /// <summary>
 /// The Function That will Execute The command
 /// </summary>
 /// <param name="args"> Arguments to execute command.</param>
 /// <param name="result">Out for result of execution.</param>
 /// <returns></returns>
 public string Execute(string[] args, out bool result)
 {
     //Check if there are enough arguments to add file.
     if (args.Length >= 1)
     {
         return(m_modal.AddFile(args[0], out result));
     }
     else
     {
         //If not, set result to false and return corresponding message.
         result = false;
         return("There are no args for new file command to execute");
     }
 }
示例#15
0
 /// <summary>
 /// Executes the new file command with the specified arguments.
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="result">if set to <c>true</c> [result].</param>
 /// <returns></returns>
 /// <exception cref="Exception">No args received!</exception>
 public string Execute(string[] args, out bool result)
 {
     try {
         if (args.Length == 0)
         {
             throw new Exception("No args received!");
         }
         else if (File.Exists(args[0]))
         {
             return(m_modal.AddFile(args[0], out result));
         }
         result = true;
         return(" ");
     } catch (Exception exeption) {
         result = false;
         return(exeption.ToString());
     }
 }
示例#16
0
 /// <summary>
 /// Execute to the command
 /// </summary>
 /// <param name="args"></param>
 /// <param name="result">if worked</param>
 /// <returns></returns>
 public string Execute(string[] args, out bool result)
 {
     try
     {
         String ret = m_modal.AddFile(args[0], out result);
         // when execue go worng, we get false result
         if (!result)
         {
             throw new Exception("ERROR at exectue");
         }
         return(ret);
     }
     catch (Exception e)
     {
         result = false;
         return(e.ToString());
     }
 }
示例#17
0
 /// <summary>
 /// This function execute the command .
 /// </summary>
 /// <param name="args"> arguments for the command </param>
 /// <param name="result"> result , if the command executed or failed .</param>
 /// <returns> the message of the path , if the command succeed or the exception message if the function failed</returns>
 public string Execute(string[] args, out bool result)
 {
     try
     {
         if (File.Exists(args[0]))
         {
             // The String Will Return the New Path if result = true, and will return the error message
             return(m_modal.AddFile(args[0], out result));
         }
         else
         {
             throw new Exception("Wrong path!");
         }
     }
     catch (Exception e)
     {
         result = false;
         return(e.Message);
     }
 }
示例#18
0
 /// <summary>
 /// the method get an array of strings and a boolean, retuen the new path and the boolean
 /// </summary>
 /// <param name="args">an array of strings that represent the file</param>
 /// <param name="result">a boolean that represent if the method succesed(true) or not(false)</param>
 /// <returns>a string that represent the new path</returns>
 public string Execute(string[] args, out bool result)
 {
     try
     {
         // The String Will Return the New Path if result = true, and will return the error message
         if (args.Length == 0)
         {
             throw new Exception("args is empty");
         }
         else if (File.Exists(args[0]))
         {
             return(m_modal.AddFile(args[0], out result));
         }
         result = true;
         return(args[0].ToString());
     } catch (Exception e)
     {
         result = false;
         return(e.ToString());
     }
 }
示例#19
0
 public string Execute(string[] args, out bool result)
 {
     // The String Will Return the New Path if result = true, and will return the error message
     try
     {
         if (args.Length > 0)
         {
             return(m_modal.AddFile(args[0], out result));
         }
         else
         {
             throw new Exception("Invalid NewFileCommand");
         }
     }
     // addind file did not succeed
     catch (Exception e)
     {
         result = false;
         return(e.Message.ToString());
     }
 }
示例#20
0
 /// <summary>
 /// That function will execute the task of the command.
 /// </summary>
 /// <param name="args">arguments</param>
 /// <param name="result"> tells if the command succeded or not.</param>
 /// <returns>command return a string describes the operartion of the command.</returns>
 public string Execute(string[] args, out bool result)
 {
     // The String Will Return the New Path if result = true, and will return the error message
     try
     {
         if (args.Length == 0)
         {
             throw new Exception("Ars len is 0!");
         }
         else if (File.Exists(args[0]))
         {
             //calls to AddFile method to add the file in the given path to the backup directory.
             return(m_modal.AddFile(args[0], out result));
         }
         result = true;
         return(string.Empty);
     }
     catch (Exception ex)
     {
         result = false;
         return(ex.ToString());
     }
 }
示例#21
0
 /// <summary>
 /// Executes the command.
 /// </summary>
 /// <param name="args">Command arguments</param>
 /// <param name="result">Result variable</param>
 /// <param name="responseBack"></param>
 /// <returns>A result string</returns>
 public string Execute(string[] args, out bool result, out bool responseBack)
 {
     responseBack = false;
     return(_modal.AddFile(args[0], out result));
 }
示例#22
0
        /// <summary>
        /// Executes the add file command.
        /// </summary>
        /// <param name="args"> Arguments. </param>
        /// <param name="result"> Determines wether the adding worked. </param>
        /// <returns></returns>
        public string Execute(string[] args, out bool result)
        {
            string result_ex = m_modal.AddFile(args[0], out result);

            return(result_ex);
        }
示例#23
0
 /// <summary>
 /// Execute a command
 /// </summary>
 /// <param name="args"> the command's argument </param>
 /// <param name="result"> result of executing the wanted command </param>
 /// <returns></returns>
 public string Execute(string[] args, out bool result)
 {
     //return the result of trying to execute the command
     return(m_modal.AddFile(args[0], out result));
 }
 /// <summary>
 //  Executes the command by calling a function in IImageServiceModal class.
 /// </summary>
 /// <param name="args">Function arguments</param>
 /// <param name="result">If the value is true then the process is successfully completed</param>
 /// <returns></returns>
 public string Execute(string[] args, out bool result)
 {
     // The String Will Return the New Path if result = true, and will return the error message
     System.Threading.Thread.Sleep(500);
     return(m_modal.AddFile(args[0], out result));
 }
示例#25
0
 /// <summary>
 /// Calls AddFile function of ImageServiceModal class
 /// </summary>
 /// <param name="args">The path of the Image from the file</param>
 /// <param name="result">Result of AddFile function</param>
 /// <returns>Message for the log</returns>
 public string Execute(string[] args, out bool result)
 {
     // Returns the new path if result = true, and the error message if result = false
     return(m_modal.AddFile(args[0], out result));
 }
示例#26
0
 /// <summary>
 /// New file command execution. Add file called.
 /// </summary>
 public string Execute(string[] args, out MessageTypeEnum result, TcpClient client = null)
 {
     return(m_modal.AddFile(args, out result));
 }
示例#27
0
 /// <summary>
 /// Execute this command by arguments and result to update.
 /// </summary>
 /// <param name="args"> arguments for command </param>
 /// <param name="result"> result of the run </param>
 /// <returns> updated result string </returns>
 public string Execute(string[] args, out bool result)
 {
     return(modal.AddFile(args, out result));
 }
示例#28
0
 public string Execute(string[] args, out bool result)
 {
     // args[0] will contain full path of file created in the original dir
     return(m_modal.AddFile(args[0], args[1], out result));
     // The String Will Return the New Path if result = true, and will return the error message
 }
示例#29
0
 /// <summary>
 /// this method will execute the task of the command.
 /// </summary>
 /// <param name="args">arguments</param>
 /// <param name="result"> tells if the command succeded or not.</param>
 /// <returns> return a string describes the operartion of the command.</returns>
 public string Execute(string[] args, out bool result)
 {
     return(m_modal.AddFile(args[0], out result));
     // The String Will Return the New Path if result = true, and will return the error message
 }
示例#30
0
 /// <summary>
 /// executing the new file command - adding a file using the image service
 /// modal.
 /// </summary>
 /// <param name="args">info for execution</param>
 /// <param name="result">false-failure, true-success</param>
 /// <returns>if result=true returns the new path of the file, otherwise an error message</returns>
 public string Execute(string[] args, out bool result)
 {
     // assuming args[0] holds the path of the file
     return(m_modal.AddFile(args[0], out result));
 }