public void WriteTomlTableArray(TomlKey key, TomlTableArray tableArray) { this.WritePrependComments(tableArray); const string assignment = " = [ "; this.writer.Write(key.ToString()); this.writer.Write(assignment); int indentLen = key.ToString().Length + assignment.Length; string indent = new string(' ', indentLen); for (int i = 0; i < tableArray.Items.Count; i++) { this.WriteInlineTableBody(tableArray.Items[i]); if (i < tableArray.Items.Count - 1) { this.writer.Write(","); this.writer.WriteLine(); this.writer.Write(indent); } } this.writer.WriteLine(" ]"); }
protected void WriteArray(TomlKey key, TomlArray array) { this.writer.Write(key.ToString()); this.writer.Write(" = "); this.WriteArrayPart(array); }
public void WriteInlineTable(TomlKey key, TomlTable table) { this.WritePrependComments(table); this.writer.Write(key.ToString()); this.writer.Write(" = "); this.WriteInlineTableBody(table); this.WriteAppendComments(table); }
protected void WriteArray(TomlKey key, TomlArray array) { this.writer.Write(key.ToString()); this.writer.Write(" = ["); for (int i = 0; i < array.Items.Length - 1; i++) { this.WriteValue(array[i]); this.writer.Write(", "); } if (array.Items.Length > 0) { this.WriteValue(array.Items[array.Items.Length - 1]); } this.writer.Write(']'); }
private void WriteTomlTableArray(string parentKey, TomlKey key, TomlTableArray tableArray) { if (IsInlineTomlTableArray(tableArray)) { var inlineWriter = new TomlInlineTableWriter(this.writer, this.settings); inlineWriter.WriteTomlTableArray(key, tableArray); } else { this.WritePrependComments(tableArray); foreach (var t in tableArray.Items) { this.writer.Write("[["); this.writer.Write(parentKey + key.ToString()); this.writer.Write("]]"); this.writer.WriteLine(); this.WriteAppendComments(tableArray); this.WriteTableRows(CombineKey(parentKey, key), t); } } }
private static string CombineKey(string parent, TomlKey key) => parent + key.ToString() + ".";