/// <summary> /// Runs automation commands using supplied text rather than filepath. /// </summary> /// <param name="content"></param> /// <returns></returns> public ScriptResult RunText(string content) { _result = null; _script.Assemblies = this.Assemblies; _result = _script.Run(content); return(_result); }
/// <summary> /// Runs automation commands using supplied text rather than filepath. /// </summary> /// <param name="content"></param> /// <returns></returns> public ScriptResult Run(string content) { _started = DateTime.Now; string error = "Assemblies for commands not specified. 'Assemblies' property must be set with delimited list of assemblies containing commands"; if (string.IsNullOrEmpty(this.Assemblies)) { throw new InvalidOperationException(error); } // Load all the commands in the dlls. _cmdService = new CommandService(); _cmdService.Load(this.Assemblies); // Register defaults RegisterSystemCommands(); // Check for "list all" _cmdResults = new List <CommandResult>(); // Reset. _allCommandsSuccessful = true; var result = DoRun(content); _ended = DateTime.Now; _result = new ScriptResult(_started, _ended, result.Success, result.Message); _result.CommandResults = _cmdResults; return(_result); }
/// <summary> /// Run the /// </summary> /// <returns></returns> public ScriptResult RunScript(string filePath) { // Validate if (!File.Exists(filePath)) { throw new FileNotFoundException("File : " + filePath + " does not exist."); } var content = File.ReadAllText(filePath); _result = RunText(content); _result.Name = Path.GetFileName(filePath); _result.FilePath = filePath; return(_result); }