private bool CollectProjectItem(ZeusModule parent, string projectPath, string templatePath) { bool complete = false; int moduleIndex = projectPath.LastIndexOf('/'); if (moduleIndex >= 0) { string modulePath = projectPath.Substring(0, moduleIndex), objectName = projectPath.Substring(moduleIndex + 1); ZeusModule m = FindModule(parent, modulePath); if (m != null) { ZeusTemplate template = new ZeusTemplate(templatePath); DefaultSettings settings = DefaultSettings.Instance; SavedTemplateInput savedInput = null; if (m.SavedObjects.Contains(objectName)) { savedInput = m.SavedObjects[objectName]; } else { savedInput = new SavedTemplateInput(); savedInput.SavedObjectName = objectName; } ZeusContext context = new ZeusContext(); context.Log = this._log; savedInput.TemplateUniqueID = template.UniqueID; savedInput.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); if (m != null) { m.PopulateZeusContext(context); m.OverrideSavedData(savedInput.InputItems); } if (template.Collect(context, settings.ScriptTimeout, savedInput.InputItems)) { //this._lastRecordedSelectedNode = this.SelectedTemplate; } if (this._argmgr.InternalUseOnly) { this._log.Write("[BEGIN_RECORDING]"); this._log.Write(savedInput.XML); this._log.Write("[END_RECORDING]"); } complete = true; } } return(complete); }
public IZeusSavedInput CollectTemplateInput(IZeusContext context, string templatePath) { var template = new ZeusTemplate(templatePath); var collectedInput = new ZeusSavedInput(); DefaultSettings.Instance.PopulateZeusContext(context); template.Collect(context, DefaultSettings.Instance.ScriptTimeout, collectedInput.InputData.InputItems); collectedInput.Save(); return(collectedInput); }
public IZeusSavedInput CollectTemplateInput(IZeusContext context, string templatePath) { ZeusTemplate template = new ZeusTemplate(templatePath); ZeusSavedInput collectedInput = new ZeusSavedInput(); DefaultSettings settings = DefaultSettings.Instance; settings.PopulateZeusContext(context); template.Collect(context, settings.ScriptTimeout, collectedInput.InputData.InputItems); collectedInput.Save(); return collectedInput; }
private void SaveInput() { try { ZeusTemplate template = new ZeusTemplate(this.SelectedTemplate.Tag.ToString()); DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; SavedObject.TemplateUniqueID = template.UniqueID; SavedObject.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); if (_module != null) { _module.PopulateZeusContext(context); } if (template.Collect(context, settings.ScriptTimeout, SavedObject.InputItems)) { this._lastRecordedSelectedNode = this.SelectedTemplate; } if (log.HasExceptions) { throw log.Exceptions[0]; } } catch (Exception ex) { ZeusDisplayError formError = new ZeusDisplayError(ex); formError.SetControlsFromException(); formError.ShowDialog(this); } Cursor.Current = Cursors.Default; }
public void SaveInput(ZeusTemplate template) { try { DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; ZeusSavedInput collectedInput = new ZeusSavedInput(); collectedInput.InputData.TemplateUniqueID = template.UniqueID; collectedInput.InputData.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); template.Collect(context, settings.ScriptTimeout, collectedInput.InputData.InputItems); if (log.HasExceptions) { throw log.Exceptions[0]; } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Zues Input Files (*.zinp)|*.zinp"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if(saveFileDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; collectedInput.FilePath = saveFileDialog.FileName; collectedInput.Save(); } } MessageBox.Show(this, "Input collected and saved to file: \r\n" + collectedInput.FilePath); } catch (Exception ex) { mdi.ErrorsOccurred(ex); //ZeusDisplayError formError = new ZeusDisplayError(ex); //formError.SetControlsFromException(); //formError.ShowDialog(this); } Cursor.Current = Cursors.Default; }
public void SaveInput(ZeusTemplate template) { bool overridden = false; if (ExecuteTemplateOverride != null) { overridden = ExecuteTemplateOverride(TemplateOperations.SaveInput, template, null, _guiHandler); } if (!overridden) { try { DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; ZeusSavedInput collectedInput = new ZeusSavedInput(); collectedInput.InputData.TemplateUniqueID = template.UniqueID; collectedInput.InputData.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); template.Collect(context, settings.ScriptTimeout, collectedInput.InputData.InputItems); if (log.HasExceptions) { throw log.Exceptions[0]; } else { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Zues Input Files (*.zinp)|*.zinp"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; collectedInput.FilePath = saveFileDialog.FileName; collectedInput.Save(); } } MessageBox.Show(this, "Input collected and saved to file: \r\n" + collectedInput.FilePath); } catch (Exception ex) { OnErrorsOccurred(ex); } Cursor.Current = Cursors.Default; } }
private bool CollectProjectItem(ZeusModule parent, string projectPath, string templatePath) { bool complete = false; int moduleIndex = projectPath.LastIndexOf('/'); if (moduleIndex >= 0) { string modulePath = projectPath.Substring(0, moduleIndex), objectName = projectPath.Substring(moduleIndex + 1); ZeusModule m = FindModule(parent, modulePath); if (m != null) { ZeusTemplate template = new ZeusTemplate(templatePath); DefaultSettings settings = DefaultSettings.Instance; SavedTemplateInput savedInput = null; if (m.SavedObjects.Contains(objectName)) { savedInput = m.SavedObjects[objectName]; } else { savedInput = new SavedTemplateInput(); savedInput.SavedObjectName = objectName; } ZeusContext context = new ZeusContext(); context.Log = this._log; savedInput.TemplateUniqueID = template.UniqueID; savedInput.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); if (m != null) { m.PopulateZeusContext(context); m.OverrideSavedData(savedInput.InputItems); } if (template.Collect(context, settings.ScriptTimeout, savedInput.InputItems)) { //this._lastRecordedSelectedNode = this.SelectedTemplate; } if (this._argmgr.InternalUseOnly) { this._log.Write("[BEGIN_RECORDING]"); this._log.Write(savedInput.XML); this._log.Write("[END_RECORDING]"); } complete = true; } } return complete; }
private void SaveInput() { try { if (_collectInChildProcess) { this.buttonCollectInput.Enabled = false; this.Cursor = Cursors.WaitCursor; ZeusProcessManager.RecordProjectItem(this._module.RootProject.FilePath, _module.ProjectPath + "/" + SavedObject.SavedObjectName, this.SelectedTemplate.Tag.ToString(), _executionCallback); } else { //RecordProjectItem ZeusTemplate template = new ZeusTemplate(this.SelectedTemplate.Tag.ToString()); DefaultSettings settings = DefaultSettings.Instance; ZeusSimpleLog log = new ZeusSimpleLog(); ZeusContext context = new ZeusContext(); context.Log = log; SavedObject.TemplateUniqueID = template.UniqueID; SavedObject.TemplatePath = template.FilePath + template.FileName; settings.PopulateZeusContext(context); if (_module != null) { _module.PopulateZeusContext(context); _module.OverrideSavedData(SavedObject.InputItems); } if (template.Collect(context, settings.ScriptTimeout, SavedObject.InputItems)) { this._lastRecordedSelectedNode = this.SelectedTemplate; } if (log.HasExceptions) { throw log.Exceptions[0]; } } } catch (Exception ex) { mdi.ErrorsOccurred(ex); //ZeusDisplayError formError = new ZeusDisplayError(ex); //formError.SetControlsFromException(); //formError.ShowDialog(this); } Cursor.Current = Cursors.Default; }