コード例 #1
0
        /// <summary>
        /// Generates content for <see cref="settingsPropertyEntry"/>
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <param name="output">The output.</param>
        public static void GetUserManualSPE(this settingsPropertyEntry spec, ITextRender output)
        {
            output.AppendHeading(imbSciStringExtensions.add(spec.categoryName, spec.displayName, ": "), 3);
            output.AppendPair("Property name: ", spec.name);
            output.AppendPair("Type: ", spec.type.Name);

            if (!spec.description.isNullOrEmpty())
            {
                output.AppendParagraph(spec.description);
            }

            if (!spec.letter.isNullOrEmpty())
            {
                output.AppendPair("Annotation: ", spec.letter);
            }
            if (!spec.unit.isNullOrEmpty())
            {
                output.AppendPair("Unit: ", spec.unit);
            }
            if (spec.aggregation != null)
            {
                output.AppendPair("Aggregation: ", spec.aggregation.multiTableType.ToString());
            }

            //if (showValue)
            //{
            //    if (spec.value != null)
            //    {
            //        output.AppendPair("Value: ", spec.value.toStringSafe(spec.format));
            //    }
            //}

            if (spec.type.IsEnum)
            {
                output.AppendPair("Possible values: ", spec.type.GetEnumNames().toCsvInLine());
            }
            else if (spec.type == typeof(Int32))
            {
            }

            if (!spec.info_helpTitle.isNullOrEmpty())
            {
                output.AppendLabel(spec.info_helpTitle);
                output.AppendQuote(spec.info_helpTips);
            }

            if (!spec.info_link.isNullOrEmpty())
            {
                output.AppendLink(spec.info_link, "More", "More");
            }

            output.AppendHorizontalLine();
        }
コード例 #2
0
        /// <summary>
        /// Generates property manual
        /// </summary>
        /// <param name="dataObject">The data object.</param>
        /// <param name="output">The output.</param>
        public static void GetUserManual(this Object dataObject, ITextRender output, String directInfo = "", Boolean skipUnDescribed = true, Boolean showValue = true)
        {
            settingsEntriesForObject seo = new settingsEntriesForObject(dataObject, false, false);

            String heading = "";

            if (!seo.Category.isNullOrEmpty())
            {
                heading += seo.Category + ": ";
            }

            output.AppendHeading(heading + seo.DisplayName, 2);

            List <String> description = new List <string>();

            if (!seo.Description.isNullOrEmpty())
            {
                output.AppendSection(seo.Description, "Class: " + dataObject.GetType().Name, dataObject.GetType().Namespace, seo.additionalInfo);
            }

            if (!directInfo.isNullOrEmpty())
            {
                output.AppendComment(directInfo);
            }

            var list = seo.spes.Values.ToList().OrderBy(x => x.categoryName);

            foreach (settingsPropertyEntryWithContext spec in list)
            {
                if (spec.description.isNullOrEmpty() && skipUnDescribed)
                {
                }
                else
                {
                    output.AppendHeading(imbSciStringExtensions.add(spec.categoryName, spec.displayName, ": "), 3);
                    output.AppendPair("Property name: ", spec.pi.Name);
                    output.AppendPair("Type: ", spec.pi.PropertyType.Name);

                    if (!spec.description.isNullOrEmpty())
                    {
                        output.AppendParagraph(spec.description);
                    }

                    if (!spec.letter.isNullOrEmpty())
                    {
                        output.AppendPair("Annotation: ", spec.letter);
                    }
                    if (!spec.unit.isNullOrEmpty())
                    {
                        output.AppendPair("Unit: ", spec.unit);
                    }
                    if (spec.aggregation != null)
                    {
                        output.AppendPair("Aggregation: ", spec.aggregation.multiTableType.ToString());
                    }

                    if (showValue)
                    {
                        if (spec.value != null)
                        {
                            output.AppendPair("Value: ", spec.value.toStringSafe(spec.format));
                        }
                    }

                    if (spec.type.IsEnum)
                    {
                        output.AppendPair("Possible values: ", spec.type.GetEnumNames().toCsvInLine());
                    }
                    else if (spec.type == typeof(Int32))
                    {
                    }

                    if (!spec.info_helpTitle.isNullOrEmpty())
                    {
                        output.AppendLabel(spec.info_helpTitle);
                        output.AppendQuote(spec.info_helpTips);
                    }

                    if (!spec.info_link.isNullOrEmpty())
                    {
                        output.AppendLink(spec.info_link, "More", "More");
                    }

                    output.AppendHorizontalLine();
                }
            }

            if (!seo.info_helpTitle.isNullOrEmpty())
            {
                output.AppendLabel(seo.info_helpTitle);
                output.AppendQuote(seo.info_helpTips);
            }

            if (!seo.info_link.isNullOrEmpty())
            {
                output.AppendLink(seo.info_link, "More", "More");
            }
        }
コード例 #3
0
        /// <summary>
        /// Reports the command tree.
        /// </summary>
        /// <param name="tree">The tree.</param>
        /// <param name="output">The output.</param>
        public static void ReportCommandTree(this commandTree tree, ITextRender output, Boolean paginate, Int32 lastPageLine = 0, aceCommandConsoleHelpOptions option = aceCommandConsoleHelpOptions.full)
        {
            output.AppendHeading(tree.name.ToUpper(), 1);

            output.AppendParagraph(tree.description);

            if (tree.helpLines.Any())
            {
                output.AppendHeading("Description", 2);
                foreach (String ln in tree.helpLines)
                {
                    output.AppendLine(ln);
                }
            }

            if (option.HasFlag(aceCommandConsoleHelpOptions.parameters))
            {
                output.AppendHeading("Properties", 2);

                foreach (var pair in tree.properties)
                {
                    output.AppendPair(pair.Value.Name, pair.Value.PropertyType.Name, true, ":");
                }

                output.AppendHorizontalLine();
            }

            if (option.HasFlag(aceCommandConsoleHelpOptions.plugins))
            {
                output.AppendHeading("Plugins", 2);

                foreach (var pair in tree.plugins)
                {
                    output.AppendPair(pair.Key.Trim('.'), pair.Value.GetType().Name, true, ":");

                    var methods = pair.Value.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);
                    if (Enumerable.Any <MethodInfo>(methods))
                    {
                        List <String> lst = new List <string>();
                        foreach (MemberInfo mInfo in Enumerable.Where <MethodInfo>(methods, x => x.Name.StartsWith(aceMenuItemMeta.METHOD_PREFIX)))
                        {
                            lst.Add(pair.Key.add(mInfo.Name.removeStartsWith(aceMenuItemMeta.METHOD_PREFIX), ".").Trim('.'));
                        }

                        output.AppendList(lst);
                    }
                }

                output.AppendHorizontalLine();
            }

            if (option.HasFlag(aceCommandConsoleHelpOptions.modules))
            {
                output.AppendHeading("Modules", 2);

                foreach (var pair in tree.modules)
                {
                    output.AppendPair(pair.Value.Name, pair.Value.PropertyType.Name, true, ":");
                }

                output.AppendHorizontalLine();
            }

            //if (option.HasFlag(aceCommandConsoleHelpOptions.brief))
            //{
            //    output.AppendHeading("Overview", 2);

            //    foreach (var pair in tree.flatAccess)
            //    {
            //        output.AppendPair(pair.Value.path.Trim('.'), pair.Value.menuMeta.cmdParams.ToString(false, true, true), true, " ");
            //    }

            //    output.AppendHorizontalLine();
            //}

            if (option.HasFlag(aceCommandConsoleHelpOptions.commands))
            {
                foreach (commandTreeDescription node in tree)
                {
                    node.ReportCommandNode(output, paginate, lastPageLine);
                }
            }
        }