diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs b/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs new file mode 100644 index 0000000..587314f --- /dev/null +++ b/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs | |||
@@ -0,0 +1,45 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Reflection; | ||
4 | using System.Runtime.Remoting.Lifetime; | ||
5 | using System.Text; | ||
6 | |||
7 | namespace ScriptAssemblies | ||
8 | { | ||
9 | public class ScriptBase : MarshalByRefObject, IScript | ||
10 | { | ||
11 | |||
12 | #region AppDomain Serialization Keep-Alive | ||
13 | // | ||
14 | // Never expire this object | ||
15 | // | ||
16 | public override Object InitializeLifetimeService() | ||
17 | { | ||
18 | ILease lease = (ILease)base.InitializeLifetimeService(); | ||
19 | |||
20 | if (lease.CurrentState == LeaseState.Initial) | ||
21 | { | ||
22 | lease.InitialLeaseTime = TimeSpan.Zero; | ||
23 | } | ||
24 | return lease; | ||
25 | } | ||
26 | #endregion | ||
27 | |||
28 | public delegate void ExecuteFunctionEventDelegate(string functionName, params object[] args); | ||
29 | public event ExecuteFunctionEventDelegate OnExecuteFunction; | ||
30 | |||
31 | private List<ICommandProvider> CommandProviders = new List<ICommandProvider>(); | ||
32 | |||
33 | public ScriptBase() | ||
34 | { | ||
35 | } | ||
36 | |||
37 | public void ExecuteFunction(string functionName, params object[] args) | ||
38 | { | ||
39 | // We got a new command, fire event | ||
40 | if (OnExecuteFunction != null) | ||
41 | OnExecuteFunction(functionName, args); | ||
42 | |||
43 | } | ||
44 | } | ||
45 | } | ||