Beispiel #1
0
        public static void PropertyToXrefString(this EnumSDPModel enumSDPModel, PageModel pageModel)
        {
            if (enumSDPModel == null)
            {
                return;
            }

            enumSDPModel.Implements   = enumSDPModel.Implements?.Select(i => { return(i = InterpretXref(pageModel, i) ?? i); });
            enumSDPModel.Inheritances = enumSDPModel.Inheritances?.Select(i => { return(i = InterpretXref(pageModel, i) ?? i); });

            if (enumSDPModel.Methods != null)
            {
                foreach (var method in enumSDPModel.Methods)
                {
                    method.Parameters = method.Parameters?.Select(p => { return(new Parameter()
                        {
                            Name = p.Name, Type = InterpretXref(pageModel, p.Type ?? null) ?? p.Type, Description = p.Description
                        }); });

                    if (method.Returns != null)
                    {
                        method.Returns.Type = InterpretXref(pageModel, method.Returns.Type) ?? method.Returns.Type;
                    }

                    if (method.Exceptions != null)
                    {
                        foreach (var subMember in method.Exceptions)
                        {
                            subMember.Type = InterpretXref(pageModel, subMember.Type) ?? subMember.Type;
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public override bool Interpret(PageModel pageModel, BuildContext context)
        {
            if (!base.Valid(pageModel))
            {
                return(false);
            }

            var enumItem = pageModel.Items?.Where(item => item.Type == MemberType.Enum)?.ToList()?.FirstOrDefault();

            if (enumItem != null)
            {
                var enumSDPModel = new EnumSDPModel();
                enumSDPModel.Uid              = enumItem.Uid;
                enumSDPModel.FullName         = enumItem.FullName;
                enumSDPModel.Name             = enumItem.Name;
                enumSDPModel.Package          = enumItem.PackageName;
                enumSDPModel.Summary          = enumItem.Summary;
                enumSDPModel.NameWithType     = enumItem.NameWithType.RemoveFromValue("(");
                enumSDPModel.Syntax           = TransferSyntax(enumItem.Syntax);
                enumSDPModel.Inheritances     = ConvertStringToInlineMD(enumItem.Inheritance);
                enumSDPModel.InheritedMembers = enumItem.InheritedMembers;
                enumSDPModel.Methods          = TransferMethods(pageModel.Items);
                enumSDPModel.Fields           = TransferFields(pageModel.Items);
                enumSDPModel.Implements       = enumItem.Implements;
                enumSDPModel.PropertyToXrefString(pageModel);
                base.Save(enumSDPModel, enumSDPModel.YamlMime, enumSDPModel.Uid, MemberType.Enum.ToString());

                return(false);
            }

            return(true);
        }