public object ReadYaml(IParser parser, Type type) { var scalar = (YamlDotNet.Core.Events.Scalar)parser.Current; var value = scalar.Value; if (string.IsNullOrWhiteSpace(value)) { parser.MoveNext(); return(null); } var values = value .Split(delimiter, StringSplitOptions.RemoveEmptyEntries) .ToList(); Color?color = TryParseEachAndRemove <Color?>(values, x => { bool success = ColorX.TryParse(x, out Color c); return(success, c); }); int?size = TryParseEachAndRemove(values, x => { bool success = int.TryParse(x, out int number); return(success, number); }); var result = new BorderSideStyle { Width = size ?? 0, Color = color ?? Color.Transparent, }; parser.MoveNext(); return(result); }
public BorderStyle(BorderStyle parent = null) { _parent = parent; Left = new BorderSideStyle(_parent?.Left); Top = new BorderSideStyle(_parent?.Top); Right = new BorderSideStyle(_parent?.Right); Bottom = new BorderSideStyle(_parent?.Bottom); }
public BorderStyle(BorderSideStyle top, BorderSideStyle rightAndLeft, BorderSideStyle bottom) : this($"{top} {rightAndLeft} {bottom}") { }
public BorderStyle(BorderSideStyle topAndBottom, BorderSideStyle rightAndLeft) : this($"{topAndBottom} {rightAndLeft}") { }
public BorderStyle(BorderSideStyle top, BorderSideStyle right, BorderSideStyle bottom, BorderSideStyle left) : this($"{top} {right} {bottom} {left}") { }
public Border(BorderSideStyle style) : base($"{style}") { }
public Border(BorderSideWidth width, BorderSideStyle style, CssColor borderColor) : this($"{width} {style} {borderColor}") { }
public Border(BorderSideWidth width, BorderSideStyle style) : this($"{width} {style}") { }
public Border(BorderSideStyle style, CssColor borderColor) : this($"{style} {borderColor}") { }