getting all our line endings consistant again

afrisby
Sean Dague 2007-10-05 15:45:45 +00:00
parent d4a4aafaf1
commit c3d8f1f425
40 changed files with 2836 additions and 2836 deletions

View File

@ -8,7 +8,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;

View File

@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Threading;
namespace OpenSim.Framework
{
public class Culture
{
private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true);
public static NumberFormatInfo NumberFormatInfo
{
get
{
return m_cultureInfo.NumberFormat;
}
}
public static void SetCurrentCulture()
{
Thread.CurrentThread.CurrentCulture = m_cultureInfo;
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Threading;
namespace OpenSim.Framework
{
public class Culture
{
private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true);
public static NumberFormatInfo NumberFormatInfo
{
get
{
return m_cultureInfo.NumberFormat;
}
}
public static void SetCurrentCulture()
{
Thread.CurrentThread.CurrentCulture = m_cultureInfo;
}
}
}

View File

@ -24,35 +24,35 @@
* (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.Text;
namespace OpenSim.Grid.ScriptServer
{
class OpenScript_Main
{
public static ScriptServerMain SE;
static void Main(string[] args)
{
// Application is starting
SE = new ScriptServerMain();
System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine("");
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine("");
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
Console.WriteLine("Exception:");
Console.WriteLine(e.ExceptionObject.ToString());
}
}
}
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Grid.ScriptServer
{
class OpenScript_Main
{
public static ScriptServerMain SE;
static void Main(string[] args)
{
// Application is starting
SE = new ScriptServerMain();
System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine("");
Console.WriteLine("APPLICATION EXCEPTION DETECTED");
Console.WriteLine("");
Console.WriteLine("Application is terminating: " + e.IsTerminating.ToString());
Console.WriteLine("Exception:");
Console.WriteLine(e.ExceptionObject.ToString());
}
}
}

View File

@ -1,33 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.Grid.ScriptServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[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("b6861b87-5203-4040-b756-fd4774932f82")]
// 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")]
using System.Reflection;
using System.Runtime.CompilerServices;
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.Grid.ScriptServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Grid.ScriptServer")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[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("b6861b87-5203-4040-b756-fd4774932f82")]
// 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")]

View File

@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Grid.ScriptServer
{
// Maintains connection and communication to a region
internal class RegionConnectionManager
{
public RegionConnectionManager()
{
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Grid.ScriptServer
{
// Maintains connection and communication to a region
internal class RegionConnectionManager
{
public RegionConnectionManager()
{
}
}
}

View File

@ -24,76 +24,76 @@
* (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.Text;
using System.Threading;
using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer
{
// Waiting for incoming script requests from region
internal class RegionCommManager
{
private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private LogBase m_log;
private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm, LogBase logger)
{
m_ScriptServerMain = scm;
m_log = logger;
}
~RegionCommManager()
{
Stop();
}
/// <summary>
/// Starts listening for region requests
/// </summary>
public void Start()
{
// Start listener
Stop();
listenThread = new Thread(ListenThreadLoop);
listenThread.Name = "listenThread";
listenThread.IsBackground = true;
listenThread.Start();
}
/// <summary>
/// Stops listening for region requests
/// </summary>
public void Stop()
{
// Stop listener, clean up
if (listenThread != null)
{
try
{
if (listenThread.IsAlive)
listenThread.Abort();
listenThread.Join(1000); // Wait 1 second for thread to shut down
}
catch { }
listenThread = null;
}
}
private void ListenThreadLoop()
{
// * Listen for requests from regions
// * When a request is received:
// - Authenticate region
// - Authenticate user
// - Have correct scriptengine load script
// ~ ask scriptengines if they will accept script?
// - Add script to shared communication channel towards that region
}
}
}
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer
{
// Waiting for incoming script requests from region
internal class RegionCommManager
{
private Thread listenThread;
private List<RegionConnectionManager> Regions = new List<RegionConnectionManager>();
private LogBase m_log;
private ScriptServerMain m_ScriptServerMain;
public RegionCommManager(ScriptServerMain scm, LogBase logger)
{
m_ScriptServerMain = scm;
m_log = logger;
}
~RegionCommManager()
{
Stop();
}
/// <summary>
/// Starts listening for region requests
/// </summary>
public void Start()
{
// Start listener
Stop();
listenThread = new Thread(ListenThreadLoop);
listenThread.Name = "listenThread";
listenThread.IsBackground = true;
listenThread.Start();
}
/// <summary>
/// Stops listening for region requests
/// </summary>
public void Stop()
{
// Stop listener, clean up
if (listenThread != null)
{
try
{
if (listenThread.IsAlive)
listenThread.Abort();
listenThread.Join(1000); // Wait 1 second for thread to shut down
}
catch { }
listenThread = null;
}
}
private void ListenThreadLoop()
{
// * Listen for requests from regions
// * When a request is received:
// - Authenticate region
// - Authenticate user
// - Have correct scriptengine load script
// ~ ask scriptengines if they will accept script?
// - Add script to shared communication channel towards that region
}
}
}

View File

@ -28,8 +28,8 @@
using System;
using System.IO;
using System.Reflection;
using OpenSim.Framework.Console;
using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer
{
internal class ScriptEngineLoader
@ -39,7 +39,7 @@ namespace OpenSim.Grid.ScriptServer
public ScriptEngineLoader(LogBase logger)
{
m_log = logger;
m_log = logger;
}
public ScriptEngineInterface LoadScriptEngine(string EngineName)
@ -121,5 +121,5 @@ namespace OpenSim.Grid.ScriptServer
return ret;
}
}
}
}

View File

@ -1,41 +1,41 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer
{
internal class ScriptEngineManager
{
private LogBase m_log;
private ScriptEngineLoader ScriptEngineLoader;
private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>();
private ScriptServerMain m_ScriptServerMain;
// Initialize
public ScriptEngineManager(ScriptServerMain scm, LogBase logger)
{
m_ScriptServerMain = scm;
m_log = logger;
ScriptEngineLoader = new ScriptEngineLoader(m_log);
// Temp - we should not load during initialize... Loading should be done later.
LoadEngine("DotNetScriptEngine");
}
~ScriptEngineManager()
{
}
public void LoadEngine(string engineName)
{
// Load and add to list of ScriptEngines
ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName);
if (sei != null)
{
scriptEngines.Add(sei);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Console;
namespace OpenSim.Grid.ScriptServer
{
internal class ScriptEngineManager
{
private LogBase m_log;
private ScriptEngineLoader ScriptEngineLoader;
private List<ScriptEngineInterface> scriptEngines = new List<ScriptEngineInterface>();
private ScriptServerMain m_ScriptServerMain;
// Initialize
public ScriptEngineManager(ScriptServerMain scm, LogBase logger)
{
m_ScriptServerMain = scm;
m_log = logger;
ScriptEngineLoader = new ScriptEngineLoader(m_log);
// Temp - we should not load during initialize... Loading should be done later.
LoadEngine("DotNetScriptEngine");
}
~ScriptEngineManager()
{
}
public void LoadEngine(string engineName)
{
// Load and add to list of ScriptEngines
ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName);
if (sei != null)
{
scriptEngines.Add(sei);
}
}
}
}

View File

@ -1,48 +1,48 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities;
namespace OpenSim.Grid.ScriptServer
{
public class ScriptServerMain : conscmd_callback
{
private readonly string m_logFilename = ("region-console.log");
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
private LogBase m_log;
public ScriptServerMain()
{
m_log = CreateLog();
RegionScriptDaemon = new RegionCommManager(this, m_log);
ScriptEngines = new ScriptEngineManager(this, m_log);
}
~ScriptServerMain()
{
}
protected LogBase CreateLog()
{
if (!Directory.Exists(Util.logDir()))
{
Directory.CreateDirectory(Util.logDir());
}
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, false);
}
public void RunCmd(string command, string[] cmdparams)
{
}
public void Show(string ShowWhat)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using OpenSim.Framework.Console;
using OpenSim.Framework.Utilities;
namespace OpenSim.Grid.ScriptServer
{
public class ScriptServerMain : conscmd_callback
{
private readonly string m_logFilename = ("region-console.log");
internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region
internal ScriptEngineManager ScriptEngines; // Loads scriptengines
private LogBase m_log;
public ScriptServerMain()
{
m_log = CreateLog();
RegionScriptDaemon = new RegionCommManager(this, m_log);
ScriptEngines = new ScriptEngineManager(this, m_log);
}
~ScriptServerMain()
{
}
protected LogBase CreateLog()
{
if (!Directory.Exists(Util.logDir()))
{
Directory.CreateDirectory(Util.logDir());
}
return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, false);
}
public void RunCmd(string command, string[] cmdparams)
{
}
public void Show(string ShowWhat)
{
}
}
}

View File

@ -1,96 +1,96 @@
using System;
using System.Collections;
using System.Net;
using Nwc.XmlRpc;
using OpenSim.Framework.Data;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;
using OpenSim.Framework.Types;
namespace OpenSim.Grid.UserServer
{
public class UserLoginService : LoginService
{
public UserConfig m_config;
public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
: base(userManager, welcomeMess)
{
m_config = config;
}
/// <summary>
/// Customises the login response and fills in missing values.
/// </summary>
/// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param>
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{
// Load information from the gridserver
SimProfileData SimInfo = new SimProfileData();
SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
// Customise the response
// Home Location
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
// Destination
Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
response.SimPort = (Int32)SimInfo.serverPort;
response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY;
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
string capsPath = Util.GetRandomCapsPath();
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
// Notify the target of an incoming user
Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
// Prepare notification
Hashtable SimParams = new Hashtable();
SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
SimParams["firstname"] = theUser.username;
SimParams["lastname"] = theUser.surname;
SimParams["agent_id"] = theUser.UUID.ToString();
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
SimParams["caps_path"] = capsPath;
ArrayList SendParams = new ArrayList();
SendParams.Add(SimParams);
// Update agent with target sim
theUser.currentAgent.currentRegion = SimInfo.UUID;
theUser.currentAgent.currentHandle = SimInfo.regionHandle;
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
// Send
try
{
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
}
catch( WebException e )
{
switch( e.Status )
{
case WebExceptionStatus.Timeout:
//TODO: Send him to nearby or default region instead
break;
default:
throw;
}
}
}
}
}
using System;
using System.Collections;
using System.Net;
using Nwc.XmlRpc;
using OpenSim.Framework.Data;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;
using OpenSim.Framework.Types;
namespace OpenSim.Grid.UserServer
{
public class UserLoginService : LoginService
{
public UserConfig m_config;
public UserLoginService(UserManagerBase userManager, UserConfig config, string welcomeMess)
: base(userManager, welcomeMess)
{
m_config = config;
}
/// <summary>
/// Customises the login response and fills in missing values.
/// </summary>
/// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param>
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{
// Load information from the gridserver
SimProfileData SimInfo = new SimProfileData();
SimInfo = SimInfo.RequestSimProfileData(theUser.currentAgent.currentHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
// Customise the response
// Home Location
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * 256).ToString() + ",r" + (SimInfo.regionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
// Destination
Console.WriteLine("CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromDNS(SimInfo.serverIP).ToString();
response.SimPort = (Int32)SimInfo.serverPort;
response.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY;
//Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
string capsPath = Util.GetRandomCapsPath();
response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
// Notify the target of an incoming user
Console.WriteLine("Notifying " + SimInfo.regionName + " (" + SimInfo.serverURI + ")");
// Prepare notification
Hashtable SimParams = new Hashtable();
SimParams["session_id"] = theUser.currentAgent.sessionID.ToString();
SimParams["secure_session_id"] = theUser.currentAgent.secureSessionID.ToString();
SimParams["firstname"] = theUser.username;
SimParams["lastname"] = theUser.surname;
SimParams["agent_id"] = theUser.UUID.ToString();
SimParams["circuit_code"] = (Int32)Convert.ToUInt32(response.CircuitCode);
SimParams["startpos_x"] = theUser.currentAgent.currentPos.X.ToString();
SimParams["startpos_y"] = theUser.currentAgent.currentPos.Y.ToString();
SimParams["startpos_z"] = theUser.currentAgent.currentPos.Z.ToString();
SimParams["regionhandle"] = theUser.currentAgent.currentHandle.ToString();
SimParams["caps_path"] = capsPath;
ArrayList SendParams = new ArrayList();
SendParams.Add(SimParams);
// Update agent with target sim
theUser.currentAgent.currentRegion = SimInfo.UUID;
theUser.currentAgent.currentHandle = SimInfo.regionHandle;
System.Console.WriteLine("Informing region --> " + SimInfo.httpServerURI);
// Send
try
{
XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
}
catch( WebException e )
{
switch( e.Status )
{
case WebExceptionStatus.Timeout:
//TODO: Send him to nearby or default region instead
break;
default:
throw;
}
}
}
}
}

View File

@ -1,67 +1,67 @@
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local
{
public class LocalInventoryService : InventoryServiceBase
{
public LocalInventoryService()
{
}
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.parentID == libsecondlife.LLUUID.Zero)
{
InventoryFolder newfolder = new InventoryFolder(folder);
rootFolder = newfolder;
folderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolder newfolder = new InventoryFolder(folder);
folderCallBack(userID, newfolder);
List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
foreach (InventoryItemBase item in items)
{
itemCallBack(userID, item);
}
}
}
}
}
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{
this.AddFolder(folder);
}
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
this.AddItem(item);
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
this.deleteItem(item);
}
}
}
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local
{
public class LocalInventoryService : InventoryServiceBase
{
public LocalInventoryService()
{
}
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null;
//need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders)
{
if (folder.parentID == libsecondlife.LLUUID.Zero)
{
InventoryFolder newfolder = new InventoryFolder(folder);
rootFolder = newfolder;
folderCallBack(userID, newfolder);
}
}
if (rootFolder != null)
{
foreach (InventoryFolderBase folder in folders)
{
if (folder.folderID != rootFolder.folderID)
{
InventoryFolder newfolder = new InventoryFolder(folder);
folderCallBack(userID, newfolder);
List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
foreach (InventoryItemBase item in items)
{
itemCallBack(userID, item);
}
}
}
}
}
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{
this.AddFolder(folder);
}
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
this.AddItem(item);
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
this.deleteItem(item);
}
}
}

View File

@ -1,173 +1,173 @@
using System;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local
{
public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
public class LocalLoginService : LoginService
{
private CommunicationsLocal m_Parent;
private NetworkServersInfo serversInfo;
private uint defaultHomeX;
private uint defaultHomeY;
private bool authUsers = false;
public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
: base(userManager, welcomeMess)
{
m_Parent = parent;
this.serversInfo = serversInfo;
defaultHomeX = this.serversInfo.DefaultHomeLocX;
defaultHomeY = this.serversInfo.DefaultHomeLocY;
this.authUsers = authenticate;
}
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
return profile;
}
if (!authUsers)
{
//no current user account so make one
Console.WriteLine("No User account found so creating a new one ");
this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
}
return profile;
}
return null;
}
public override bool AuthenticateUser(UserProfileData profile, string password)
{
if (!authUsers)
{
//for now we will accept any password in sandbox mode
Console.WriteLine("authorising user");
return true;
}
else
{
Console.WriteLine("Authenticating " + profile.username + " " + profile.surname);
password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
}
}
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{
ulong currentRegion = theUser.currentAgent.currentHandle;
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
if (reg != null)
{
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
string capsPath = Util.GetRandomCapsPath();
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
response.SimPort = (Int32)reg.ExternalEndPoint.Port;
response.RegionX = reg.RegionLocX;
response.RegionY = reg.RegionLocY;
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
Login _login = new Login();
//copy data to login object
_login.First = response.Firstname;
_login.Last = response.Lastname;
_login.Agent = response.AgentID;
_login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
if( OnLoginToRegion != null )
{
OnLoginToRegion(currentRegion, _login);
}
}
else
{
Console.WriteLine("not found region " + currentRegion);
}
}
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
if (folders.Count > 0)
{
LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.parentID == LLUUID.Zero)
{
rootID = InvFolder.folderID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.name;
TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.version;
TempHash["type_default"] = (Int32)InvFolder.type;
TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
else
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{
TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
}
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using OpenSim.Framework.UserManagement;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
namespace OpenSim.Region.Communications.Local
{
public delegate void LoginToRegionEvent(ulong regionHandle, Login login);
public class LocalLoginService : LoginService
{
private CommunicationsLocal m_Parent;
private NetworkServersInfo serversInfo;
private uint defaultHomeX;
private uint defaultHomeY;
private bool authUsers = false;
public event LoginToRegionEvent OnLoginToRegion;
public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate)
: base(userManager, welcomeMess)
{
m_Parent = parent;
this.serversInfo = serversInfo;
defaultHomeX = this.serversInfo.DefaultHomeLocX;
defaultHomeY = this.serversInfo.DefaultHomeLocY;
this.authUsers = authenticate;
}
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
return profile;
}
if (!authUsers)
{
//no current user account so make one
Console.WriteLine("No User account found so creating a new one ");
this.m_userManager.AddUserProfile(firstname, lastname, "test", defaultHomeX, defaultHomeY);
profile = this.m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
m_Parent.InventoryService.CreateNewUserInventory(profile.UUID);
}
return profile;
}
return null;
}
public override bool AuthenticateUser(UserProfileData profile, string password)
{
if (!authUsers)
{
//for now we will accept any password in sandbox mode
Console.WriteLine("authorising user");
return true;
}
else
{
Console.WriteLine("Authenticating " + profile.username + " " + profile.surname);
password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
}
}
public override void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{
ulong currentRegion = theUser.currentAgent.currentHandle;
RegionInfo reg = m_Parent.GridService.RequestNeighbourInfo(currentRegion);
if (reg != null)
{
response.Home = "{'region_handle':[r" + (reg.RegionLocX * 256).ToString() + ",r" + (reg.RegionLocY * 256).ToString() + "], " +
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "]}";
string capsPath = Util.GetRandomCapsPath();
response.SimAddress = reg.ExternalEndPoint.Address.ToString();
response.SimPort = (Int32)reg.ExternalEndPoint.Port;
response.RegionX = reg.RegionLocX;
response.RegionY = reg.RegionLocY;
response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CAPS/" + capsPath + "0000/";
// response.SeedCapability = "http://" + reg.ExternalHostName + ":" + this.serversInfo.HttpListenerPort.ToString() + "/CapsSeed/" + capsPath + "0000/";
theUser.currentAgent.currentRegion = reg.SimUUID;
theUser.currentAgent.currentHandle = reg.RegionHandle;
Login _login = new Login();
//copy data to login object
_login.First = response.Firstname;
_login.Last = response.Lastname;
_login.Agent = response.AgentID;
_login.Session = response.SessionID;
_login.SecureSession = response.SecureSessionID;
_login.CircuitCode = (uint)response.CircuitCode;
_login.CapsPath = capsPath;
if( OnLoginToRegion != null )
{
OnLoginToRegion(currentRegion, _login);
}
}
else
{
Console.WriteLine("not found region " + currentRegion);
}
}
protected override InventoryData CreateInventoryData(LLUUID userID)
{
List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
if (folders.Count > 0)
{
LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.parentID == LLUUID.Zero)
{
rootID = InvFolder.folderID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.name;
TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.version;
TempHash["type_default"] = (Int32)InvFolder.type;
TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
else
{
AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{
TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
}
}
}
}

View File

@ -1,52 +1,52 @@
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices
{
public OGS1InventoryService()
{
}
#region IInventoryServices Members
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
}
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{
}
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
}
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
}
public void CreateNewUserInventory(LLUUID user)
{
}
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{
return new List<InventoryFolderBase>();
}
#endregion
}
}
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Types;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1
{
public class OGS1InventoryService : IInventoryServices
{
public OGS1InventoryService()
{
}
#region IInventoryServices Members
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{
}
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{
}
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
}
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
}
public void CreateNewUserInventory(LLUUID user)
{
}
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
{
return new List<InventoryFolderBase>();
}
#endregion
}
}

View File

@ -1,17 +1,17 @@
using System.IO;
using libsecondlife;
using System.IO;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IDynamicTextureManager
{
void RegisterRender(string handleType, IDynamicTextureRender render);
void ReturnData(LLUUID id, byte[] data);
LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams,
int updateTimer);
LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams,
void ReturnData(LLUUID id, byte[] data);
LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams,
int updateTimer);
LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams,
int updateTimer);
}

View File

@ -1,5 +1,5 @@
using libsecondlife;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IHttpRequests

View File

@ -1,5 +1,5 @@
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IRegionModule

View File

@ -1,5 +1,5 @@
using libsecondlife;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ISimChat

View File

@ -1,16 +1,16 @@
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces
{
public interface ITerrain
{
bool Tainted();
bool Tainted(int x, int y);
void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser);
void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west,
IClientAPI remoteUser);
void CheckHeightValues();
float[] GetHeights1D();
float[,] GetHeights2D();

View File

@ -1,156 +1,156 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment
{
public class ModuleLoader
{
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
public List<IRegionModule> LoadedModules = new List<IRegionModule>();
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
public ModuleLoader()
{
}
/// <summary>
/// Should have a module factory?
/// </summary>
/// <param name="scene"></param>
public void CreateDefaultModules(Scene scene, string exceptModules)
{
IRegionModule module = new XferModule();
InitialiseModule(module, scene);
module = new ChatModule();
InitialiseModule(module, scene);
module = new AvatarProfilesModule();
InitialiseModule(module, scene);
LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
LoadRegionModule(lslPath, "LSLScriptingModule", scene);
}
public void LoadDefaultSharedModules(string exceptModules)
{
DynamicTextureModule dynamicModule = new DynamicTextureModule();
LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
}
public void InitialiseSharedModules(Scene scene)
{
foreach (IRegionModule module in LoadedSharedModules.Values)
{
module.Initialise(scene);
scene.AddModule(module.GetName(), module); //should be doing this?
}
}
private void InitialiseModule(IRegionModule module, Scene scene)
{
module.Initialise(scene);
scene.AddModule(module.GetName(), module);
LoadedModules.Add(module);
}
/// <summary>
/// Loads/initialises a Module instance that can be used by mutliple Regions
/// </summary>
/// <param name="dllName"></param>
/// <param name="moduleName"></param>
/// <param name="scene"></param>
public void LoadSharedModule(string dllName, string moduleName)
{
IRegionModule module = LoadModule(dllName, moduleName);
if (module != null)
{
LoadedSharedModules.Add(module.GetName(), module);
}
}
public void LoadRegionModule(string dllName, string moduleName, Scene scene)
{
IRegionModule module = LoadModule(dllName, moduleName);
if (module != null)
{
InitialiseModule(module, scene);
}
}
/// <summary>
/// Loads a external Module (if not already loaded) and creates a new instance of it.
/// </summary>
/// <param name="dllName"></param>
/// <param name="moduleName"></param>
/// <param name="scene"></param>
public IRegionModule LoadModule(string dllName, string moduleName)
{
Assembly pluginAssembly = null;
if (LoadedAssemblys.ContainsKey(dllName))
{
pluginAssembly = LoadedAssemblys[dllName];
}
else
{
pluginAssembly = Assembly.LoadFrom(dllName);
LoadedAssemblys.Add(dllName, pluginAssembly);
}
IRegionModule module = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IRegionModule", true);
if (typeInterface != null)
{
module =
(IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
if ((module != null) || (module.GetName() == moduleName))
{
return module;
}
return null;
}
public void PostInitialise()
{
foreach (IRegionModule module in LoadedSharedModules.Values)
{
module.PostInitialise();
}
foreach (IRegionModule module in LoadedModules)
{
module.PostInitialise();
}
}
public void ClearCache()
{
LoadedAssemblys.Clear();
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment
{
public class ModuleLoader
{
public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
public List<IRegionModule> LoadedModules = new List<IRegionModule>();
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
public ModuleLoader()
{
}
/// <summary>
/// Should have a module factory?
/// </summary>
/// <param name="scene"></param>
public void CreateDefaultModules(Scene scene, string exceptModules)
{
IRegionModule module = new XferModule();
InitialiseModule(module, scene);
module = new ChatModule();
InitialiseModule(module, scene);
module = new AvatarProfilesModule();
InitialiseModule(module, scene);
LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene);
string lslPath = Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll");
LoadRegionModule(lslPath, "LSLScriptingModule", scene);
}
public void LoadDefaultSharedModules(string exceptModules)
{
DynamicTextureModule dynamicModule = new DynamicTextureModule();
LoadedSharedModules.Add(dynamicModule.GetName(), dynamicModule);
}
public void InitialiseSharedModules(Scene scene)
{
foreach (IRegionModule module in LoadedSharedModules.Values)
{
module.Initialise(scene);
scene.AddModule(module.GetName(), module); //should be doing this?
}
}
private void InitialiseModule(IRegionModule module, Scene scene)
{
module.Initialise(scene);
scene.AddModule(module.GetName(), module);
LoadedModules.Add(module);
}
/// <summary>
/// Loads/initialises a Module instance that can be used by mutliple Regions
/// </summary>
/// <param name="dllName"></param>
/// <param name="moduleName"></param>
/// <param name="scene"></param>
public void LoadSharedModule(string dllName, string moduleName)
{
IRegionModule module = LoadModule(dllName, moduleName);
if (module != null)
{
LoadedSharedModules.Add(module.GetName(), module);
}
}
public void LoadRegionModule(string dllName, string moduleName, Scene scene)
{
IRegionModule module = LoadModule(dllName, moduleName);
if (module != null)
{
InitialiseModule(module, scene);
}
}
/// <summary>
/// Loads a external Module (if not already loaded) and creates a new instance of it.
/// </summary>
/// <param name="dllName"></param>
/// <param name="moduleName"></param>
/// <param name="scene"></param>
public IRegionModule LoadModule(string dllName, string moduleName)
{
Assembly pluginAssembly = null;
if (LoadedAssemblys.ContainsKey(dllName))
{
pluginAssembly = LoadedAssemblys[dllName];
}
else
{
pluginAssembly = Assembly.LoadFrom(dllName);
LoadedAssemblys.Add(dllName, pluginAssembly);
}
IRegionModule module = null;
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
if (!pluginType.IsAbstract)
{
Type typeInterface = pluginType.GetInterface("IRegionModule", true);
if (typeInterface != null)
{
module =
(IRegionModule) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
break;
}
typeInterface = null;
}
}
}
pluginAssembly = null;
if ((module != null) || (module.GetName() == moduleName))
{
return module;
}
return null;
}
public void PostInitialise()
{
foreach (IRegionModule module in LoadedSharedModules.Values)
{
module.PostInitialise();
}
foreach (IRegionModule module in LoadedModules)
{
module.PostInitialise();
}
}
public void ClearCache()
{
LoadedAssemblys.Clear();
}
}
}

View File

@ -1,7 +1,7 @@
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AssetDownloadModule : IRegionModule
@ -9,7 +9,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene;
public AssetDownloadModule()
{
{
}
public void Initialise(Scene scene)
@ -19,7 +19,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()

View File

@ -1,16 +1,16 @@
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AvatarProfilesModule : IRegionModule
{
{
private Scene m_scene;
public AvatarProfilesModule()
{
{
}
public void Initialise(Scene scene)
@ -20,11 +20,11 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
{
{
}
public string GetName()
@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Modules
string bornOn = "Before now";
string flAbout = "First life? What is one of those? OpenSim is my life!";
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "",
partner);
}
}

View File

@ -1,214 +1,214 @@
using System;
using System.IO;
using System.Net.Sockets;
using System.Threading;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class ChatModule : IRegionModule, ISimChat
{
private Scene m_scene;
private string m_server = "irc2.choopa.net";
// private int m_port = 6668;
//private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private string m_nick = "OSimBot";
private string m_channel = "#opensim";
// private NetworkStream m_stream;
private TcpClient m_irc;
private StreamWriter m_ircWriter;
private StreamReader m_ircReader;
// private Thread pingSender;
// private Thread listener;
private bool connected = false;
public ChatModule()
{
m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
m_irc = null;
m_ircWriter = null;
m_ircReader = null;
}
public void Initialise(Scene scene)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;
m_scene.RegisterModuleInterface<ISimChat>(this);
}
public void PostInitialise()
{
/*
try
{
m_irc = new TcpClient(m_server, m_port);
m_stream = m_irc.GetStream();
m_ircReader = new StreamReader(m_stream);
m_ircWriter = new StreamWriter(m_stream);
pingSender = new Thread(new ThreadStart(this.PingRun));
pingSender.Start();
listener = new Thread(new ThreadStart(this.ListenerRun));
listener.Start();
m_ircWriter.WriteLine(m_user);
m_ircWriter.Flush();
m_ircWriter.WriteLine("NICK " + m_nick);
m_ircWriter.Flush();
m_ircWriter.WriteLine("JOIN " + m_channel);
m_ircWriter.Flush();
connected = true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
*/
}
public void CloseDown()
{
m_ircWriter.Close();
m_ircReader.Close();
m_irc.Close();
}
public string GetName()
{
return "ChatModule";
}
public bool IsSharedModule()
{
return false;
}
public void NewClient(IClientAPI client)
{
client.OnChatFromViewer += SimChat;
}
public void PingRun()
{
while (true)
{
m_ircWriter.WriteLine("PING :" + m_server);
m_ircWriter.Flush();
Thread.Sleep(15000);
}
}
public void ListenerRun()
{
string inputLine;
LLVector3 pos = new LLVector3(128, 128, 20);
while (true)
{
while ((inputLine = m_ircReader.ReadLine()) != null)
{
Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel))
{
string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
m_scene.Broadcast(delegate(IClientAPI client)
{
client.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero);
});
}
}
}
}
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{
ScenePresence avatar = null;
avatar = m_scene.GetScenePresence(fromAgentID);
if (avatar != null)
{
fromPos = avatar.AbsolutePosition;
fromName = avatar.Firstname + " " + avatar.Lastname;
avatar = null;
}
if (connected)
{
m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
Util.FieldToString(message));
m_ircWriter.Flush();
}
if (channel == 0)
{
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
int dis = -1000;
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null)
{
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
}
switch (type)
{
case 0: // Whisper
if ((dis < 10) && (dis > -10))
{
//should change so the message is sent through the avatar rather than direct to the ClientView
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 1: // Say
if ((dis < 30) && (dis > -30))
{
//Console.WriteLine("sending chat");
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 2: // Shout
if ((dis < 100) && (dis > -100))
{
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 0xff: // Broadcast
presence.ControllingClient.SendChatMessage(message, type,
fromPos,
fromName,
fromAgentID);
break;
}
});
}
}
}
using System;
using System.IO;
using System.Net.Sockets;
using System.Threading;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class ChatModule : IRegionModule, ISimChat
{
private Scene m_scene;
private string m_server = "irc2.choopa.net";
// private int m_port = 6668;
//private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
private string m_nick = "OSimBot";
private string m_channel = "#opensim";
// private NetworkStream m_stream;
private TcpClient m_irc;
private StreamWriter m_ircWriter;
private StreamReader m_ircReader;
// private Thread pingSender;
// private Thread listener;
private bool connected = false;
public ChatModule()
{
m_nick = "OSimBot" + Util.RandomClass.Next(1, 99);
m_irc = null;
m_ircWriter = null;
m_ircReader = null;
}
public void Initialise(Scene scene)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;
m_scene.RegisterModuleInterface<ISimChat>(this);
}
public void PostInitialise()
{
/*
try
{
m_irc = new TcpClient(m_server, m_port);
m_stream = m_irc.GetStream();
m_ircReader = new StreamReader(m_stream);
m_ircWriter = new StreamWriter(m_stream);
pingSender = new Thread(new ThreadStart(this.PingRun));
pingSender.Start();
listener = new Thread(new ThreadStart(this.ListenerRun));
listener.Start();
m_ircWriter.WriteLine(m_user);
m_ircWriter.Flush();
m_ircWriter.WriteLine("NICK " + m_nick);
m_ircWriter.Flush();
m_ircWriter.WriteLine("JOIN " + m_channel);
m_ircWriter.Flush();
connected = true;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
*/
}
public void CloseDown()
{
m_ircWriter.Close();
m_ircReader.Close();
m_irc.Close();
}
public string GetName()
{
return "ChatModule";
}
public bool IsSharedModule()
{
return false;
}
public void NewClient(IClientAPI client)
{
client.OnChatFromViewer += SimChat;
}
public void PingRun()
{
while (true)
{
m_ircWriter.WriteLine("PING :" + m_server);
m_ircWriter.Flush();
Thread.Sleep(15000);
}
}
public void ListenerRun()
{
string inputLine;
LLVector3 pos = new LLVector3(128, 128, 20);
while (true)
{
while ((inputLine = m_ircReader.ReadLine()) != null)
{
Console.WriteLine(inputLine);
if (inputLine.Contains(m_channel))
{
string mess = inputLine.Substring(inputLine.IndexOf(m_channel));
m_scene.Broadcast(delegate(IClientAPI client)
{
client.SendChatMessage(
Helpers.StringToField(mess), 255, pos, "IRC:",
LLUUID.Zero);
});
}
}
}
}
public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{
ScenePresence avatar = null;
avatar = m_scene.GetScenePresence(fromAgentID);
if (avatar != null)
{
fromPos = avatar.AbsolutePosition;
fromName = avatar.Firstname + " " + avatar.Lastname;
avatar = null;
}
if (connected)
{
m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
Util.FieldToString(message));
m_ircWriter.Flush();
}
if (channel == 0)
{
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
int dis = -1000;
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null)
{
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
}
switch (type)
{
case 0: // Whisper
if ((dis < 10) && (dis > -10))
{
//should change so the message is sent through the avatar rather than direct to the ClientView
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 1: // Say
if ((dis < 30) && (dis > -30))
{
//Console.WriteLine("sending chat");
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 2: // Shout
if ((dis < 100) && (dis > -100))
{
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 0xff: // Broadcast
presence.ControllingClient.SendChatMessage(message, type,
fromPos,
fromName,
fromAgentID);
break;
}
});
}
}
}
}

View File

@ -1,157 +1,157 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene)
{
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
{
RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
}
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "DynamicTextureModule";
}
public bool IsSharedModule()
{
return true;
}
public void RegisterRender(string handleType, IDynamicTextureRender render)
{
if (!RenderPlugins.ContainsKey(handleType))
{
RenderPlugins.Add(handleType, render);
}
}
public void ReturnData(LLUUID id, byte[] data)
{
if (Updaters.ContainsKey(id))
{
DynamicTextureUpdater updater = Updaters[id];
if (RegisteredScenes.ContainsKey(updater.SimUUID))
{
Scene scene = RegisteredScenes[updater.SimUUID];
updater.DataReceived(data, scene);
}
}
}
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
string extraParams, int updateTimer)
{
Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.Url = url;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
return updater.UpdaterID;
}
return LLUUID.Zero;
}
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
string extraParams, int updateTimer)
{
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.BodyData = data;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
return updater.UpdaterID;
}
return LLUUID.Zero;
}
public class DynamicTextureUpdater
{
public LLUUID SimUUID;
public LLUUID UpdaterID;
public string ContentType;
public string Url;
public string BodyData;
public LLUUID PrimID;
public int UpdateTimer;
public LLUUID LastAssetID;
public string Params;
public DynamicTextureUpdater()
{
LastAssetID = LLUUID.Zero;
UpdateTimer = 0;
BodyData = null;
}
public void DataReceived(byte[] data, Scene scene)
{
//TODO delete the last asset(data), if it was a dynamic texture
AssetBase asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Data = data;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0;
scene.commsManager.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
part.ScheduleFullUpdate();
}
}
}
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
{
private Dictionary<LLUUID, Scene> RegisteredScenes = new Dictionary<LLUUID, Scene>();
private Dictionary<string, IDynamicTextureRender> RenderPlugins =
new Dictionary<string, IDynamicTextureRender>();
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene)
{
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.SimUUID))
{
RegisteredScenes.Add(scene.RegionInfo.SimUUID, scene);
scene.RegisterModuleInterface<IDynamicTextureManager>(this);
}
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "DynamicTextureModule";
}
public bool IsSharedModule()
{
return true;
}
public void RegisterRender(string handleType, IDynamicTextureRender render)
{
if (!RenderPlugins.ContainsKey(handleType))
{
RenderPlugins.Add(handleType, render);
}
}
public void ReturnData(LLUUID id, byte[] data)
{
if (Updaters.ContainsKey(id))
{
DynamicTextureUpdater updater = Updaters[id];
if (RegisteredScenes.ContainsKey(updater.SimUUID))
{
Scene scene = RegisteredScenes[updater.SimUUID];
updater.DataReceived(data, scene);
}
}
}
public LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url,
string extraParams, int updateTimer)
{
Console.WriteLine("dynamic texture being created: " + url + " of type " + contentType);
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.Url = url;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
return updater.UpdaterID;
}
return LLUUID.Zero;
}
public LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data,
string extraParams, int updateTimer)
{
if (RenderPlugins.ContainsKey(contentType))
{
DynamicTextureUpdater updater = new DynamicTextureUpdater();
updater.SimUUID = simID;
updater.PrimID = primID;
updater.ContentType = contentType;
updater.BodyData = data;
updater.UpdateTimer = updateTimer;
updater.UpdaterID = LLUUID.Random();
updater.Params = extraParams;
if (!Updaters.ContainsKey(updater.UpdaterID))
{
Updaters.Add(updater.UpdaterID, updater);
}
RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
return updater.UpdaterID;
}
return LLUUID.Zero;
}
public class DynamicTextureUpdater
{
public LLUUID SimUUID;
public LLUUID UpdaterID;
public string ContentType;
public string Url;
public string BodyData;
public LLUUID PrimID;
public int UpdateTimer;
public LLUUID LastAssetID;
public string Params;
public DynamicTextureUpdater()
{
LastAssetID = LLUUID.Zero;
UpdateTimer = 0;
BodyData = null;
}
public void DataReceived(byte[] data, Scene scene)
{
//TODO delete the last asset(data), if it was a dynamic texture
AssetBase asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Data = data;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0;
scene.commsManager.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes();
part.ScheduleFullUpdate();
}
}
}
}

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class FriendsModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class GroupsModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class InstantMessageModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()

View File

@ -1,6 +1,6 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class InventoryModule : IRegionModule
@ -13,7 +13,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()

View File

@ -1,8 +1,8 @@
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class TextureDownloadModule : IRegionModule
@ -10,7 +10,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene;
public TextureDownloadModule()
{
{
}
public void Initialise(Scene scene)
@ -20,7 +20,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules
}
public void TextureAssetCallback(LLUUID texture, byte[] data)
{
{
}
}
}

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using System;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class XferModule : IRegionModule, IXfer
@ -15,7 +15,7 @@ namespace OpenSim.Region.Environment.Modules
private Scene m_scene;
public XferModule()
{
{
}
public void Initialise(Scene scene)
@ -27,11 +27,11 @@ namespace OpenSim.Region.Environment.Modules
}
public void PostInitialise()
{
{
}
public void CloseDown()
{
{
}
public string GetName()
@ -119,7 +119,7 @@ namespace OpenSim.Region.Environment.Modules
}
public XferDownLoad()
{
{
}
public void StartSend()

View File

@ -1,7 +1,7 @@
using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
using libsecondlife;
using OpenSim.Region.Environment.LandManagement;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment
{
public class PermissionManager
@ -12,8 +12,8 @@ namespace OpenSim.Region.Environment
// disable in any production environment
// TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option.
private bool m_bypassPermissions = true;
private bool m_bypassPermissions = true;
public bool BypassPermissions
{
get { return m_bypassPermissions; }
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment
permission = true;
// Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID ==
user)
permission = true;
@ -294,6 +294,6 @@ namespace OpenSim.Region.Environment
return GenericParcelPermission(user, parcel);
}
#endregion
#endregion
}
}

View File

@ -1,445 +1,445 @@
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public partial class Scene
{
//split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
// or at least some of they can be moved somewhere else
public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
{
ScenePresence avatar;
if ( TryGetAvatar( avatarId, out avatar ))
{
AddInventoryItem(avatar.ControllingClient, item);
}
}
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
}
public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
{
ScenePresence avatar;
if (TryGetAvatar(avatarId, out avatar))
{
return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
}
return LLUUID.Zero;
}
public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AssetBase asset;
asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Type = (sbyte) item.assetType;
asset.InvType = (sbyte) item.invType;
asset.Name = item.inventoryName;
asset.Data = data;
commsManager.AssetCache.AddAsset(asset);
item.assetID = asset.FullID;
userInfo.UpdateItem(remoteClient.AgentId, item);
// remoteClient.SendInventoryItemUpdate(item);
if (item.invType == 7)
{
//do we want to know about updated note cards?
}
else if (item.invType == 10)
{
// do we want to know about updated scripts
}
return (asset.FullID);
}
}
}
return LLUUID.Zero;
}
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
LLUUID itemID)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AgentAssetTransactions transactions =
commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
if (transactions != null)
{
AssetBase asset = null;
bool addToCache = false;
asset = commsManager.AssetCache.GetAsset(assetID);
if (asset == null)
{
asset = transactions.GetTransactionAsset(transactionID);
addToCache = true;
}
if (asset != null)
{
if (asset.FullID == assetID)
{
asset.Name = item.inventoryName;
asset.Description = item.inventoryDescription;
asset.InvType = (sbyte) item.invType;
asset.Type = (sbyte) item.assetType;
item.assetID = asset.FullID;
if (addToCache)
{
commsManager.AssetCache.AddAsset(asset);
}
userInfo.UpdateItem(remoteClient.AgentId, item);
}
}
}
}
}
}
}
/// <summary>
/// temporary method to test out creating new inventory items
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transActionID"></param>
/// <param name="folderID"></param>
/// <param name="callbackID"></param>
/// <param name="description"></param>
/// <param name="name"></param>
/// <param name="invType"></param>
/// <param name="type"></param>
/// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param>
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, sbyte type,
byte wearableType, uint nextOwnerMask)
{
if (transActionID == LLUUID.Zero)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = new AssetBase();
asset.Name = name;
asset.Description = description;
asset.InvType = invType;
asset.Type = type;
asset.FullID = LLUUID.Random();
asset.Data = new byte[1];
commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID;
item.inventoryDescription = description;
item.inventoryName = name;
item.assetType = invType;
item.invType = invType;
item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = nextOwnerMask;
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
}
else
{
commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
callbackID, description, name, invType,
type, wearableType, nextOwnerMask);
//System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="primLocalID"></param>
public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange)
{
if (XferManager != null)
{
((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
}
}
break;
}
}
}
}
public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
if (type == 10)
{
EventManager.TriggerRemoveScript(localID, itemID);
}
}
}
}
}
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
LLUUID copyID = LLUUID.Random();
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
bool isTexture = false;
bool rezzed = false;
if (item.invType == 0)
{
isTexture = true;
}
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null)
{
string script = Util.FieldToString(rezAsset.Data);
//Console.WriteLine("rez script "+script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
else
{
//lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null)
{
string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
}
if (rezzed)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
}
}
}
}
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="packet"></param>
/// <param name="simClient"></param>
public void DeRezObject(Packet packet, IClientAPI remoteClient)
{
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{
//currently following code not used (or don't know of any case of destination being zero
}
else
{
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
{
EntityBase selectedEnt = null;
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
foreach (EntityBase ent in Entities.Values)
{
if (ent.LocalId == Data.ObjectLocalID)
{
selectedEnt = ent;
break;
}
}
if (selectedEnt != null)
{
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
{
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6;
asset.Type = 6;
asset.FullID = LLUUID.Random();
asset.Data = Helpers.StringToField(sceneObjectXml);
commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID;
item.inventoryDescription = asset.Description;
item.inventoryName = asset.Name;
item.assetType = asset.Type;
item.invType = asset.InvType;
item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = 2147483647;
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
SceneObjectPart rootPart =
((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
if (rootPart.PhysActor != null)
{
phyScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null;
}
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup();
lock (Entities)
{
Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
}
((SceneObjectGroup) selectedEnt).DeleteParts();
}
}
}
}
}
public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
else
{
//lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
}
}
}
}
}
private void AddRezObject(string xmlData, LLVector3 pos)
{
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
AddEntity(group);
group.AbsolutePosition = pos;
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
{
PrimitiveBaseShape pbs = rootPart.Shape;
rootPart.PhysActor = phyScene.AddPrimShape(
rootPart.Name,
pbs,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
}
}
}
}
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public partial class Scene
{
//split these method into this partial as a lot of these (hopefully) are only temporary and won't be needed once Caps is more complete
// or at least some of they can be moved somewhere else
public void AddInventoryItem(LLUUID avatarId, InventoryItemBase item)
{
ScenePresence avatar;
if ( TryGetAvatar( avatarId, out avatar ))
{
AddInventoryItem(avatar.ControllingClient, item);
}
}
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
}
public LLUUID CapsUpdateInventoryItemAsset(LLUUID avatarId, LLUUID itemID, byte[] data)
{
ScenePresence avatar;
if (TryGetAvatar(avatarId, out avatar))
{
return CapsUpdateInventoryItemAsset(avatar.ControllingClient, itemID, data);
}
return LLUUID.Zero;
}
public LLUUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID itemID, byte[] data)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AssetBase asset;
asset = new AssetBase();
asset.FullID = LLUUID.Random();
asset.Type = (sbyte) item.assetType;
asset.InvType = (sbyte) item.invType;
asset.Name = item.inventoryName;
asset.Data = data;
commsManager.AssetCache.AddAsset(asset);
item.assetID = asset.FullID;
userInfo.UpdateItem(remoteClient.AgentId, item);
// remoteClient.SendInventoryItemUpdate(item);
if (item.invType == 7)
{
//do we want to know about updated note cards?
}
else if (item.invType == 10)
{
// do we want to know about updated scripts
}
return (asset.FullID);
}
}
}
return LLUUID.Zero;
}
public void UDPUpdateInventoryItemAsset(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID,
LLUUID itemID)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AgentAssetTransactions transactions =
commsManager.TransactionsManager.GetUserTransActions(remoteClient.AgentId);
if (transactions != null)
{
AssetBase asset = null;
bool addToCache = false;
asset = commsManager.AssetCache.GetAsset(assetID);
if (asset == null)
{
asset = transactions.GetTransactionAsset(transactionID);
addToCache = true;
}
if (asset != null)
{
if (asset.FullID == assetID)
{
asset.Name = item.inventoryName;
asset.Description = item.inventoryDescription;
asset.InvType = (sbyte) item.invType;
asset.Type = (sbyte) item.assetType;
item.assetID = asset.FullID;
if (addToCache)
{
commsManager.AssetCache.AddAsset(asset);
}
userInfo.UpdateItem(remoteClient.AgentId, item);
}
}
}
}
}
}
}
/// <summary>
/// temporary method to test out creating new inventory items
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="transActionID"></param>
/// <param name="folderID"></param>
/// <param name="callbackID"></param>
/// <param name="description"></param>
/// <param name="name"></param>
/// <param name="invType"></param>
/// <param name="type"></param>
/// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param>
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, sbyte type,
byte wearableType, uint nextOwnerMask)
{
if (transActionID == LLUUID.Zero)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = new AssetBase();
asset.Name = name;
asset.Description = description;
asset.InvType = invType;
asset.Type = type;
asset.FullID = LLUUID.Random();
asset.Data = new byte[1];
commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID;
item.inventoryDescription = description;
item.inventoryName = name;
item.assetType = invType;
item.invType = invType;
item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = nextOwnerMask;
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
}
else
{
commsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID,
callbackID, description, name, invType,
type, wearableType, nextOwnerMask);
//System.Console.WriteLine("request to create inventory item from transaction " + transActionID);
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="primLocalID"></param>
public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(primLocalID);
if (hasPrim != false)
{
bool fileChange = ((SceneObjectGroup) ent).GetPartInventoryFileName(remoteClient, primLocalID);
if (fileChange)
{
if (XferManager != null)
{
((SceneObjectGroup) ent).RequestInventoryFile(primLocalID, XferManager);
}
}
break;
}
}
}
}
public void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
int type = ((SceneObjectGroup) ent).RemoveInventoryItem(remoteClient, localID, itemID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
if (type == 10)
{
EventManager.TriggerRemoveScript(localID, itemID);
}
}
}
}
}
public void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
LLUUID copyID = LLUUID.Random();
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
bool isTexture = false;
bool rezzed = false;
if (item.invType == 0)
{
isTexture = true;
}
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null)
{
string script = Util.FieldToString(rezAsset.Data);
//Console.WriteLine("rez script "+script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
else
{
//lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, isTexture);
if (rezAsset != null)
{
string script = Util.FieldToString(rezAsset.Data);
// Console.WriteLine("rez script " + script);
EventManager.TriggerRezScript(localID, copyID, script);
rezzed = true;
}
}
if (rezzed)
{
bool hasPrim = false;
foreach (EntityBase ent in Entities.Values)
{
if (ent is SceneObjectGroup)
{
hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID);
if (hasPrim != false)
{
bool added =
((SceneObjectGroup) ent).AddInventoryItem(remoteClient, localID, item,
copyID);
((SceneObjectGroup) ent).GetProperites(remoteClient);
}
}
}
}
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="packet"></param>
/// <param name="simClient"></param>
public void DeRezObject(Packet packet, IClientAPI remoteClient)
{
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
{
//currently following code not used (or don't know of any case of destination being zero
}
else
{
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
{
EntityBase selectedEnt = null;
//OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LocalID:" + Data.ObjectLocalID.ToString());
foreach (EntityBase ent in Entities.Values)
{
if (ent.LocalId == Data.ObjectLocalID)
{
selectedEnt = ent;
break;
}
}
if (selectedEnt != null)
{
if (PermissionsMngr.CanDeRezObject(remoteClient.AgentId, ((SceneObjectGroup) selectedEnt).UUID))
{
string sceneObjectXml = ((SceneObjectGroup) selectedEnt).ToXmlString();
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
AssetBase asset = new AssetBase();
asset.Name = ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId);
asset.Description =
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId);
asset.InvType = 6;
asset.Type = 6;
asset.FullID = LLUUID.Random();
asset.Data = Helpers.StringToField(sceneObjectXml);
commsManager.AssetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase();
item.avatarID = remoteClient.AgentId;
item.creatorsID = remoteClient.AgentId;
item.inventoryID = LLUUID.Random();
item.assetID = asset.FullID;
item.inventoryDescription = asset.Description;
item.inventoryName = asset.Name;
item.assetType = asset.Type;
item.invType = asset.InvType;
item.parentFolderID = DeRezPacket.AgentBlock.DestinationID;
item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = 2147483647;
userInfo.AddItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemUpdate(item);
}
SceneObjectPart rootPart =
((SceneObjectGroup) selectedEnt).GetChildPart(((SceneObjectGroup) selectedEnt).UUID);
if (rootPart.PhysActor != null)
{
phyScene.RemovePrim(rootPart.PhysActor);
rootPart.PhysActor = null;
}
storageManager.DataStore.RemoveObject(((SceneObjectGroup) selectedEnt).UUID,
m_regInfo.SimUUID);
((SceneObjectGroup) selectedEnt).DeleteGroup();
lock (Entities)
{
Entities.Remove(((SceneObjectGroup) selectedEnt).UUID);
}
((SceneObjectGroup) selectedEnt).DeleteParts();
}
}
}
}
}
public void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos)
{
CachedUserInfo userInfo = commsManager.UserProfileCache.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AssetBase rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
else
{
//lets try once more incase the asset cache is being slow getting the asset from server
rezAsset = commsManager.AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
AddRezObject(Util.FieldToString(rezAsset.Data), pos);
userInfo.DeleteItem(remoteClient.AgentId, item);
remoteClient.SendRemoveInventoryItem(itemID);
}
}
}
}
}
}
private void AddRezObject(string xmlData, LLVector3 pos)
{
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, xmlData);
AddEntity(group);
group.AbsolutePosition = pos;
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0)
{
PrimitiveBaseShape pbs = rootPart.Shape;
rootPart.PhysActor = phyScene.AddPrimShape(
rootPart.Name,
pbs,
new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
rootPart.AbsolutePosition.Z),
new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
}
}
}
}

View File

@ -1,251 +1,251 @@
using System;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes
{
public class SceneManager
{
private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null;
public Scene CurrentScene
{
get { return m_currentScene; }
}
public Scene CurrentOrFirstScene
{
get
{
if (m_currentScene == null)
{
return m_localScenes[0];
}
else
{
return m_currentScene;
}
}
}
public SceneManager()
{
m_localScenes = new List<Scene>();
}
public void Close()
{
for (int i = 0; i < m_localScenes.Count; i++)
{
m_localScenes[i].Close();
}
}
public void Add(Scene scene)
{
m_localScenes.Add(scene);
}
public void SaveCurrentSceneToXml(string filename)
{
CurrentOrFirstScene.SavePrimsToXml(filename);
}
public void LoadCurrentSceneFromXml(string filename)
{
CurrentOrFirstScene.LoadPrimsFromXml(filename);
}
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{
if (m_currentScene == null)
{
bool success = true;
foreach (Scene scene in m_localScenes)
{
if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
{
success = false;
}
}
return success;
}
else
{
return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
}
}
public void SendCommandToCurrentSceneScripts(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
}
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
}
private void ForEachCurrentScene(Action<Scene> func)
{
if (m_currentScene == null)
{
m_localScenes.ForEach(func);
}
else
{
func(m_currentScene);
}
}
public void BackupCurrentScene()
{
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
}
public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
}
public bool TrySetCurrentScene(string regionName)
{
if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
{
m_currentScene = null;
return true;
}
else
{
Console.WriteLine("Searching for Region: '" + regionName + "'");
foreach (Scene scene in m_localScenes)
{
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
{
m_currentScene = scene;
return true;
}
}
return false;
}
}
public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
{
ForEachCurrentScene(delegate(Scene scene)
{
foreach (EntityBase entity in scene.Entities.Values)
{
if (entity is ScenePresence)
{
ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent)
{
log.Error(String.Format("Packet debug for {0} {1} set to {2}",
scenePrescence.Firstname, scenePrescence.Lastname,
newDebug));
scenePrescence.ControllingClient.SetDebug(newDebug);
}
}
}
});
}
public List<ScenePresence> GetCurrentSceneAvatars()
{
List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene)
{
foreach (EntityBase entity in scene.Entities.Values)
{
if (entity is ScenePresence)
{
ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent)
{
avatars.Add(scenePrescence);
}
}
}
});
return avatars;
}
public RegionInfo GetRegionInfo(ulong regionHandle)
{
foreach (Scene scene in m_localScenes)
{
if (scene.RegionInfo.RegionHandle == regionHandle)
{
return scene.RegionInfo;
}
}
return null;
}
public void SetCurrentSceneTimePhase(int timePhase)
{
ForEachCurrentScene(delegate(Scene scene)
{
scene.SetTimePhase(
timePhase)
;
});
}
public void ForceCurrentSceneClientUpdate()
{
ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); });
}
public void HandleEditCommandOnCurrentScene(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
}
public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar )
{
foreach (Scene scene in m_localScenes)
{
if( scene.TryGetAvatar( avatarId, out avatar ))
{
return true;
}
}
avatar = null;
return false;
}
public void CloseScene(Scene scene)
{
m_localScenes.Remove(scene);
scene.Close();
}
public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{
foreach (Scene scene in m_localScenes)
{
if (scene.TryGetAvatarByName(avatarName, out avatar))
{
return true;
}
}
avatar = null;
return false;
}
}
using System;
using System.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Framework.Types;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes
{
public class SceneManager
{
private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null;
public Scene CurrentScene
{
get { return m_currentScene; }
}
public Scene CurrentOrFirstScene
{
get
{
if (m_currentScene == null)
{
return m_localScenes[0];
}
else
{
return m_currentScene;
}
}
}
public SceneManager()
{
m_localScenes = new List<Scene>();
}
public void Close()
{
for (int i = 0; i < m_localScenes.Count; i++)
{
m_localScenes[i].Close();
}
}
public void Add(Scene scene)
{
m_localScenes.Add(scene);
}
public void SaveCurrentSceneToXml(string filename)
{
CurrentOrFirstScene.SavePrimsToXml(filename);
}
public void LoadCurrentSceneFromXml(string filename)
{
CurrentOrFirstScene.LoadPrimsFromXml(filename);
}
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{
if (m_currentScene == null)
{
bool success = true;
foreach (Scene scene in m_localScenes)
{
if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
{
success = false;
}
}
return success;
}
else
{
return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
}
}
public void SendCommandToCurrentSceneScripts(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
}
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{
ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
}
private void ForEachCurrentScene(Action<Scene> func)
{
if (m_currentScene == null)
{
m_localScenes.ForEach(func);
}
else
{
func(m_currentScene);
}
}
public void BackupCurrentScene()
{
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
}
public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
}
public bool TrySetCurrentScene(string regionName)
{
if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
{
m_currentScene = null;
return true;
}
else
{
Console.WriteLine("Searching for Region: '" + regionName + "'");
foreach (Scene scene in m_localScenes)
{
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
{
m_currentScene = scene;
return true;
}
}
return false;
}
}
public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
{
ForEachCurrentScene(delegate(Scene scene)
{
foreach (EntityBase entity in scene.Entities.Values)
{
if (entity is ScenePresence)
{
ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent)
{
log.Error(String.Format("Packet debug for {0} {1} set to {2}",
scenePrescence.Firstname, scenePrescence.Lastname,
newDebug));
scenePrescence.ControllingClient.SetDebug(newDebug);
}
}
}
});
}
public List<ScenePresence> GetCurrentSceneAvatars()
{
List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene)
{
foreach (EntityBase entity in scene.Entities.Values)
{
if (entity is ScenePresence)
{
ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.IsChildAgent)
{
avatars.Add(scenePrescence);
}
}
}
});
return avatars;
}
public RegionInfo GetRegionInfo(ulong regionHandle)
{
foreach (Scene scene in m_localScenes)
{
if (scene.RegionInfo.RegionHandle == regionHandle)
{
return scene.RegionInfo;
}
}
return null;
}
public void SetCurrentSceneTimePhase(int timePhase)
{
ForEachCurrentScene(delegate(Scene scene)
{
scene.SetTimePhase(
timePhase)
;
});
}
public void ForceCurrentSceneClientUpdate()
{
ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); });
}
public void HandleEditCommandOnCurrentScene(string[] cmdparams)
{
ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
}
public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar )
{
foreach (Scene scene in m_localScenes)
{
if( scene.TryGetAvatar( avatarId, out avatar ))
{
return true;
}
}
avatar = null;
return false;
}
public void CloseScene(Scene scene)
{
m_localScenes.Remove(scene);
scene.Close();
}
public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
{
foreach (Scene scene in m_localScenes)
{
if (scene.TryGetAvatarByName(avatarName, out avatar))
{
return true;
}
}
avatar = null;
return false;
}
}
}

View File

@ -1,6 +1,6 @@
using Axiom.Math;
using libsecondlife;
using Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public interface IScriptHost

View File

@ -1,13 +1,13 @@
using System;
using Axiom.Math;
using libsecondlife;
using System;
using Axiom.Math;
using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting
{
public class NullScriptHost : IScriptHost
{
private LLVector3 m_pos = new LLVector3(128, 128, 30);
{
private LLVector3 m_pos = new LLVector3(128, 128, 30);
public string Name
{
get { return "Object"; }
@ -38,13 +38,13 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
}
public LLUUID ObjectOwner
{
get { return LLUUID.Zero; }
{
get { return LLUUID.Zero; }
}
public LLUUID ObjectCreator
{
get { return LLUUID.Zero; }
public LLUUID ObjectCreator
{
get { return LLUUID.Zero; }
}
public LLVector3 AbsolutePosition

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types
{
public class BasicQuadTreeNode
@ -64,16 +64,16 @@ namespace OpenSim.Region.Environment.Types
if (m_childNodes == null)
{
m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] =
m_childNodes[0] =
new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2));
m_childNodes[1] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2),
m_childNodes[1] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2),
(short) (m_height/2));
m_childNodes[2] =
new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2),
m_childNodes[2] =
new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2),
(short) (m_height/2));
m_childNodes[3] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)),
m_childNodes[3] =
new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)),
(short) (m_width/2), (short) (m_height/2));
}
else
@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Types
List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
foreach (SceneObjectGroup group in m_objects)
{
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{
//still in bounds
@ -157,7 +157,7 @@ namespace OpenSim.Region.Environment.Types
public void PassUp(SceneObjectGroup group)
{
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) &&
((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height))))
{
AddObject(group);

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using libsecondlife;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types
{
public class UpdateQueue
@ -46,6 +46,6 @@ namespace OpenSim.Region.Environment.Types
}
return part;
}
}
}
}

View File

@ -1,148 +1,148 @@
/*
* 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.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
namespace OpenSim.Region.ExtensionsScriptModule
{
public class ScriptManager : IRegionModule, IExtensionScriptModule
{
readonly List<IScript> scripts = new List<IScript>();
Scene m_scene;
readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{
foreach (KeyValuePair<string, IScript> script in compiledscripts)
{
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
MainLog.Instance.Verbose("Loading " + script.Key);
script.Value.Initialise(scriptInfo);
scripts.Add(script.Value);
}
MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count));
}
public ScriptManager()
{
// Default Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
JScriptEngine jscriptCompiler = new JScriptEngine();
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
JavaEngine javaCompiler = new JavaEngine();
compilers.Add(javaCompiler.FileExt(), javaCompiler);
}
public void Initialise(Scene scene)
{
System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene;
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "ExtensionsScriptingModule";
}
public bool IsSharedModule()
{
return false;
}
public bool Compile(string filename)
{
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{
if (filename.EndsWith(compiler.Key))
{
LoadFromCompiler(compiler.Value.compile(filename));
break;
}
}
return true;
}
public void RunScriptCmd(string[] args)
{
switch (args[0])
{
case "load":
Compile(args[1]);
break;
default:
MainLog.Instance.Error("Unknown script command");
break;
}
}
public bool AddPreCompiledScript(IScript script)
{
MainLog.Instance.Verbose("Loading script " + script.Name);
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
script.Initialise(scriptInfo);
scripts.Add(script);
return true;
}
}
public interface IExtensionScriptModule
{
bool Compile(string filename);
bool AddPreCompiledScript(IScript script);
}
interface IScriptCompiler
{
Dictionary<string, IScript> compile(string filename);
string FileExt();
}
}
/*
* 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.Collections.Generic;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
namespace OpenSim.Region.ExtensionsScriptModule
{
public class ScriptManager : IRegionModule, IExtensionScriptModule
{
readonly List<IScript> scripts = new List<IScript>();
Scene m_scene;
readonly Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{
foreach (KeyValuePair<string, IScript> script in compiledscripts)
{
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
MainLog.Instance.Verbose("Loading " + script.Key);
script.Value.Initialise(scriptInfo);
scripts.Add(script.Value);
}
MainLog.Instance.Verbose(string.Format("Finished loading {0} script(s)", compiledscripts.Count));
}
public ScriptManager()
{
// Default Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
JScriptEngine jscriptCompiler = new JScriptEngine();
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
JavaEngine javaCompiler = new JavaEngine();
compilers.Add(javaCompiler.FileExt(), javaCompiler);
}
public void Initialise(Scene scene)
{
System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene;
m_scene.RegisterModuleInterface<IExtensionScriptModule>(this);
}
public void PostInitialise()
{
}
public void CloseDown()
{
}
public string GetName()
{
return "ExtensionsScriptingModule";
}
public bool IsSharedModule()
{
return false;
}
public bool Compile(string filename)
{
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{
if (filename.EndsWith(compiler.Key))
{
LoadFromCompiler(compiler.Value.compile(filename));
break;
}
}
return true;
}
public void RunScriptCmd(string[] args)
{
switch (args[0])
{
case "load":
Compile(args[1]);
break;
default:
MainLog.Instance.Error("Unknown script command");
break;
}
}
public bool AddPreCompiledScript(IScript script)
{
MainLog.Instance.Verbose("Loading script " + script.Name);
ScriptInfo scriptInfo = new ScriptInfo(m_scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
script.Initialise(scriptInfo);
scripts.Add(script);
return true;
}
}
public interface IExtensionScriptModule
{
bool Compile(string filename);
bool AddPreCompiledScript(IScript script);
}
interface IScriptCompiler
{
Dictionary<string, IScript> compile(string filename);
string FileExt();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -760,138 +760,138 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
}
public double llGetRegionTimeDilation() { return 1.0f; }
public double llGetRegionFPS() { return 10.0f; }
/* particle system rules should be coming into this routine as doubles, that is
rule[0] should be an integer from this list and rule[1] should be the arg
for the same integer. wiki.secondlife.com has most of this mapping, but some
came from http://www.caligari-designs.com/p4u2
We iterate through the list for 'Count' elements, incrementing by two for each
iteration and set the members of Primitive.ParticleSystem, one at a time.
*/
public enum PrimitiveRule : int
{
PSYS_PART_FLAGS = 0,
PSYS_PART_START_COLOR = 1,
PSYS_PART_START_ALPHA = 2,
PSYS_PART_END_COLOR = 3,
PSYS_PART_END_ALPHA = 4,
PSYS_PART_START_SCALE = 5,
PSYS_PART_END_SCALE = 6,
PSYS_PART_MAX_AGE = 7,
PSYS_SRC_ACCEL = 8,
PSYS_SRC_PATTERN = 9,
PSYS_SRC_TEXTURE = 12,
PSYS_SRC_BURST_RATE = 13,
PSYS_SRC_BURST_PART_COUNT = 15,
PSYS_SRC_BURST_RADIUS = 16,
PSYS_SRC_BURST_SPEED_MIN = 17,
PSYS_SRC_BURST_SPEED_MAX = 18,
PSYS_SRC_MAX_AGE = 19,
PSYS_SRC_TARGET_KEY = 20,
PSYS_SRC_OMEGA = 21,
PSYS_SRC_ANGLE_BEGIN = 22,
PSYS_SRC_ANGLE_END = 23
}
public void llParticleSystem(List<Object> rules)
{
Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
for (int i = 0; i < rules.Count; i += 2)
{
switch ((int)rules[i])
{
case (int)PrimitiveRule.PSYS_PART_FLAGS:
prules.PartFlags = (uint)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_COLOR:
prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_COLOR:
prules.PartEndColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_MAX_AGE:
prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ACCEL:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_PATTERN:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_TEXTURE:
prules.Texture = (LLUUID)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RATE:
prules.BurstRate = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
prules.BurstPartCount = (byte)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS:
prules.BurstRadius = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
prules.BurstSpeedMin = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
prules.BurstSpeedMax = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_MAX_AGE:
prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY:
prules.Target = (LLUUID)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_OMEGA:
//cast?? prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
prules.InnerAngle = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_END:
prules.OuterAngle = (float)rules[i + 1];
break;
}
}
m_host.AddNewParticleSystem(prules);
}
public double llGetRegionFPS() { return 10.0f; }
/* particle system rules should be coming into this routine as doubles, that is
rule[0] should be an integer from this list and rule[1] should be the arg
for the same integer. wiki.secondlife.com has most of this mapping, but some
came from http://www.caligari-designs.com/p4u2
We iterate through the list for 'Count' elements, incrementing by two for each
iteration and set the members of Primitive.ParticleSystem, one at a time.
*/
public enum PrimitiveRule : int
{
PSYS_PART_FLAGS = 0,
PSYS_PART_START_COLOR = 1,
PSYS_PART_START_ALPHA = 2,
PSYS_PART_END_COLOR = 3,
PSYS_PART_END_ALPHA = 4,
PSYS_PART_START_SCALE = 5,
PSYS_PART_END_SCALE = 6,
PSYS_PART_MAX_AGE = 7,
PSYS_SRC_ACCEL = 8,
PSYS_SRC_PATTERN = 9,
PSYS_SRC_TEXTURE = 12,
PSYS_SRC_BURST_RATE = 13,
PSYS_SRC_BURST_PART_COUNT = 15,
PSYS_SRC_BURST_RADIUS = 16,
PSYS_SRC_BURST_SPEED_MIN = 17,
PSYS_SRC_BURST_SPEED_MAX = 18,
PSYS_SRC_MAX_AGE = 19,
PSYS_SRC_TARGET_KEY = 20,
PSYS_SRC_OMEGA = 21,
PSYS_SRC_ANGLE_BEGIN = 22,
PSYS_SRC_ANGLE_END = 23
}
public void llParticleSystem(List<Object> rules)
{
Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
for (int i = 0; i < rules.Count; i += 2)
{
switch ((int)rules[i])
{
case (int)PrimitiveRule.PSYS_PART_FLAGS:
prules.PartFlags = (uint)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_COLOR:
prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_COLOR:
prules.PartEndColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_ALPHA:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_START_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_END_SCALE:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_PART_MAX_AGE:
prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ACCEL:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_PATTERN:
//what is the cast? prules.PartStartColor = (LLColor)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_TEXTURE:
prules.Texture = (LLUUID)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RATE:
prules.BurstRate = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_PART_COUNT:
prules.BurstPartCount = (byte)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_RADIUS:
prules.BurstRadius = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MIN:
prules.BurstSpeedMin = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_BURST_SPEED_MAX:
prules.BurstSpeedMax = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_MAX_AGE:
prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_TARGET_KEY:
prules.Target = (LLUUID)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_OMEGA:
//cast?? prules.MaxAge = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_BEGIN:
prules.InnerAngle = (float)rules[i + 1];
break;
case (int)PrimitiveRule.PSYS_SRC_ANGLE_END:
prules.OuterAngle = (float)rules[i + 1];
break;
}
}
m_host.AddNewParticleSystem(prules);
}
public void llGroundRepel(double height, int water, double tau) { NotImplemented("llGroundRepel"); }
public void llGiveInventoryList() { NotImplemented("llGiveInventoryList"); }
public void llSetVehicleType(int type) { NotImplemented("llSetVehicleType"); }

View File

@ -285,7 +285,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
before = GC.GetTotalMemory(true);
#endif
LSL_BaseClass CompiledScript;
LSL_BaseClass CompiledScript;
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
#if DEBUG