public static object RunInAppDomain(Delegate delg, params object[] args) { AppDomain tempDomain = AppDomain.CreateDomain("domain_RunInAppDomain" + delg.GetHashCode()); object returnValue; try { returnValue = RunInAppDomain(delg, tempDomain, args); } finally { AppDomain.Unload(tempDomain); } return returnValue; }
static int GetHashCode(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); System.Delegate obj = (System.Delegate)ToLua.CheckObject <System.Delegate>(L, 1); int o = obj.GetHashCode(); LuaDLL.lua_pushinteger(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetHashCode(IntPtr L) { ToLua.CheckArgsCount(L, 1); System.Delegate obj = (System.Delegate)ToLua.CheckObject(L, 1, typeof(System.Delegate)); int o; try { o = obj.GetHashCode(); } catch (Exception e) { return(LuaDLL.luaL_error(L, e.Message)); } LuaDLL.lua_pushinteger(L, o); return(1); }
public static object RunInAppDomain(Delegate delg, AppDomain targetDomain, params object[] args) { var runner = new domainDomainRunner(delg, args, delg.GetHashCode()); targetDomain.DoCallBack(runner.Invoke); return targetDomain.GetData("appDomainResult" + delg.GetHashCode()); }