protected internal virtual void CreateMethodBindings() { var mapperClass = GetType(); CommandContextFunctionMap["currentUser"] = ReflectUtil.GetMethod(mapperClass, "currentUser"); CommandContextFunctionMap["currentUserGroups"] = ReflectUtil.GetMethod(mapperClass, "currentUserGroups"); }
protected internal virtual void CreateMethodBindings() { var mapperClass = GetType(); DateTimeFunctionMap["Now"] = ReflectUtil.GetMethod(mapperClass, "Now"); DateTimeFunctionMap["DateTime"] = ReflectUtil.GetMethod(mapperClass, "DateTime"); }
// Activity Behavior public override void Execute(IActivityExecution execution) { var scope = Context.CommandContext.Scope; var type = ReflectUtil.LoadClass(_className); object clazz; if (scope.IsRegistered(type)) { clazz = scope.Resolve(type); } else { clazz = ReflectUtil.Instantiate(_className); } if (type != null) { //execution.SetVariableLocal(_className,clazz); MethodInfo m = ReflectUtil.GetMethod(type, _methodName); if (m == null) { throw Log.MissingClassException(_className); } PerformExecution(execution, m, clazz); return; } throw Log.MissingClassException(_className); }
protected internal static MethodInfo GetMethod(string name, params Type[] parameterTypes) { try { return(ReflectUtil.GetMethod(typeof(FeelFunctionMapper), name, parameterTypes)); } //TODO 反射异常类型 catch (System.Exception var3) { throw LOG.unableToFindMethod(var3, name, parameterTypes); } }
public override void OnLoad() { UEssentials.Logger.LogInfo("Loading AviEconomy hook..."); IRocketPlugin economyPlugin = R.Plugins.GetPlugins().FirstOrDefault(c => c.Name.EqualsIgnoreCase("AviEconomy")); if (economyPlugin == null) { throw new Exception("AviEconomy Plugin couldn't be loaded..."); } this._bankType = economyPlugin.GetType().Assembly.GetType("com.aviadmini.rocketmod.AviEconomy.Bank"); if (this._bankType == null) { throw new Exception("AviEconomy Bank type couldn't be loaded..."); } this._getBalanceMethod = ReflectUtil.GetMethod(this._bankType, "GetBalance", BindingFlags.Static | BindingFlags.Public, new[] { typeof(string) }); if (this._bankType == null) { throw new Exception("AviEconomy GetBalance method couldn't be loaded..."); } this._performPaymentMethod = ReflectUtil.GetMethod(this._bankType, "PerformPayment", BindingFlags.Static | BindingFlags.Public, new[] { typeof(IRocketPlayer), typeof(string), typeof(decimal), typeof(string) }); if (this._bankType == null) { throw new Exception("AviEconomy PerformPayment method couldn't be loaded..."); } this._processPurchaseMethod = ReflectUtil.GetMethod(this._bankType, "ProcessPurchaseFromServer", BindingFlags.Static | BindingFlags.Public, new[] { typeof(UnturnedPlayer), typeof(decimal), typeof(string), typeof(bool) }); if (this._bankType == null) { throw new Exception("AviEconomy ProcessPurchase method couldn't be loaded..."); } UEssentials.Logger.LogInfo("AviEconomy hook loaded."); }
public override void OnLoad() { UEssentials.Logger.LogInfo("Loading Uconomy hook..."); var uconomyPlugin = R.Plugins.GetPlugins().FirstOrDefault(c => c.Name.EqualsIgnoreCase("uconomy")); var uconomyType = uconomyPlugin.GetType().Assembly.GetType("fr34kyn01535.Uconomy.Uconomy"); var uconomyInstance = uconomyType.GetField("Instance", BindingFlags.Static | BindingFlags.Public).GetValue(uconomyPlugin); _databaseInstance = uconomyInstance.GetType().GetField("Database").GetValue(uconomyInstance); _getBalanceMethod = ReflectUtil.GetMethod(_databaseInstance.GetType(), "GetBalance", new [] { typeof(string) }); _increaseBalanceMethod = ReflectUtil.GetMethod(_databaseInstance.GetType(), "IncreaseBalance", new [] { typeof(string), typeof(decimal) }); UEssentials.Logger.LogInfo("Uconomy hook loaded."); }
protected internal virtual void CreateMethodBindings() { StringFunctionMap["IsNullOrEmpty"] = ReflectUtil.GetMethod(typeof(string), "IsNullOrEmpty", new Type[] { typeof(string) }); }