Example #1
0
        /// <summary>
        /// Iterates and displays the parameters in the parameter collection.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <param name="name">The name.</param>
        /// <param name="info">Optional arguments.</param>
        public static string ToStringDebug(this ParameterCollection parameters, string name, StringDebugInfo info = null)
        {
            info = info ?? StringDebugInfo.Default;
            if (parameters == null)
            {
                return(info.Indent + name + ": null");
            }

            if (parameters.Count <= 0)
            {
                return(info.Indent + name + ": {}");
            }

            var allEntities = parameters.Values.All(a => a is Entity);

            return(Wrap(info.Indent + name + ": {",
                        parameters.ToStringDebug(allEntities ? info : info.IncreaseIndent()),
                        "}",
                        allEntities ? info.WithNoTab() : info, string.Empty));
        }
Example #2
0
        /// <summary>
        /// Iterates and displays the entity images in the entity image collection.
        /// </summary>
        /// <param name="images">The images.</param>
        /// <param name="name">The name.</param>
        /// <param name="info">Optional arguments.</param>
        public static string ToStringDebug(this EntityImageCollection images, string name, StringDebugInfo info = null)
        {
            info = info ?? StringDebugInfo.Default;
            if (images == null)
            {
                return(info.Indent + name + ": null");
            }


            if (images.Count == 1)
            {
                var kvp = images.First();
                var id  = kvp.Value?.Id == Guid.Empty
                    ? string.Empty
                    : "_" + kvp.Value?.LogicalName + "_" + kvp.Value?.Id.ToString("N");
                return(info.Indent + name + id + ": " + images.Values.First().ToStringAttributes(info).TrimStart());
            }

            return(Wrap(name + ": {",
                        images.Select(v => v.Key + ": " + v.Value.ToStringDebug(info).TrimStart()),
                        "}",
                        info.WithNoTab(),
                        string.Empty));
        }