示例#1
0
        void TypeToString(IDecompilerOutput output, ConvertTypeOptions options, ITypeDefOrRef?type, IHasCustomAttribute?typeAttributes = null)
        {
            if (type is null)
            {
                return;
            }
            var envProvider = new ILSpyEnvironmentProvider();
            var converter   = new CSharpToVBConverterVisitor(type.Module, envProvider);
            var astType     = AstBuilder.ConvertType(type, new StringBuilder(), typeAttributes, options);

            if (type.TryGetByRefSig() is not null)
            {
                output.Write("ByRef", BoxedTextColor.Keyword);
                output.Write(" ", BoxedTextColor.Text);
                if (astType is ICSharpCode.NRefactory.CSharp.ComposedType && ((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank > 0)
                {
                    ((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank--;
                }
            }

            var vbAstType = astType.AcceptVisitor(converter, null);
            var settings  = GetDecompilerSettings();
            var ctx       = new DecompilerContext(settings.SettingsVersion, type.Module, MetadataTextColorProvider);

            vbAstType.AcceptVisitor(new OutputVisitor(new VBTextOutputFormatter(output, ctx), CreateVBFormattingOptions(settings)), null);
        }
示例#2
0
        void TypeToString(IDecompilerOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null)
        {
            var envProvider = new ILSpyEnvironmentProvider();
            var converter   = new CSharpToVBConverterVisitor(type.Module, envProvider);
            var astType     = AstBuilder.ConvertType(type, new StringBuilder(), typeAttributes, options);

            if (type.TryGetByRefSig() != null)
            {
                output.Write("ByRef", BoxedTextColor.Keyword);
                output.Write(" ", BoxedTextColor.Text);
                if (astType is ICSharpCode.NRefactory.CSharp.ComposedType && ((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank > 0)
                {
                    ((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank--;
                }
            }

            var vbAstType = astType.AcceptVisitor(converter, null);

            vbAstType.AcceptVisitor(new OutputVisitor(new VBTextOutputFormatter(output), new VBFormattingOptions()), null);
        }
示例#3
0
		void TypeToString(IDecompilerOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) {
			var envProvider = new ILSpyEnvironmentProvider();
			var converter = new CSharpToVBConverterVisitor(type.Module, envProvider);
			var astType = AstBuilder.ConvertType(type, new StringBuilder(), typeAttributes, options);

			if (type.TryGetByRefSig() != null) {
				output.Write("ByRef", BoxedTextColor.Keyword);
				output.Write(" ", BoxedTextColor.Text);
				if (astType is ICSharpCode.NRefactory.CSharp.ComposedType && ((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank > 0)
					((ICSharpCode.NRefactory.CSharp.ComposedType)astType).PointerRank--;
			}

			var vbAstType = astType.AcceptVisitor(converter, null);

			vbAstType.AcceptVisitor(new OutputVisitor(new VBTextOutputFormatter(output), new VBFormattingOptions()), null);
		}