/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="TypeSig"/> instance or <c>null</c> if parsing failed</returns> public static TypeSig ParseAsTypeSigReflection(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) { try { return ParseAsTypeSigReflectionThrow(ownerModule, typeFullName, typeNameParserHelper); } catch (TypeNameParserException) { return null; } }
/// <summary> /// Constructor /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="IType"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> protected TypeNameParser(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) { this.ownerModule = ownerModule; this.reader = new StringReader(typeFullName ?? string.Empty); this.typeNameParserHelper = typeNameParserHelper; }
/// <summary> /// Constructor /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="IType"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> protected TypeNameParser(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) : this(ownerModule, typeFullName, typeNameParserHelper, new GenericParamContext()) { }
/// <summary> /// Constructor /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="IType"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param>/// protected TypeNameParser(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { this.ownerModule = ownerModule; this.reader = new StringReader(typeFullName ?? string.Empty); this.typeNameParserHelper = typeNameParserHelper; this.gpContext = gpContext; }
/// <summary> /// Parses a Reflection type name and creates a <see cref="ITypeDefOrRef"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="ITypeDefOrRef"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="ITypeDefOrRef"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static ITypeDefOrRef ParseReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) { return ParseReflectionThrow(ownerModule, typeFullName, typeNameParserHelper, new GenericParamContext()); }
/// <summary> /// Constructor /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="IType"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> public ReflectionTypeNameParser(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) : base(ownerModule, typeFullName, typeNameParserHelper, gpContext) { }
/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="TypeSig"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static TypeSig ParseAsTypeSigReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { using (var parser = new ReflectionTypeNameParser(ownerModule, typeFullName, typeNameParserHelper, gpContext)) return parser.ParseAsTypeSig(); }
/// <summary> /// Parses a Reflection type name and creates a <see cref="ITypeDefOrRef"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="ITypeDefOrRef"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="ITypeDefOrRef"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static ITypeDefOrRef ParseReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) => ParseReflectionThrow(ownerModule, typeFullName, typeNameParserHelper, new GenericParamContext());
/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="TypeSig"/> instance or <c>null</c> if parsing failed</returns> public static TypeSig ParseAsTypeSigReflection(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) { return ParseAsTypeSigReflection(ownerModule, typeFullName, typeNameParserHelper, new GenericParamContext()); }
/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="TypeSig"/> instance or <c>null</c> if parsing failed</returns> public static TypeSig ParseAsTypeSigReflection(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { try { return(ParseAsTypeSigReflectionThrow(ownerModule, typeFullName, typeNameParserHelper, gpContext)); } catch (TypeNameParserException) { return(null); } }
/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="TypeSig"/> instance or <c>null</c> if parsing failed</returns> public static TypeSig ParseAsTypeSigReflection(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) => ParseAsTypeSigReflection(ownerModule, typeFullName, typeNameParserHelper, new GenericParamContext());
/// <summary> /// Parses a Reflection type name and creates a <see cref="TypeSig"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="TypeSig"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="TypeSig"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static TypeSig ParseAsTypeSigReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { using (var parser = new ReflectionTypeNameParser(ownerModule, typeFullName, typeNameParserHelper, gpContext)) return(parser.ParseAsTypeSig()); }
/// <summary> /// Constructor /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="IType"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> public ReflectionTypeNameParser(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) : base(ownerModule, typeFullName, typeNameParserHelper) { }
/// <summary> /// Parses a Reflection type name and creates a <see cref="ITypeDefOrRef"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="ITypeDefOrRef"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <param name="gpContext">Generic parameter context</param> /// <returns>A new <see cref="ITypeDefOrRef"/> instance or <c>null</c> if parsing failed</returns> public static ITypeDefOrRef ParseReflection(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper, GenericParamContext gpContext) { try { return ParseReflectionThrow(ownerModule, typeFullName, typeNameParserHelper, gpContext); } catch (TypeNameParserException) { return null; } }
/// <summary> /// Parses a Reflection type name and creates a <see cref="ITypeDefOrRef"/> /// </summary> /// <param name="ownerModule">Module that will own the returned <see cref="ITypeDefOrRef"/> or <c>null</c></param> /// <param name="typeFullName">Full name of type</param> /// <param name="typeNameParserHelper">Helper class</param> /// <returns>A new <see cref="ITypeDefOrRef"/> instance</returns> /// <exception cref="TypeNameParserException">If parsing failed</exception> public static ITypeDefOrRef ParseReflectionThrow(ModuleDef ownerModule, string typeFullName, IAssemblyRefFinder typeNameParserHelper) { using (var parser = new ReflectionTypeNameParser(ownerModule, typeFullName, typeNameParserHelper)) return parser.Parse(); }