Yay! Common/ is gone! One API is achieved!
parent
055ea73b57
commit
12a6b7c835
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public class Executor : ExecutorBase
|
||||
{
|
||||
// Cache functions by keeping a reference to them in a dictionary
|
||||
private Dictionary<string, MethodInfo> Events = new Dictionary<string, MethodInfo>();
|
||||
private Dictionary<string, scriptEvents> m_stateEvents = new Dictionary<string, scriptEvents>();
|
||||
|
||||
public Executor(IScript script) : base(script)
|
||||
{
|
||||
initEventFlags();
|
||||
}
|
||||
|
||||
|
||||
protected override scriptEvents DoGetStateEventFlags(string state)
|
||||
{
|
||||
// Console.WriteLine("Get event flags for " + state);
|
||||
|
||||
// Check to see if we've already computed the flags for this state
|
||||
scriptEvents eventFlags = scriptEvents.None;
|
||||
if (m_stateEvents.ContainsKey(state))
|
||||
{
|
||||
m_stateEvents.TryGetValue(state, out eventFlags);
|
||||
return eventFlags;
|
||||
}
|
||||
|
||||
// Fill in the events for this state, cache the results in the map
|
||||
foreach (KeyValuePair<string, scriptEvents> kvp in m_eventFlagsMap)
|
||||
{
|
||||
string evname = state + "_event_" + kvp.Key;
|
||||
Type type = m_Script.GetType();
|
||||
try
|
||||
{
|
||||
MethodInfo mi = type.GetMethod(evname);
|
||||
if (mi != null)
|
||||
{
|
||||
// Console.WriteLine("Found handler for " + kvp.Key);
|
||||
eventFlags |= kvp.Value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Save the flags we just computed and return the result
|
||||
m_stateEvents.Add(state, eventFlags);
|
||||
return (eventFlags);
|
||||
}
|
||||
|
||||
protected override void DoExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
// IMPORTANT: Types and MemberInfo-derived objects require a LOT of memory.
|
||||
// Instead use RuntimeTypeHandle, RuntimeFieldHandle and RunTimeHandle (IntPtr) instead!
|
||||
|
||||
string EventName = state + "_event_" + FunctionName;
|
||||
|
||||
//#if DEBUG
|
||||
// Console.WriteLine("ScriptEngine: Script event function name: " + EventName);
|
||||
//#endif
|
||||
|
||||
if (Events.ContainsKey(EventName) == false)
|
||||
{
|
||||
// Not found, create
|
||||
Type type = m_Script.GetType();
|
||||
try
|
||||
{
|
||||
MethodInfo mi = type.GetMethod(EventName);
|
||||
Events.Add(EventName, mi);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Event name not found, cache it as not found
|
||||
Events.Add(EventName, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Get event
|
||||
MethodInfo ev = null;
|
||||
Events.TryGetValue(EventName, out ev);
|
||||
|
||||
if (ev == null) // No event by that name!
|
||||
{
|
||||
//Console.WriteLine("ScriptEngine Can not find any event named: \String.Empty + EventName + "\String.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
//cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined
|
||||
#if DEBUG
|
||||
//Console.WriteLine("ScriptEngine: Executing function name: " + EventName);
|
||||
#endif
|
||||
// Found
|
||||
ev.Invoke(m_Script, args);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,213 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public abstract class ExecutorBase : MarshalByRefObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the script to execute functions in.
|
||||
/// </summary>
|
||||
protected IScript m_Script;
|
||||
/// <summary>
|
||||
/// If set to False events will not be executed.
|
||||
/// </summary>
|
||||
protected bool m_Running = true;
|
||||
/// <summary>
|
||||
/// True indicates that the ScriptManager has stopped
|
||||
/// this script. This prevents a script that has been
|
||||
/// stopped as part of deactivation from being
|
||||
/// resumed by a pending llSetScriptState request.
|
||||
/// </summary>
|
||||
protected bool m_Disable = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indicate the scripts current running status.
|
||||
/// </summary>
|
||||
public bool Running
|
||||
{
|
||||
get { return m_Running; }
|
||||
set
|
||||
{
|
||||
if (!m_Disable)
|
||||
m_Running = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Dictionary<string, scriptEvents> m_eventFlagsMap = new Dictionary<string, scriptEvents>();
|
||||
|
||||
[Flags]
|
||||
public enum scriptEvents : int
|
||||
{
|
||||
None = 0,
|
||||
attach = 1,
|
||||
collision = 16,
|
||||
collision_end = 32,
|
||||
collision_start = 64,
|
||||
control = 128,
|
||||
dataserver = 256,
|
||||
email = 512,
|
||||
http_response = 1024,
|
||||
land_collision = 2048,
|
||||
land_collision_end = 4096,
|
||||
land_collision_start = 8192,
|
||||
at_target = 16384,
|
||||
listen = 32768,
|
||||
money = 65536,
|
||||
moving_end = 131072,
|
||||
moving_start = 262144,
|
||||
not_at_rot_target = 524288,
|
||||
not_at_target = 1048576,
|
||||
remote_data = 8388608,
|
||||
run_time_permissions = 268435456,
|
||||
state_entry = 1073741824,
|
||||
state_exit = 2,
|
||||
timer = 4,
|
||||
touch = 8,
|
||||
touch_end = 536870912,
|
||||
touch_start = 2097152,
|
||||
object_rez = 4194304
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new instance of ExecutorBase
|
||||
/// </summary>
|
||||
/// <param name="Script"></param>
|
||||
public ExecutorBase(IScript Script)
|
||||
{
|
||||
m_Script = Script;
|
||||
initEventFlags();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make sure our object does not timeout when in AppDomain. (Called by ILease base class)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Object InitializeLifetimeService()
|
||||
{
|
||||
//Console.WriteLine("Executor: InitializeLifetimeService()");
|
||||
// return null;
|
||||
ILease lease = (ILease)base.InitializeLifetimeService();
|
||||
|
||||
if (lease.CurrentState == LeaseState.Initial)
|
||||
{
|
||||
lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1);
|
||||
// lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
|
||||
// lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
return lease;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current AppDomain
|
||||
/// </summary>
|
||||
/// <returns>Current AppDomain</returns>
|
||||
public AppDomain GetAppDomain()
|
||||
{
|
||||
return AppDomain.CurrentDomain;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a specific function/event in script.
|
||||
/// </summary>
|
||||
/// <param name="FunctionName">Name of function to execute</param>
|
||||
/// <param name="args">Arguments to pass to function</param>
|
||||
public void ExecuteEvent(string state, string FunctionName, object[] args)
|
||||
{
|
||||
DoExecuteEvent(state, FunctionName, args);
|
||||
}
|
||||
|
||||
protected abstract void DoExecuteEvent(string state, string FunctionName, object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Compute the events handled by the current state of the script
|
||||
/// </summary>
|
||||
/// <returns>state mask</returns>
|
||||
public scriptEvents GetStateEventFlags(string state)
|
||||
{
|
||||
return DoGetStateEventFlags(state);
|
||||
}
|
||||
|
||||
protected abstract scriptEvents DoGetStateEventFlags(string state);
|
||||
|
||||
/// <summary>
|
||||
/// Stop script from running. Event execution will be ignored.
|
||||
/// </summary>
|
||||
public void StopScript()
|
||||
{
|
||||
m_Running = false;
|
||||
m_Disable = true;
|
||||
}
|
||||
|
||||
protected void initEventFlags()
|
||||
{
|
||||
// Initialize the table if it hasn't already been done
|
||||
if (m_eventFlagsMap.Count > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_eventFlagsMap.Add("attach", scriptEvents.attach);
|
||||
// m_eventFlagsMap.Add("at_rot_target",(long)scriptEvents.at_rot_target);
|
||||
m_eventFlagsMap.Add("at_target", scriptEvents.at_target);
|
||||
// m_eventFlagsMap.Add("changed",(long)scriptEvents.changed);
|
||||
m_eventFlagsMap.Add("collision", scriptEvents.collision);
|
||||
m_eventFlagsMap.Add("collision_end", scriptEvents.collision_end);
|
||||
m_eventFlagsMap.Add("collision_start", scriptEvents.collision_start);
|
||||
m_eventFlagsMap.Add("control", scriptEvents.control);
|
||||
m_eventFlagsMap.Add("dataserver", scriptEvents.dataserver);
|
||||
m_eventFlagsMap.Add("email", scriptEvents.email);
|
||||
m_eventFlagsMap.Add("http_response", scriptEvents.http_response);
|
||||
m_eventFlagsMap.Add("land_collision", scriptEvents.land_collision);
|
||||
m_eventFlagsMap.Add("land_collision_end", scriptEvents.land_collision_end);
|
||||
m_eventFlagsMap.Add("land_collision_start", scriptEvents.land_collision_start);
|
||||
// m_eventFlagsMap.Add("link_message",scriptEvents.link_message);
|
||||
m_eventFlagsMap.Add("listen", scriptEvents.listen);
|
||||
m_eventFlagsMap.Add("money", scriptEvents.money);
|
||||
m_eventFlagsMap.Add("moving_end", scriptEvents.moving_end);
|
||||
m_eventFlagsMap.Add("moving_start", scriptEvents.moving_start);
|
||||
m_eventFlagsMap.Add("not_at_rot_target", scriptEvents.not_at_rot_target);
|
||||
m_eventFlagsMap.Add("not_at_target", scriptEvents.not_at_target);
|
||||
// m_eventFlagsMap.Add("no_sensor",(long)scriptEvents.no_sensor);
|
||||
// m_eventFlagsMap.Add("on_rez",(long)scriptEvents.on_rez);
|
||||
m_eventFlagsMap.Add("remote_data", scriptEvents.remote_data);
|
||||
m_eventFlagsMap.Add("run_time_permissions", scriptEvents.run_time_permissions);
|
||||
// m_eventFlagsMap.Add("sensor",(long)scriptEvents.sensor);
|
||||
m_eventFlagsMap.Add("state_entry", scriptEvents.state_entry);
|
||||
m_eventFlagsMap.Add("state_exit", scriptEvents.state_exit);
|
||||
m_eventFlagsMap.Add("timer", scriptEvents.timer);
|
||||
m_eventFlagsMap.Add("touch", scriptEvents.touch);
|
||||
m_eventFlagsMap.Add("touch_end", scriptEvents.touch_end);
|
||||
m_eventFlagsMap.Add("touch_start", scriptEvents.touch_start);
|
||||
m_eventFlagsMap.Add("object_rez", scriptEvents.object_rez);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Common
|
||||
{
|
||||
public interface IScript
|
||||
{
|
||||
ExecutorBase Exec { get; }
|
||||
void InitApi(string api, IScriptApi LSL_Functions);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
[assembly : AssemblyTitle("OpenSim.Region.ScriptEngine.Common")]
|
||||
[assembly : AssemblyDescription("")]
|
||||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("")]
|
||||
[assembly : AssemblyProduct("OpenSim.Region.ScriptEngine.Common")]
|
||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2008")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
[assembly : ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly : Guid("0bf07c53-ae51-487f-a907-e9b30c251602")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
|
||||
[assembly : AssemblyVersion("1.0.0.0")]
|
||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
File diff suppressed because it is too large
Load Diff
|
@ -29,7 +29,8 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
|
|
|
@ -217,23 +217,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
|
||||
}
|
||||
|
||||
////private ICodeCompiler icc = codeProvider.CreateCompiler();
|
||||
//public string CompileFromFile(string LSOFileName)
|
||||
//{
|
||||
// switch (Path.GetExtension(LSOFileName).ToLower())
|
||||
// {
|
||||
// case ".txt":
|
||||
// case ".lsl":
|
||||
// Common.ScriptEngineBase.Common.SendToDebug("Source code is LSL, converting to CS");
|
||||
// return CompileFromLSLText(File.ReadAllText(LSOFileName));
|
||||
// case ".cs":
|
||||
// Common.ScriptEngineBase.Common.SendToDebug("Source code is CS");
|
||||
// return CompileFromCSText(File.ReadAllText(LSOFileName));
|
||||
// default:
|
||||
// throw new Exception("Unknown script type.");
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Converts script from LSL to CS and calls CompileFromCSText
|
||||
/// </summary>
|
||||
|
@ -332,9 +315,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
private static string CreateJSCompilerScript(string compileScript)
|
||||
{
|
||||
compileScript = String.Empty +
|
||||
"import OpenSim.Region.ScriptEngine.Common; import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
|
||||
"import OpenSim.Region.ScriptEngine.Shared; import System.Collections.Generic;\r\n" +
|
||||
"package SecondLife {\r\n" +
|
||||
"class Script extends OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" +
|
||||
"class Script extends OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
|
||||
compileScript +
|
||||
"} }\r\n";
|
||||
return compileScript;
|
||||
|
@ -343,9 +326,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
private static string CreateCSCompilerScript(string compileScript)
|
||||
{
|
||||
compileScript = String.Empty +
|
||||
"using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
|
||||
"using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
|
||||
String.Empty + "namespace SecondLife { " +
|
||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" +
|
||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
|
||||
@"public Script() { } " +
|
||||
compileScript +
|
||||
"} }\r\n";
|
||||
|
@ -356,9 +339,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
{
|
||||
compileScript = String.Empty +
|
||||
"using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog; " +
|
||||
"using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
|
||||
"using OpenSim.Region.ScriptEngine.Shared; using System.Collections.Generic;\r\n" +
|
||||
String.Empty + "namespace SecondLife { " +
|
||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.ScriptBaseClass { \r\n" +
|
||||
String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { \r\n" +
|
||||
//@"public Script() { } " +
|
||||
@"static OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP YP=null; " +
|
||||
@"public Script() { YP= new OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.YieldProlog.YP(); } "+
|
||||
|
@ -371,9 +354,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
private static string CreateVBCompilerScript(string compileScript)
|
||||
{
|
||||
compileScript = String.Empty +
|
||||
"Imports OpenSim.Region.ScriptEngine.Common: Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
|
||||
"Imports OpenSim.Region.ScriptEngine.Shared: Imports System.Collections.Generic: " +
|
||||
String.Empty + "NameSpace SecondLife:" +
|
||||
String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.ScriptBaseClass: " +
|
||||
String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass: " +
|
||||
"\r\nPublic Sub New()\r\nEnd Sub: " +
|
||||
compileScript +
|
||||
":End Class :End Namespace\r\n";
|
||||
|
@ -439,9 +422,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
|
||||
string rootPathSE = Path.GetDirectoryName(GetType().Assembly.Location);
|
||||
//Console.WriteLine("Assembly location: " + rootPath);
|
||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
|
||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll"));
|
||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
|
||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll"));
|
||||
|
||||
if (lang == enumCompileType.yp)
|
||||
{
|
||||
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.YieldProlog.dll"));
|
||||
}
|
||||
|
||||
//parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
|
||||
parameters.GenerateExecutable = false;
|
||||
|
|
|
@ -36,7 +36,7 @@ using OpenSim.Region.Environment.Scenes;
|
|||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
|
|
|
@ -31,13 +31,14 @@ using log4net;
|
|||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Environment.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
|
@ -446,7 +447,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
detparms[id] = qParams;
|
||||
if (id.Running)
|
||||
id.Script.Exec.ExecuteEvent(id.State, FunctionName, args);
|
||||
id.Script.ExecuteEvent(id.State, FunctionName, args);
|
||||
detparms.Remove(id);
|
||||
}
|
||||
|
||||
|
@ -470,8 +471,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
ExecutorBase.scriptEvents evflags =
|
||||
id.Script.Exec.GetStateEventFlags(id.State);
|
||||
int evflags = id.Script.GetStateEventFlags(id.State);
|
||||
|
||||
return (int)evflags;
|
||||
}
|
||||
catch (Exception)
|
||||
|
|
44
prebuild.xml
44
prebuild.xml
|
@ -1931,49 +1931,6 @@
|
|||
</Project>
|
||||
|
||||
|
||||
<Project name="OpenSim.Region.ScriptEngine.Common" path="OpenSim/Region/ScriptEngine/Common" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../../../bin/</ReferencePath>
|
||||
<ReferencePath>../../../../bin/ScriptEngines/</ReferencePath>
|
||||
<Reference name="System" localCopy="false"/>
|
||||
<Reference name="System.Data" localCopy="false"/>
|
||||
<Reference name="System.Web" localCopy="false"/>
|
||||
<Reference name="System.Xml" localCopy="false"/>
|
||||
<Reference name="OpenMetaverseTypes.dll"/>
|
||||
<Reference name="OpenMetaverse.dll"/>
|
||||
<Reference name="OpenSim" />
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Communications"/>
|
||||
<Reference name="OpenSim.Region.Environment" />
|
||||
<Reference name="OpenSim.Region.Interfaces" />
|
||||
<Reference name="OpenSim.Region.Physics.Manager" />
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api.Runtime"/>
|
||||
<Reference name="Nini.dll" />
|
||||
<Reference name="RAIL.dll"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="Nini.dll" />
|
||||
<Reference name="log4net.dll"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true" >
|
||||
<Exclude name="Tests" pattern="Tests" />
|
||||
</Match>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<Project name="OpenSim.Region.ScriptEngine.DotNetEngine" path="OpenSim/Region/ScriptEngine/DotNetEngine" type="Library">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
|
@ -1998,7 +1955,6 @@
|
|||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Region.Environment" />
|
||||
<Reference name="OpenSim.Region.Interfaces" />
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Shared"/>
|
||||
<Reference name="OpenSim.Region.ScriptEngine.Shared.Api"/>
|
||||
<Reference name="Microsoft.JScript"/>
|
||||
|
|
Loading…
Reference in New Issue