void TypeToString(ITextOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { if (type == null) { return; } AstType astType = AstBuilder.ConvertType(type, typeAttributes, options); if (WriteRefIfByRef(output, type.TryGetByRefSig(), typeAttributes as ParamDef)) { if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0) { ((ComposedType)astType).PointerRank--; } } var module = type.Module; if (module == null && type is TypeSpec && ((TypeSpec)type).TypeSig.RemovePinnedAndModifiers() is GenericSig) { var sig = (GenericSig)((TypeSpec)type).TypeSig.RemovePinnedAndModifiers(); if (sig.OwnerType != null) { module = sig.OwnerType.Module; } if (module == null && sig.OwnerMethod != null && sig.OwnerMethod.DeclaringType != null) { module = sig.OwnerMethod.DeclaringType.Module; } } var ctx = new DecompilerContext(type.Module); astType.AcceptVisitor(new CSharpOutputVisitor(new TextTokenWriter(output, ctx), FormattingOptionsFactory.CreateAllman())); }
string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { AstType astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options); StringWriter w = new StringWriter(); if (type.TryGetByRefSig() != null) { ParamDef pd = typeAttributes as ParamDef; if (pd != null && (!pd.IsIn && pd.IsOut)) { w.Write("out "); } else { w.Write("ref "); } if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0) { ((ComposedType)astType).PointerRank--; } } astType.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateAllman())); return(w.ToString()); }
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); }
string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { var envProvider = new ILSpyEnvironmentProvider(); var converter = new CSharpToVBConverterVisitor(envProvider); var astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options); StringWriter w = new StringWriter(); if (type.TryGetByRefSig() != null) { w.Write("ByRef "); if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0) { ((NRefactory.CSharp.ComposedType)astType).PointerRank--; } } var vbAstType = astType.AcceptVisitor(converter, null); vbAstType.AcceptVisitor(new OutputVisitor(w, new VBFormattingOptions()), null); return(w.ToString()); }
string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { AstType astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options); StringWriter w = new StringWriter(); if (type.TryGetByRefSig() != null) { ParamDef pd = typeAttributes as ParamDef; if (pd != null && (!pd.IsIn && pd.IsOut)) w.Write("out "); else w.Write("ref "); if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0) ((ComposedType)astType).PointerRank--; } astType.AcceptVisitor(new CSharpOutputVisitor(w, FormattingOptionsFactory.CreateAllman())); return w.ToString(); }
void TypeToString(ITextOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { if (type == null) return; AstType astType = AstBuilder.ConvertType(type, typeAttributes, options); if (WriteRefIfByRef(output, type.TryGetByRefSig(), typeAttributes as ParamDef)) { if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0) ((ComposedType)astType).PointerRank--; } var module = type.Module; if (module == null && type is TypeSpec && ((TypeSpec)type).TypeSig.RemovePinnedAndModifiers() is GenericSig) { var sig = (GenericSig)((TypeSpec)type).TypeSig.RemovePinnedAndModifiers(); if (sig.OwnerType != null) module = sig.OwnerType.Module; if (module == null && sig.OwnerMethod != null && sig.OwnerMethod.DeclaringType != null) module = sig.OwnerMethod.DeclaringType.Module; } var ctx = new DecompilerContext(type.Module); astType.AcceptVisitor(new CSharpOutputVisitor(new TextTokenWriter(output, ctx), FormattingOptionsFactory.CreateAllman())); }
void TypeToString(ITextOutput output, ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { var envProvider = new ILSpyEnvironmentProvider(); var converter = new CSharpToVBConverterVisitor(envProvider); var astType = AstBuilder.ConvertType(type, typeAttributes, options); if (type.TryGetByRefSig() != null) { output.Write("ByRef", TextTokenType.Keyword); output.WriteSpace(); if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0) ((NRefactory.CSharp.ComposedType)astType).PointerRank--; } var vbAstType = astType.AcceptVisitor(converter, null); vbAstType.AcceptVisitor(new OutputVisitor(new VBTextOutputFormatter(output), new VBFormattingOptions()), null); }
string TypeToString(ConvertTypeOptions options, ITypeDefOrRef type, IHasCustomAttribute typeAttributes = null) { var envProvider = new ILSpyEnvironmentProvider(); var converter = new CSharpToVBConverterVisitor(envProvider); var astType = AstBuilder.ConvertType(null, null, type, typeAttributes, options); StringWriter w = new StringWriter(); if (type.TryGetByRefSig() != null) { w.Write("ByRef "); if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0) ((NRefactory.CSharp.ComposedType)astType).PointerRank--; } var vbAstType = astType.AcceptVisitor(converter, null); vbAstType.AcceptVisitor(new OutputVisitor(w, new VBFormattingOptions()), null); return w.ToString(); }