Example #1
0
        internal static List <BepInProcess> FromCecilType(TypeDefinition td)
        {
            var attrs = MetadataHelper.GetCustomAttributes <BepInProcess>(td, true);

            return(attrs.Select(customAttribute =>
                                new BepInProcess((string)customAttribute.ConstructorArguments[0].Value)).ToList());
        }
Example #2
0
        internal static IEnumerable <BepInIncompatibility> FromCecilType(TypeDefinition td)
        {
            var attrs = MetadataHelper.GetCustomAttributes <BepInIncompatibility>(td, true);

            return(attrs.Select(customAttribute =>
            {
                var dependencyGuid = (string)customAttribute.ConstructorArguments[0].Value;
                return new BepInIncompatibility(dependencyGuid);
            }).ToList());
        }
Example #3
0
        internal static BepInPlugin FromCecilType(TypeDefinition td)
        {
            var attr = MetadataHelper.GetCustomAttributes <BepInPlugin>(td, false).FirstOrDefault();

            if (attr == null)
            {
                return(null);
            }

            return(new BepInPlugin((string)attr.ConstructorArguments[0].Value, (string)attr.ConstructorArguments[1].Value, (string)attr.ConstructorArguments[2].Value));
        }
Example #4
0
        internal static IEnumerable <BepInDependency> FromCecilType(TypeDefinition td)
        {
            var attrs = MetadataHelper.GetCustomAttributes <BepInDependency>(td, true);

            return(attrs.Select(customAttribute =>
            {
                var dependencyGuid = (string)customAttribute.ConstructorArguments[0].Value;
                var secondArg = customAttribute.ConstructorArguments[1].Value;
                if (secondArg is string minVersion)
                {
                    return new BepInDependency(dependencyGuid, minVersion);
                }
                return new BepInDependency(dependencyGuid, (DependencyFlags)secondArg);
            }).ToList());
        }
Example #5
0
        internal static IEnumerable <BepInDependency> FromCecilType(TypeDefinition td)
        {
            var attrs = MetadataHelper.GetCustomAttributes <BepInDependency>(td, true);

            return(attrs.Select(customAttribute => new BepInDependency((string)customAttribute.ConstructorArguments[0].Value, (DependencyFlags)customAttribute.ConstructorArguments[1].Value)).ToList());
        }