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()); }
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()); }
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)); }
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()); }
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()); }