/// <summary> /// Writes a header line with the items provided in the List /// </summary> /// <param name="Headers"></param> public void WriteHeaderLine(List<string> Headers) { if (Transpose) { if (Formatted != null) ResponseBody.Append(Formatted.ToString()); Formatted = new FormattedOutput(Headers); Formatted.Transpose = true; } else ResponseBody.AppendFormat("\nH\t{0}", String.Join("\t", Headers)); }
/// <summary> /// Adds HeaderData to the current output /// </summary> /// <param name="Data"></param> public void WriteHeaderDataPair(Dictionary<string, object> Data) { if (Transpose) { if (Formatted != null) ResponseBody.Append(Formatted.ToString()); List<string> Params = new List<string>(Data.Count); foreach (KeyValuePair<string, object> Item in Data) Params.Add(Item.Key); Formatted = new FormattedOutput(Params); Formatted.Transpose = true; Params = new List<string>(Data.Count); foreach (KeyValuePair<string, object> Item in Data) Params.Add(Item.Value.ToString()); Formatted.AddRow(Params); } else { // Add Keys ResponseBody.Append("\nH"); foreach (KeyValuePair<string, object> Item in Data) ResponseBody.Append("\t" + Item.Key); // Add Data ResponseBody.Append("\nD"); foreach (KeyValuePair<string, object> Item in Data) ResponseBody.Append("\t" + Item.Value); } }
/// <summary> /// Writes a Header line with the specified parameters /// </summary> /// <param name="Params"></param> public void WriteHeaderLine(params object[] Params) { if (Transpose) { if (Formatted != null) ResponseBody.Append(Formatted.ToString()); Formatted = new FormattedOutput(Params); Formatted.Transpose = true; } else ResponseBody.AppendFormat("\nH\t{0}", String.Join("\t", Params)); }
/// <summary> /// Adds HeaderData to the current output /// </summary> /// <param name="Data"></param> public void AddData(FormattedOutput Data) { Data.Transpose = Transpose; ResponseBody.Append(Data.ToString().Trim()); }