29 using System.Collections.Generic;
33 namespace OpenSim.Framework.Console
46 public const string DefaultKeyValueDivider =
" : ";
51 public string KeyValueDivider {
get; set; }
56 public List<KeyValuePair<string, string>> Rows {
get;
private set; }
61 public int Indent {
get; set; }
65 Rows =
new List<KeyValuePair<string, string>>();
66 KeyValueDivider = DefaultKeyValueDivider;
71 StringBuilder sb =
new StringBuilder();
72 AddToStringBuilder(sb);
78 string formatString = GetFormatString();
82 foreach (KeyValuePair<string, string> row
in Rows)
83 sb.AppendFormat(formatString, row.Key, row.Value);
89 private string GetFormatString()
91 StringBuilder formatSb =
new StringBuilder();
95 foreach (KeyValuePair<string, string> row
in Rows)
96 if (row.Key.Length > longestKey)
97 longestKey = row.Key.Length;
99 formatSb.Append(
' ', Indent);
102 formatSb.AppendFormat(
"{{0,-{0}}}{1}{{1}}\n", longestKey, KeyValueDivider);
104 return formatSb.ToString();
109 Rows.Add(
new KeyValuePair<string, string>(key.ToString(), value.ToString()));
Used to generated a formatted table for the console.
void AddRow(object key, object value)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString key
override string ToString()
void AddToStringBuilder(StringBuilder sb)