diff options
Diffstat (limited to 'OpenSim/ScriptEngine/Shared.Script')
4 files changed, 104 insertions, 0 deletions
diff --git a/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs b/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs new file mode 100644 index 0000000..fefb5f9 --- /dev/null +++ b/OpenSim/ScriptEngine/Shared.Script/ICommandProvider.cs | |||
@@ -0,0 +1,12 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace ScriptAssemblies | ||
6 | { | ||
7 | public interface ICommandProvider | ||
8 | { | ||
9 | void ExecuteCommand(string functionName, params object[] args); | ||
10 | string Name { get; } | ||
11 | } | ||
12 | } | ||
diff --git a/OpenSim/ScriptEngine/Shared.Script/IScript.cs b/OpenSim/ScriptEngine/Shared.Script/IScript.cs new file mode 100644 index 0000000..5a3d3f3 --- /dev/null +++ b/OpenSim/ScriptEngine/Shared.Script/IScript.cs | |||
@@ -0,0 +1,11 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace ScriptAssemblies | ||
6 | { | ||
7 | public interface IScript | ||
8 | { | ||
9 | void ExecuteFunction(string functionName, params object[] args); | ||
10 | } | ||
11 | } \ No newline at end of file | ||
diff --git a/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs b/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..96b6c0c --- /dev/null +++ b/OpenSim/ScriptEngine/Shared.Script/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,36 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.ScriptEngine.Shared.Script")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("Microsoft")] | ||
12 | [assembly: AssemblyProduct("OpenSim.ScriptEngine.Shared.Script")] | ||
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2008")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("ea77002b-c967-4368-ace9-6533f8147d4b")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Build and Revision Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | // [assembly: AssemblyVersion("1.0.*")] | ||
35 | [assembly: AssemblyVersion("1.0.0.0")] | ||
36 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
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 | } | ||