List <DebugItem> CreateDebugInputs(IDSFDataObject dataObject) { var result = new List <IDebugItem>(); var allErrors = new ErrorResultTO(); var env = dataObject.Environment; try { var dds = Conditions; var userModel = dds.GenerateToolLabel(env, dds.Mode, out ErrorResultTO error); allErrors.MergeErrors(error); foreach (Dev2Decision dev2Decision in dds.TheStack) { AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col1, out error); allErrors.MergeErrors(error); AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col2, out error); allErrors.MergeErrors(error); AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col3, out error); allErrors.MergeErrors(error); } var itemToAdd = new DebugItem(); userModel = userModel.Replace("OR", " OR\r\n") .Replace("AND", " AND\r\n") .Replace("\r\n ", "\r\n") .Replace("\r\n\r\n", "\r\n") .Replace(" ", " "); AddDebugItem(new DebugItemStaticDataParams(userModel, "Statement"), itemToAdd); result.Add(itemToAdd); itemToAdd = new DebugItem(); AddDebugItem(new DebugItemStaticDataParams(dds.Mode == Dev2DecisionMode.AND ? "YES" : "NO", "Require all decisions to be true"), itemToAdd); result.Add(itemToAdd); } catch (JsonSerializationException e) { Dev2Logger.Warn(e.Message, "Warewolf Warn"); } catch (Exception e) { allErrors.AddError(e.Message); } finally { if (allErrors.HasErrors()) { var serviceName = GetType().Name; DisplayAndWriteError(dataObject, serviceName, allErrors); } } var val = result.Select(a => a as DebugItem).ToList(); _inner?.SetDebugInputs(val); return(val); }
List <DebugItem> CreateDebugInputs(IExecutionEnvironment env) { List <IDebugItem> result = new List <IDebugItem>(); var allErrors = new ErrorResultTO(); try { Dev2DecisionStack dds = Conditions; ErrorResultTO error; string userModel = dds.GenerateUserFriendlyModel(env, dds.Mode, out error); allErrors.MergeErrors(error); foreach (Dev2Decision dev2Decision in dds.TheStack) { AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col1, out error); allErrors.MergeErrors(error); AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col2, out error); allErrors.MergeErrors(error); AddInputDebugItemResultsAfterEvaluate(result, ref userModel, env, dev2Decision.Col3, out error); allErrors.MergeErrors(error); } var itemToAdd = new DebugItem(); userModel = userModel.Replace("OR", " OR\r\n") .Replace("AND", " AND\r\n") .Replace("\r\n ", "\r\n") .Replace("\r\n\r\n", "\r\n") .Replace(" ", " "); AddDebugItem(new DebugItemStaticDataParams(userModel, "Statement"), itemToAdd); result.Add(itemToAdd); itemToAdd = new DebugItem(); AddDebugItem(new DebugItemStaticDataParams(dds.Mode == Dev2DecisionMode.AND ? "YES" : "NO", "Require All decisions to be True"), itemToAdd); result.Add(itemToAdd); } catch (JsonSerializationException) { } catch (Exception e) { allErrors.AddError(e.Message); } finally { if (allErrors.HasErrors()) { var serviceName = GetType().Name; DisplayAndWriteError(serviceName, allErrors); } } var val = result.Select(a => a as DebugItem).ToList(); _inner.SetDebugInputs(val); return(val); }