aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ScriptEngine/Shared.Script/ScriptBase.cs
blob: 587314f78bb21742cc9ae528e02f44fa4f727b1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Remoting.Lifetime;
using System.Text;

namespace ScriptAssemblies
{
    public class ScriptBase : MarshalByRefObject, IScript
    {

        #region AppDomain Serialization Keep-Alive
        //
        // Never expire this object
        //
        public override Object InitializeLifetimeService()
        {
            ILease lease = (ILease)base.InitializeLifetimeService();

            if (lease.CurrentState == LeaseState.Initial)
            {
                lease.InitialLeaseTime = TimeSpan.Zero;
            }
            return lease;
        }
        #endregion

        public delegate void ExecuteFunctionEventDelegate(string functionName, params object[] args);
        public event ExecuteFunctionEventDelegate OnExecuteFunction;

        private List<ICommandProvider> CommandProviders = new List<ICommandProvider>();

        public ScriptBase()
        {
        }

        public void ExecuteFunction(string functionName, params object[] args)
        {
            // We got a new command, fire event
            if (OnExecuteFunction != null)
                OnExecuteFunction(functionName, args);
            
        }
    }
}