/// <summary>
        /// Finds a <see cref="TypeDef"/>
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>/</c></param>
        /// <returns>An existing <see cref="TypeDef"/></returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindNormalThrow(this ITypeDefFinder self, string fullName)
        {
            var type = self.Find(fullName, false);

            if (type is not null)
            {
                return(type);
            }
            throw new TypeResolveException($"Could not find type: {fullName}");
        }
        /// <summary>
        /// Finds a <see cref="TypeDef"/>. Its scope (i.e., module or assembly) is ignored when
        /// looking up the type.
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="typeRef">The type ref</param>
        /// <returns>An existing <see cref="TypeDef"/> or <c>null</c> if it wasn't found.</returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindThrow(this ITypeDefFinder self, TypeRef typeRef)
        {
            var type = self.Find(typeRef);

            if (type is not null)
            {
                return(type);
            }
            throw new TypeResolveException($"Could not find type: {typeRef}");
        }
Exemple #3
0
        /// <summary>
        /// Finds a <see cref="TypeDef"/>. Its scope (i.e., module or assembly) is ignored when
        /// looking up the type.
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="typeRef">The type ref</param>
        /// <returns>An existing <see cref="TypeDef"/> or <c>null</c> if it wasn't found.</returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindThrow(this ITypeDefFinder self, TypeRef typeRef)
        {
            var type = self.Find(typeRef);

            if (type != null)
            {
                return(type);
            }
            throw new TypeResolveException(string.Format("Could not find type: {0}", typeRef));
        }
        /// <summary>
        /// Finds a <see cref="TypeDef"/>
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="fullName">Full name of the type (no assembly information)</param>
        /// <param name="isReflectionName"><c>true</c> if it's a reflection name, and nested
        /// type names are separated by a <c>+</c> character. If <c>false</c>, nested type names
        /// are separated by a <c>/</c> character.</param>
        /// <returns>An existing <see cref="TypeDef"/></returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindThrow(this ITypeDefFinder self, string fullName, bool isReflectionName)
        {
            var type = self.Find(fullName, isReflectionName);

            if (type != null)
            {
                return(type);
            }
            throw new TypeResolveException($"Could not find type: {fullName}");
        }
Exemple #5
0
        /// <summary>
        /// Finds a <see cref="TypeDef"/>
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>+</c></param>
        /// <returns>An existing <see cref="TypeDef"/></returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindReflectionThrow(this ITypeDefFinder self, string fullName)
        {
            var type = self.Find(fullName, true);

            if (type != null)
            {
                return(type);
            }
            throw new TypeResolveException(string.Format("Could not find type: {0}", fullName));
        }
        /// <summary>
        /// Finds a <see cref="TypeDef"/>
        /// </summary>
        /// <param name="self">this</param>
        /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>+</c></param>
        /// <returns>An existing <see cref="TypeDef"/></returns>
        /// <exception cref="TypeResolveException">If type couldn't be found</exception>
        public static TypeDef FindReflectionThrow(this ITypeDefFinder self, string fullName)
        {
            var type = self.Find(fullName, true);

            if (!(type is null))
            {
                return(type);
            }
            throw new TypeResolveException($"Could not find type: {fullName}");
        }
 /// <summary>
 /// Finds a <see cref="TypeDef"/>
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>/</c></param>
 /// <returns>An existing <see cref="TypeDef"/> or <c>null</c> if it wasn't found.</returns>
 public static TypeDef FindNormal(this ITypeDefFinder self, string fullName) => self.Find(fullName, false);
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>+</c></param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExistsReflection(this ITypeDefFinder self, string fullName) => self.Find(fullName, true) is not null;
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>/</c></param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExistsNormal(this ITypeDefFinder self, string fullName) => self.Find(fullName, false) is not null;
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists. <paramref name="typeRef"/>'s scope (i.e.,
 /// module or assembly) is ignored when looking up the type.
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="typeRef">The type ref</param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExists(this ITypeDefFinder self, TypeRef typeRef) => self.Find(typeRef) is not null;
 /// <summary>
 /// Finds a <see cref="TypeDef"/>
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>+</c></param>
 /// <returns>An existing <see cref="TypeDef"/> or <c>null</c> if it wasn't found.</returns>
 public static TypeDef FindReflection(this ITypeDefFinder self, string fullName) => self.Find(fullName, true);
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information)</param>
 /// <param name="isReflectionName"><c>true</c> if it's a reflection name, and nested
 /// type names are separated by a <c>+</c> character. If <c>false</c>, nested type names
 /// are separated by a <c>/</c> character.</param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExists(this ITypeDefFinder self, string fullName, bool isReflectionName) => self.Find(fullName, isReflectionName) != null;
Exemple #13
0
 /// <summary>
 /// Finds a <see cref="TypeDef"/>
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>/</c></param>
 /// <returns>An existing <see cref="TypeDef"/> or <c>null</c> if it wasn't found.</returns>
 public static TypeDef FindNormal(this ITypeDefFinder self, string fullName)
 {
     return(self.Find(fullName, false));
 }
Exemple #14
0
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>+</c></param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExistsReflection(this ITypeDefFinder self, string fullName)
 {
     return(self.Find(fullName, true) != null);
 }
Exemple #15
0
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="fullName">Full name of the type (no assembly information). Nested types are separated by <c>/</c></param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExistsNormal(this ITypeDefFinder self, string fullName)
 {
     return(self.Find(fullName, false) != null);
 }
Exemple #16
0
 /// <summary>
 /// Checks whether a <see cref="TypeDef"/> exists. <paramref name="typeRef"/>'s scope (i.e.,
 /// module or assembly) is ignored when looking up the type.
 /// </summary>
 /// <param name="self">this</param>
 /// <param name="typeRef">The type ref</param>
 /// <returns><c>true</c> if the <see cref="TypeDef"/> exists, <c>false</c> otherwise</returns>
 public static bool TypeExists(this ITypeDefFinder self, TypeRef typeRef)
 {
     return(self.Find(typeRef) != null);
 }