Ejemplo n.º 1
0
        /// <summary>
        /// Converts the String representation of a action to a ActionRun object.
        /// A return value indicates whether the conversion succeded or not.
        /// <param name="sAction">A string containing the action to convert</param>
        /// <param name="action">When this method returns, contains the ActionRun equivalent to the action
        /// contained in the string, if the conversion succeeded, or null if the conversion failed.
        /// The conversion fails if the node parameter is a null reference (Nothing in Visual Basic) or is not of the correct format.
        /// This parameter is passed uninitialized</param>
        /// </summary>
        /// <returns>true if conversion was successfull, false otherwise</returns>
        public static bool TryParse(string sAction, out ActionRun action)
        {
            Match  m;
            string programPath;
            string programArgs;

            action = null;
            m      = rxActionRunValidator.Match(sAction);
            if (!m.Success)
            {
                return(false);
            }

            programPath = m.Result("${programPath}");
            programArgs = (m.Result("${programArgs}") == null) ? "" : m.Result("${programArgs}");
            action      = new ActionRun(programPath, programArgs);
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses an string and gets the action contained in it
        /// </summary>
        /// <param name="sAction">string containing the action to parse</param>
        /// <param name="action">The action extracted from string</param>
        /// <returns>true if action parsed successfully, false otherwise</returns>
        private bool Parse(string sAction, out IAction action)
        {
            Match  m = rxAction.Match(sAction);
            string actionName;

            action = null;

            if (!m.Success)
            {
                return(false);
            }
            actionName = m.Result("${action}");

            switch (actionName.ToLower())
            {
            case "checkprocess":
                if (ActionCheck.TryParse(sAction, out action))
                {
                    return(true);
                }
                break;

            case "kill":
                if (ActionKill.TryParse(sAction, out action))
                {
                    return(true);
                }
                break;

            case "run":
                if (ActionRun.TryParse(sAction, out action))
                {
                    ((ActionRun)action).UserName = "******";
                    return(true);
                }
                break;
            }
            return(false);
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Converts the String representation of a action to a ActionRun object.
		/// A return value indicates whether the conversion succeded or not.
		/// <param name="sAction">A string containing the action to convert</param>
		/// <param name="action">When this method returns, contains the ActionRun equivalent to the action
		/// contained in the string, if the conversion succeeded, or null if the conversion failed.
		/// The conversion fails if the node parameter is a null reference (Nothing in Visual Basic) or is not of the correct format.
		/// This parameter is passed uninitialized</param>
		/// </summary>
		/// <returns>true if conversion was successfull, false otherwise</returns>
		public static bool TryParse(string sAction, out ActionRun action)
		{
			Match m;
			string programPath;
			string programArgs;

			action = null;
			m = rxActionRunValidator.Match(sAction);
			if (!m.Success)
				return false;

			programPath = m.Result("${programPath}");
			programArgs = (m.Result("${programArgs}") == null) ? "" : m.Result("${programArgs}");
			action = new ActionRun(programPath, programArgs);
			return true;
		}