Exemple #1
0
        public string ToString(int indent, bool endLine)
        {
            if (!endLine)
            {
                return(BlockIndenter.Indent("{0}: '{1}'".ToFormat(Name, Value), indent));
            }

            return(BlockIndenter.Indent("{0}: '{1}'{2}".ToFormat(Name, Value, Environment.NewLine), indent));
        }
        public string OneLineSummary(string collectionName = null, int indent = 0)
        {
            //TODO: one line summary not valid if there is no Name
            var nameAndValue = "{0} '{1}'".ToFormat(collectionName ?? Name, ImplicitValue);
            var content      = new[] { nameAndValue }
            .Concat(GetBlocks <PropertyBlock>().Select(p => p.ToString(0, false)))
            .Join(", ");

            return("{0}{1}".ToFormat(BlockIndenter.Indent(content, indent), Environment.NewLine));
        }
        public string ToString(int indent = 0)
        {
            var hasName     = Name.IsNotEmpty();
            var objectTitle = hasName
                ? new[] { BlockIndenter.Indent("{0}:{1}".ToFormat(Name, Environment.NewLine), indent) }
                : new string[] {};
            var nextIndentAmount = hasName ? indent + 1 : indent;

            var values = objectTitle.Concat(Blocks.Select(x => x.ToString(nextIndentAmount)));

            return(values.Join(string.Empty));
        }