2 using System.Collections.Generic;
8 namespace Loot.Api.Attributes
17 [AttributeUsage(AttributeTargets.Class)]
20 public string[] Namespaces {
get;
set; }
24 Assembly
asm = Assembly.GetExecutingAssembly();
27 foreach (
string ns
in namespaces)
29 Assembly useAssembly =
asm;
31 int index = ns.IndexOf(
'.');
34 root = ns.Substring(0, index);
37 var mod = ModLoader.GetMod(root);
40 useAssembly = mod.Code;
43 if (!useAssembly.GetTypes().Any(x => x.Namespace != null && x.Namespace.StartsWith(ns)))
45 throw new ArgumentException($
"Namespace not found", nameof(ns));
49 Namespaces = namespaces;
54 var dict =
new Dictionary<string, List<Type>>();
55 foreach (
string s
in Namespaces)
57 dict.Add(s, GetModifierClasses(s).ToList());
65 Assembly
asm = Assembly.GetExecutingAssembly();
66 Assembly useAssembly =
asm;
68 int index = ns.IndexOf(
'.');
71 root = ns.Substring(0, index);
74 var mod = ModLoader.GetMod(root);
77 useAssembly = mod.Code;
84 && type.IsSubclassOf(typeof(
Modifier))
85 && type.Namespace != null && type.Namespace.StartsWith(ns));
Defines a modifier, which is an unloaded GlobalItem Making it a GlobalItem gives easy access to all h...
Will populate a ModifierPool based on a namespace All Modifiers in that namespace will become part of...
Dictionary< string, List< Type > > GetClasses()
IEnumerable< Type > GetModifierClasses(string ns)
PopulatePoolFromAttribute(params string[] namespaces)