static Cheat() { CheatManager = new LoadedTypeManager(new Assembly[] { Assembly.GetExecutingAssembly() }, typeof(Cheat), null); foreach (var iterate in CheatManager.ManagedTypes) { ConstructorInfo findconstructor = iterate.GetConstructor(new Type[] { }); if (findconstructor != null) { Cheat CheatInstance = (Cheat)findconstructor.Invoke(new object[] { }); CheatDictionary.Add(CheatInstance.CheatName, CheatInstance); } } }
public static bool ProcessCheat(String cheattext, IStateOwner pStateOwner) { //same recursive definition for semicolons as well. if (cheattext.Contains(";")) { return(ProcessCheat(cheattext.Split(';'), pStateOwner)); } String[] splitcheat = cheattext.Split(' '); Cheat acquirecheat = Cheat.GetCheat(splitcheat[0]); if (acquirecheat == null) { return(false); } //remove the first element from the string array. splitcheat = new List <String>(splitcheat.Skip(1)).ToArray(); //call the cheat we acquired. return(acquirecheat.CheatAction(pStateOwner, splitcheat)); }