public void RunStepsFromHere(Step step) { var steps = Steps.Skip(Steps.IndexOf(step)).ToList(); RunSelectedSteps(steps); }
private void ParseConfigFile() { if (!File.Exists(ConfigFile)) { MessageBox.Show(string.Format("Couldn't find file {0}", ConfigFile)); return; } var document = XDocument.Load(ConfigFile); var configurationElement = document.Element("Configuration"); if (configurationElement == null) { MessageBox.Show("Couldn't find 'Configuration' section in research.xml file"); return; } var globalsElement = configurationElement.Element("Globals"); if (globalsElement == null) { MessageBox.Show("Couldn't find 'Globals' section in research.xml file"); return; } var globalArgsElement = configurationElement.Element("GlobalArgs"); if (globalArgsElement == null) { MessageBox.Show("Couldn't find 'GlobalArgs' section in research.xml file"); return; } var stepsElement = configurationElement.Element("Steps"); if (stepsElement == null) { MessageBox.Show("Couldn't find 'Steps' section in research.xml file"); return; } var processPathAttribute = configurationElement.Attribute("processPath"); if (processPathAttribute == null) { MessageBox.Show("Couldn't find 'processPath' attribute in research.xml file"); return; } ProcessPath = processPathAttribute.Value; var globals = ParseGlobals(globalsElement.Elements()); var globalArgs = ParseElementsAndEmbedGlobals(globalArgsElement.Elements(), globals); var stepsClean = ParseElementsAndEmbedGlobals(stepsElement.Elements(), globals); var processPathEmbedded = EmbedGlobals(globals, new Dictionary<string, string>() {{"-processPath", ProcessPath}}); ProcessPath = processPathEmbedded.Values.First(); if (!File.Exists(ProcessPath)) { MessageBox.Show(string.Format("No such file as {0}", ProcessPath)); return; } // aggregate global args var globalArgsList = new List<String>(); foreach (var globalArg in globalArgs) { globalArgsList.Add(globalArg.Key); globalArgsList.Add(globalArg.Value); } var globalArgsAggregated = string.Join(" ", globalArgsList); // concatnate global args to each step var steps = new Dictionary<string, string>(stepsClean); foreach (var keyValuePair in stepsClean) { var stepName = keyValuePair.Key; var args = keyValuePair.Value; steps[stepName] = args + " " + globalArgsAggregated; } // alloc new steps Steps = new ObservableCollection<Step>(); foreach (var keyValuePair in steps) { var stepName = keyValuePair.Key; var args = keyValuePair.Value; var argumentsDic = Utils.ArgsToDic(args); var newStep = new Step(this) { Name = stepName, ArgumentsDic = argumentsDic }; Steps.Add(newStep); } }
public void RunStep(Step step) { step.ArgumentsDic["-startDate"] = StartDate.YMD(); step.ArgumentsDic["-endDate"] = EndDate.YMD(); RunWorkerThreadWithSteps(new List<Step>(){step}); }