コード例 #1
0
        string GetTypeInfo(ProgrammableBlockApi api, Type type)
        {
            var entry = api.GetEntry(type);

            if (entry == null)
            {
                return(type.GetHumanReadableName());
            }
            return(LinkTo(entry.ToString(ApiEntryStringFlags.ShortDisplayName), entry));
        }
コード例 #2
0
        async Task WriteConstructor(ProgrammableBlockApi api, ApiEntry overload, MarkdownWriter writer, ConstructorInfo constructorInfo)
        {
            await writer.BeginCodeBlockAsync();

            await writer.WriteLineAsync(overload.ToString(ApiEntryStringFlags.Modifiers | ApiEntryStringFlags.GenericParameters | ApiEntryStringFlags.ParameterTypes | ApiEntryStringFlags.ParameterNames | ApiEntryStringFlags.ReturnValue | ApiEntryStringFlags.Accessors));

            await writer.EndCodeBlockAsync();

            if (overload.Documentation?.Summary != null)
            {
                await WriteDocumentation(api, overload.Documentation?.Summary, writer);
            }

            var parameters = constructorInfo.GetParameters();

            if (parameters.Length > 0)
            {
                await writer.WriteHeaderAsync(3, "Parameters");

                foreach (var parameter in parameters)
                {
                    var returnEntry = api.GetEntry(parameter.GetActualParameterType(), true);
                    await writer.WriteAsync("* ");

                    await writer.WriteAsync(LinkTo(returnEntry.ToString(ApiEntryStringFlags.ShortDisplayName), returnEntry));

                    await writer.WriteAsync(" ");

                    await writer.WriteAsync(parameter.Name);

                    await writer.WriteLineAsync();
                }
            }

            if (overload.Documentation?.Example != null)
            {
                await writer.WriteHeaderAsync(3, "Example");
                await WriteDocumentation(api, overload.Documentation?.Example, writer);
            }

            if (overload.Documentation?.Remarks != null)
            {
                await writer.WriteHeaderAsync(3, "Remarks");
                await WriteDocumentation(api, overload.Documentation?.Remarks, writer);
            }
        }
コード例 #3
0
        async Task WriteField(ProgrammableBlockApi api, ApiEntry overload, MarkdownWriter writer, FieldInfo fieldInfo)
        {
            await writer.BeginCodeBlockAsync();

            await writer.WriteLineAsync(overload.ToString(ApiEntryStringFlags.Modifiers | ApiEntryStringFlags.GenericParameters | ApiEntryStringFlags.ParameterTypes | ApiEntryStringFlags.ParameterNames | ApiEntryStringFlags.ReturnValue | ApiEntryStringFlags.Accessors));

            await writer.EndCodeBlockAsync();

            if (overload.Documentation?.Summary != null)
            {
                await WriteDocumentation(api, overload.Documentation?.Summary, writer);
            }
            await writer.WriteHeaderAsync(3, "Returns");

            var returnEntry = api.GetEntry(fieldInfo.FieldType, true);
            await writer.BeginParagraphAsync();

            await writer.WriteAsync(LinkTo(returnEntry.ToString(ApiEntryStringFlags.ShortDisplayName), returnEntry));

            await writer.EndParagraphAsync();

            if (overload.Documentation?.Returns != null)
            {
                await WriteDocumentation(api, overload.Documentation?.Returns, writer);
            }

            if (overload.Documentation?.Example != null)
            {
                await writer.WriteHeaderAsync(3, "Example");
                await WriteDocumentation(api, overload.Documentation?.Example, writer);
            }

            if (overload.Documentation?.Remarks != null)
            {
                await writer.WriteHeaderAsync(3, "Remarks");
                await WriteDocumentation(api, overload.Documentation?.Remarks, writer);
            }
        }