public Dialog_DebugOutputMenu() { forcePause = true; foreach (Type item in GenTypes.AllTypesWithAttribute <HasDebugOutputAttribute>()) { MethodInfo[] methods = item.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo mi in methods) { if (mi.TryGetAttribute(out DebugOutputAttribute _)) { string label = GenText.SplitCamelCase(mi.Name); Action action = delegate { mi.Invoke(null, null); }; CategoryAttribute customAttribute2 = null; string category = (!mi.TryGetAttribute(out customAttribute2)) ? "General" : customAttribute2.name; debugOutputs.Add(new DebugOutputOption { label = label, category = category, action = action }); } } } debugOutputs = (from r in debugOutputs orderby r.category, r.label select r).ToList(); }
public static void CallAll() { IEnumerable <Type> enumerable = GenTypes.AllTypesWithAttribute <StaticConstructorOnStartup>(); foreach (Type item in enumerable) { RuntimeHelpers.RunClassConstructor(item.TypeHandle); } StaticConstructorOnStartupUtility.coreStaticAssetsLoaded = true; }
public static void CallAll() { foreach (Type item in GenTypes.AllTypesWithAttribute <StaticConstructorOnStartup>()) { try { RuntimeHelpers.RunClassConstructor(item.TypeHandle); } catch (Exception ex) { Log.Error(string.Concat("Error in static constructor of ", item, ": ", ex)); } } coreStaticAssetsLoaded = true; }
public Dialog_DebugOutputMenu() { this.forcePause = true; foreach (Type current in GenTypes.AllTypesWithAttribute <HasDebugOutputAttribute>()) { MethodInfo[] methods = current.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < methods.Length; i++) { MethodInfo mi = methods[i]; DebugOutputAttribute debugOutputAttribute; if (mi.TryGetAttribute(out debugOutputAttribute)) { string label = GenText.SplitCamelCase(mi.Name); Action action = delegate { mi.Invoke(null, null); }; CategoryAttribute categoryAttribute = null; string category; if (mi.TryGetAttribute(out categoryAttribute)) { category = categoryAttribute.name; } else { category = "General"; } this.debugOutputs.Add(new Dialog_DebugOutputMenu.DebugOutputOption { label = label, category = category, action = action }); } } } this.debugOutputs = (from r in this.debugOutputs orderby r.category, r.label select r).ToList <Dialog_DebugOutputMenu.DebugOutputOption>(); }