/// <summary> /// Builds a single condition element /// </summary> /// <param name="condition">Current Condition</param> /// <param name="project">Project</param> /// <param name="errorCollection">Error Collection</param> /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param> /// <param name="exportSettings">Export Settings</param> /// <returns>Condition Build Result</returns> public string BuildSingleConditionElement(ParsedConditionData condition, GoNorthProject project, ExportPlaceholderErrorCollection errorCollection, FlexFieldObject flexFieldObject, ExportSettings exportSettings) { JsonSerializerOptions jsonOptions = new JsonSerializerOptions(); jsonOptions.Converters.Add(new JsonStringEnumConverter()); jsonOptions.PropertyNameCaseInsensitive = true; T parsedData = JsonSerializer.Deserialize <T>(condition.ConditionData.GetRawText(), jsonOptions); return(BuildConditionElementFromParsedData(parsedData, project, errorCollection, flexFieldObject, exportSettings)); }
/// <summary> /// Builds a single condition element /// </summary> /// <param name="condition">Current Condition</param> /// <param name="project">Project</param> /// <param name="errorCollection">Error Collection</param> /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param> /// <param name="exportSettings">Export Settings</param> /// <returns>Condition Build Result</returns> public async Task <string> BuildSingleConditionElement(ParsedConditionData condition, GoNorthProject project, ExportPlaceholderErrorCollection errorCollection, FlexFieldObject flexFieldObject, ExportSettings exportSettings) { ExportTemplate template = await _templateProvider.GetDefaultTemplateByType(project.Id, _templateType); if (!_renderers.ContainsKey(template.RenderingEngine)) { throw new KeyNotFoundException(string.Format("Unknown rendering engine {0} for Condition {1}", template.RenderingEngine.ToString(), _templateType.ToString())); } return(await _renderers[template.RenderingEngine].BuildSingleConditionElement(template, condition, project, errorCollection, flexFieldObject, exportSettings)); }
/// <summary> /// Builds a single condition element /// </summary> /// <param name="condition">Current Condition</param> /// <param name="project">Project</param> /// <param name="errorCollection">Error Collection</param> /// <param name="npc">Npc to which the dialog belongs</param> /// <param name="exportSettings">Export Settings</param> /// <returns>Condition Build Result</returns> public string BuildSingleConditionElement(ParsedConditionData condition, GoNorthProject project, ExportPlaceholderErrorCollection errorCollection, KortistoNpc npc, ExportSettings exportSettings) { T parsedData = condition.ConditionData.ToObject <T>(); return(BuildConditionElementFromParsedData(parsedData, project, errorCollection, npc, exportSettings)); }