/// <summary> /// Add a class method to the given class in the given service for the given class type annotated with the KRPCClass attribute. /// </summary> public void AddClassMethod(string cls, Type classType, MethodInfo method) { TypeUtils.ValidateIdentifier(cls); TypeUtils.ValidateKRPCMethod(classType, method); if (!Classes.ContainsKey(cls)) { throw new ArgumentException("Class " + cls + " does not exist"); } var name = method.Name; var id = NextProcedureId; var classGameScene = TypeUtils.GetClassGameScene(classType, gameScene); if (!method.IsStatic) { var handler = new ClassMethodHandler(classType, method, TypeUtils.GetNullable(method)); AddProcedure(new ProcedureSignature( Name, cls + '_' + name, id, method.GetDocumentation(), handler, TypeUtils.GetMethodGameScene(classType, method, classGameScene))); } else { var handler = new ClassStaticMethodHandler(method, TypeUtils.GetNullable(method)); AddProcedure(new ProcedureSignature( Name, cls + "_static_" + name, id, method.GetDocumentation(), handler, TypeUtils.GetMethodGameScene(classType, method, classGameScene))); } }
/// <summary> /// Add a class method to the given class in the given service for the given class type annotated with the KRPCClass attribute. /// </summary> public void AddClassMethod(string cls, MethodInfo method) { if (!Classes.ContainsKey(cls)) { throw new ArgumentException("Class " + cls + " does not exist"); } if (!method.IsStatic) { var handler = new ClassMethodHandler(method); AddProcedure(new ProcedureSignature(Name, cls + '_' + method.Name, method.GetDocumentation(), handler, GameScene, "Class.Method(" + Name + "." + cls + "," + method.Name + ")", "ParameterType(0).Class(" + Name + "." + cls + ")")); } else { var handler = new ClassStaticMethodHandler(method); AddProcedure(new ProcedureSignature(Name, cls + '_' + method.Name, method.GetDocumentation(), handler, GameScene, "Class.StaticMethod(" + Name + "." + cls + "," + method.Name + ")")); } }
/// <summary> /// Add a class method to the given class in the given service for the given class type annotated with the KRPCClass attribute. /// </summary> public void AddClassMethod(string cls, MethodInfo method) { if (!Classes.ContainsKey (cls)) throw new ArgumentException ("Class " + cls + " does not exist"); if (!method.IsStatic) { var handler = new ClassMethodHandler (method); AddProcedure (new ProcedureSignature (Name, cls + '_' + method.Name, method.GetDocumentation (), handler, GameScene, "Class.Method(" + Name + "." + cls + "," + method.Name + ")", "ParameterType(0).Class(" + Name + "." + cls + ")")); } else { var handler = new ClassStaticMethodHandler (method); AddProcedure (new ProcedureSignature (Name, cls + '_' + method.Name, method.GetDocumentation (), handler, GameScene, "Class.StaticMethod(" + Name + "." + cls + "," + method.Name + ")")); } }