public static AbstractModifier MakeModifier(string name) { bool found = false; Type ftype = typeof(Object); AbstractModifier ret = null; foreach (Assembly asm in AbstractModifier.loadedAssemblies) { foreach (Type item in asm.GetTypes()) { object[] at = item.GetCustomAttributes(typeof(ModifierAttribute), false); string n = item.Name; if (at.Length > 0 && ((ModifierAttribute)at[0]).Name == name) { found = true; ftype = item; break; } } if (found == true) { break; } } if (found == true) { ConstructorInfo info = ftype.GetConstructor(new Type[0]); ret = info.Invoke(new Type[0]) as AbstractModifier; } return(ret); }
private void UpdateModifiers(AbstractModifier startingModifier) { int start = 0; for(int i = 0;i < this.modifiers.Count; i++) if (this.modifiers[i] == startingModifier) { start = i; } for (int i = start; i < this.modifiers.Count; i++) { this.modifiers[i].Target = this.modifiersStages[i]; this.modifiersStages[i + 1] = this.modifiers[i].Apply(); } this.modifiersListView.BeginUpdate(); this.modifiersListView.Items.Clear(); for (int i = 0; i < this.modifiers.Count; i++) this.modifiersListView.Items.Add(this.modifiers[i].ToListViewItem(i)); this.modifiersListView.EndUpdate(); }