protected override void FormatReturnValueMethodName(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgValueFormatterTypeOptions typeOptions, DbgValueFormatterOptions valueOptions, CultureInfo cultureInfo, DmdMethodBase method, DmdPropertyInfo property)
        {
            var typeFormatter = new Formatters.CSharp.CSharpTypeFormatter(output, typeOptions.ToTypeFormatterOptions(), null);

            typeFormatter.Format(method.DeclaringType, null);
            var valueFormatter = new Formatters.CSharp.CSharpPrimitiveValueFormatter(output, valueOptions.ToValueFormatterOptions(), cultureInfo);

            output.Write(DbgTextColor.Operator, ".");
            if ((object)property != null)
            {
                if (property.GetIndexParameters().Count != 0)
                {
                    output.Write(DbgTextColor.Keyword, Keyword_this);
                    WriteMethodParameterList(output, method, typeFormatter, GetAllMethodParameterTypes(property.GetMethodSignature()), IndexerParenOpen, IndexerParenClose);
                }
                else
                {
                    output.Write(MemberUtils.GetColor(property), Formatters.CSharp.CSharpTypeFormatter.GetFormattedIdentifier(property.Name));
                }
                valueFormatter.WriteTokenComment(property.MetadataToken);
                output.Write(DbgTextColor.Operator, ".");
                output.Write(DbgTextColor.Keyword, "get");
                valueFormatter.WriteTokenComment(method.MetadataToken);
            }
            else
            {
                var methodColor = TypeFormatterUtils.GetColor(method, canBeModule: false);
                if (TypeFormatterUtils.TryGetMethodName(method.Name, out var containingMethodName, out var localFunctionName))
                {
                    output.Write(methodColor, Formatters.CSharp.CSharpTypeFormatter.GetFormattedIdentifier(containingMethodName));
                    output.Write(DbgTextColor.Operator, ".");
                    output.Write(methodColor, Formatters.CSharp.CSharpTypeFormatter.GetFormattedIdentifier(localFunctionName));
                    valueFormatter.WriteTokenComment(method.MetadataToken);
                    WriteGenericMethodArguments(output, method, typeFormatter);
                }
Ejemplo n.º 2
0
        protected override void FormatReturnValueMethodName(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgValueFormatterTypeOptions typeOptions, DbgValueFormatterOptions valueOptions, CultureInfo?cultureInfo, DmdMethodBase method, DmdPropertyInfo?property)
        {
            var typeFormatter = new Formatters.CSharp.CSharpTypeFormatter(output, typeOptions.ToTypeFormatterOptions(), null);

            typeFormatter.Format(method.DeclaringType !, null);
            var valueFormatter = new Formatters.CSharp.CSharpPrimitiveValueFormatter(output, valueOptions.ToValueFormatterOptions(), cultureInfo);

            output.Write(DbgTextColor.Operator, ".");
            if (!(property is null))
            {
                if (property.GetIndexParameters().Count != 0)
                {
                    output.Write(DbgTextColor.Keyword, Keyword_this);
                    WriteMethodParameterList(output, method, typeFormatter, GetAllMethodParameterTypes(property.GetMethodSignature()), IndexerParenOpen, IndexerParenClose);
                }
                else
                {
                    output.Write(MemberUtils.GetColor(property), Formatters.CSharp.CSharpTypeFormatter.GetFormattedIdentifier(property.Name));
                }
                valueFormatter.WriteTokenComment(property.MetadataToken);
                output.Write(DbgTextColor.Operator, ".");
                output.Write(DbgTextColor.Keyword, "get");
                valueFormatter.WriteTokenComment(method.MetadataToken);
            }