internal string GetDesc(SelectionContext context) { string start = "[Record]" + Environment.NewLine + GetBaseDesc(); string end; try { end = GetExtendedDesc(context); } catch { end = "Warning: An error occurred while processing the record. It may not conform to the structure defined in RecordStructure.xml"; } if (end == null) { return(start); } else { return(start + Environment.NewLine + Environment.NewLine + "[Formatted information]" + Environment.NewLine + end); } }
private string GetExtendedDesc(SelectionContext selectContext) { var context = selectContext.Clone(); try { context.Record = this; RecordStructure rec; if (!RecordStructure.Records.TryGetValue(Name, out rec)) return ""; var s = new StringBuilder(); s.AppendLine(rec.description); foreach (var subrec in SubRecords) { if (subrec.Structure == null) continue; if (subrec.Structure.elements == null) return s.ToString(); if (subrec.Structure.notininfo) continue; s.AppendLine(); s.Append(subrec.GetFormattedData()); } return s.ToString(); } finally { context.Record = null; context.SubRecord = null; context.Conditions.Clear(); } }
internal string GetDesc(SelectionContext context) { string start = "[Record]" + Environment.NewLine + GetBaseDesc(); string end; try { end = GetExtendedDesc(context); } catch { end = "Warning: An error occurred while processing the record. It may not conform to the structure defined in RecordStructure.xml"; } if (end == null) return start; else return start + Environment.NewLine + Environment.NewLine + "[Formatted information]" + Environment.NewLine + end; }