/// <summary>
        /// Gets the user manual for table.
        /// </summary>
        /// <param name="dataObject">The data object.</param>
        /// <param name="output">The output.</param>
        /// <param name="directInfo">The direct information.</param>
        /// <param name="skipUnDescribed">if set to <c>true</c> [skip un described].</param>
        public static void GetUserManualForTable(this DataTable dataObject, ITextRender output, String directInfo = "", Boolean skipUnDescribed = true)
        {
            output.AppendHeading("DataTable: " + dataObject.GetTitle(), 1);

            AppendIf(output, directInfo, "Comment: ");
            AppendIf(output, dataObject.GetDescription(), "Table description: ");

            output.AppendLine("This is automatically generated description of columns of DataTable [" + dataObject.TableName + "]");
            output.AppendHorizontalLine();

            AppendIf(output, dataObject.GetClassName(), "Table shema source: ");
            //output.AppendIf(dataObject.Rows.Count, "Table shema source: ");

            foreach (DataColumn dc in dataObject.Columns)
            {
                //output.AppendHeading("DataColumn -> [" + dc.ColumnName + "]", 2);

                var spe = dc.ExtendedProperties[templateFieldDataTable.col_spe] as settingsPropertyEntry;
                if (spe == null)
                {
                    spe = new settingsPropertyEntry(dc);
                    //spe.displayName = dc.Caption;
                    //spe.name = dc.ColumnName;
                    //spe.description = dc.GetDesc();
                    //spe.type = dc.DataType;
                    //spe.categoryName = dc.GetGroup();
                    //spe.format = dc.GetFormat();
                    //spe.letter = dc.GetLetter();
                    //spe.aggregation = dc.GetAggregation();
                    ////spe.index = dc.Ordinal;
                    //spe.importance = dc.GetImportance();
                    //spe.expression = dc.Expression;
                    //spe.unit = dc.GetUnit();
                    //spe.priority = dc.Ordinal;
                    //spe.width = dc.GetWidth();
                }

                GetUserManualSPE(spe, output);

                // dc.GetSPE().GetUserManual(output);
            }

            output.AppendHorizontalLine();

            var addInfo = dataObject.GetAdditionalInfo();

            output.AppendPairs(addInfo, false, " => ");

            var extraLines = dataObject.GetExtraDesc();

            if (Enumerable.Any <string>(extraLines))
            {
                output.AppendHorizontalLine();

                output.AppendList(extraLines, true);
            }

            //dataObject.GetDescription();
        }
예제 #2
0
 public void Describe(ITextRender output)
 {
     output.AppendHeading("Document selection query", 2);
     //  if (ApplyDomainLevelLimits) output.AppendLabel("Apply limit on domain level");
     output.AppendPair("Size limit", SizeLimit, true, "");
     output.AppendPair("Trashold limit", TrasholdLimit, true, "");
     output.AppendPair("Query Terms", QueryTerms, true, "");
 }
        /// <summary>
        /// Reports public properties and returns the ones that are not supported/reported
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="instance">The instance.</param>
        /// <param name="output">The output.</param>
        /// <param name="onlyDeclared">if set to <c>true</c> [only declared].</param>
        /// <param name="heading">The heading.</param>
        /// <returns></returns>
        public static List <PropertyInfo> ReportBase <T>(this T instance, ITextRender output, Boolean onlyDeclared = true, String heading = "") where T : class
        {
            List <PropertyInfo> plist = instance.GetType().GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).ToList();

            if (output == null)
            {
                return(plist);
            }
            if (!heading.isNullOrEmpty())
            {
                output.AppendHeading(heading, 1);
                output.nextTabLevel();
            }

            foreach (var pi in plist.ToList())
            {
                Boolean removePi = true;
                if (onlyDeclared && pi.DeclaringType != instance.GetType())
                {
                    continue;
                }

                Object vl = pi.GetValue(instance, null);

                if (pi.PropertyType.IsValueType || pi.PropertyType == typeof(String))
                {
                    output.AppendLine(pi.Name + "\t\t\t" + vl.toStringSafe());
                }
                else if (vl is List <String> stringList)
                {
                    output.AppendLine(pi.Name + "\t\t\t" + stringList.toCsvInLine());
                }
                else if (vl is rangeFinder range)
                {
                    if (range.IsLearned)
                    {
                        range.Report(output, pi.Name, "");
                    }
                }
                else
                {
                    removePi = false;
                }
                if (removePi)
                {
                    plist.Remove(pi);
                }
            }

            if (!heading.isNullOrEmpty())
            {
                output.prevTabLevel();
            }

            return(plist);
        }
        /// <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();
        }
예제 #5
0
        public static void Describe(this ISpiderEvaluatorBase evaluator, ITextRender output)
        {
            output.AppendHeading("Crawler [" + evaluator.name + "]");

            output.AppendPair("Class name", evaluator.GetType().Name, true, ": ");

            output.AppendPair("Description", evaluator.description, true, ": ");



            if (evaluator is spiderModularEvaluatorBase)
            {
                spiderModularEvaluatorBase evaluator_spiderModularEvaluatorBase = (spiderModularEvaluatorBase)evaluator;

                foreach (var md in evaluator_spiderModularEvaluatorBase.modules)
                {
                    md.DescribeModule(output);
                }
            }



            if (evaluator is spiderEvaluatorSimpleBase)
            {
                spiderEvaluatorSimpleBase evaluator_spiderEvaluatorSimpleBase = (spiderEvaluatorSimpleBase)evaluator;

                evaluator_spiderEvaluatorSimpleBase.linkActiveRules.ToList().ForEach(x => x.DescribeRule(output));
            }


            output.AppendHorizontalLine();

            output.open("div", "General configuration", "Crawler configuration properties declared in common settings class");

            evaluator.settings.GetUserManual(output, "", true, true);

            output.close();
        }
        /// <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");
            }
        }
예제 #7
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);
                }
            }
        }