Example #1
0
        /// <summary>
        ///     Edit a command
        /// </summary>
        public static void EditCommand()
        {
            if (CommandType != "exit")
            {
                CommandString = GeneralFunctions.RemoveFirstWord(CommandString);        //Remove first word from command string
                CommandString = SaveFileParser.TakeBackSemiColonEscapes(CommandString); //Add in semicolons again
            }

            switch (CommandType)
            {
            case "addtrigger":
                if (!IsValidCommand(1, 10))
                {
                    break;
                }
                LoadParametersForCommand("trigger");
                CommandManagement.AddTrigger(CommandString);     //Add trigger
                break;

            case "addaction":
                if (!IsValidCommand(2, 10))
                {
                    break;
                }
                LoadParametersForCommand("action");
                CommandManagement.AddAction(CommandString);     //Add action
                break;

            case "exit":
                Program.OpenCommand = null;
                break;
            }
        }
Example #2
0
        /// <summary>
        ///     Execute a command using a command string
        /// </summary>
        /// <param name="commandString">The command string</param>
        public static void DoCommand(string commandString)
        {
            CommandType              = GeneralFunctions.GetCommandNameFromCommandString(commandString); //Get command name (first word in command string)
            CommandString            = SaveFileParser.EscapeSemiColons(commandString);                  //Escape semicolons
            Parameters.ParameterList = ParseInput.Parse(commandString);

            //if a project is open
            if (Program.OpenProject == null)
            {
                DoCommandNoOpenProject(); //Do a command that won't affect any project, eg. createproject, openproject, etc.
            }
            else
            {
                if (Program.OpenCommand == null)
                {
                    DoCommandForOpenProject(); //Do a command for the open project
                }
                else
                {
                    EditCommand(); //Go in edit command mode
                }
            }
        }
 /// <summary>
 ///     Add project to the list of all projects
 /// </summary>
 /// <param name="projectName"></param>
 /// <param name="projectPath"></param>
 public static void AddProjectToList(string projectName, string projectPath)
 {
     File.AppendAllText("ProjectsList.set", SaveFileParser.Generate(projectName, projectPath) + "\n");
 }