- Timestamp:
- Apr 2, 2015, 9:16:34 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/CommandExtensions.cs
r198 r224 12 12 try { 13 13 ConsoleSdtd cons = manager.m_GUIConsole; 14 string ns = "AllocsFixes.CustomCommands"; 15 string basetype = "ConsoleCommand"; 14 Type commandType = typeof (ConsoleCommand); 16 15 17 foreach (Type t in Assembly.GetExecutingAssembly ().GetTypes()) { 18 if (t.IsClass && t.Namespace.Equals (ns) && t.BaseType.Name.Equals (basetype)) { 19 try { 20 ConstructorInfo ctor = t.GetConstructor (new Type[] {typeof(ConsoleSdtd)}); 21 cons.AddCommand ((ConsoleCommand)ctor.Invoke (new object[] {cons})); 22 } catch (Exception e) { 23 Log.Out ("Could not register custom command \"" + t.Name + "\": " + e); 16 Mods.ModData thisMd = new Mods.ModData (); 17 thisMd.assembly = Assembly.GetExecutingAssembly (); 18 19 List<Mods.ModData> mods = Mods.LoadedMods (); 20 mods.Add (thisMd); 21 22 foreach (Mods.ModData md in mods) { 23 foreach (Type t in md.assembly.GetTypes()) { 24 if (t.IsClass && commandType.IsAssignableFrom (t)) { 25 try { 26 ConstructorInfo ctor = t.GetConstructor (new Type[] {typeof(ConsoleSdtd)}); 27 cons.AddCommand ((ConsoleCommand)ctor.Invoke (new object[] {cons})); 28 } catch (Exception e) { 29 Log.Out ("Could not register custom command \"" + t.Name + "\": " + e); 30 } 24 31 } 25 32 }
Note:
See TracChangeset
for help on using the changeset viewer.