Пример #1
0
        private static void AppendEnumValueMarkdown(StringBuilder sb, CodeInfo cinfo, FieldInfo f)
        {
            CodeItem item = cinfo.FindField(f);

            sb.Append("| `");
            sb.Append(f.Name);
            sb.Append("` | ");
            sb.Append(CodeInfo.Linear(item.Summary));
            sb.AppendLine(" |");
        }
Пример #2
0
        private static void AppendMemberVariableMarkdown(StringBuilder sb, CodeInfo cinfo, FieldInfo f)
        {
            CodeItem item = cinfo.FindField(f);

            sb.Append("| ");
            sb.Append(TypeMarkdown(f.FieldType));
            sb.Append(" | `");
            sb.Append(f.Name);
            sb.Append("` | ");
            sb.Append(CodeInfo.Linear(item.Summary));
            sb.AppendLine(" |");
        }
Пример #3
0
        private static void AppendConstantMarkdown(StringBuilder sb, CodeInfo cinfo, FieldInfo f)
        {
            CodeItem item = cinfo.FindField(f);

            if (item == null)
            {
                return;
            }

            string fieldType;

            switch (f.FieldType.Name)
            {
            case "Double":
                fieldType = "double";
                break;

            default:
                throw new Exception($"Do not know how to generate markdown for constant type: {f.FieldType.Name}");
            }

            string parentClassName = f.DeclaringType.Name;

            sb.AppendFormat("<a name=\"{0}.{1}\"></a>", parentClassName, f.Name);
            sb.AppendLine();
            sb.AppendFormat("### `const {0} {1}.{2} = {3};`", fieldType, parentClassName, f.Name, f.GetValue(null));
            sb.AppendLine();
            sb.AppendLine();
            if (!string.IsNullOrWhiteSpace(item.Summary))
            {
                sb.AppendLine("**" + item.Summary + "**");
                sb.AppendLine();
            }

            if (!string.IsNullOrWhiteSpace(item.Remarks))
            {
                sb.AppendLine(item.Remarks);
                sb.AppendLine();
            }
            sb.AppendLine();
            sb.AppendLine("---");
            sb.AppendLine();
        }