Ejemplo n.º 1
0
            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(" ]");
            }
Ejemplo n.º 2
0
        protected void WriteArray(TomlKey key, TomlArray array)
        {
            this.writer.Write(key.ToString());
            this.writer.Write(" = ");

            this.WriteArrayPart(array);
        }
Ejemplo n.º 3
0
            public void WriteInlineTable(TomlKey key, TomlTable table)
            {
                this.WritePrependComments(table);

                this.writer.Write(key.ToString());
                this.writer.Write(" = ");
                this.WriteInlineTableBody(table);

                this.WriteAppendComments(table);
            }
Ejemplo n.º 4
0
        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(']');
        }
Ejemplo n.º 5
0
        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);
                }
            }
        }
Ejemplo n.º 6
0
 private static string CombineKey(string parent, TomlKey key) => parent + key.ToString() + ".";