Ejemplo n.º 1
0
        /// <summary>
        ///     Generate the code from action string
        /// </summary>
        /// <param name="actionString">Action string</param>
        /// <returns></returns>
        public static string GenerateActionCode(string actionString)
        {
            Parameters.ParameterList = ParseInput.Parse(actionString); //Update the parameters
            Commands.LoadParametersForCommand("action");               //Update the parameters
            ConvertVariablesToJavaScript();

            var typeID  = -1;
            var valueID = -1;

            switch (Parameters.Type)
            {
            case "message":
                typeID = 0;
                if (Parameters.Channel == "message")
                {
                    valueID = 0;                                      //Channel by message
                }
                if (Parameters.Channel == "default")
                {
                    valueID = 1;                                      //Channel by default channel
                }
                if (Parameters.Channel.Replace(" ", "").StartsWith("#"))
                {
                    valueID = 2;                                                          //Channel by name
                }
                if (valueID == -1)
                {
                    valueID = 3;                    //Channel by ID
                }
                break;
            }

            return(GetActionCodeString(typeID, valueID, GetGuildAndChannelCodes(Parameters.Guild, Parameters.Channel),
                                       Parameters.Value));
        }
        /// <summary>
        ///     Generate code for trigger
        /// </summary>
        /// <param name="commandString"></param>
        /// <returns></returns>
        public static string GenerateTriggerCode(string commandString)
        {
            Parameters.ParameterList = ParseInput.Parse(commandString); //Update parameters

            switch (Parameters.Type)
            {
            case "message":
                return(CodeGenerator.GenerateOnMessageCode());
            }

            return(null);
        }
Ejemplo n.º 3
0
        public void Parse_WrongRecursiveConst_Exception()
        {
            string[] args = { "path", "mask", "mod", "WRONG_recursive" };

            var actual = ParseInput.Parse(args);
        }