Esempio n. 1
0
 public override string ToYamlString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? string.Join("\n", this.Select(i => i.ToYamlString(style)))
         : this.Any()
             ? $"{{ {string.Join(", ", this.Select(i => i.ToYamlString(style)))} }}"
             : "{}");
 }
Esempio n. 2
0
 public override string ToYamlString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? this.Key.ToYamlString(YNodeStyle.Flow) + ": " +
            (this.Value.Style == YNodeStyle.Block && this.Value is YCollection <YKeyValuePair>
             ? "\n" + AddIndent(this.Value.ToYamlString())
                 : AddIndent(this.Value.ToYamlString()).Substring(2))
         : this.Key.ToYamlString(YNodeStyle.Flow) + ": " + this.Value.ToYamlString(YNodeStyle.Flow));
 }
Esempio n. 3
0
 public override string ToYamlString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? $"|-\n{AddIndent(this.Value)}"
         : this.Value.IndexOfAny(new[] { '-', '{', '}', '[', ']', '|', '>', '?' }) == 0 ||
            this.Value.IndexOfAny(new[] { '\a', '\b', '\t', '\0', '\r', ':' }) != -1
             ? $"\"{EscapeString(this.Value)}\""
             : this.Value);
 }
Esempio n. 4
0
        public override string ToYamlString(YNodeStyle style)
        {
            return(style == YNodeStyle.Block
                ? string.Join("\n", this.Select(i =>
            {
                var rt = i.ToYamlString();

                if (i.Style == YNodeStyle.Block && i is YSequence)
                {
                    rt = "\n" + AddIndent(rt);
                }
                else
                {
                    rt = AddIndent(rt).Substring(2);
                }

                return "- " + rt;
            }))
                : this.Any()
                    ? $"[ {string.Join(", ", this.Select(i => i.ToYamlString(style)))} ]"
                    : "[]");
        }
Esempio n. 5
0
 public YCollection(YNodeStyle style, params YNode[] content)
     : base(style)
 {
     this.Initialize(content);
 }
Esempio n. 6
0
 public override string ToString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? $"? {this.Key}\n: {this.Value}"
         : $"? {this.Key.ToString(style)} : {this.Value.ToString(style)}");
 }
Esempio n. 7
0
 public YMapping(int indentLevel, YNodeStyle style = YNodeStyle.Block, params YNode[] content)
     : base(style, content)
 {
     this.IndentLevel = indentLevel;
 }
Esempio n. 8
0
 public override string ToString(YNodeStyle style)
 {
     return(this.Name);
 }
Esempio n. 9
0
 public override string ToString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? $"str: |-\n{AddIndent(this.Value)}"
         : $"str: \"{EscapeString(this.Value)}\"");
 }
Esempio n. 10
0
 private YSequence(YNodeStyle style, params YNode[] content)
     : base(style, content)
 {
 }
Esempio n. 11
0
 public override string ToYamlString(YNodeStyle style)
 {
     return(this.Value.ToYamlString(style));
 }
Esempio n. 12
0
 protected YNode(YNodeStyle style)
 {
     this.Style = style;
 }
Esempio n. 13
0
 public abstract string ToYamlString(YNodeStyle style);
Esempio n. 14
0
 public override string ToYamlString(YNodeStyle style)
 {
     return("---\n" + string.Join("\n", this.Select(i => i.ToYamlString())));
 }
Esempio n. 15
0
 public YDocument(YNodeStyle style, params YNode[] content)
     : base(style, content)
 {
 }
Esempio n. 16
0
 public YScalar(YNodeStyle style = YNodeStyle.Flow)
     : base(style)
 {
 }
Esempio n. 17
0
 public YScalar(string value, YNodeStyle style = YNodeStyle.Flow)
     : this(style)
 {
     this.Value = value;
 }
Esempio n. 18
0
 internal YSequence(YNodeStyle style, params YNode[] content)
     : base(style, content)
 {
 }
Esempio n. 19
0
 public override string ToString(YNodeStyle style)
 {
     return(style == YNodeStyle.Block
         ? $"!!map {{\n{string.Join("\n", this.Select(i => AddIndent(i.ToString() + ",")))}\n}}"
         : $"!!map {{ {string.Join(" ", this.Select(i => i.ToString(style) + ","))} }}");
 }
Esempio n. 20
0
 public YMapping(YNodeStyle style = YNodeStyle.Block, params YNode[] content)
     : base(style, content)
 {
 }