private bool ValidateInputSchemas() { if (!InputNodes.All(node => node.IsConnected())) { MessageService.ShowError("Data Connection Error", "Not all input nodes are connected to scripting module"); return(false); } foreach (var node in InputNodes) { string prevModName = node.DisplayName; var state = ((OutputNode)node.Connector).State; if (state == null) { MessageService.ShowError("Data Connection Error", $"In Module {prevModName} passed invalid state object"); return(false); } if (state.Schema == null) { MessageService.ShowError("Data Connection Error", $"In Module {prevModName} Sate has invalid Schema"); return(false); } } return(true); }
private bool CanRun(WorkInfo workInfo) { if (!InputNodes.All(node => node.IsConnected())) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"{this.DisplayName} input node is not connected with any other module"); return(false); } string prevModuleName = workInfo.NextModuleRTL(this).DisplayName; if (workInfo.Schema == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as Previous Module {prevModuleName} dis not pass Schema"); return(false); } foreach (var node in InputNodes) { if (node.State == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State is null"); return(false); } node.State.DataFilePath = ((OutputNode)node.Connector).State.DataFilePath; node.State.Schema = ((OutputNode)node.Connector).State.Schema; node.State.DataFile = ((OutputNode)node.Connector).State.DataFile; if (node.State.DataFilePath == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State.DataFilePath is null"); return(false); } if (!File.Exists(node.State.DataFilePath)) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as {node.State.DataFilePath} does not exist "); return(false); } if (node.State.DataFile == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as DataFile is null"); return(false); } } for (int i = 0; i < OutputNodes.Count; i++) { if (OutputNodes[i].Connector.IsConnected() == false) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode is not connected"); return(false); } if (((InputNode)OutputNodes[i].Connector).State == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode.State is null"); return(false); } } SetOutputSchemas(); return(true); }