Created
January 28, 2015 23:15
-
-
Save JonRurka/5bb20a48936d83c10b8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public object Call_CMD(params string[] args) | |
{ | |
if (args.Length >= 3) | |
{ | |
Type compType = null; | |
foreach (Assembly assm in Assemblies.Values) | |
{ | |
Type testType = assm.GetType(args[1]); | |
if (testType != null) | |
{ | |
compType = testType; | |
object[] components = GameObject.FindObjectsOfType(compType); | |
if (components.Length > 0) | |
{ | |
foreach (object comp in components) | |
{ | |
MethodInfo method = compType.GetMethod(args[2]); | |
if (method != null) | |
{ | |
ParameterInfo[] parameters = method.GetParameters(); | |
object[] paramObjs = new object[parameters.Length]; | |
for (int i = 0; i < parameters.Length; i++) | |
{ | |
Type paramType = parameters[i].ParameterType; | |
if (paramType.IsPrimitive) | |
{ | |
// iterate through parameters, convert to the types, add to paramObjs, and | |
// call method.Invoke. | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment