Esempio n. 1
0
        public static void BuildTable <T>(MdStringEditor mb, MarkDownType parent, string label, List <T> array)
            where T : MarkDownBase
        {
            if (array.Count <= 0)
            {
                return;
            }
            mb.AppendLine("* * *");
            mb.AppendLine($"__{label}__");
            mb.AppendLine();
            var head = (parent.IsEnum)
                ? new[] { "Value", "Name", "Summary" }
                : new[] { "Name", "Summary" };
            IEnumerable <T> seq = array;

            if (!parent.IsEnum)
            {
                seq = array.OrderBy(x => x.Name);
            }
            var data = seq.Select(item => parent.IsEnum
                ? new[] { HelpUtils.WritePropertyType(item).ToLower(), HelpUtils.WritePropertyName(item), item.Summary }
                : new[] { item.Name, item.Summary });

            mb.Table(head, data);
            mb.AppendLine();
        }
Esempio n. 2
0
 public static void CreateHeader(MdStringEditor mb, MarkDownType parent)
 {
     mb.Header(3, $"{parent.Prefix}");
     mb.AppendLine($"__Namespace__: {parent.RepresentType.Namespace}");
     mb.AppendLine("* * *");
     mb.AppendLine($"__Summary__: {parent.Summary}");
     mb.AppendLine();
 }
        public static MarkDownType CreateType(Type type, bool isEnum)
        {
            var createdType = new MarkDownType(MemberType.Type, type, isEnum)
            {
                Name     = type.Name,
                FullName = type.FullName,
            };

            return(createdType);
        }
        public void MdFluentBuilder_Build_Should_ReturnException(string template, string fileName, bool isType)
        {
            MarkDownType type = null;

            if (isType)
            {
                type = new MarkDownType(MemberType.Property, null, false);
            }
            Assert.Throws(typeof(ArgumentNullException),
                          () => _builder = new MdFluentBuilder(template, fileName, type));
        }
Esempio n. 5
0
 public MdFluentBuilder(string template, string fileName, MarkDownType type)
 {
     ConditionValidator.ThrowExceptionIfNotValid <ArgumentNullException>((string.IsNullOrWhiteSpace(template)),
                                                                         nameof(template));
     ConditionValidator.ThrowExceptionIfNotValid <ArgumentNullException>((string.IsNullOrWhiteSpace(fileName)),
                                                                         nameof(fileName));
     ConditionValidator.ThrowExceptionIfNotValid <ArgumentNullException>((type == null),
                                                                         nameof(type));
     Template = template;
     FileName = fileName;
     Type     = type;
 }
Esempio n. 6
0
        public static IList <MarkDownField> GetFields(Type type, MarkDownType entity)
        {
            var list   = new List <MarkDownField>();
            var fields = type.GetFields(Variables.FieldFlags);

            foreach (var field in fields)
            {
                if (field.CheckAttribute <IgnoredDocs>())
                {
                    continue;
                }
                list.Add(MarkDownEntityCreator.CreateField(field, entity.FullName));
            }
            return(list);
        }
Esempio n. 7
0
        public static IList <MarkDownProperty> GetProperties(Type type, MarkDownType entity)
        {
            var list       = new List <MarkDownProperty>();
            var properties = type.GetProperties(Variables.PropertiesFlags);

            foreach (var property in properties)
            {
                if (property.CheckAttribute <IgnoredDocs>())
                {
                    continue;
                }
                list.Add(MarkDownEntityCreator.CreateProperty(property, entity.FullName));
            }
            return(list);
        }
Esempio n. 8
0
        public static IList <MarkDownMethod> GetMethods(Type type, MarkDownType entity)
        {
            var list    = new List <MarkDownMethod>();
            var methods = type.GetMethods(Variables.MethodsFlags)
                          .Where(Variables.MethodQueries).ToArray();

            foreach (var method in methods)
            {
                if (method.CheckAttribute <IgnoredDocs>())
                {
                    continue;
                }
                list.Add(MarkDownEntityCreator.CreatMethod(method, entity.FullName));
            }
            return(list);
        }