fixing me some line endings

afrisby
Sean Dague 2007-09-17 12:52:03 +00:00
parent 219d3a7e37
commit b8d9737a47
89 changed files with 9444 additions and 9444 deletions

View File

@ -1,393 +1,393 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using Db4objects.Db4o; using Db4objects.Db4o;
using Db4objects.Db4o.Query; using Db4objects.Db4o.Query;
using libsecondlife; using libsecondlife;
using Nini.Config; using Nini.Config;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Caches
{ {
public class LocalAssetServer : IAssetServer public class LocalAssetServer : IAssetServer
{ {
private IAssetReceiver _receiver; private IAssetReceiver _receiver;
private BlockingQueue<ARequest> _assetRequests; private BlockingQueue<ARequest> _assetRequests;
private IObjectContainer db; private IObjectContainer db;
private Thread _localAssetServerThread; private Thread _localAssetServerThread;
public LocalAssetServer() public LocalAssetServer()
{ {
System.Console.WriteLine("Starting Db4o asset storage system"); System.Console.WriteLine("Starting Db4o asset storage system");
bool yapfile; bool yapfile;
this._assetRequests = new BlockingQueue<ARequest>(); this._assetRequests = new BlockingQueue<ARequest>();
yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
MainLog.Instance.Verbose("Local Asset Server class created"); MainLog.Instance.Verbose("Local Asset Server class created");
db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
MainLog.Instance.Verbose("Db4 Asset database creation"); MainLog.Instance.Verbose("Db4 Asset database creation");
if (!yapfile) if (!yapfile)
{ {
this.SetUpAssetDatabase(); this.SetUpAssetDatabase();
} }
this._localAssetServerThread = new Thread(new ThreadStart(RunRequests)); this._localAssetServerThread = new Thread(new ThreadStart(RunRequests));
this._localAssetServerThread.IsBackground = true; this._localAssetServerThread.IsBackground = true;
this._localAssetServerThread.Start(); this._localAssetServerThread.Start();
} }
public void SetReceiver(IAssetReceiver receiver) public void SetReceiver(IAssetReceiver receiver)
{ {
this._receiver = receiver; this._receiver = receiver;
} }
public void FetchAsset(LLUUID assetID, bool isTexture) public void FetchAsset(LLUUID assetID, bool isTexture)
{ {
ARequest req = new ARequest(); ARequest req = new ARequest();
req.AssetID = assetID; req.AssetID = assetID;
req.IsTexture = isTexture; req.IsTexture = isTexture;
this._assetRequests.Enqueue(req); this._assetRequests.Enqueue(req);
} }
public void UpdateAsset(AssetBase asset) public void UpdateAsset(AssetBase asset)
{ {
} }
public void CreateAsset(AssetBase asset) public void CreateAsset(AssetBase asset)
{ {
AssetStorage store = new AssetStorage(); AssetStorage store = new AssetStorage();
store.Data = asset.Data; store.Data = asset.Data;
store.Name = asset.Name; store.Name = asset.Name;
store.UUID = asset.FullID; store.UUID = asset.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
} }
public void SetServerInfo(string ServerUrl, string ServerKey) public void SetServerInfo(string ServerUrl, string ServerKey)
{ {
} }
public void Close() public void Close()
{ {
if (db != null) if (db != null)
{ {
MainLog.Instance.Verbose("Closing local asset server database"); MainLog.Instance.Verbose("Closing local asset server database");
db.Close(); db.Close();
} }
} }
private void RunRequests() private void RunRequests()
{ {
while (true) while (true)
{ {
byte[] idata = null; byte[] idata = null;
bool found = false; bool found = false;
AssetStorage foundAsset = null; AssetStorage foundAsset = null;
ARequest req = this._assetRequests.Dequeue(); ARequest req = this._assetRequests.Dequeue();
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
if (result.Count > 0) if (result.Count > 0)
{ {
foundAsset = (AssetStorage)result.Next(); foundAsset = (AssetStorage)result.Next();
found = true; found = true;
} }
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
if (found) if (found)
{ {
asset.FullID = foundAsset.UUID; asset.FullID = foundAsset.UUID;
asset.Type = foundAsset.Type; asset.Type = foundAsset.Type;
asset.InvType = foundAsset.Type; asset.InvType = foundAsset.Type;
asset.Name = foundAsset.Name; asset.Name = foundAsset.Name;
idata = foundAsset.Data; idata = foundAsset.Data;
asset.Data = idata; asset.Data = idata;
_receiver.AssetReceived(asset, req.IsTexture); _receiver.AssetReceived(asset, req.IsTexture);
} }
else else
{ {
//asset.FullID = ; //asset.FullID = ;
_receiver.AssetNotFound(req.AssetID); _receiver.AssetNotFound(req.AssetID);
} }
} }
} }
private void SetUpAssetDatabase() private void SetUpAssetDatabase()
{ {
MainLog.Instance.Verbose("Setting up asset database"); MainLog.Instance.Verbose("Setting up asset database");
AssetBase Image = new AssetBase(); AssetBase Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000001");
Image.Name = "Bricks"; Image.Name = "Bricks";
this.LoadAsset(Image, true, "bricks.jp2"); this.LoadAsset(Image, true, "bricks.jp2");
AssetStorage store = new AssetStorage(); AssetStorage store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000002");
Image.Name = "Plywood"; Image.Name = "Plywood";
this.LoadAsset(Image, true, "plywood.jp2"); this.LoadAsset(Image, true, "plywood.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000003");
Image.Name = "Rocks"; Image.Name = "Rocks";
this.LoadAsset(Image, true, "rocks.jp2"); this.LoadAsset(Image, true, "rocks.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000004");
Image.Name = "Granite"; Image.Name = "Granite";
this.LoadAsset(Image, true, "granite.jp2"); this.LoadAsset(Image, true, "granite.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000005");
Image.Name = "Hardwood"; Image.Name = "Hardwood";
this.LoadAsset(Image, true, "hardwood.jp2"); this.LoadAsset(Image, true, "hardwood.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005"); Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
Image.Name = "Prim Base Texture"; Image.Name = "Prim Base Texture";
this.LoadAsset(Image, true, "plywood.jp2"); this.LoadAsset(Image, true, "plywood.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000006");
Image.Name = "Map Base Texture"; Image.Name = "Map Base Texture";
this.LoadAsset(Image, true, "map_base.jp2"); this.LoadAsset(Image, true, "map_base.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007"); Image.FullID = new LLUUID("00000000-0000-0000-9999-000000000007");
Image.Name = "Map Texture"; Image.Name = "Map Texture";
this.LoadAsset(Image, true, "map1.jp2"); this.LoadAsset(Image, true, "map1.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010"); Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000010");
Image.Name = "Female Body Texture"; Image.Name = "Female Body Texture";
this.LoadAsset(Image, true, "femalebody.jp2"); this.LoadAsset(Image, true, "femalebody.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011"); Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000011");
Image.Name = "Female Bottom Texture"; Image.Name = "Female Bottom Texture";
this.LoadAsset(Image, true, "femalebottom.jp2"); this.LoadAsset(Image, true, "femalebottom.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012"); Image.FullID = new LLUUID("00000000-0000-1111-9999-000000000012");
Image.Name = "Female Face Texture"; Image.Name = "Female Face Texture";
this.LoadAsset(Image, true, "femaleface.jp2"); this.LoadAsset(Image, true, "femaleface.jp2");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); Image.FullID = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
Image.Name = "Skin"; Image.Name = "Skin";
Image.Type = 13; Image.Type = 13;
Image.InvType = 13; Image.InvType = 13;
this.LoadAsset(Image, false, "base_skin.dat"); this.LoadAsset(Image, false, "base_skin.dat");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); Image.FullID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
Image.Name = "Shape"; Image.Name = "Shape";
Image.Type = 13; Image.Type = 13;
Image.InvType = 13; Image.InvType = 13;
this.LoadAsset(Image, false, "base_shape.dat"); this.LoadAsset(Image, false, "base_shape.dat");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110"); Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111110");
Image.Name = "Shirt"; Image.Name = "Shirt";
Image.Type = 5; Image.Type = 5;
Image.InvType = 18; Image.InvType = 18;
this.LoadAsset(Image, false, "newshirt.dat"); this.LoadAsset(Image, false, "newshirt.dat");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
Image = new AssetBase(); Image = new AssetBase();
Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120"); Image.FullID = new LLUUID("00000000-38f9-1111-024e-222222111120");
Image.Name = "Shirt"; Image.Name = "Shirt";
Image.Type = 5; Image.Type = 5;
Image.InvType = 18; Image.InvType = 18;
this.LoadAsset(Image, false, "newpants.dat"); this.LoadAsset(Image, false, "newpants.dat");
store = new AssetStorage(); store = new AssetStorage();
store.Data = Image.Data; store.Data = Image.Data;
store.Name = Image.Name; store.Name = Image.Name;
store.UUID = Image.FullID; store.UUID = Image.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml"); string filePath = Path.Combine(Util.configDir(), "OpenSimAssetSet.xml");
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
XmlConfigSource source = new XmlConfigSource(filePath); XmlConfigSource source = new XmlConfigSource(filePath);
ReadAssetDetails(source); ReadAssetDetails(source);
} }
} }
protected void ReadAssetDetails(IConfigSource source) protected void ReadAssetDetails(IConfigSource source)
{ {
AssetBase newAsset = null; AssetBase newAsset = null;
for (int i = 0; i < source.Configs.Count; i++) for (int i = 0; i < source.Configs.Count; i++)
{ {
newAsset = new AssetBase(); newAsset = new AssetBase();
newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); newAsset.FullID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
newAsset.Name = source.Configs[i].GetString("name", ""); newAsset.Name = source.Configs[i].GetString("name", "");
newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0); newAsset.Type = (sbyte)source.Configs[i].GetInt("assetType", 0);
newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); newAsset.InvType = (sbyte)source.Configs[i].GetInt("inventoryType", 0);
string fileName = source.Configs[i].GetString("fileName", ""); string fileName = source.Configs[i].GetString("fileName", "");
if (fileName != "") if (fileName != "")
{ {
this.LoadAsset(newAsset, false, fileName); this.LoadAsset(newAsset, false, fileName);
AssetStorage store = new AssetStorage(); AssetStorage store = new AssetStorage();
store.Data = newAsset.Data; store.Data = newAsset.Data;
store.Name = newAsset.Name; store.Name = newAsset.Name;
store.UUID = newAsset.FullID; store.UUID = newAsset.FullID;
db.Set(store); db.Set(store);
db.Commit(); db.Commit();
} }
} }
} }
private void LoadAsset(AssetBase info, bool image, string filename) private void LoadAsset(AssetBase info, bool image, string filename)
{ {
//should request Asset from storage manager //should request Asset from storage manager
//but for now read from file //but for now read from file
string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder; string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
string fileName = Path.Combine(dataPath, filename); string fileName = Path.Combine(dataPath, filename);
FileInfo fInfo = new FileInfo(fileName); FileInfo fInfo = new FileInfo(fileName);
long numBytes = fInfo.Length; long numBytes = fInfo.Length;
FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
byte[] idata = new byte[numBytes]; byte[] idata = new byte[numBytes];
BinaryReader br = new BinaryReader(fStream); BinaryReader br = new BinaryReader(fStream);
idata = br.ReadBytes((int)numBytes); idata = br.ReadBytes((int)numBytes);
br.Close(); br.Close();
fStream.Close(); fStream.Close();
info.Data = idata; info.Data = idata;
//info.loaded=true; //info.loaded=true;
} }
} }
public class AssetUUIDQuery : Predicate public class AssetUUIDQuery : Predicate
{ {
private LLUUID _findID; private LLUUID _findID;
public AssetUUIDQuery(LLUUID find) public AssetUUIDQuery(LLUUID find)
{ {
_findID = find; _findID = find;
} }
public bool Match(AssetStorage asset) public bool Match(AssetStorage asset)
{ {
return (asset.UUID == _findID); return (asset.UUID == _findID);
} }
} }
} }

View File

@ -44,7 +44,7 @@ namespace OpenSim.Framework.Communications.Caches
private IAssetReceiver _receiver; private IAssetReceiver _receiver;
private BlockingQueue<ARequest> _assetRequests; private BlockingQueue<ARequest> _assetRequests;
private Thread _localAssetServerThread; private Thread _localAssetServerThread;
protected IAssetProvider m_plugin; protected IAssetProvider m_plugin;
private object syncLock = new object(); private object syncLock = new object();
@ -102,20 +102,20 @@ namespace OpenSim.Framework.Communications.Caches
} }
public void UpdateAsset(AssetBase asset) public void UpdateAsset(AssetBase asset)
{ {
lock (syncLock) lock (syncLock)
{ {
m_plugin.UpdateAsset(asset); m_plugin.UpdateAsset(asset);
m_plugin.CommitAssets(); m_plugin.CommitAssets();
} }
} }
public void CreateAsset(AssetBase asset) public void CreateAsset(AssetBase asset)
{ {
lock (syncLock) lock (syncLock)
{ {
m_plugin.CreateAsset(asset); m_plugin.CreateAsset(asset);
m_plugin.CommitAssets(); m_plugin.CommitAssets();
} }
} }
@ -135,12 +135,12 @@ namespace OpenSim.Framework.Communications.Caches
{ {
ARequest req = this._assetRequests.Dequeue(); ARequest req = this._assetRequests.Dequeue();
MainLog.Instance.Verbose("Requesting asset: " + req.AssetID); MainLog.Instance.Verbose("Requesting asset: " + req.AssetID);
AssetBase asset = null; AssetBase asset = null;
lock (syncLock) lock (syncLock)
{ {
asset = m_plugin.FetchAsset(req.AssetID); asset = m_plugin.FetchAsset(req.AssetID);
} }
if (asset != null) if (asset != null)
{ {

View File

@ -1,17 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities
{ {
[LLSDMap] [LLSDMap]
public class LLSDItemUpdate public class LLSDItemUpdate
{ {
public LLUUID item_id; public LLUUID item_id;
public LLSDItemUpdate() public LLSDItemUpdate()
{ {
} }
} }
} }

View File

@ -1,18 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using libsecondlife; using libsecondlife;
namespace OpenSim.Framework.Interfaces namespace OpenSim.Framework.Interfaces
{ {
public interface IAssetProvider public interface IAssetProvider
{ {
void Initialise(string dbfile, string dbname); void Initialise(string dbfile, string dbname);
AssetBase FetchAsset(LLUUID uuid); AssetBase FetchAsset(LLUUID uuid);
void CreateAsset(AssetBase asset); void CreateAsset(AssetBase asset);
void UpdateAsset(AssetBase asset); void UpdateAsset(AssetBase asset);
bool ExistsAsset(LLUUID uuid); bool ExistsAsset(LLUUID uuid);
void CommitAssets(); // force a sync to the database void CommitAssets(); // force a sync to the database
} }
} }

View File

@ -1,38 +1,38 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
public class CAPSService public class CAPSService
{ {
private BaseHttpServer m_server; private BaseHttpServer m_server;
public CAPSService(BaseHttpServer httpServer) public CAPSService(BaseHttpServer httpServer)
{ {
m_server = httpServer; m_server = httpServer;
this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); this.AddCapsSeedHandler("/CapsSeed/", CapsRequest);
} }
private void AddCapsSeedHandler(string path, RestMethod restMethod) private void AddCapsSeedHandler(string path, RestMethod restMethod)
{ {
m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
} }
public string CapsRequest(string request, string path, string param) public string CapsRequest(string request, string path, string param)
{ {
System.Console.WriteLine("new caps request " + request +" from path "+ path); System.Console.WriteLine("new caps request " + request +" from path "+ path);
return ""; return "";
} }
} }
} }

View File

@ -1,290 +1,290 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory; using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;
using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
public class LoginService public class LoginService
{ {
protected string m_welcomeMessage = "Welcome to OpenSim"; protected string m_welcomeMessage = "Welcome to OpenSim";
protected UserManagerBase m_userManager = null; protected UserManagerBase m_userManager = null;
public LoginService(UserManagerBase userManager, string welcomeMess) public LoginService(UserManagerBase userManager, string welcomeMess)
{ {
m_userManager = userManager; m_userManager = userManager;
if (welcomeMess != "") if (welcomeMess != "")
{ {
m_welcomeMessage = welcomeMess; m_welcomeMessage = welcomeMess;
} }
} }
/// <summary> /// <summary>
/// Main user login function /// Main user login function
/// </summary> /// </summary>
/// <param name="request">The XMLRPC request</param> /// <param name="request">The XMLRPC request</param>
/// <returns>The response to send</returns> /// <returns>The response to send</returns>
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{ {
System.Console.WriteLine("Attempting login now..."); System.Console.WriteLine("Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable)request.Params[0];
bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd"));
bool GoodLogin = false; bool GoodLogin = false;
string firstname = ""; string firstname = "";
string lastname = ""; string lastname = "";
string passwd = ""; string passwd = "";
UserProfileData userProfile; UserProfileData userProfile;
LoginResponse logResponse = new LoginResponse(); LoginResponse logResponse = new LoginResponse();
if (GoodXML) if (GoodXML)
{ {
firstname = (string)requestData["first"]; firstname = (string)requestData["first"];
lastname = (string)requestData["last"]; lastname = (string)requestData["last"];
passwd = (string)requestData["passwd"]; passwd = (string)requestData["passwd"];
userProfile = GetTheUser(firstname, lastname); userProfile = GetTheUser(firstname, lastname);
if (userProfile == null) if (userProfile == null)
return logResponse.CreateLoginFailedResponse(); return logResponse.CreateLoginFailedResponse();
GoodLogin = AuthenticateUser(userProfile, passwd); GoodLogin = AuthenticateUser(userProfile, passwd);
} }
else else
{ {
return logResponse.CreateGridErrorResponse(); return logResponse.CreateGridErrorResponse();
} }
if (!GoodLogin) if (!GoodLogin)
{ {
return logResponse.CreateLoginFailedResponse(); return logResponse.CreateLoginFailedResponse();
} }
else else
{ {
// If we already have a session... // If we already have a session...
if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline) if (userProfile.currentAgent != null && userProfile.currentAgent.agentOnline)
{ {
// Reject the login // Reject the login
return logResponse.CreateAlreadyLoggedInResponse(); return logResponse.CreateAlreadyLoggedInResponse();
} }
// Otherwise... // Otherwise...
// Create a new agent session // Create a new agent session
CreateAgent(userProfile, request); CreateAgent(userProfile, request);
try try
{ {
LLUUID agentID = userProfile.UUID; LLUUID agentID = userProfile.UUID;
// Inventory Library Section // Inventory Library Section
InventoryData inventData = this.CreateInventoryData(agentID); InventoryData inventData = this.CreateInventoryData(agentID);
ArrayList AgentInventoryArray = inventData.InventoryArray; ArrayList AgentInventoryArray = inventData.InventoryArray;
Hashtable InventoryRootHash = new Hashtable(); Hashtable InventoryRootHash = new Hashtable();
InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated();
ArrayList InventoryRoot = new ArrayList(); ArrayList InventoryRoot = new ArrayList();
InventoryRoot.Add(InventoryRootHash); InventoryRoot.Add(InventoryRootHash);
userProfile.rootInventoryFolderID = inventData.RootFolderID; userProfile.rootInventoryFolderID = inventData.RootFolderID;
// Circuit Code // Circuit Code
uint circode = (uint)(Util.RandomClass.Next()); uint circode = (uint)(Util.RandomClass.Next());
logResponse.Lastname = userProfile.surname; logResponse.Lastname = userProfile.surname;
logResponse.Firstname = userProfile.username; logResponse.Firstname = userProfile.username;
logResponse.AgentID = agentID.ToStringHyphenated(); logResponse.AgentID = agentID.ToStringHyphenated();
logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated();
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
logResponse.InventoryRoot = InventoryRoot; logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = this.GetInventoryLibrary(); logResponse.InventoryLibrary = this.GetInventoryLibrary();
logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); logResponse.InventoryLibraryOwner = this.GetLibraryOwner();
logResponse.CircuitCode = (Int32)circode; logResponse.CircuitCode = (Int32)circode;
//logResponse.RegionX = 0; //overwritten //logResponse.RegionX = 0; //overwritten
//logResponse.RegionY = 0; //overwritten //logResponse.RegionY = 0; //overwritten
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
//logResponse.SimAddress = "127.0.0.1"; //overwritten //logResponse.SimAddress = "127.0.0.1"; //overwritten
//logResponse.SimPort = 0; //overwritten //logResponse.SimPort = 0; //overwritten
logResponse.Message = this.GetMessage(); logResponse.Message = this.GetMessage();
try try
{ {
this.CustomiseResponse(logResponse, userProfile); this.CustomiseResponse(logResponse, userProfile);
} }
catch (Exception e) catch (Exception e)
{ {
System.Console.WriteLine(e.ToString()); System.Console.WriteLine(e.ToString());
return logResponse.CreateDeadRegionResponse(); return logResponse.CreateDeadRegionResponse();
//return logResponse.ToXmlRpcResponse(); //return logResponse.ToXmlRpcResponse();
} }
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
return logResponse.ToXmlRpcResponse(); return logResponse.ToXmlRpcResponse();
} }
catch (Exception E) catch (Exception E)
{ {
System.Console.WriteLine(E.ToString()); System.Console.WriteLine(E.ToString());
} }
//} //}
} }
return response; return response;
} }
/// <summary> /// <summary>
/// Customises the login response and fills in missing values. /// Customises the login response and fills in missing values.
/// </summary> /// </summary>
/// <param name="response">The existing response</param> /// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param> /// <param name="theUser">The user profile</param>
public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser) public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser)
{ {
} }
/// <summary> /// <summary>
/// Saves a target agent to the database /// Saves a target agent to the database
/// </summary> /// </summary>
/// <param name="profile">The users profile</param> /// <param name="profile">The users profile</param>
/// <returns>Successful?</returns> /// <returns>Successful?</returns>
public bool CommitAgent(ref UserProfileData profile) public bool CommitAgent(ref UserProfileData profile)
{ {
// Saves the agent to database // Saves the agent to database
return true; return true;
} }
/// <summary> /// <summary>
/// Checks a user against it's password hash /// Checks a user against it's password hash
/// </summary> /// </summary>
/// <param name="profile">The users profile</param> /// <param name="profile">The users profile</param>
/// <param name="password">The supplied password</param> /// <param name="password">The supplied password</param>
/// <returns>Authenticated?</returns> /// <returns>Authenticated?</returns>
public virtual bool AuthenticateUser(UserProfileData profile, string password) public virtual bool AuthenticateUser(UserProfileData profile, string password)
{ {
MainLog.Instance.Verbose( MainLog.Instance.Verbose(
"Authenticating " + profile.username + " " + profile.surname); "Authenticating " + profile.username + " " + profile.surname);
password = password.Remove(0, 3); //remove $1$ password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.passwordSalt); string s = Util.Md5Hash(password + ":" + profile.passwordSalt);
return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase); return profile.passwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="profile"></param> /// <param name="profile"></param>
/// <param name="request"></param> /// <param name="request"></param>
public void CreateAgent(UserProfileData profile, XmlRpcRequest request) public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
{ {
this.m_userManager.CreateAgent(profile, request); this.m_userManager.CreateAgent(profile, request);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="firstname"></param> /// <param name="firstname"></param>
/// <param name="lastname"></param> /// <param name="lastname"></param>
/// <returns></returns> /// <returns></returns>
public virtual UserProfileData GetTheUser(string firstname, string lastname) public virtual UserProfileData GetTheUser(string firstname, string lastname)
{ {
return this.m_userManager.getUserProfile(firstname, lastname); return this.m_userManager.getUserProfile(firstname, lastname);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual string GetMessage() public virtual string GetMessage()
{ {
return m_welcomeMessage; return m_welcomeMessage;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual ArrayList GetInventoryLibrary() protected virtual ArrayList GetInventoryLibrary()
{ {
//return new ArrayList(); //return new ArrayList();
Hashtable TempHash = new Hashtable(); Hashtable TempHash = new Hashtable();
TempHash["name"] = "OpenSim Library"; TempHash["name"] = "OpenSim Library";
TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated();
TempHash["version"] = 1; TempHash["version"] = 1;
TempHash["type_default"] = -1; TempHash["type_default"] = -1;
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
ArrayList temp = new ArrayList(); ArrayList temp = new ArrayList();
temp.Add(TempHash); temp.Add(TempHash);
TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["name"] = "Texture Library"; TempHash["name"] = "Texture Library";
TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000";
TempHash["version"] = 1; TempHash["version"] = 1;
TempHash["type_default"] = -1; TempHash["type_default"] = -1;
TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001";
temp.Add(TempHash); temp.Add(TempHash);
return temp; return temp;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual ArrayList GetLibraryOwner() protected virtual ArrayList GetLibraryOwner()
{ {
//for now create random inventory library owner //for now create random inventory library owner
Hashtable TempHash = new Hashtable(); Hashtable TempHash = new Hashtable();
TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000";
ArrayList inventoryLibOwner = new ArrayList(); ArrayList inventoryLibOwner = new ArrayList();
inventoryLibOwner.Add(TempHash); inventoryLibOwner.Add(TempHash);
return inventoryLibOwner; return inventoryLibOwner;
} }
protected virtual InventoryData CreateInventoryData(LLUUID userID) protected virtual InventoryData CreateInventoryData(LLUUID userID)
{ {
AgentInventory userInventory = new AgentInventory(); AgentInventory userInventory = new AgentInventory();
userInventory.CreateRootFolder(userID, false); userInventory.CreateRootFolder(userID, false);
ArrayList AgentInventoryArray = new ArrayList(); ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash; Hashtable TempHash;
foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
{ {
TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName; TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version; TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType; TempHash["type_default"] = (Int32)InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash); AgentInventoryArray.Add(TempHash);
} }
return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
} }
public class InventoryData public class InventoryData
{ {
public ArrayList InventoryArray = null; public ArrayList InventoryArray = null;
public LLUUID RootFolderID = LLUUID.Zero; public LLUUID RootFolderID = LLUUID.Zero;
public InventoryData(ArrayList invList, LLUUID rootID) public InventoryData(ArrayList invList, LLUUID rootID)
{ {
InventoryArray = invList; InventoryArray = invList;
RootFolderID = rootID; RootFolderID = rootID;
} }
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -1,38 +1,38 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class OGS1InventoryService : IInventoryServices public class OGS1InventoryService : IInventoryServices
{ {
public OGS1InventoryService() public OGS1InventoryService()
{ {
} }
public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{ {
} }
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder)
{ {
} }
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
} }
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
} }
} }
} }

View File

@ -1,27 +1,27 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IDynamicTextureManager public interface IDynamicTextureManager
{ {
void RegisterRender(string handleType, IDynamicTextureRender render); void RegisterRender(string handleType, IDynamicTextureRender render);
void ReturnData(LLUUID id, byte[] data); void ReturnData(LLUUID id, byte[] data);
LLUUID AddDynamicTextureURL(LLUUID simID, LLUUID primID, string contentType, string url, string extraParams, int updateTimer); 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); LLUUID AddDynamicTextureData(LLUUID simID, LLUUID primID, string contentType, string data, string extraParams, int updateTimer);
} }
public interface IDynamicTextureRender public interface IDynamicTextureRender
{ {
string GetName(); string GetName();
string GetContentType(); string GetContentType();
bool SupportsAsynchronous(); bool SupportsAsynchronous();
byte[] ConvertUrl(string url, string extraParams); byte[] ConvertUrl(string url, string extraParams);
byte[] ConvertStream(Stream data, string extraParams); byte[] ConvertStream(Stream data, string extraParams);
bool AsyncConvertUrl(LLUUID id, string url, string extraParams); bool AsyncConvertUrl(LLUUID id, string url, string extraParams);
bool AsyncConvertData(LLUUID id, string bodyData, string extraParams); bool AsyncConvertData(LLUUID id, string bodyData, string extraParams);
} }
} }

View File

@ -1,12 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IHttpRequests public interface IHttpRequests
{ {
LLUUID MakeHttpRequest(string url, string type, string body); LLUUID MakeHttpRequest(string url, string type, string body);
} }
} }

View File

@ -1,15 +1,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IRegionModule public interface IRegionModule
{ {
void Initialise(Scenes.Scene scene); void Initialise(Scenes.Scene scene);
void PostInitialise(); void PostInitialise();
void CloseDown(); void CloseDown();
string GetName(); string GetName();
bool IsSharedModule(); bool IsSharedModule();
} }
} }

View File

@ -1,12 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface ISimChat public interface ISimChat
{ {
void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
} }
} }

View File

@ -1,46 +1,46 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface ITerrain public interface ITerrain
{ {
bool Tainted(); bool Tainted();
bool Tainted(int x, int y); bool Tainted(int x, int y);
void ResetTaint(); void ResetTaint();
void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser); void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser);
void CheckHeightValues(); void CheckHeightValues();
float[] GetHeights1D(); float[] GetHeights1D();
float[,] GetHeights2D(); float[,] GetHeights2D();
double[,] GetHeights2DD(); double[,] GetHeights2DD();
void GetHeights1D(float[] heights); void GetHeights1D(float[] heights);
void SetHeights2D(float[,] heights); void SetHeights2D(float[,] heights);
void SetHeights2D(double[,] heights); void SetHeights2D(double[,] heights);
void SwapRevertMaps(); void SwapRevertMaps();
void SaveRevertMap(); void SaveRevertMap();
bool RunTerrainCmd(string[] args, ref string resultText, string simName); bool RunTerrainCmd(string[] args, ref string resultText, string simName);
void SetRange(float min, float max); void SetRange(float min, float max);
void LoadFromFileF64(string filename); void LoadFromFileF64(string filename);
void LoadFromFileF32(string filename); void LoadFromFileF32(string filename);
void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); void LoadFromFileF32(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY); void LoadFromFileIMG(string filename, int dimensionX, int dimensionY, int lowerboundX, int lowerboundY);
void LoadFromFileSLRAW(string filename); void LoadFromFileSLRAW(string filename);
void WriteToFileF64(string filename); void WriteToFileF64(string filename);
void WriteToFileF32(string filename); void WriteToFileF32(string filename);
void WriteToFileRAW(string filename); void WriteToFileRAW(string filename);
void WriteToFileHiRAW(string filename); void WriteToFileHiRAW(string filename);
void SetSeed(int val); void SetSeed(int val);
void RaiseTerrain(double rx, double ry, double size, double amount); void RaiseTerrain(double rx, double ry, double size, double amount);
void LowerTerrain(double rx, double ry, double size, double amount); void LowerTerrain(double rx, double ry, double size, double amount);
void FlattenTerrain(double rx, double ry, double size, double amount); void FlattenTerrain(double rx, double ry, double size, double amount);
void NoiseTerrain(double rx, double ry, double size, double amount); void NoiseTerrain(double rx, double ry, double size, double amount);
void RevertTerrain(double rx, double ry, double size, double amount); void RevertTerrain(double rx, double ry, double size, double amount);
void SmoothTerrain(double rx, double ry, double size, double amount); void SmoothTerrain(double rx, double ry, double size, double amount);
void HillsGenerator(); void HillsGenerator();
double GetHeight(int x, int y); double GetHeight(int x, int y);
void ExportImage(string filename, string gradientmap); void ExportImage(string filename, string gradientmap);
byte[] ExportJpegImage(string gradientmap); byte[] ExportJpegImage(string gradientmap);
} }
} }

View File

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IXfer public interface IXfer
{ {
bool AddNewFile(string fileName, byte[] data); bool AddNewFile(string fileName, byte[] data);
} }
} }

View File

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

View File

@ -1,50 +1,50 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class AssetDownloadModule : IRegionModule public class AssetDownloadModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public AssetDownloadModule() public AssetDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "AssetDownloadModule"; return "AssetDownloadModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public void NewClient(IClientAPI client) public void NewClient(IClientAPI client)
{ {
} }
} }
} }

View File

@ -1,71 +1,71 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class AvatarProfilesModule :IRegionModule public class AvatarProfilesModule :IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public AvatarProfilesModule() public AvatarProfilesModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "AvatarProfilesModule"; return "AvatarProfilesModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public void NewClient(IClientAPI client) public void NewClient(IClientAPI client)
{ {
client.OnRequestAvatarProperties += RequestAvatarProperty; client.OnRequestAvatarProperties += RequestAvatarProperty;
} }
public void RemoveClient(IClientAPI client) public void RemoveClient(IClientAPI client)
{ {
client.OnRequestAvatarProperties -= RequestAvatarProperty; client.OnRequestAvatarProperties -= RequestAvatarProperty;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="avatarID"></param> /// <param name="avatarID"></param>
public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID) public void RequestAvatarProperty(IClientAPI remoteClient, LLUUID avatarID)
{ {
string about = "OpenSim crash test dummy"; string about = "OpenSim crash test dummy";
string bornOn = "Before now"; string bornOn = "Before now";
string flAbout = "First life? What is one of those? OpenSim is my life!"; string flAbout = "First life? What is one of those? OpenSim is my life!";
LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000"); LLUUID partner = new LLUUID("11111111-1111-0000-0000-000100bba000");
remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner); remoteClient.SendAvatarProperties(avatarID, about, bornOn, "", flAbout, 0, LLUUID.Zero, LLUUID.Zero, "", partner);
} }
} }
} }

View File

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

View File

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

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class EmailModule class EmailModule
{ {
} }
} }

View File

@ -1,40 +1,40 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class FriendsModule : IRegionModule public class FriendsModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "FriendsModule"; return "FriendsModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
} }
} }

View File

@ -1,40 +1,40 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class GroupsModule : IRegionModule public class GroupsModule : IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "GroupsModule"; return "GroupsModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
} }
} }

View File

@ -1,40 +1,40 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InstantMessageModule :IRegionModule public class InstantMessageModule :IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "InstantMessageModule"; return "InstantMessageModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
} }
} }

View File

@ -1,40 +1,40 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class InventoryModule :IRegionModule public class InventoryModule :IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "InventoryModule"; return "InventoryModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class ScriptsHttpRequests class ScriptsHttpRequests
{ {
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
class TeleportModule class TeleportModule
{ {
} }
} }

View File

@ -1,54 +1,54 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class TextureDownloadModule :IRegionModule public class TextureDownloadModule :IRegionModule
{ {
private Scene m_scene; private Scene m_scene;
public TextureDownloadModule() public TextureDownloadModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "TextureDownloadModule"; return "TextureDownloadModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public void NewClient(IClientAPI client) public void NewClient(IClientAPI client)
{ {
} }
public void TextureAssetCallback(LLUUID texture, byte[] data) public void TextureAssetCallback(LLUUID texture, byte[] data)
{ {
} }
} }
} }

View File

@ -1,180 +1,180 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules namespace OpenSim.Region.Environment.Modules
{ {
public class XferModule : IRegionModule, IXfer public class XferModule : IRegionModule, IXfer
{ {
public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>(); public Dictionary<string, byte[]> NewFiles = new Dictionary<string, byte[]>();
public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>(); public Dictionary<ulong, XferDownLoad> Transfers = new Dictionary<ulong, XferDownLoad>();
private Scene m_scene; private Scene m_scene;
public XferModule() public XferModule()
{ {
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
m_scene = scene; m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient; m_scene.EventManager.OnNewClient += NewClient;
m_scene.RegisterModuleInterface<IXfer>(this); m_scene.RegisterModuleInterface<IXfer>(this);
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "XferModule"; return "XferModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public void NewClient(IClientAPI client) public void NewClient(IClientAPI client)
{ {
client.OnRequestXfer += RequestXfer; client.OnRequestXfer += RequestXfer;
client.OnConfirmXfer += AckPacket; client.OnConfirmXfer += AckPacket;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="xferID"></param> /// <param name="xferID"></param>
/// <param name="fileName"></param> /// <param name="fileName"></param>
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName) public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
{ {
lock (NewFiles) lock (NewFiles)
{ {
if (NewFiles.ContainsKey(fileName)) if (NewFiles.ContainsKey(fileName))
{ {
if (!Transfers.ContainsKey(xferID)) if (!Transfers.ContainsKey(xferID))
{ {
byte[] fileData = NewFiles[fileName]; byte[] fileData = NewFiles[fileName];
XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient); XferDownLoad transaction = new XferDownLoad(fileName, fileData, xferID, remoteClient);
Transfers.Add(xferID, transaction); Transfers.Add(xferID, transaction);
NewFiles.Remove(fileName); NewFiles.Remove(fileName);
transaction.StartSend(); transaction.StartSend();
} }
} }
} }
} }
public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet) public void AckPacket(IClientAPI remoteClient, ulong xferID, uint packet)
{ {
if (this.Transfers.ContainsKey(xferID)) if (this.Transfers.ContainsKey(xferID))
{ {
Transfers[xferID].AckPacket(packet); Transfers[xferID].AckPacket(packet);
} }
} }
public bool AddNewFile(string fileName, byte[] data) public bool AddNewFile(string fileName, byte[] data)
{ {
lock (NewFiles) lock (NewFiles)
{ {
if (NewFiles.ContainsKey(fileName)) if (NewFiles.ContainsKey(fileName))
{ {
NewFiles[fileName] = data; NewFiles[fileName] = data;
} }
else else
{ {
NewFiles.Add(fileName, data); NewFiles.Add(fileName, data);
} }
} }
return true; return true;
} }
public class XferDownLoad public class XferDownLoad
{ {
public byte[] Data = new byte[0]; public byte[] Data = new byte[0];
public string FileName = ""; public string FileName = "";
public ulong XferID = 0; public ulong XferID = 0;
public int DataPointer = 0; public int DataPointer = 0;
public uint Packet = 0; public uint Packet = 0;
public IClientAPI Client; public IClientAPI Client;
public uint Serial = 1; public uint Serial = 1;
private bool complete = false; private bool complete = false;
public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client) public XferDownLoad(string fileName, byte[] data, ulong xferID, IClientAPI client)
{ {
FileName = fileName; FileName = fileName;
Data = data; Data = data;
XferID = xferID; XferID = xferID;
Client = client; Client = client;
} }
public XferDownLoad() public XferDownLoad()
{ {
} }
public void StartSend() public void StartSend()
{ {
if (Data.Length < 1000) if (Data.Length < 1000)
{ {
// for now (testing ) we only support files under 1000 bytes // for now (testing ) we only support files under 1000 bytes
byte[] transferData = new byte[Data.Length + 4]; byte[] transferData = new byte[Data.Length + 4];
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
Array.Copy(Data, 0, transferData, 4, Data.Length); Array.Copy(Data, 0, transferData, 4, Data.Length);
Client.SendXferPacket(XferID, 0 + 0x80000000, transferData); Client.SendXferPacket(XferID, 0 + 0x80000000, transferData);
complete = true; complete = true;
} }
else else
{ {
byte[] transferData = new byte[1000 +4]; byte[] transferData = new byte[1000 +4];
Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4); Array.Copy(Helpers.IntToBytes(Data.Length), 0, transferData, 0, 4);
Array.Copy(Data, 0, transferData, 4, 1000); Array.Copy(Data, 0, transferData, 4, 1000);
Client.SendXferPacket(XferID, 0 , transferData); Client.SendXferPacket(XferID, 0 , transferData);
Packet++; Packet++;
DataPointer = 1000; DataPointer = 1000;
} }
} }
public void AckPacket(uint packet) public void AckPacket(uint packet)
{ {
if (!complete) if (!complete)
{ {
if ((Data.Length - DataPointer) > 1000) if ((Data.Length - DataPointer) > 1000)
{ {
byte[] transferData = new byte[1000]; byte[] transferData = new byte[1000];
Array.Copy(Data, DataPointer, transferData, 0, 1000); Array.Copy(Data, DataPointer, transferData, 0, 1000);
Client.SendXferPacket(XferID, Packet, transferData); Client.SendXferPacket(XferID, Packet, transferData);
Packet++; Packet++;
DataPointer += 1000; DataPointer += 1000;
} }
else else
{ {
byte[] transferData = new byte[Data.Length - DataPointer]; byte[] transferData = new byte[Data.Length - DataPointer];
Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer); Array.Copy(Data, DataPointer, transferData, 0, Data.Length - DataPointer);
uint endPacket = Packet |= (uint)0x80000000; uint endPacket = Packet |= (uint)0x80000000;
Client.SendXferPacket(XferID, endPacket, transferData); Client.SendXferPacket(XferID, endPacket, transferData);
Packet++; Packet++;
DataPointer += (Data.Length - DataPointer); DataPointer += (Data.Length - DataPointer);
complete = true; complete = true;
} }
} }
} }
} }
} }
} }

View File

@ -1,305 +1,305 @@
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities; using OpenSim.Region.Capabilities;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment namespace OpenSim.Region.Environment
{ {
public class PermissionManager public class PermissionManager
{ {
protected Scene m_scene; protected Scene m_scene;
// Bypasses the permissions engine (always returns OK) // Bypasses the permissions engine (always returns OK)
// disable in any production environment // disable in any production environment
// TODO: Change this to false when permissions are a desired default // TODO: Change this to false when permissions are a desired default
// TODO: Move to configuration option. // TODO: Move to configuration option.
private bool m_bypassPermissions = true; private bool m_bypassPermissions = true;
public bool BypassPermissions public bool BypassPermissions
{ {
get { return m_bypassPermissions; } get { return m_bypassPermissions; }
set { m_bypassPermissions = value; } set { m_bypassPermissions = value; }
} }
public PermissionManager(Scene scene) public PermissionManager(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
protected virtual void SendPermissionError(LLUUID user, string reason) protected virtual void SendPermissionError(LLUUID user, string reason)
{ {
m_scene.EventManager.TriggerPermissionError(user, reason); m_scene.EventManager.TriggerPermissionError(user, reason);
} }
protected virtual bool IsAdministrator(LLUUID user) protected virtual bool IsAdministrator(LLUUID user)
{ {
if (m_bypassPermissions) if (m_bypassPermissions)
{ {
return true; return true;
} }
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
} }
protected virtual bool IsEstateManager(LLUUID user) protected virtual bool IsEstateManager(LLUUID user)
{ {
if (m_bypassPermissions) if (m_bypassPermissions)
{ {
return true; return true;
} }
return false; return false;
} }
protected virtual bool IsGridUser(LLUUID user) protected virtual bool IsGridUser(LLUUID user)
{ {
return true; return true;
} }
protected virtual bool IsGuest(LLUUID user) protected virtual bool IsGuest(LLUUID user)
{ {
return false; return false;
} }
public virtual bool CanRezObject(LLUUID user, LLVector3 position) public virtual bool CanRezObject(LLUUID user, LLVector3 position)
{ {
bool permission = false; bool permission = false;
string reason = "Insufficient permission"; string reason = "Insufficient permission";
if (IsAdministrator(user)) if (IsAdministrator(user))
{ {
permission = true; permission = true;
} }
else else
{ {
reason = "Not an administrator"; reason = "Not an administrator";
} }
if (GenericParcelPermission(user, position)) if (GenericParcelPermission(user, position))
{ {
permission = true; permission = true;
} }
else else
{ {
reason = "Not the parcel owner"; reason = "Not the parcel owner";
} }
if (!permission) if (!permission)
SendPermissionError(user, reason); SendPermissionError(user, reason);
return permission; return permission;
} }
#region Object Permissions #region Object Permissions
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId) protected virtual bool GenericObjectPermission(LLUUID user, LLUUID objId)
{ {
// Default: deny // Default: deny
bool permission = false; bool permission = false;
if( !m_scene.Entities.ContainsKey( objId )) if( !m_scene.Entities.ContainsKey( objId ))
{ {
return false; return false;
} }
// If it's not an object, we cant edit it. // If it's not an object, we cant edit it.
if (!(m_scene.Entities[objId] is SceneObjectGroup)) if (!(m_scene.Entities[objId] is SceneObjectGroup))
{ {
return false; return false;
} }
SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId]; SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objId];
LLUUID taskOwner = null; LLUUID taskOwner = null;
// Object owners should be able to edit their own content // Object owners should be able to edit their own content
if (user == taskOwner) if (user == taskOwner)
permission = true; permission = true;
// Users should be able to edit what is over their land. // Users should be able to edit what is over their land.
if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user) if (m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y).landData.ownerID == user)
permission = true; permission = true;
// Estate users should be able to edit anything in the sim // Estate users should be able to edit anything in the sim
if (IsEstateManager(user)) if (IsEstateManager(user))
permission = true; permission = true;
// Admin objects should not be editable by the above // Admin objects should not be editable by the above
if (IsAdministrator(taskOwner)) if (IsAdministrator(taskOwner))
permission = false; permission = false;
// Admin should be able to edit anything in the sim (including admin objects) // Admin should be able to edit anything in the sim (including admin objects)
if (IsAdministrator(user)) if (IsAdministrator(user))
permission = true; permission = true;
return permission; return permission;
} }
/// <summary> /// <summary>
/// Permissions check - can user delete an object? /// Permissions check - can user delete an object?
/// </summary> /// </summary>
/// <param name="user">User attempting the delete</param> /// <param name="user">User attempting the delete</param>
/// <param name="obj">Target object</param> /// <param name="obj">Target object</param>
/// <returns>Has permission?</returns> /// <returns>Has permission?</returns>
public virtual bool CanDeRezObject(LLUUID user, LLUUID obj) public virtual bool CanDeRezObject(LLUUID user, LLUUID obj)
{ {
return GenericObjectPermission(user, obj); return GenericObjectPermission(user, obj);
} }
public virtual bool CanEditObject(LLUUID user, LLUUID obj) public virtual bool CanEditObject(LLUUID user, LLUUID obj)
{ {
return GenericObjectPermission(user, obj); return GenericObjectPermission(user, obj);
} }
public virtual bool CanReturnObject(LLUUID user, LLUUID obj) public virtual bool CanReturnObject(LLUUID user, LLUUID obj)
{ {
return GenericObjectPermission(user, obj); return GenericObjectPermission(user, obj);
} }
#endregion #endregion
#region Communication Permissions #region Communication Permissions
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target) public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
{ {
bool permission = false; bool permission = false;
string reason = "Only registered users may communicate with another account."; string reason = "Only registered users may communicate with another account.";
if (IsGridUser(user)) if (IsGridUser(user))
permission = true; permission = true;
if (!IsGridUser(user)) if (!IsGridUser(user))
{ {
permission = false; permission = false;
reason = "The person that you are messaging is not a registered user."; reason = "The person that you are messaging is not a registered user.";
} }
if (IsAdministrator(user)) if (IsAdministrator(user))
permission = true; permission = true;
if (IsEstateManager(user)) if (IsEstateManager(user))
permission = true; permission = true;
if (!permission) if (!permission)
SendPermissionError(user, reason); SendPermissionError(user, reason);
return permission; return permission;
} }
public virtual bool CanInstantMessage(LLUUID user, LLUUID target) public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
{ {
return GenericCommunicationPermission(user, target); return GenericCommunicationPermission(user, target);
} }
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target) public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
{ {
return GenericCommunicationPermission(user, target); return GenericCommunicationPermission(user, target);
} }
#endregion #endregion
public virtual bool CanEditScript(LLUUID user, LLUUID script) public virtual bool CanEditScript(LLUUID user, LLUUID script)
{ {
return IsAdministrator(user); return IsAdministrator(user);
} }
public virtual bool CanRunScript(LLUUID user, LLUUID script) public virtual bool CanRunScript(LLUUID user, LLUUID script)
{ {
return IsAdministrator(user); return IsAdministrator(user);
} }
public virtual bool CanTerraform(LLUUID user, LLVector3 position) public virtual bool CanTerraform(LLUUID user, LLVector3 position)
{ {
bool permission = false; bool permission = false;
// Estate override // Estate override
if (GenericEstatePermission(user)) if (GenericEstatePermission(user))
permission = true; permission = true;
// Land owner can terraform too // Land owner can terraform too
if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y))) if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y)))
permission = true; permission = true;
if (!permission) if (!permission)
SendPermissionError(user, "Not authorized to terraform at this location."); SendPermissionError(user, "Not authorized to terraform at this location.");
return permission; return permission;
} }
#region Estate Permissions #region Estate Permissions
protected virtual bool GenericEstatePermission(LLUUID user) protected virtual bool GenericEstatePermission(LLUUID user)
{ {
// Default: deny // Default: deny
bool permission = false; bool permission = false;
// Estate admins should be able to use estate tools // Estate admins should be able to use estate tools
if (IsEstateManager(user)) if (IsEstateManager(user))
permission = true; permission = true;
// Administrators always have permission // Administrators always have permission
if (IsAdministrator(user)) if (IsAdministrator(user))
permission = true; permission = true;
return permission; return permission;
} }
public virtual bool CanEditEstateTerrain(LLUUID user) public virtual bool CanEditEstateTerrain(LLUUID user)
{ {
return GenericEstatePermission(user); return GenericEstatePermission(user);
} }
#endregion #endregion
#region Parcel Permissions #region Parcel Permissions
protected virtual bool GenericParcelPermission(LLUUID user, Land parcel) protected virtual bool GenericParcelPermission(LLUUID user, Land parcel)
{ {
bool permission = false; bool permission = false;
if (parcel.landData.ownerID == user) if (parcel.landData.ownerID == user)
permission = true; permission = true;
if (parcel.landData.isGroupOwned) if (parcel.landData.isGroupOwned)
{ {
// TODO: Need to do some extra checks here. Requires group code. // TODO: Need to do some extra checks here. Requires group code.
} }
if(IsEstateManager(user)) if(IsEstateManager(user))
permission = true; permission = true;
if (IsAdministrator(user)) if (IsAdministrator(user))
permission = true; permission = true;
return permission; return permission;
} }
protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos) protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos)
{ {
return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y)); return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y));
} }
public virtual bool CanEditParcel(LLUUID user, Land parcel) public virtual bool CanEditParcel(LLUUID user, Land parcel)
{ {
return GenericParcelPermission(user, parcel); return GenericParcelPermission(user, parcel);
} }
public virtual bool CanSellParcel(LLUUID user, Land parcel) public virtual bool CanSellParcel(LLUUID user, Land parcel)
{ {
return GenericParcelPermission(user, parcel); return GenericParcelPermission(user, parcel);
} }
public virtual bool CanAbandonParcel(LLUUID user, Land parcel) public virtual bool CanAbandonParcel(LLUUID user, Land parcel)
{ {
return GenericParcelPermission(user, parcel); return GenericParcelPermission(user, parcel);
} }
#endregion #endregion
} }
} }

View File

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

View File

@ -1,237 +1,237 @@
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
public class SceneManager public class SceneManager
{ {
private readonly List<Scene> m_localScenes; private readonly List<Scene> m_localScenes;
private Scene m_currentScene = null; private Scene m_currentScene = null;
public Scene CurrentScene public Scene CurrentScene
{ {
get get
{ {
return m_currentScene; return m_currentScene;
} }
} }
private Scene CurrentOrFirstScene private Scene CurrentOrFirstScene
{ {
get get
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
return m_localScenes[0]; return m_localScenes[0];
} }
else else
{ {
return m_currentScene; return m_currentScene;
} }
} }
} }
public SceneManager() public SceneManager()
{ {
m_localScenes = new List<Scene>(); m_localScenes = new List<Scene>();
} }
public void Close() public void Close()
{ {
for (int i = 0; i < m_localScenes.Count; i++) for (int i = 0; i < m_localScenes.Count; i++)
{ {
m_localScenes[i].Close(); m_localScenes[i].Close();
} }
} }
public void Add(Scene scene) public void Add(Scene scene)
{ {
m_localScenes.Add(scene); m_localScenes.Add(scene);
} }
public void SavePrimsToXml(string filename) public void SavePrimsToXml(string filename)
{ {
CurrentOrFirstScene.SavePrimsToXml(filename); CurrentOrFirstScene.SavePrimsToXml(filename);
} }
public void LoadPrimsFromXml(string filename) public void LoadPrimsFromXml(string filename)
{ {
CurrentOrFirstScene.LoadPrimsFromXml(filename); CurrentOrFirstScene.LoadPrimsFromXml(filename);
} }
public bool RunTerrainCmd(string[] cmdparams, ref string result) public bool RunTerrainCmd(string[] cmdparams, ref string result)
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
bool success = true; bool success = true;
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
{ {
success = false; success = false;
} }
} }
return success; return success;
} }
else else
{ {
return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
} }
} }
public void SendCommandToScripts(string[] cmdparams) public void SendCommandToScripts(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.SendCommandToScripts(cmdparams); scene.SendCommandToScripts(cmdparams);
}); });
} }
public void BypassPermissions(bool bypassPermissions) public void BypassPermissions(bool bypassPermissions)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.PermissionsMngr.BypassPermissions = bypassPermissions; scene.PermissionsMngr.BypassPermissions = bypassPermissions;
}); });
} }
private void ForEach(Action<Scene> func) private void ForEach(Action<Scene> func)
{ {
if (m_currentScene == null) if (m_currentScene == null)
{ {
m_localScenes.ForEach(func); m_localScenes.ForEach(func);
} }
else else
{ {
func(m_currentScene); func(m_currentScene);
} }
} }
public void Backup() public void Backup()
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.Backup(); scene.Backup();
}); });
} }
public void HandleAlertCommand(string[] cmdparams) public void HandleAlertCommand(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.HandleAlertCommand(cmdparams); scene.HandleAlertCommand(cmdparams);
}); });
} }
public bool TrySetCurrentRegion(string regionName) public bool TrySetCurrentRegion(string regionName)
{ {
if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
{ {
m_currentScene = null; m_currentScene = null;
return true; return true;
} }
else else
{ {
Console.WriteLine("Searching for Region: '" + regionName + "'"); Console.WriteLine("Searching for Region: '" + regionName + "'");
Scene foundScene = null; Scene foundScene = null;
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
{ {
m_currentScene = scene; m_currentScene = scene;
return true; return true;
} }
} }
return false; return false;
} }
} }
public void DebugPacket(LogBase log, int newDebug) public void DebugPacket(LogBase log, int newDebug)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
foreach (EntityBase entity in scene.Entities.Values) foreach (EntityBase entity in scene.Entities.Values)
{ {
if (entity is ScenePresence) if (entity is ScenePresence)
{ {
ScenePresence scenePrescence = entity as ScenePresence; ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.childAgent) if (!scenePrescence.childAgent)
{ {
log.Error(String.Format("Packet debug for {0} {1} set to {2}", log.Error(String.Format("Packet debug for {0} {1} set to {2}",
scenePrescence.Firstname, scenePrescence.Lastname, scenePrescence.Firstname, scenePrescence.Lastname,
newDebug)); newDebug));
scenePrescence.ControllingClient.SetDebug(newDebug); scenePrescence.ControllingClient.SetDebug(newDebug);
} }
} }
} }
}); });
} }
public List<ScenePresence> GetAvatars() public List<ScenePresence> GetAvatars()
{ {
List<ScenePresence> avatars = new List<ScenePresence>(); List<ScenePresence> avatars = new List<ScenePresence>();
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
foreach (EntityBase entity in scene.Entities.Values) foreach (EntityBase entity in scene.Entities.Values)
{ {
if (entity is ScenePresence) if (entity is ScenePresence)
{ {
ScenePresence scenePrescence = entity as ScenePresence; ScenePresence scenePrescence = entity as ScenePresence;
if (!scenePrescence.childAgent) if (!scenePrescence.childAgent)
{ {
avatars.Add(scenePrescence); avatars.Add(scenePrescence);
} }
} }
} }
}); });
return avatars; return avatars;
} }
public RegionInfo GetRegionInfo(ulong regionHandle) public RegionInfo GetRegionInfo(ulong regionHandle)
{ {
foreach (Scene scene in m_localScenes) foreach (Scene scene in m_localScenes)
{ {
if (scene.RegionInfo.RegionHandle == regionHandle) if (scene.RegionInfo.RegionHandle == regionHandle)
{ {
return scene.RegionInfo; return scene.RegionInfo;
} }
} }
return null; return null;
} }
public void SetTimePhase(int timePhase) public void SetTimePhase(int timePhase)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.SetTimePhase( scene.SetTimePhase(
timePhase) timePhase)
; ;
}); });
} }
public void ForceClientUpdate() public void ForceClientUpdate()
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.ForceClientUpdate(); scene.ForceClientUpdate();
}); });
} }
public void HandleEditCommand(string[] cmdparams) public void HandleEditCommand(string[] cmdparams)
{ {
ForEach(delegate(Scene scene) ForEach(delegate(Scene scene)
{ {
scene.HandleEditCommand(cmdparams); scene.HandleEditCommand(cmdparams);
}); });
} }
} }
} }

View File

@ -1,20 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public interface IScriptHost public interface IScriptHost
{ {
string Name { get; set;} string Name { get; set;}
string SitName{ get; set;} string SitName{ get; set;}
string TouchName { get; set;} string TouchName { get; set;}
string Description { get; set; } string Description { get; set; }
LLUUID UUID { get; } LLUUID UUID { get; }
LLUUID ObjectOwner { get;} LLUUID ObjectOwner { get;}
LLUUID ObjectCreator { get; } LLUUID ObjectCreator { get; }
LLVector3 AbsolutePosition { get; } LLVector3 AbsolutePosition { get; }
void SetText(string text, Axiom.Math.Vector3 color, double alpha); void SetText(string text, Axiom.Math.Vector3 color, double alpha);
} }
} }

View File

@ -1,56 +1,56 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class NullScriptHost : IScriptHost public class NullScriptHost : IScriptHost
{ {
LLVector3 m_pos = new LLVector3( 128, 128, 30 ); LLVector3 m_pos = new LLVector3( 128, 128, 30 );
public string Name public string Name
{ {
get { return "Object"; } get { return "Object"; }
set { } set { }
} }
public string SitName public string SitName
{ {
get { return ""; } get { return ""; }
set { } set { }
} }
public string TouchName public string TouchName
{ {
get { return ""; } get { return ""; }
set { } set { }
} }
public string Description public string Description
{ {
get { return ""; } get { return ""; }
set { } set { }
} }
public LLUUID UUID public LLUUID UUID
{ {
get { return LLUUID.Zero; } get { return LLUUID.Zero; }
} }
public LLUUID ObjectOwner 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 public LLVector3 AbsolutePosition
{ {
get { return m_pos; } get { return m_pos; }
} }
public void SetText(string text, Axiom.Math.Vector3 color, double alpha) public void SetText(string text, Axiom.Math.Vector3 color, double alpha)
{ {
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text); Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
} }
} }
} }

View File

@ -1,43 +1,43 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
/* Original code: Tedd Hansen */ /* Original code: Tedd Hansen */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
//TODO: WHERE TO PLACE THIS? //TODO: WHERE TO PLACE THIS?
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public interface ScriptEngineInterface public interface ScriptEngineInterface
{ {
void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger); void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger);
void Shutdown(); void Shutdown();
// void StartScript(string ScriptID, IScriptHost ObjectID); // void StartScript(string ScriptID, IScriptHost ObjectID);
} }
} }

View File

@ -1,124 +1,124 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
/* Original code: Tedd Hansen */ /* Original code: Tedd Hansen */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Reflection; using System.Reflection;
namespace OpenSim.Region.Environment.Scenes.Scripting namespace OpenSim.Region.Environment.Scenes.Scripting
{ {
public class ScriptEngineLoader public class ScriptEngineLoader
{ {
private OpenSim.Framework.Console.LogBase m_log; private OpenSim.Framework.Console.LogBase m_log;
public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger) public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger)
{ {
m_log = logger; m_log = logger;
} }
public ScriptEngineInterface LoadScriptEngine(string EngineName) public ScriptEngineInterface LoadScriptEngine(string EngineName)
{ {
ScriptEngineInterface ret = null; ScriptEngineInterface ret = null;
try try
{ {
ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString());
} }
return ret; return ret;
} }
/// <summary> /// <summary>
/// Does actual loading and initialization of script Assembly /// Does actual loading and initialization of script Assembly
/// </summary> /// </summary>
/// <param name="FreeAppDomain">AppDomain to load script into</param> /// <param name="FreeAppDomain">AppDomain to load script into</param>
/// <param name="FileName">FileName of script assembly (.dll)</param> /// <param name="FileName">FileName of script assembly (.dll)</param>
/// <returns></returns> /// <returns></returns>
private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace) private ScriptEngineInterface LoadAndInitAssembly(string FileName, string NameSpace)
{ {
//Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName);
// Load .Net Assembly (.dll) // Load .Net Assembly (.dll)
// Initialize and return it // Initialize and return it
// TODO: Add error handling // TODO: Add error handling
Assembly a; Assembly a;
//try //try
//{ //{
// Load to default appdomain (temporary) // Load to default appdomain (temporary)
a = Assembly.LoadFrom(FileName); a = Assembly.LoadFrom(FileName);
// Load to specified appdomain // Load to specified appdomain
// TODO: Insert security // TODO: Insert security
//a = FreeAppDomain.Load(FileName); //a = FreeAppDomain.Load(FileName);
//} //}
//catch (Exception e) //catch (Exception e)
//{ //{
// m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString()); // m_log.Error("ScriptEngine", "Error loading assembly \"" + FileName + "\": " + e.ToString());
//} //}
//Console.WriteLine("Loading: " + FileName); //Console.WriteLine("Loading: " + FileName);
//foreach (Type _t in a.GetTypes()) //foreach (Type _t in a.GetTypes())
//{ //{
// Console.WriteLine("Type: " + _t.ToString()); // Console.WriteLine("Type: " + _t.ToString());
//} //}
Type t; Type t;
//try //try
//{ //{
t = a.GetType(NameSpace, true); t = a.GetType(NameSpace, true);
//} //}
//catch (Exception e) //catch (Exception e)
//{ //{
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
//} //}
ScriptEngineInterface ret; ScriptEngineInterface ret;
//try //try
//{ //{
ret = (ScriptEngineInterface)Activator.CreateInstance(t); ret = (ScriptEngineInterface)Activator.CreateInstance(t);
//} //}
//catch (Exception e) //catch (Exception e)
//{ //{
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString()); // m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
//} //}
return ret; return ret;
} }
} }
} }

View File

@ -1,167 +1,167 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
{ {
public class BasicQuadTreeNode public class BasicQuadTreeNode
{ {
private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>();
private BasicQuadTreeNode[] m_childNodes = null; private BasicQuadTreeNode[] m_childNodes = null;
private BasicQuadTreeNode m_parent = null; private BasicQuadTreeNode m_parent = null;
private short m_leftX; private short m_leftX;
private short m_leftY; private short m_leftY;
private short m_width; private short m_width;
private short m_height; private short m_height;
public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height)
{ {
m_parent = parent; m_parent = parent;
m_leftX = leftX; m_leftX = leftX;
m_leftY = leftY; m_leftY = leftY;
m_width = width; m_width = width;
m_height = height; m_height = height;
} }
public void AddObject(SceneObjectGroup obj) public void AddObject(SceneObjectGroup obj)
{ {
if (m_childNodes == null) if (m_childNodes == null)
{ {
if (!m_objects.Contains(obj)) if (!m_objects.Contains(obj))
{ {
m_objects.Add(obj); m_objects.Add(obj);
} }
} }
else else
{ {
if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2)))
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
{ {
m_childNodes[0].AddObject(obj); m_childNodes[0].AddObject(obj);
} }
else else
{ {
m_childNodes[2].AddObject(obj); m_childNodes[2].AddObject(obj);
} }
} }
else else
{ {
if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2)))
{ {
m_childNodes[1].AddObject(obj); m_childNodes[1].AddObject(obj);
} }
else else
{ {
m_childNodes[3].AddObject(obj); m_childNodes[3].AddObject(obj);
} }
} }
} }
} }
public void Subdivide() public void Subdivide()
{ {
if (m_childNodes == null) if (m_childNodes == null)
{ {
m_childNodes = new BasicQuadTreeNode[4]; m_childNodes = new BasicQuadTreeNode[4];
m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); 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),(short) (m_height / 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),(short)( m_height / 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)),(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)),(short)( m_width / 2), (short)(m_height / 2));
} }
else else
{ {
for (int i = 0; i < m_childNodes.Length; i++) for (int i = 0; i < m_childNodes.Length; i++)
{ {
m_childNodes[i].Subdivide(); m_childNodes[i].Subdivide();
} }
} }
} }
public List<SceneObjectGroup> GetObjectsFrom(int x, int y) public List<SceneObjectGroup> GetObjectsFrom(int x, int y)
{ {
if (m_childNodes == null) if (m_childNodes == null)
{ {
return m_objects; return m_objects;
} }
else else
{ {
if (x < (m_leftX + (m_width / 2))) if (x < (m_leftX + (m_width / 2)))
{ {
if (y < (m_leftY + (m_height / 2))) if (y < (m_leftY + (m_height / 2)))
{ {
return m_childNodes[0].GetObjectsFrom(x, y); return m_childNodes[0].GetObjectsFrom(x, y);
} }
else else
{ {
return m_childNodes[2].GetObjectsFrom(x, y); return m_childNodes[2].GetObjectsFrom(x, y);
} }
} }
else else
{ {
if (y < (m_leftY + (m_height / 2))) if (y < (m_leftY + (m_height / 2)))
{ {
return m_childNodes[1].GetObjectsFrom(x, y); return m_childNodes[1].GetObjectsFrom(x, y);
} }
else else
{ {
return m_childNodes[3].GetObjectsFrom(x, y); return m_childNodes[3].GetObjectsFrom(x, y);
} }
} }
} }
} }
public void Update() public void Update()
{ {
if (m_childNodes != null) if (m_childNodes != null)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
m_childNodes[i].Update(); m_childNodes[i].Update();
} }
} }
else else
{ {
List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>();
foreach (SceneObjectGroup group in m_objects) foreach (SceneObjectGroup group in m_objects)
{ {
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)))) 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 //still in bounds
} }
else else
{ {
outBounds.Add(group); outBounds.Add(group);
} }
} }
foreach (SceneObjectGroup removee in outBounds) foreach (SceneObjectGroup removee in outBounds)
{ {
m_objects.Remove(removee); m_objects.Remove(removee);
if (m_parent != null) if (m_parent != null)
{ {
m_parent.PassUp(removee); m_parent.PassUp(removee);
} }
} }
outBounds.Clear(); outBounds.Clear();
} }
} }
public void PassUp(SceneObjectGroup group) public void PassUp(SceneObjectGroup group)
{ {
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)))) 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))))
{ {
this.AddObject(group); this.AddObject(group);
} }
else else
{ {
if (m_parent != null) if (m_parent != null)
{ {
m_parent.PassUp(group); m_parent.PassUp(group);
} }
} }
} }
} }
} }

View File

@ -1,54 +1,54 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Environment.Types namespace OpenSim.Region.Environment.Types
{ {
public class UpdateQueue public class UpdateQueue
{ {
private Queue<SceneObjectPart> m_queue; private Queue<SceneObjectPart> m_queue;
private List<LLUUID> m_ids; private List<LLUUID> m_ids;
public int Count public int Count
{ {
get { return m_queue.Count; } get { return m_queue.Count; }
} }
public UpdateQueue() public UpdateQueue()
{ {
m_queue = new Queue<SceneObjectPart>(); m_queue = new Queue<SceneObjectPart>();
m_ids = new List<LLUUID>(); m_ids = new List<LLUUID>();
} }
public void Enqueue(SceneObjectPart part) public void Enqueue(SceneObjectPart part)
{ {
lock (m_ids) lock (m_ids)
{ {
if (!m_ids.Contains(part.UUID)) if (!m_ids.Contains(part.UUID))
{ {
m_ids.Add(part.UUID); m_ids.Add(part.UUID);
m_queue.Enqueue(part); m_queue.Enqueue(part);
} }
} }
} }
public SceneObjectPart Dequeue() public SceneObjectPart Dequeue()
{ {
SceneObjectPart part = null; SceneObjectPart part = null;
if (m_queue.Count > 0) if (m_queue.Count > 0)
{ {
part = m_queue.Dequeue(); part = m_queue.Dequeue();
lock (m_ids) lock (m_ids)
{ {
m_ids.Remove(part.UUID); m_ids.Remove(part.UUID);
} }
} }
return part; return part;
} }
} }
} }

View File

@ -1,78 +1,78 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using Axiom.Math; using Axiom.Math;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
namespace SimpleApp namespace SimpleApp
{ {
public class ComplexObject : SceneObjectGroup public class ComplexObject : SceneObjectGroup
{ {
private LLQuaternion m_rotationDirection; private LLQuaternion m_rotationDirection;
private class RotatingWheel : SceneObjectPart private class RotatingWheel : SceneObjectPart
{ {
private LLQuaternion m_rotationDirection; private LLQuaternion m_rotationDirection;
public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection) public RotatingWheel(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, LLVector3 groupPosition, LLVector3 offsetPosition, LLQuaternion rotationDirection)
: base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition ) : base(regionHandle, parent, ownerID, localID, new CylinderShape( 0.5f, 0.2f ), groupPosition, offsetPosition )
{ {
m_rotationDirection = rotationDirection; m_rotationDirection = rotationDirection;
} }
public override void UpdateMovement() public override void UpdateMovement()
{ {
UpdateRotation(RotationOffset * m_rotationDirection); UpdateRotation(RotationOffset * m_rotationDirection);
} }
} }
public override void UpdateMovement() public override void UpdateMovement()
{ {
UpdateGroupRotation(GroupRotation * m_rotationDirection); UpdateGroupRotation(GroupRotation * m_rotationDirection);
base.UpdateMovement(); base.UpdateMovement();
} }
public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos ) public ComplexObject(Scene scene, ulong regionHandle, LLUUID ownerID, uint localID, LLVector3 pos )
: base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default ) : base(scene, regionHandle, ownerID, localID, pos, BoxShape.Default )
{ {
m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f); m_rotationDirection = new LLQuaternion(0.05f, 0.1f, 0.15f);
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, 0.75f), new LLQuaternion(0.05f,0,0)));
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0, -0.75f), new LLQuaternion(-0.05f,0,0)));
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, 0.75f,0), new LLQuaternion(0.5f, 0, 0.05f)));
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0, -0.75f,0), new LLQuaternion(-0.5f, 0, -0.05f)));
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(0.75f, 0, 0), new LLQuaternion(0, 0.5f, 0.05f)));
AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f))); AddPart(new RotatingWheel(regionHandle, this, ownerID, scene.PrimIDAllocate(), pos, new LLVector3(-0.75f, 0, 0), new LLQuaternion(0, -0.5f, -0.05f)));
UpdateParentIDs(); UpdateParentIDs();
} }
public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient) public override void OnGrabPart(SceneObjectPart part, LLVector3 offsetPos, IClientAPI remoteClient)
{ {
m_parts.Remove(part.UUID); m_parts.Remove(part.UUID);
remoteClient.SendKillObject(m_regionHandle, part.LocalID); remoteClient.SendKillObject(m_regionHandle, part.LocalID);
remoteClient.AddMoney(1); remoteClient.AddMoney(1);
remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero); remoteClient.SendChatMessage("Poof!", 1, this.AbsolutePosition, "Party Party", LLUUID.Zero);
} }
public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient) public override void OnGrabGroup( LLVector3 offsetPos, IClientAPI remoteClient)
{ {
if( m_parts.Count == 1 ) if( m_parts.Count == 1 )
{ {
m_parts.Remove(m_rootPart.UUID); m_parts.Remove(m_rootPart.UUID);
m_scene.RemoveEntity(this); m_scene.RemoveEntity(this);
remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID); remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalID);
remoteClient.AddMoney(50); remoteClient.AddMoney(50);
remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero); remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero);
} }
} }
} }
} }

View File

@ -1,103 +1,103 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.CSharp; using Microsoft.CSharp;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Region.ExtensionsScriptModule.CSharp namespace OpenSim.Region.ExtensionsScriptModule.CSharp
{ {
public class CSharpScriptEngine : IScriptCompiler public class CSharpScriptEngine : IScriptCompiler
{ {
public string FileExt() public string FileExt()
{ {
return ".cs"; return ".cs";
} }
private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) private Dictionary<string,IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
{ {
CompilerParameters compilerParams = new CompilerParameters(); CompilerParameters compilerParams = new CompilerParameters();
CompilerResults compilerResults; CompilerResults compilerResults;
compilerParams.GenerateExecutable = false; compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false; compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.dll");
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
if (compilerResults.Errors.Count > 0) if (compilerResults.Errors.Count > 0)
{ {
MainLog.Instance.Error("Compile errors"); MainLog.Instance.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors) foreach (CompilerError error in compilerResults.Errors)
{ {
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
} }
} }
else else
{ {
Dictionary<string,IScript> scripts = new Dictionary<string,IScript>(); Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
{ {
Type testInterface = pluginType.GetInterface("IScript", true); Type testInterface = pluginType.GetInterface("IScript", true);
if (testInterface != null) if (testInterface != null)
{ {
IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
string scriptName = "C#/" + script.Name; string scriptName = "C#/" + script.Name;
Console.WriteLine("Script: " + scriptName + " loaded."); Console.WriteLine("Script: " + scriptName + " loaded.");
if (!scripts.ContainsKey(scriptName)) if (!scripts.ContainsKey(scriptName))
{ {
scripts.Add(scriptName, script); scripts.Add(scriptName, script);
} }
else else
{ {
scripts[scriptName] = script; scripts[scriptName] = script;
} }
} }
} }
return scripts; return scripts;
} }
return null; return null;
} }
public Dictionary<string,IScript> compile(string filename) public Dictionary<string,IScript> compile(string filename)
{ {
CSharpCodeProvider csharpProvider = new CSharpCodeProvider(); CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
return LoadDotNetScript(csharpProvider, filename); return LoadDotNetScript(csharpProvider, filename);
} }
} }
} }

View File

@ -1,72 +1,72 @@
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples namespace OpenSim.Region.ExtensionsScriptModule.CSharp.Examples
{ {
public class LSLExportScript : IScript public class LSLExportScript : IScript
{ {
ScriptInfo script; ScriptInfo script;
public string Name public string Name
{ {
get { return "LSL Export Script 0.1"; } get { return "LSL Export Script 0.1"; }
} }
public void Initialise(ScriptInfo scriptInfo) public void Initialise(ScriptInfo scriptInfo)
{ {
script = scriptInfo; script = scriptInfo;
script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg); script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(ProcessConsoleMsg);
} }
void ProcessConsoleMsg(string[] args) void ProcessConsoleMsg(string[] args)
{ {
/*if (args[0].ToLower() == "lslexport") /*if (args[0].ToLower() == "lslexport")
{ {
string sequence = ""; string sequence = "";
foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects) foreach (KeyValuePair<LLUUID, SceneObject> obj in script.world.Objects)
{ {
SceneObject root = obj.Value; SceneObject root = obj.Value;
sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n"; sequence += "NEWOBJ::" + obj.Key.ToStringHyphenated() + "\n";
string rootPrim = processPrimitiveToString(root.rootPrimitive); string rootPrim = processPrimitiveToString(root.rootPrimitive);
sequence += "ROOT:" + rootPrim; sequence += "ROOT:" + rootPrim;
foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children) foreach (KeyValuePair<LLUUID, OpenSim.Region.Environment.Scenes.Primitive> prim in root.Children)
{ {
string child = processPrimitiveToString(prim.Value); string child = processPrimitiveToString(prim.Value);
sequence += "CHILD:" + child; sequence += "CHILD:" + child;
} }
} }
System.Console.WriteLine(sequence); System.Console.WriteLine(sequence);
}*/ }*/
} }
string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim) string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim)
{ {
/*string desc = prim.Description; /*string desc = prim.Description;
string name = prim.Name; string name = prim.Name;
LLVector3 pos = prim.Pos; LLVector3 pos = prim.Pos;
LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w); LLQuaternion rot = new LLQuaternion(prim.Rotation.x, prim.Rotation.y, prim.Rotation.z, prim.Rotation.w);
LLVector3 scale = prim.Scale; LLVector3 scale = prim.Scale;
LLVector3 rootPos = prim.WorldPos; LLVector3 rootPos = prim.WorldPos;
string setPrimParams = ""; string setPrimParams = "";
setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n"; setPrimParams += "[PRIM_SCALE, " + scale.ToString() + ", PRIM_POS, " + rootPos.ToString() + ", PRIM_ROTATION, " + rot.ToString() + "]\n";
return setPrimParams; return setPrimParams;
*/ */
return ""; return "";
} }
} }
} }

View File

@ -1,103 +1,103 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.JScript; using Microsoft.JScript;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Region.ExtensionsScriptModule.JScript namespace OpenSim.Region.ExtensionsScriptModule.JScript
{ {
public class JScriptEngine : IScriptCompiler public class JScriptEngine : IScriptCompiler
{ {
public string FileExt() public string FileExt()
{ {
return ".js"; return ".js";
} }
private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename) private Dictionary<string, IScript> LoadDotNetScript(CodeDomProvider compiler, string filename)
{ {
CompilerParameters compilerParams = new CompilerParameters(); CompilerParameters compilerParams = new CompilerParameters();
CompilerResults compilerResults; CompilerResults compilerResults;
compilerParams.GenerateExecutable = false; compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true; compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false; compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ClientStack.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Region.ExtensionsScriptModule.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll"); compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll"); compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll"); compilerParams.ReferencedAssemblies.Add("System.dll");
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
if (compilerResults.Errors.Count > 0) if (compilerResults.Errors.Count > 0)
{ {
MainLog.Instance.Error("Compile errors"); MainLog.Instance.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors) foreach (CompilerError error in compilerResults.Errors)
{ {
MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString()); MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
} }
} }
else else
{ {
Dictionary<string, IScript> scripts = new Dictionary<string, IScript>(); Dictionary<string, IScript> scripts = new Dictionary<string, IScript>();
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
{ {
Type testInterface = pluginType.GetInterface("IScript", true); Type testInterface = pluginType.GetInterface("IScript", true);
if (testInterface != null) if (testInterface != null)
{ {
IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
string scriptName = "JS.NET/" + script.Name; string scriptName = "JS.NET/" + script.Name;
Console.WriteLine("Script: " + scriptName + " loaded."); Console.WriteLine("Script: " + scriptName + " loaded.");
if (!scripts.ContainsKey(scriptName)) if (!scripts.ContainsKey(scriptName))
{ {
scripts.Add(scriptName, script); scripts.Add(scriptName, script);
} }
else else
{ {
scripts[scriptName] = script; scripts[scriptName] = script;
} }
} }
} }
return scripts; return scripts;
} }
return null; return null;
} }
public Dictionary<string, IScript> compile(string filename) public Dictionary<string, IScript> compile(string filename)
{ {
JScriptCodeProvider jscriptProvider = new JScriptCodeProvider(); JScriptCodeProvider jscriptProvider = new JScriptCodeProvider();
return LoadDotNetScript(jscriptProvider, filename); return LoadDotNetScript(jscriptProvider, filename);
} }
} }
} }

View File

@ -1,46 +1,46 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class ClassInstance : Object public class ClassInstance : Object
{ {
public int Size; public int Size;
public ClassRecord ClassRec; public ClassRecord ClassRec;
public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>(); public Dictionary<string, BaseType> Fields = new Dictionary<string, BaseType>();
public ClassInstance() public ClassInstance()
{ {
} }
} }
} }

View File

@ -1,43 +1,43 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Heap public class Heap
{ {
public List<ClassInstance> ClassObjects = new List<ClassInstance>(); public List<ClassInstance> ClassObjects = new List<ClassInstance>();
public Heap() public Heap()
{ {
} }
} }
} }

View File

@ -1,96 +1,96 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
private bool IsMethodOpCode(byte opcode) private bool IsMethodOpCode(byte opcode)
{ {
bool result = false; bool result = false;
switch (opcode) switch (opcode)
{ {
case 184: case 184:
short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]); short refIndex = (short) ((GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC] << 8) + GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC+1]);
if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef) if (this.m_thread.currentClass.m_constantsPool[refIndex - 1] is ClassRecord.PoolMethodRef)
{ {
string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value; string typ = ((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Type.Value;
string typeparam = ""; string typeparam = "";
string typereturn = ""; string typereturn = "";
int firstbrak = 0; int firstbrak = 0;
int secondbrak = 0; int secondbrak = 0;
firstbrak = typ.LastIndexOf('('); firstbrak = typ.LastIndexOf('(');
secondbrak = typ.LastIndexOf(')'); secondbrak = typ.LastIndexOf(')');
typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1); typeparam = typ.Substring(firstbrak + 1, secondbrak - firstbrak - 1);
typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1); typereturn = typ.Substring(secondbrak + 1, typ.Length - secondbrak - 1);
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value) if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == this.m_thread.currentClass.MClass.Name.Value)
{ {
//calling a method in this class //calling a method in this class
if (typeparam.Length == 0) if (typeparam.Length == 0)
{ {
this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2)); this.m_thread.JumpToStaticVoidMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, (this.m_thread.PC + 2));
} }
else else
{ {
this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2)); this.m_thread.JumpToStaticParamMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, typeparam, (this.m_thread.PC + 2));
} }
} }
else else
{ {
//calling a method of a different class //calling a method of a different class
// OpenSimAPI Class // OpenSimAPI Class
if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI") if (((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mClass.Name.Value == "OpenSimAPI")
{ {
this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null); this.m_thread.scriptInfo.api.CallMethod(((ClassRecord.PoolMethodRef)this.m_thread.currentClass.m_constantsPool[refIndex - 1]).mNameType.Name.Value, null);
} }
} }
} }
else else
{ {
this.m_thread.PC += 2; this.m_thread.PC += 2;
} }
result = true; result = true;
break; break;
} }
return result; return result;
} }
} }
} }
} }

View File

@ -1,40 +1,40 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
} }
} }
} }

View File

@ -1,135 +1,135 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
partial class Thread partial class Thread
{ {
private partial class Interpreter private partial class Interpreter
{ {
private Thread m_thread; private Thread m_thread;
public Interpreter(Thread parentThread) public Interpreter(Thread parentThread)
{ {
m_thread = parentThread; m_thread = parentThread;
} }
public bool Excute() public bool Excute()
{ {
bool run = true; bool run = true;
byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++]; byte currentOpCode = GlobalMemory.MethodArea.MethodBuffer[this.m_thread.PC++];
// Console.WriteLine("opCode is: " + currentOpCode); // Console.WriteLine("opCode is: " + currentOpCode);
bool handled = false; bool handled = false;
handled = this.IsLogicOpCode(currentOpCode); handled = this.IsLogicOpCode(currentOpCode);
if (!handled) if (!handled)
{ {
handled = this.IsMethodOpCode(currentOpCode); handled = this.IsMethodOpCode(currentOpCode);
} }
if (!handled) if (!handled)
{ {
if (currentOpCode == 172) if (currentOpCode == 172)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning int from function"); Console.WriteLine("returning int from function");
int retPC1 = this.m_thread.m_currentFrame.ReturnPC; int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC1; this.m_thread.PC = retPC1;
if (bas1 is Int) if (bas1 is Int)
{ {
this.m_thread.m_currentFrame.OpStack.Push((Int)bas1); this.m_thread.m_currentFrame.OpStack.Push((Int)bas1);
} }
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
if (currentOpCode == 174) if (currentOpCode == 174)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning float from function"); Console.WriteLine("returning float from function");
int retPC1 = this.m_thread.m_currentFrame.ReturnPC; int retPC1 = this.m_thread.m_currentFrame.ReturnPC;
BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop(); BaseType bas1 = this.m_thread.m_currentFrame.OpStack.Pop();
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC1; this.m_thread.PC = retPC1;
if (bas1 is Float) if (bas1 is Float)
{ {
this.m_thread.m_currentFrame.OpStack.Push((Float)bas1); this.m_thread.m_currentFrame.OpStack.Push((Float)bas1);
} }
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
if (currentOpCode == 177) if (currentOpCode == 177)
{ {
if (this.m_thread.stack.StackFrames.Count > 1) if (this.m_thread.stack.StackFrames.Count > 1)
{ {
Console.WriteLine("returning from function"); Console.WriteLine("returning from function");
int retPC = this.m_thread.m_currentFrame.ReturnPC; int retPC = this.m_thread.m_currentFrame.ReturnPC;
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek(); this.m_thread.m_currentFrame = this.m_thread.stack.StackFrames.Peek();
this.m_thread.PC = retPC; this.m_thread.PC = retPC;
} }
else else
{ {
// Console.WriteLine("No parent function so ending program"); // Console.WriteLine("No parent function so ending program");
this.m_thread.stack.StackFrames.Pop(); this.m_thread.stack.StackFrames.Pop();
run = false; run = false;
} }
handled = true; handled = true;
} }
} }
if (!handled) if (!handled)
{ {
Console.WriteLine("opcode " + currentOpCode + " not been handled "); Console.WriteLine("opcode " + currentOpCode + " not been handled ");
} }
return run; return run;
} }
} }
} }
} }

View File

@ -1,45 +1,45 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class MainMemory public class MainMemory
{ {
public Heap HeapArea; public Heap HeapArea;
public MethodMemory MethodArea; public MethodMemory MethodArea;
public MainMemory() public MainMemory()
{ {
MethodArea = new MethodMemory(); MethodArea = new MethodMemory();
HeapArea = new Heap(); HeapArea = new Heap();
} }
} }
} }

View File

@ -1,46 +1,46 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class MethodMemory public class MethodMemory
{ {
public byte[] MethodBuffer; public byte[] MethodBuffer;
public List<ClassRecord> Classes = new List<ClassRecord>(); public List<ClassRecord> Classes = new List<ClassRecord>();
public int NextMethodPC = 0; public int NextMethodPC = 0;
public int Methodcount = 0; public int Methodcount = 0;
public MethodMemory() public MethodMemory()
{ {
MethodBuffer = new byte[20000]; MethodBuffer = new byte[20000];
} }
} }
} }

View File

@ -1,37 +1,37 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Object public class Object
{ {
} }
} }

View File

@ -1,56 +1,56 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public enum OpCode : byte public enum OpCode : byte
{ {
iconst_m1 = 2, iconst_m1 = 2,
iconst_0 = 3, iconst_0 = 3,
iconst_1 = 4, iconst_1 = 4,
iconst_2 = 5, iconst_2 = 5,
iconst_3 = 6, iconst_3 = 6,
iconst_4 = 7, iconst_4 = 7,
iconst_5 = 8, iconst_5 = 8,
fconst_0 = 11, fconst_0 = 11,
fconst_1 = 12, fconst_1 = 12,
fconst_2 = 13, fconst_2 = 13,
bipush = 16, bipush = 16,
sipush = 17, sipush = 17,
fload = 23, fload = 23,
iload_0 = 26, iload_0 = 26,
iload_1 = 27, iload_1 = 27,
fload_0 = 34, fload_0 = 34,
fload_1 = 35, fload_1 = 35,
fload_2 = 36, fload_2 = 36,
fload_3 = 37, fload_3 = 37,
istore = 54, istore = 54,
fstore = 56, fstore = 56,
istore_0 = 59, istore_0 = 59,
istore_1 = 60, istore_1 = 60,
istore_2 = 61, istore_2 = 61,
istore_3 = 62, istore_3 = 62,
fstore_0 = 67, fstore_0 = 67,
fstore_1 = 68, fstore_1 = 68,
fstore_2 = 69, fstore_2 = 69,
fstore_3 = 70, fstore_3 = 70,
pop = 87, pop = 87,
fadd = 98, fadd = 98,
fsub = 102, fsub = 102,
imul = 104, imul = 104,
iinc = 132, iinc = 132,
f2i = 139, f2i = 139,
fcmpl = 149, fcmpl = 149,
fcmpg = 150, fcmpg = 150,
ifge = 156, ifge = 156,
ifgt = 157, ifgt = 157,
ifle = 158, ifle = 158,
if_icmpge = 162, if_icmpge = 162,
if_icmpgt = 163, if_icmpgt = 163,
if_icmple = 164, if_icmple = 164,
_goto = 167, _goto = 167,
getstatic = 178, getstatic = 178,
putstatic = 179 putstatic = 179
} }
} }

View File

@ -1,42 +1,42 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class Stack public class Stack
{ {
public Stack<StackFrame> StackFrames = new Stack<StackFrame>(); public Stack<StackFrame> StackFrames = new Stack<StackFrame>();
public Stack() public Stack()
{ {
} }
} }
} }

View File

@ -1,49 +1,49 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public class StackFrame public class StackFrame
{ {
public BaseType[] LocalVariables; public BaseType[] LocalVariables;
public Stack<BaseType> OpStack = new Stack<BaseType>(); public Stack<BaseType> OpStack = new Stack<BaseType>();
public int ReturnPC = 0; public int ReturnPC = 0;
public ClassRecord CallingClass = null; public ClassRecord CallingClass = null;
public StackFrame() public StackFrame()
{ {
LocalVariables = new BaseType[20]; LocalVariables = new BaseType[20];
} }
} }
} }

View File

@ -1,119 +1,119 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule; using OpenSim.Region.ExtensionsScriptModule;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM
{ {
public partial class Thread public partial class Thread
{ {
// Is this smart? // Is this smart?
public static MainMemory GlobalMemory; public static MainMemory GlobalMemory;
public static Scene World; public static Scene World;
private int PC = 0; private int PC = 0;
private Stack stack; private Stack stack;
private Interpreter m_Interpreter; private Interpreter m_Interpreter;
public ClassRecord currentClass; public ClassRecord currentClass;
public ClassInstance currentInstance; public ClassInstance currentInstance;
private StackFrame m_currentFrame; private StackFrame m_currentFrame;
public int excutionCounter = 0; public int excutionCounter = 0;
public bool running = false; public bool running = false;
public ScriptInfo scriptInfo; public ScriptInfo scriptInfo;
public Thread() public Thread()
{ {
this.m_Interpreter = new Interpreter(this); this.m_Interpreter = new Interpreter(this);
this.stack = new Stack(); this.stack = new Stack();
} }
public void SetPC(int methodpointer) public void SetPC(int methodpointer)
{ {
//Console.WriteLine("Thread PC has been set to " + methodpointer); //Console.WriteLine("Thread PC has been set to " + methodpointer);
PC = methodpointer; PC = methodpointer;
} }
public void StartMethod(ClassRecord rec, string methName) public void StartMethod(ClassRecord rec, string methName)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
this.currentClass = rec; this.currentClass = rec;
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void StartMethod( string methName) public void StartMethod( string methName)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void JumpToStaticVoidMethod(string methName, int returnPC) public void JumpToStaticVoidMethod(string methName, int returnPC)
{ {
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
m_currentFrame.ReturnPC = returnPC; m_currentFrame.ReturnPC = returnPC;
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
public void JumpToStaticParamMethod(string methName, string param, int returnPC) public void JumpToStaticParamMethod(string methName, string param, int returnPC)
{ {
if (param == "I") if (param == "I")
{ {
BaseType bs1 = m_currentFrame.OpStack.Pop(); BaseType bs1 = m_currentFrame.OpStack.Pop();
m_currentFrame = new StackFrame(); m_currentFrame = new StackFrame();
m_currentFrame.ReturnPC = returnPC; m_currentFrame.ReturnPC = returnPC;
this.stack.StackFrames.Push(m_currentFrame); this.stack.StackFrames.Push(m_currentFrame);
m_currentFrame.LocalVariables[0] = ((Int)bs1); m_currentFrame.LocalVariables[0] = ((Int)bs1);
currentClass.StartMethod(this, methName); currentClass.StartMethod(this, methName);
} }
if (param == "F") if (param == "F")
{ {
} }
} }
public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC) public void JumpToClassStaticVoidMethod(string className, string methName, int returnPC)
{ {
} }
public bool Excute() public bool Excute()
{ {
excutionCounter++; excutionCounter++;
return this.m_Interpreter.Excute(); return this.m_Interpreter.Excute();
} }
} }
} }

View File

@ -1,28 +1,28 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule; using OpenSim.Region.ExtensionsScriptModule;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
{ {
public class JavaEngine : IScriptCompiler public class JavaEngine : IScriptCompiler
{ {
public string FileExt() public string FileExt()
{ {
return ".java"; return ".java";
} }
public Dictionary<string, IScript> compile(string filename) public Dictionary<string, IScript> compile(string filename)
{ {
JVMScript script = new JVMScript(); JVMScript script = new JVMScript();
Dictionary<string, IScript> returns = new Dictionary<string, IScript>(); Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
script.LoadScript(filename); script.LoadScript(filename);
returns.Add(filename, script); returns.Add(filename, script);
return returns; return returns;
} }
} }
} }

View File

@ -1,171 +1,171 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM;
using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread; using Thread = OpenSim.Region.ExtensionsScriptModule.JVMEngine.JVM.Thread;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine
{ {
public class JVMScript : IScript public class JVMScript : IScript
{ {
private List<Thread> _threads = new List<Thread>(); private List<Thread> _threads = new List<Thread>();
private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
private MainMemory _mainMemory; private MainMemory _mainMemory;
ScriptInfo scriptInfo; ScriptInfo scriptInfo;
public void Initialise(ScriptInfo info) public void Initialise(ScriptInfo info)
{ {
scriptInfo = info; scriptInfo = info;
_mainMemory = new MainMemory(); _mainMemory = new MainMemory();
Thread.GlobalMemory = this._mainMemory; Thread.GlobalMemory = this._mainMemory;
Thread.World = info.world; Thread.World = info.world;
CompileScript(); CompileScript();
scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame); scriptInfo.events.OnFrame += new EventManager.OnFrameDelegate(events_OnFrame);
scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); scriptInfo.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
} }
void events_OnNewPresence(ScenePresence presence) void events_OnNewPresence(ScenePresence presence)
{ {
for (int i = 0; i < this._threads.Count; i++) for (int i = 0; i < this._threads.Count; i++)
{ {
if (!this._threads[i].running) if (!this._threads[i].running)
{ {
this._threads[i].StartMethod("OnNewPresence"); this._threads[i].StartMethod("OnNewPresence");
bool run = true; bool run = true;
while (run) while (run)
{ {
run = this._threads[i].Excute(); run = this._threads[i].Excute();
} }
} }
} }
} }
void events_OnFrame() void events_OnFrame()
{ {
for (int i = 0; i < this._threads.Count; i++) for (int i = 0; i < this._threads.Count; i++)
{ {
if (!this._threads[i].running) if (!this._threads[i].running)
{ {
this._threads[i].StartMethod("OnFrame"); this._threads[i].StartMethod("OnFrame");
bool run = true; bool run = true;
while (run) while (run)
{ {
run = this._threads[i].Excute(); run = this._threads[i].Excute();
} }
} }
} }
} }
public string Name public string Name
{ {
get { return "JVM Scripting Engine"; } get { return "JVM Scripting Engine"; }
} }
public void LoadScript(string script) public void LoadScript(string script)
{ {
Console.WriteLine("OpenSimJVM - loading new script: " + script); Console.WriteLine("OpenSimJVM - loading new script: " + script);
CompileInfo comp = new CompileInfo(); CompileInfo comp = new CompileInfo();
comp.script = script; comp.script = script;
comp.scriptName = script; comp.scriptName = script;
this.CompileScripts.Enqueue(comp); this.CompileScripts.Enqueue(comp);
} }
public void CompileScript() public void CompileScript()
{ {
CompileInfo comp = this.CompileScripts.Dequeue(); CompileInfo comp = this.CompileScripts.Dequeue();
string script = comp.script; string script = comp.script;
string scriptName = comp.scriptName; string scriptName = comp.scriptName;
try try
{ {
//need to compile the script into a java class file //need to compile the script into a java class file
//first save it to a java source file //first save it to a java source file
TextWriter tw = new StreamWriter(scriptName + ".java"); TextWriter tw = new StreamWriter(scriptName + ".java");
tw.WriteLine(script); tw.WriteLine(script);
tw.Close(); tw.Close();
//now compile //now compile
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java"); System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("javac.exe", "*.java");
// psi.RedirectStandardOutput = true; // psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false; psi.UseShellExecute = false;
System.Diagnostics.Process javacomp; System.Diagnostics.Process javacomp;
javacomp = System.Diagnostics.Process.Start(psi); javacomp = System.Diagnostics.Process.Start(psi);
javacomp.WaitForExit(); javacomp.WaitForExit();
//now load in class file //now load in class file
ClassRecord class1 = new ClassRecord(); ClassRecord class1 = new ClassRecord();
class1.LoadClassFromFile(scriptName + ".class"); class1.LoadClassFromFile(scriptName + ".class");
class1.PrintToConsole(); class1.PrintToConsole();
//Console.WriteLine(); //Console.WriteLine();
this._mainMemory.MethodArea.Classes.Add(class1); this._mainMemory.MethodArea.Classes.Add(class1);
class1.AddMethodsToMemory(this._mainMemory.MethodArea); class1.AddMethodsToMemory(this._mainMemory.MethodArea);
Thread newThread = new Thread(); Thread newThread = new Thread();
this._threads.Add(newThread); this._threads.Add(newThread);
newThread.currentClass = class1; newThread.currentClass = class1;
newThread.scriptInfo = scriptInfo; newThread.scriptInfo = scriptInfo;
//now delete the created files //now delete the created files
System.IO.File.Delete(scriptName + ".java"); System.IO.File.Delete(scriptName + ".java");
System.IO.File.Delete(scriptName + ".class"); System.IO.File.Delete(scriptName + ".class");
//this.OnFrame(); //this.OnFrame();
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("exception"); Console.WriteLine("exception");
Console.WriteLine(e.StackTrace); Console.WriteLine(e.StackTrace);
Console.WriteLine(e.Message); Console.WriteLine(e.Message);
} }
} }
private class CompileInfo private class CompileInfo
{ {
public string script; public string script;
public string scriptName; public string scriptName;
public CompileInfo() public CompileInfo()
{ {
} }
} }
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class ArrayReference :BaseType public class ArrayReference :BaseType
{ {
} }
} }

View File

@ -1,10 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class BaseType : Object public class BaseType : Object
{ {
} }
} }

View File

@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types
{ {
public class ObjectReference : BaseType public class ObjectReference : BaseType
{ {
public ushort Reference; public ushort Reference;
public ObjectReference() public ObjectReference()
{ {
} }
} }
} }

View File

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{ {
public class Byte : BaseType public class Byte : BaseType
{ {
} }
} }

View File

@ -1,11 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{ {
public class Char : BaseType public class Char : BaseType
{ {
} }
} }

View File

@ -1,17 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{ {
public class Float : BaseType public class Float : BaseType
{ {
public float mValue = 0; public float mValue = 0;
public Float() public Float()
{ {
} }
} }
} }

View File

@ -1,17 +1,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types; using OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types;
namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes namespace OpenSim.Region.ExtensionsScriptModule.JVMEngine.Types.PrimitiveTypes
{ {
public class Int : BaseType public class Int : BaseType
{ {
public int mValue = 0; public int mValue = 0;
public Int() public Int()
{ {
} }
} }
} }

View File

@ -1,64 +1,64 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
public interface IScript public interface IScript
{ {
void Initialise(ScriptInfo scriptInfo); void Initialise(ScriptInfo scriptInfo);
string Name { get; } string Name { get; }
} }
public class TestScript : IScript public class TestScript : IScript
{ {
ScriptInfo script; ScriptInfo script;
public string Name public string Name
{ {
get { return "TestScript 0.1"; } get { return "TestScript 0.1"; }
} }
public void Initialise(ScriptInfo scriptInfo) public void Initialise(ScriptInfo scriptInfo)
{ {
script = scriptInfo; script = scriptInfo;
script.events.OnFrame += events_OnFrame; script.events.OnFrame += events_OnFrame;
script.events.OnNewPresence += events_OnNewPresence; script.events.OnNewPresence += events_OnNewPresence;
} }
void events_OnNewPresence(ScenePresence presence) void events_OnNewPresence(ScenePresence presence)
{ {
script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!"); script.logger.Verbose("Hello " + presence.Firstname.ToString() + "!");
} }
void events_OnFrame() void events_OnFrame()
{ {
//script.logger.Verbose("Hello World!"); //script.logger.Verbose("Hello World!");
} }
} }
} }

View File

@ -1,32 +1,32 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion; using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3; using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>; using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
// This class is to be used for engines which may not be able to access the Scene directly. // This class is to be used for engines which may not be able to access the Scene directly.
// Scene access is preffered, but obviously not possible on some non-.NET languages. // Scene access is preffered, but obviously not possible on some non-.NET languages.
public class ScriptAPI public class ScriptAPI
{ {
Scene scene; Scene scene;
ScriptInterpretedAPI interpretedAPI; ScriptInterpretedAPI interpretedAPI;
public ScriptAPI(Scene world, Key taskID) public ScriptAPI(Scene world, Key taskID)
{ {
scene = world; scene = world;
interpretedAPI = new ScriptInterpretedAPI(world, taskID); interpretedAPI = new ScriptInterpretedAPI(world, taskID);
} }
public Object CallMethod(String method, Object[] args) public Object CallMethod(String method, Object[] args)
{ {
return null; return null;
} }
} }
} }

View File

@ -1,63 +1,63 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
/// <summary> /// <summary>
/// Class which provides access to the world /// Class which provides access to the world
/// </summary> /// </summary>
public class ScriptInfo public class ScriptInfo
{ {
// Reference to world.eventsManager provided for convenience // Reference to world.eventsManager provided for convenience
public EventManager events; public EventManager events;
// The main world // The main world
public Scene world; public Scene world;
// The console // The console
public LogBase logger; public LogBase logger;
// API Access // API Access
public ScriptAPI api; public ScriptAPI api;
public ScriptInfo(Scene scene) public ScriptInfo(Scene scene)
{ {
world = scene; world = scene;
events = world.EventManager; events = world.EventManager;
logger = MainLog.Instance; logger = MainLog.Instance;
api = new ScriptAPI(world, libsecondlife.LLUUID.Zero); api = new ScriptAPI(world, libsecondlife.LLUUID.Zero);
} }
public void CreateTaskAPI(libsecondlife.LLUUID task) public void CreateTaskAPI(libsecondlife.LLUUID task)
{ {
api = new ScriptAPI(world, task); api = new ScriptAPI(world, task);
} }
} }
} }

View File

@ -1,267 +1,267 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion; using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3; using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>; using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.LandManagement; using OpenSim.Region.Environment.LandManagement;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
/// <summary> /// <summary>
/// A class inteded to act as an API for LSL-styled interpreted languages /// A class inteded to act as an API for LSL-styled interpreted languages
/// </summary> /// </summary>
/// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks> /// <remarks>Avoid at all costs. This should ONLY be used for LSL.</remarks>
class ScriptInterpretedAPI class ScriptInterpretedAPI
{ {
protected LLUUID m_object; protected LLUUID m_object;
protected Scene m_scene; protected Scene m_scene;
/// <summary> /// <summary>
/// The scene in which this script is acting /// The scene in which this script is acting
/// </summary> /// </summary>
public Scene Scene public Scene Scene
{ {
get { return m_scene; } get { return m_scene; }
} }
/// <summary> /// <summary>
/// The id of the object our script is supposed to be acting in /// The id of the object our script is supposed to be acting in
/// </summary> /// </summary>
public Key ObjectID public Key ObjectID
{ {
get { return m_object; } get { return m_object; }
} }
/// <summary> /// <summary>
/// The object our script is supposed to be in /// The object our script is supposed to be in
/// </summary> /// </summary>
public SceneObjectGroup Task public SceneObjectGroup Task
{ {
get { return Scene.Objects[ObjectID]; } get { return Scene.Objects[ObjectID]; }
} }
/// <summary> /// <summary>
/// Creates a new ScriptInterpretedAPI for a specified object /// Creates a new ScriptInterpretedAPI for a specified object
/// </summary> /// </summary>
/// <param name="world">The scene the object is located in</param> /// <param name="world">The scene the object is located in</param>
/// <param name="member">The specific member being 'occupied' by the script</param> /// <param name="member">The specific member being 'occupied' by the script</param>
public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member) public ScriptInterpretedAPI(Scene world, libsecondlife.LLUUID member)
{ {
m_scene = world; m_scene = world;
m_object = member; m_object = member;
} }
/// <summary> /// <summary>
/// Returns the absolute number of a integer value. /// Returns the absolute number of a integer value.
/// </summary> /// </summary>
/// <param name="val">Input</param> /// <param name="val">Input</param>
/// <returns>Absolute number of input</returns> /// <returns>Absolute number of input</returns>
public int osAbs(int val) public int osAbs(int val)
{ {
return Math.Abs(val); return Math.Abs(val);
} }
public float osAcos(float val) public float osAcos(float val)
{ {
return (float)Math.Acos(val); return (float)Math.Acos(val);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAddToLandPassList(Key avatar, float hours) public void osAddToLandPassList(Key avatar, float hours)
{ {
Vector myPosition = Task.AbsolutePosition; Vector myPosition = Task.AbsolutePosition;
Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y); Land myParcel = Scene.LandManager.getLandObject(myPosition.X, myPosition.Y);
OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)"); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAddToLandPassList(Key avatar, float hours)");
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAdjustSoundVolume(float volume) public void osAdjustSoundVolume(float volume)
{ {
OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)"); OpenSim.Framework.Console.MainLog.Instance.Warn("script", "Unimplemented function called by script: osAdjustSoundVolume(float volume)");
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAllowInventoryDrop(int add) public void osAllowInventoryDrop(int add)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public float osAngleBetween(Rotation a, Rotation b) public float osAngleBetween(Rotation a, Rotation b)
{ {
Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z); Axiom.Math.Quaternion axA = new Axiom.Math.Quaternion(a.W, a.X, a.Y, a.Z);
Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z); Axiom.Math.Quaternion axB = new Axiom.Math.Quaternion(b.W, b.X, b.Y, b.Z);
return 0; return 0;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osApplyImpulse(Vector force, int local) public void osApplyImpulse(Vector force, int local)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osApplyRotationalImpulse(Vector force, int local) public void osApplyRotationalImpulse(Vector force, int local)
{ {
return; return;
} }
public float osAsin(float val) public float osAsin(float val)
{ {
return (float)Math.Asin(val); return (float)Math.Asin(val);
} }
public float osAtan2(float x, float y) public float osAtan2(float x, float y)
{ {
return (float)Math.Atan2(x, y); return (float)Math.Atan2(x, y);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osAttachToAvatar(Key avatar, int attachmentPoint) public void osAttachToAvatar(Key avatar, int attachmentPoint)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public Key osAvatarOnSitTarget() public Key osAvatarOnSitTarget()
{ {
//TODO: Follow this as Children is chanced to be of type entity to support ScenePresences //TODO: Follow this as Children is chanced to be of type entity to support ScenePresences
/* /*
foreach (KeyValuePair<Key, EntityBase> Child in Task.Children) foreach (KeyValuePair<Key, EntityBase> Child in Task.Children)
{ {
if (Child.Value is ScenePresence) if (Child.Value is ScenePresence)
{ {
return Child.Value.uuid; return Child.Value.uuid;
} }
} }
*/ */
return Key.Zero; return Key.Zero;
} }
public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up) public Rotation osAxes2Rot(Vector fwd, Vector left, Vector up)
{ {
Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion(); Axiom.Math.Quaternion axQ = new Axiom.Math.Quaternion();
Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z); Axiom.Math.Vector3 axFwd = new Axiom.Math.Vector3(fwd.X, fwd.Y, fwd.Z);
Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z); Axiom.Math.Vector3 axLeft = new Axiom.Math.Vector3(left.X, left.Y, left.Z);
Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z); Axiom.Math.Vector3 axUp = new Axiom.Math.Vector3(up.X, up.Y, up.Z);
axQ.FromAxes(axFwd, axLeft, axUp); axQ.FromAxes(axFwd, axLeft, axUp);
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
} }
public Rotation osAxisAngle2Rot(Vector axis, float angle) public Rotation osAxisAngle2Rot(Vector axis, float angle)
{ {
Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z)); Axiom.Math.Quaternion axQ = Axiom.Math.Quaternion.FromAngleAxis(angle, new Axiom.Math.Vector3(axis.X, axis.Y, axis.Z));
return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w); return new Rotation(axQ.x, axQ.y, axQ.z, axQ.w);
} }
public string osBase64ToString(string str) public string osBase64ToString(string str)
{ {
Encoding enc = System.Text.Encoding.UTF8; Encoding enc = System.Text.Encoding.UTF8;
return enc.GetString(Convert.FromBase64String(str)); return enc.GetString(Convert.FromBase64String(str));
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osBreakAllLinks() public void osBreakAllLinks()
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osBreakLink() public void osBreakLink()
{ {
return; return;
} }
public LSLList osCSV2List(string src) public LSLList osCSV2List(string src)
{ {
LSLList retVal = new LSLList(); LSLList retVal = new LSLList();
retVal.AddRange(src.Split(',')); retVal.AddRange(src.Split(','));
return retVal; return retVal;
} }
public int osCeil(float val) public int osCeil(float val)
{ {
return (int)Math.Ceiling(val); return (int)Math.Ceiling(val);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCloseRemoteDataChannel(Key channel) public void osCloseRemoteDataChannel(Key channel)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public float osCloud(Vector offset) public float osCloud(Vector offset)
{ {
return 0.0f; return 0.0f;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCollisionFilter(string name, Key id, int accept) public void osCollisionFilter(string name, Key id, int accept)
{ {
return; return;
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osCollisionSprite(string impact_sprite) public void osCollisionSprite(string impact_sprite)
{ {
return; return;
} }
public float osCos(float theta) public float osCos(float theta)
{ {
return (float)Math.Cos(theta); return (float)Math.Cos(theta);
} }
public void osCreateLink(Key target, int parent) public void osCreateLink(Key target, int parent)
{ {
if(Scene.Entities[target] is SceneObjectGroup) if(Scene.Entities[target] is SceneObjectGroup)
Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]); Task.LinkToGroup((SceneObjectGroup)Scene.Entities[target]);
return; return;
} }
[Obsolete("Partially Unimplemented")] [Obsolete("Partially Unimplemented")]
public LSLList osDeleteSubList(LSLList src, int start, int end) public LSLList osDeleteSubList(LSLList src, int start, int end)
{ {
if (start < 0 || end < 0) if (start < 0 || end < 0)
{ {
throw new Exception("Unsupported at this time."); throw new Exception("Unsupported at this time.");
} }
src.RemoveRange(start, start - end + 1); src.RemoveRange(start, start - end + 1);
return src; return src;
} }
[Obsolete("Partially Unimplemented")] [Obsolete("Partially Unimplemented")]
public string osDeleteSubString(string src, int start, int end) public string osDeleteSubString(string src, int start, int end)
{ {
if (start < 0 || end < 0) if (start < 0 || end < 0)
{ {
throw new Exception("Unsupported at this time."); throw new Exception("Unsupported at this time.");
} }
return src.Remove(start, start - end + 1); return src.Remove(start, start - end + 1);
} }
[Obsolete("Unimplemented")] [Obsolete("Unimplemented")]
public void osDetachFromAvatar(Key avatar) public void osDetachFromAvatar(Key avatar)
{ {
return; return;
} }
} }
} }

View File

@ -1,23 +1,23 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using libsecondlife; using libsecondlife;
using Key = libsecondlife.LLUUID; using Key = libsecondlife.LLUUID;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
public class ScriptInterpretedEvents public class ScriptInterpretedEvents
{ {
public delegate void OnTouchStartDelegate(Key user); public delegate void OnTouchStartDelegate(Key user);
public event OnTouchStartDelegate OnTouchStart; public event OnTouchStartDelegate OnTouchStart;
public void TriggerTouchStart(Key user) public void TriggerTouchStart(Key user)
{ {
if (OnTouchStart != null) if (OnTouchStart != null)
OnTouchStart(user); OnTouchStart(user);
} }
} }
} }

View File

@ -1,143 +1,143 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment; using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.ExtensionsScriptModule.CSharp; using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript; using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine; using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
namespace OpenSim.Region.ExtensionsScriptModule namespace OpenSim.Region.ExtensionsScriptModule
{ {
public class ScriptManager : IRegionModule public class ScriptManager : IRegionModule
{ {
List<IScript> scripts = new List<IScript>(); List<IScript> scripts = new List<IScript>();
Scene m_scene; Scene m_scene;
Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>(); Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts) private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{ {
foreach (KeyValuePair<string, IScript> script in 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. 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); MainLog.Instance.Verbose("Loading " + script.Key);
script.Value.Initialise(scriptInfo); script.Value.Initialise(scriptInfo);
scripts.Add(script.Value); scripts.Add(script.Value);
} }
MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)"); MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
} }
public ScriptManager() public ScriptManager()
{ {
// Default Engines // Default Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine(); CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(csharpCompiler.FileExt(), csharpCompiler); compilers.Add(csharpCompiler.FileExt(), csharpCompiler);
JScriptEngine jscriptCompiler = new JScriptEngine(); JScriptEngine jscriptCompiler = new JScriptEngine();
compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler); compilers.Add(jscriptCompiler.FileExt(), jscriptCompiler);
JavaEngine javaCompiler = new JavaEngine(); JavaEngine javaCompiler = new JavaEngine();
compilers.Add(javaCompiler.FileExt(), javaCompiler); compilers.Add(javaCompiler.FileExt(), javaCompiler);
} }
public void Initialise(Scene scene) public void Initialise(Scene scene)
{ {
System.Console.WriteLine("Initialising Extensions Scripting Module"); System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene; m_scene = scene;
m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile)); m_scene.RegisterAPIMethod("API_CompileExtensionScript", new ModuleAPIMethod1<bool, string>(Compile));
m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript)); m_scene.RegisterAPIMethod("API_AddExtensionScript", new ModuleAPIMethod1<bool, IScript>(AddPreCompiledScript));
} }
public void PostInitialise() public void PostInitialise()
{ {
} }
public void CloseDown() public void CloseDown()
{ {
} }
public string GetName() public string GetName()
{ {
return "ExtensionsScriptingModule"; return "ExtensionsScriptingModule";
} }
public bool IsSharedModule() public bool IsSharedModule()
{ {
return false; return false;
} }
public bool Compile(string filename) public bool Compile(string filename)
{ {
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers) foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{ {
if (filename.EndsWith(compiler.Key)) if (filename.EndsWith(compiler.Key))
{ {
LoadFromCompiler(compiler.Value.compile(filename)); LoadFromCompiler(compiler.Value.compile(filename));
break; break;
} }
} }
return true; return true;
} }
public void RunScriptCmd(string[] args) public void RunScriptCmd(string[] args)
{ {
switch (args[0]) switch (args[0])
{ {
case "load": case "load":
Compile(args[1]); Compile(args[1]);
break; break;
default: default:
MainLog.Instance.Error("Unknown script command"); MainLog.Instance.Error("Unknown script command");
break; break;
} }
} }
public bool AddPreCompiledScript(IScript script) public bool AddPreCompiledScript(IScript script)
{ {
MainLog.Instance.Verbose("Loading script " + script.Name); 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. 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); script.Initialise(scriptInfo);
scripts.Add(script); scripts.Add(script);
return true; return true;
} }
} }
interface IScriptCompiler interface IScriptCompiler
{ {
Dictionary<string, IScript> compile(string filename); Dictionary<string, IScript> compile(string filename);
string FileExt(); string FileExt();
} }
} }

View File

@ -612,7 +612,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: integer llGetRegionFlags() //wiki: integer llGetRegionFlags()
int llGetRegionFlags(); int llGetRegionFlags();
//wiki: string llXorBase64StringsCorrect(string str1, string str2) //wiki: string llXorBase64StringsCorrect(string str1, string str2)
string llXorBase64StringsCorrect(string str1, string str2); string llXorBase64StringsCorrect(string str1, string str2);
void llHTTPRequest(string url, List<string> parameters, string body); void llHTTPRequest(string url, List<string> parameters, string body);
//wiki: llResetLandBanList() //wiki: llResetLandBanList()
void llResetLandBanList(); void llResetLandBanList();

View File

@ -1,120 +1,120 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using Microsoft.CSharp; using Microsoft.CSharp;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
using System.Reflection; using System.Reflection;
namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
{ {
public class Compiler public class Compiler
{ {
private LSL2CSConverter LSL_Converter = new LSL2CSConverter(); private LSL2CSConverter LSL_Converter = new LSL2CSConverter();
private CSharpCodeProvider codeProvider = new CSharpCodeProvider(); private CSharpCodeProvider codeProvider = new CSharpCodeProvider();
private static UInt64 scriptCompileCounter = 0; private static UInt64 scriptCompileCounter = 0;
//private ICodeCompiler icc = codeProvider.CreateCompiler(); //private ICodeCompiler icc = codeProvider.CreateCompiler();
public string CompileFromFile(string LSOFileName) public string CompileFromFile(string LSOFileName)
{ {
switch (System.IO.Path.GetExtension(LSOFileName).ToLower()) switch (System.IO.Path.GetExtension(LSOFileName).ToLower())
{ {
case ".txt": case ".txt":
case ".lsl": case ".lsl":
Common.SendToDebug("Source code is LSL, converting to CS"); Common.SendToDebug("Source code is LSL, converting to CS");
return CompileFromLSLText(File.ReadAllText(LSOFileName)); return CompileFromLSLText(File.ReadAllText(LSOFileName));
case ".cs": case ".cs":
Common.SendToDebug("Source code is CS"); Common.SendToDebug("Source code is CS");
return CompileFromCSText(File.ReadAllText(LSOFileName)); return CompileFromCSText(File.ReadAllText(LSOFileName));
default: default:
throw new Exception("Unknown script type."); throw new Exception("Unknown script type.");
} }
} }
/// <summary> /// <summary>
/// Converts script from LSL to CS and calls CompileFromCSText /// Converts script from LSL to CS and calls CompileFromCSText
/// </summary> /// </summary>
/// <param name="Script">LSL script</param> /// <param name="Script">LSL script</param>
/// <returns>Filename to .dll assembly</returns> /// <returns>Filename to .dll assembly</returns>
public string CompileFromLSLText(string Script) public string CompileFromLSLText(string Script)
{ {
if (Script.Substring(0, 4).ToLower() == "//c#") if (Script.Substring(0, 4).ToLower() == "//c#")
{ {
return CompileFromCSText( Script ); return CompileFromCSText( Script );
} }
else else
{ {
return CompileFromCSText(LSL_Converter.Convert(Script)); return CompileFromCSText(LSL_Converter.Convert(Script));
} }
} }
/// <summary> /// <summary>
/// Compile CS script to .Net assembly (.dll) /// Compile CS script to .Net assembly (.dll)
/// </summary> /// </summary>
/// <param name="Script">CS script</param> /// <param name="Script">CS script</param>
/// <returns>Filename to .dll assembly</returns> /// <returns>Filename to .dll assembly</returns>
public string CompileFromCSText(string Script) public string CompileFromCSText(string Script)
{ {
// Output assembly name // Output assembly name
scriptCompileCounter++; scriptCompileCounter++;
string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll"); string OutFile = Path.Combine("ScriptEngines", "Script_" + scriptCompileCounter + ".dll");
try try
{ {
System.IO.File.Delete(OutFile); System.IO.File.Delete(OutFile);
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString()); Console.WriteLine("Exception attempting to delete old compiled script: " + e.ToString());
} }
//string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll"); //string OutFile = Path.Combine("ScriptEngines", "SecondLife.Script.dll");
// DEBUG - write source to disk // DEBUG - write source to disk
try try
{ {
File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script); File.WriteAllText(Path.Combine("ScriptEngines", "debug_" + Path.GetFileNameWithoutExtension(OutFile) + ".cs"), Script);
} }
catch { } catch { }
// Do actual compile // Do actual compile
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.IncludeDebugInformation = true; parameters.IncludeDebugInformation = true;
// Add all available assemblies // Add all available assemblies
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{ {
//Console.WriteLine("Adding assembly: " + asm.Location); //Console.WriteLine("Adding assembly: " + asm.Location);
//parameters.ReferencedAssemblies.Add(asm.Location); //parameters.ReferencedAssemblies.Add(asm.Location);
} }
string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); string rootPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location); string rootPathSE = Path.GetDirectoryName(this.GetType().Assembly.Location);
//Console.WriteLine("Assembly location: " + rootPath); //Console.WriteLine("Assembly location: " + rootPath);
parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll")); parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Common.dll"));
parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll")); parameters.ReferencedAssemblies.Add(Path.Combine(rootPathSE, "OpenSim.Region.ScriptEngine.DotNetEngine.dll"));
//parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment"); //parameters.ReferencedAssemblies.Add("OpenSim.Region.Environment");
parameters.GenerateExecutable = false; parameters.GenerateExecutable = false;
parameters.OutputAssembly = OutFile; parameters.OutputAssembly = OutFile;
parameters.IncludeDebugInformation = false; parameters.IncludeDebugInformation = false;
CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script); CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, Script);
// Go through errors // Go through errors
// TODO: Return errors to user somehow // TODO: Return errors to user somehow
if (results.Errors.Count > 0) if (results.Errors.Count > 0)
{ {
string errtext = ""; string errtext = "";
foreach (CompilerError CompErr in results.Errors) foreach (CompilerError CompErr in results.Errors)
{ {
errtext += "Line number " + (CompErr.Line - 1) + errtext += "Line number " + (CompErr.Line - 1) +
", Error Number: " + CompErr.ErrorNumber + ", Error Number: " + CompErr.ErrorNumber +
", '" + CompErr.ErrorText + "'\r\n"; ", '" + CompErr.ErrorText + "'\r\n";
} }
throw new Exception(errtext); throw new Exception(errtext);
} }
return OutFile; return OutFile;
} }
} }
} }

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
} }
} }
public LSL_BuiltIn_Commands_Interface m_LSL_Functions; public LSL_BuiltIn_Commands_Interface m_LSL_Functions;
public string SourceCode = ""; public string SourceCode = "";
public LSL_BaseClass() public LSL_BaseClass()
@ -453,7 +453,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); } public int llGetUnixTime() { return m_LSL_Functions.llGetUnixTime(); }
public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); } public int llGetParcelFlags(LSL_Types.Vector3 pos) { return m_LSL_Functions.llGetParcelFlags(pos); }
public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); } public int llGetRegionFlags() { return m_LSL_Functions.llGetRegionFlags(); }
public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); } public string llXorBase64StringsCorrect(string str1, string str2) { return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2); }
public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); } public void llHTTPRequest(string url, List<string> parameters, string body) { m_LSL_Functions.llHTTPRequest(url, parameters, body); }
public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); } public void llResetLandBanList() { m_LSL_Functions.llResetLandBanList(); }
public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); } public void llResetLandPassList() { m_LSL_Functions.llResetLandPassList(); }

View File

@ -1,262 +1,262 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Common;
namespace OpenSim.Region.ScriptEngine.DotNetEngine namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
/// <summary> /// <summary>
/// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc. /// Handles LSL commands that takes long time and returns an event, for example timers, HTTP requests, etc.
/// </summary> /// </summary>
class LSLLongCmdHandler class LSLLongCmdHandler
{ {
private Thread cmdHandlerThread; private Thread cmdHandlerThread;
private int cmdHandlerThreadCycleSleepms = 100; private int cmdHandlerThreadCycleSleepms = 100;
private ScriptEngine m_ScriptEngine; private ScriptEngine m_ScriptEngine;
public LSLLongCmdHandler(ScriptEngine _ScriptEngine) public LSLLongCmdHandler(ScriptEngine _ScriptEngine)
{ {
m_ScriptEngine = _ScriptEngine; m_ScriptEngine = _ScriptEngine;
// Start the thread that will be doing the work // Start the thread that will be doing the work
cmdHandlerThread = new Thread(CmdHandlerThreadLoop); cmdHandlerThread = new Thread(CmdHandlerThreadLoop);
cmdHandlerThread.Name = "CmdHandlerThread"; cmdHandlerThread.Name = "CmdHandlerThread";
cmdHandlerThread.Priority = ThreadPriority.BelowNormal; cmdHandlerThread.Priority = ThreadPriority.BelowNormal;
cmdHandlerThread.IsBackground = true; cmdHandlerThread.IsBackground = true;
cmdHandlerThread.Start(); cmdHandlerThread.Start();
} }
~LSLLongCmdHandler() ~LSLLongCmdHandler()
{ {
// Shut down thread // Shut down thread
try try
{ {
if (cmdHandlerThread != null) if (cmdHandlerThread != null)
{ {
if (cmdHandlerThread.IsAlive == true) if (cmdHandlerThread.IsAlive == true)
{ {
cmdHandlerThread.Abort(); cmdHandlerThread.Abort();
cmdHandlerThread.Join(); cmdHandlerThread.Join();
} }
} }
} }
catch { } catch { }
} }
private void CmdHandlerThreadLoop() private void CmdHandlerThreadLoop()
{ {
while (true) while (true)
{ {
// Check timers // Check timers
CheckTimerEvents(); CheckTimerEvents();
// Check HttpRequests // Check HttpRequests
CheckHttpRequests(); CheckHttpRequests();
// Sleep before next cycle // Sleep before next cycle
Thread.Sleep(cmdHandlerThreadCycleSleepms); Thread.Sleep(cmdHandlerThreadCycleSleepms);
} }
} }
/// <summary> /// <summary>
/// Remove a specific script (and all its pending commands) /// Remove a specific script (and all its pending commands)
/// </summary> /// </summary>
/// <param name="m_localID"></param> /// <param name="m_localID"></param>
/// <param name="m_itemID"></param> /// <param name="m_itemID"></param>
public void RemoveScript(uint localID, LLUUID itemID) public void RemoveScript(uint localID, LLUUID itemID)
{ {
// Remove a specific script // Remove a specific script
// Remove from: Timers // Remove from: Timers
UnSetTimerEvents(localID, itemID); UnSetTimerEvents(localID, itemID);
// Remove from: HttpRequest // Remove from: HttpRequest
StopHttpRequest(localID, itemID); StopHttpRequest(localID, itemID);
} }
#region TIMER #region TIMER
// //
// TIMER // TIMER
// //
private class TimerClass private class TimerClass
{ {
public uint localID; public uint localID;
public LLUUID itemID; public LLUUID itemID;
public double interval; public double interval;
public DateTime next; public DateTime next;
} }
private List<TimerClass> Timers = new List<TimerClass>(); private List<TimerClass> Timers = new List<TimerClass>();
private object TimerListLock = new object(); private object TimerListLock = new object();
public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec) public void SetTimerEvent(uint m_localID, LLUUID m_itemID, double sec)
{ {
Console.WriteLine("SetTimerEvent"); Console.WriteLine("SetTimerEvent");
// Always remove first, in case this is a re-set // Always remove first, in case this is a re-set
UnSetTimerEvents(m_localID, m_itemID); UnSetTimerEvents(m_localID, m_itemID);
if (sec == 0) // Disabling timer if (sec == 0) // Disabling timer
return; return;
// Add to timer // Add to timer
TimerClass ts = new TimerClass(); TimerClass ts = new TimerClass();
ts.localID = m_localID; ts.localID = m_localID;
ts.itemID = m_itemID; ts.itemID = m_itemID;
ts.interval = sec; ts.interval = sec;
ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
lock (TimerListLock) lock (TimerListLock)
{ {
Timers.Add(ts); Timers.Add(ts);
} }
} }
public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID) public void UnSetTimerEvents(uint m_localID, LLUUID m_itemID)
{ {
// Remove from timer // Remove from timer
lock (TimerListLock) lock (TimerListLock)
{ {
List<TimerClass> NewTimers = new List<TimerClass>(); List<TimerClass> NewTimers = new List<TimerClass>();
foreach (TimerClass ts in Timers) foreach (TimerClass ts in Timers)
{ {
if (ts.localID != m_localID && ts.itemID != m_itemID) if (ts.localID != m_localID && ts.itemID != m_itemID)
{ {
NewTimers.Add(ts); NewTimers.Add(ts);
} }
} }
Timers.Clear(); Timers.Clear();
Timers = NewTimers; Timers = NewTimers;
} }
} }
public void CheckTimerEvents() public void CheckTimerEvents()
{ {
// Nothing to do here? // Nothing to do here?
if (Timers.Count == 0) if (Timers.Count == 0)
return; return;
lock (TimerListLock) lock (TimerListLock)
{ {
// Go through all timers // Go through all timers
foreach (TimerClass ts in Timers) foreach (TimerClass ts in Timers)
{ {
// Time has passed? // Time has passed?
if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime()) if (ts.next.ToUniversalTime() < DateTime.Now.ToUniversalTime())
{ {
// Add it to queue // Add it to queue
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { }); m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", new object[] { });
// set next interval // set next interval
ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval); ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
} }
} }
} // lock } // lock
} }
#endregion #endregion
#region HTTP REQUEST #region HTTP REQUEST
// //
// HTTP REAQUEST // HTTP REAQUEST
// //
private class HttpClass private class HttpClass
{ {
public uint localID; public uint localID;
public LLUUID itemID; public LLUUID itemID;
public string url; public string url;
public List<string> parameters; public List<string> parameters;
public string body; public string body;
public DateTime next; public DateTime next;
public string response_request_id; public string response_request_id;
public int response_status; public int response_status;
public List<string> response_metadata; public List<string> response_metadata;
public string response_body; public string response_body;
public void SendRequest() public void SendRequest()
{ {
// TODO: SEND REQUEST!!! // TODO: SEND REQUEST!!!
} }
public void Stop() public void Stop()
{ {
// TODO: Cancel any ongoing request // TODO: Cancel any ongoing request
} }
public bool CheckResponse() public bool CheckResponse()
{ {
// TODO: Check if we got a response yet, return true if so -- false if not // TODO: Check if we got a response yet, return true if so -- false if not
return true; return true;
// TODO: If we got a response, set the following then return true // TODO: If we got a response, set the following then return true
//response_request_id //response_request_id
//response_status //response_status
//response_metadata //response_metadata
//response_body //response_body
} }
} }
private List<HttpClass> HttpRequests = new List<HttpClass>(); private List<HttpClass> HttpRequests = new List<HttpClass>();
private object HttpListLock = new object(); private object HttpListLock = new object();
public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body) public void StartHttpRequest(uint localID, LLUUID itemID, string url, List<string> parameters, string body)
{ {
Console.WriteLine("StartHttpRequest"); Console.WriteLine("StartHttpRequest");
HttpClass htc = new HttpClass(); HttpClass htc = new HttpClass();
htc.localID = localID; htc.localID = localID;
htc.itemID = itemID; htc.itemID = itemID;
htc.url = url; htc.url = url;
htc.parameters = parameters; htc.parameters = parameters;
htc.body = body; htc.body = body;
lock (HttpListLock) lock (HttpListLock)
{ {
//ADD REQUEST //ADD REQUEST
HttpRequests.Add(htc); HttpRequests.Add(htc);
} }
} }
public void StopHttpRequest(uint m_localID, LLUUID m_itemID) public void StopHttpRequest(uint m_localID, LLUUID m_itemID)
{ {
// Remove from list // Remove from list
lock (HttpListLock) lock (HttpListLock)
{ {
List<HttpClass> NewHttpList = new List<HttpClass>(); List<HttpClass> NewHttpList = new List<HttpClass>();
foreach (HttpClass ts in HttpRequests) foreach (HttpClass ts in HttpRequests)
{ {
if (ts.localID != m_localID && ts.itemID != m_itemID) if (ts.localID != m_localID && ts.itemID != m_itemID)
{ {
// Keeping this one // Keeping this one
NewHttpList.Add(ts); NewHttpList.Add(ts);
} }
else else
{ {
// Shutting this one down // Shutting this one down
ts.Stop(); ts.Stop();
} }
} }
HttpRequests.Clear(); HttpRequests.Clear();
HttpRequests = NewHttpList; HttpRequests = NewHttpList;
} }
} }
public void CheckHttpRequests() public void CheckHttpRequests()
{ {
// Nothing to do here? // Nothing to do here?
if (HttpRequests.Count == 0) if (HttpRequests.Count == 0)
return; return;
lock (HttpListLock) lock (HttpListLock)
{ {
foreach (HttpClass ts in HttpRequests) foreach (HttpClass ts in HttpRequests)
{ {
if (ts.CheckResponse() == true) if (ts.CheckResponse() == true)
{ {
// Add it to event queue // Add it to event queue
//key request_id, integer status, list metadata, string body //key request_id, integer status, list metadata, string body
object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body }; object[] resobj = new object[] { ts.response_request_id, ts.response_status, ts.response_metadata, ts.response_body };
m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj); m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "http_response", resobj);
// Now stop it // Now stop it
StopHttpRequest(ts.localID, ts.itemID); StopHttpRequest(ts.localID, ts.itemID);
} }
} }
} // lock } // lock
} }
#endregion #endregion
} }
} }

View File

@ -246,12 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
ls.localID = localID; ls.localID = localID;
ls.itemID = itemID; ls.itemID = itemID;
unloadQueue.Enqueue(ls); unloadQueue.Enqueue(ls);
} }
public void ResetScript(uint localID, LLUUID itemID) public void ResetScript(uint localID, LLUUID itemID)
{ {
string script = GetScript(localID, itemID).SourceCode; string script = GetScript(localID, itemID).SourceCode;
StopScript(localID, itemID); StopScript(localID, itemID);
StartScript(localID, itemID, script); StartScript(localID, itemID, script);
} }
private void _StartScript(uint localID, LLUUID itemID, string Script) private void _StartScript(uint localID, LLUUID itemID, string Script)
@ -288,8 +288,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
#if DEBUG #if DEBUG
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
#endif #endif
CompiledScript.SourceCode = ScriptSource; CompiledScript.SourceCode = ScriptSource;
// Add it to our script memstruct // Add it to our script memstruct
SetScript(localID, itemID, CompiledScript); SetScript(localID, itemID, CompiledScript);

View File

@ -1,52 +1,52 @@
/* /*
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
met: met:
* Redistributions of source code must retain the above copyright * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided disclaimer in the documentation and/or other materials provided
with the distribution. with the distribution.
* Neither the name of libTerrain nor the names of * Neither the name of libTerrain nor the names of
its contributors may be used to endorse or promote products its contributors may be used to endorse or promote products
derived from this software without specific prior written derived from this software without specific prior written
permission. permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace libTerrain namespace libTerrain
{ {
class Tools class Tools
{ {
public static double linearInterpolate(double a, double b, double amount) public static double linearInterpolate(double a, double b, double amount)
{ {
return a + ((b - a) * amount); return a + ((b - a) * amount);
} }
public static double exponentialInterpolate(double a, double b, double amount) public static double exponentialInterpolate(double a, double b, double amount)
{ {
a = Math.Pow(a, amount); a = Math.Pow(a, amount);
b = Math.Pow(b - a, 1.0 - amount); b = Math.Pow(b - a, 1.0 - amount);
return a+b; return a+b;
} }
public static int powerOf2Log2(int n) { public static int powerOf2Log2(int n) {
for (int i = 0; i < 31; i++) { for (int i = 0; i < 31; i++) {
if ((n & 1) == 1) { if ((n & 1) == 1) {
@ -55,6 +55,6 @@ namespace libTerrain
n >>= 1; n >>= 1;
} }
return 0; return 0;
} }
} }
} }

View File

@ -1,88 +1,88 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
class InputTextBoxControl:System.Windows.Forms.TextBox class InputTextBoxControl:System.Windows.Forms.TextBox
{ {
public InputTextBoxControl() public InputTextBoxControl()
{ {
this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown);
} }
private List<string> CommandHistory = new List<string>(); private List<string> CommandHistory = new List<string>();
private bool InHistory = false; private bool InHistory = false;
private int HistoryPosition = -1; private int HistoryPosition = -1;
void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Enter && InHistory == false) if (e.KeyCode == Keys.Enter && InHistory == false)
{ {
CommandHistory.Add(this.Text); CommandHistory.Add(this.Text);
} }
if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
{ {
// if not inside buffer, enter // if not inside buffer, enter
// InBuffer = true // InBuffer = true
//Console.WriteLine("History: Check"); //Console.WriteLine("History: Check");
if (InHistory == false) if (InHistory == false)
{ {
if (this.Text != "") if (this.Text != "")
{ {
//Console.WriteLine("History: Add"); //Console.WriteLine("History: Add");
CommandHistory.Add(this.Text); CommandHistory.Add(this.Text);
HistoryPosition = CommandHistory.Count; HistoryPosition = CommandHistory.Count;
} }
else else
{ {
//HistoryPosition = CommandHistory.Count + 1; //HistoryPosition = CommandHistory.Count + 1;
} }
//Console.WriteLine("History: InHistory"); //Console.WriteLine("History: InHistory");
InHistory = true; InHistory = true;
} }
if (e.KeyCode == Keys.Up) if (e.KeyCode == Keys.Up)
HistoryPosition -= 1; HistoryPosition -= 1;
if (e.KeyCode == Keys.Down) if (e.KeyCode == Keys.Down)
HistoryPosition += 1; HistoryPosition += 1;
if (HistoryPosition > CommandHistory.Count - 1) if (HistoryPosition > CommandHistory.Count - 1)
HistoryPosition = -1; HistoryPosition = -1;
if (HistoryPosition < -1) if (HistoryPosition < -1)
HistoryPosition = CommandHistory.Count - 1; HistoryPosition = CommandHistory.Count - 1;
//Console.WriteLine("History: Pos: " + HistoryPosition); //Console.WriteLine("History: Pos: " + HistoryPosition);
//Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count);
if (CommandHistory.Count != 0) if (CommandHistory.Count != 0)
{ {
if (HistoryPosition != -1) if (HistoryPosition != -1)
{ {
//Console.WriteLine("History: Getting"); //Console.WriteLine("History: Getting");
//this.Text = CommandHistory.Item(HistoryPosition); //this.Text = CommandHistory.Item(HistoryPosition);
this.Text = CommandHistory[HistoryPosition]; this.Text = CommandHistory[HistoryPosition];
this.SelectionStart = this.Text.Length; this.SelectionStart = this.Text.Length;
this.SelectionLength = 0; this.SelectionLength = 0;
} }
else else
{ {
//Console.WriteLine("History: Nothing"); //Console.WriteLine("History: Nothing");
this.Text = ""; this.Text = "";
} }
} }
e.Handled = true; e.Handled = true;
} else { } else {
InHistory = false; InHistory = false;
HistoryPosition = -1; HistoryPosition = -1;
} }
} }
} }
} }

View File

@ -1,393 +1,393 @@
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
partial class Main partial class Main
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.tabLogs = new System.Windows.Forms.TabControl(); this.tabLogs = new System.Windows.Forms.TabControl();
this.tabMainLog = new System.Windows.Forms.TabPage(); this.tabMainLog = new System.Windows.Forms.TabPage();
this.txtMainLog = new System.Windows.Forms.TextBox(); this.txtMainLog = new System.Windows.Forms.TextBox();
this.tabRegionServer = new System.Windows.Forms.TabPage(); this.tabRegionServer = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.txtInputRegionServer = new OpenSim.GUI.InputTextBoxControl(); this.txtInputRegionServer = new OpenSim.GUI.InputTextBoxControl();
this.txtOpenSim = new System.Windows.Forms.TextBox(); this.txtOpenSim = new System.Windows.Forms.TextBox();
this.tabUserServer = new System.Windows.Forms.TabPage(); this.tabUserServer = new System.Windows.Forms.TabPage();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.txtInputUserServer = new OpenSim.GUI.InputTextBoxControl(); this.txtInputUserServer = new OpenSim.GUI.InputTextBoxControl();
this.txtUserServer = new System.Windows.Forms.TextBox(); this.txtUserServer = new System.Windows.Forms.TextBox();
this.tabAssetServer = new System.Windows.Forms.TabPage(); this.tabAssetServer = new System.Windows.Forms.TabPage();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.txtInputAssetServer = new OpenSim.GUI.InputTextBoxControl(); this.txtInputAssetServer = new OpenSim.GUI.InputTextBoxControl();
this.txtAssetServer = new System.Windows.Forms.TextBox(); this.txtAssetServer = new System.Windows.Forms.TextBox();
this.tabGridServer = new System.Windows.Forms.TabPage(); this.tabGridServer = new System.Windows.Forms.TabPage();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.txtInputGridServer = new OpenSim.GUI.InputTextBoxControl(); this.txtInputGridServer = new OpenSim.GUI.InputTextBoxControl();
this.txtGridServer = new System.Windows.Forms.TextBox(); this.txtGridServer = new System.Windows.Forms.TextBox();
this.gbLog = new System.Windows.Forms.GroupBox(); this.gbLog = new System.Windows.Forms.GroupBox();
this.btnStart = new System.Windows.Forms.Button(); this.btnStart = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button(); this.btnStop = new System.Windows.Forms.Button();
this.rbGridRegionMode = new System.Windows.Forms.RadioButton(); this.rbGridRegionMode = new System.Windows.Forms.RadioButton();
this.rbStandAloneMode = new System.Windows.Forms.RadioButton(); this.rbStandAloneMode = new System.Windows.Forms.RadioButton();
this.rbGridServer = new System.Windows.Forms.RadioButton(); this.rbGridServer = new System.Windows.Forms.RadioButton();
this.tabLogs.SuspendLayout(); this.tabLogs.SuspendLayout();
this.tabMainLog.SuspendLayout(); this.tabMainLog.SuspendLayout();
this.tabRegionServer.SuspendLayout(); this.tabRegionServer.SuspendLayout();
this.tabUserServer.SuspendLayout(); this.tabUserServer.SuspendLayout();
this.tabAssetServer.SuspendLayout(); this.tabAssetServer.SuspendLayout();
this.tabGridServer.SuspendLayout(); this.tabGridServer.SuspendLayout();
this.gbLog.SuspendLayout(); this.gbLog.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tabLogs // tabLogs
// //
this.tabLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.tabLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tabLogs.Controls.Add(this.tabMainLog); this.tabLogs.Controls.Add(this.tabMainLog);
this.tabLogs.Controls.Add(this.tabRegionServer); this.tabLogs.Controls.Add(this.tabRegionServer);
this.tabLogs.Controls.Add(this.tabUserServer); this.tabLogs.Controls.Add(this.tabUserServer);
this.tabLogs.Controls.Add(this.tabAssetServer); this.tabLogs.Controls.Add(this.tabAssetServer);
this.tabLogs.Controls.Add(this.tabGridServer); this.tabLogs.Controls.Add(this.tabGridServer);
this.tabLogs.Location = new System.Drawing.Point(6, 19); this.tabLogs.Location = new System.Drawing.Point(6, 19);
this.tabLogs.Name = "tabLogs"; this.tabLogs.Name = "tabLogs";
this.tabLogs.SelectedIndex = 0; this.tabLogs.SelectedIndex = 0;
this.tabLogs.Size = new System.Drawing.Size(562, 230); this.tabLogs.Size = new System.Drawing.Size(562, 230);
this.tabLogs.TabIndex = 0; this.tabLogs.TabIndex = 0;
// //
// tabMainLog // tabMainLog
// //
this.tabMainLog.Controls.Add(this.txtMainLog); this.tabMainLog.Controls.Add(this.txtMainLog);
this.tabMainLog.Location = new System.Drawing.Point(4, 22); this.tabMainLog.Location = new System.Drawing.Point(4, 22);
this.tabMainLog.Name = "tabMainLog"; this.tabMainLog.Name = "tabMainLog";
this.tabMainLog.Size = new System.Drawing.Size(554, 204); this.tabMainLog.Size = new System.Drawing.Size(554, 204);
this.tabMainLog.TabIndex = 4; this.tabMainLog.TabIndex = 4;
this.tabMainLog.Text = "Main log"; this.tabMainLog.Text = "Main log";
this.tabMainLog.UseVisualStyleBackColor = true; this.tabMainLog.UseVisualStyleBackColor = true;
// //
// txtMainLog // txtMainLog
// //
this.txtMainLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtMainLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtMainLog.Location = new System.Drawing.Point(6, 5); this.txtMainLog.Location = new System.Drawing.Point(6, 5);
this.txtMainLog.Multiline = true; this.txtMainLog.Multiline = true;
this.txtMainLog.Name = "txtMainLog"; this.txtMainLog.Name = "txtMainLog";
this.txtMainLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtMainLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtMainLog.Size = new System.Drawing.Size(542, 195); this.txtMainLog.Size = new System.Drawing.Size(542, 195);
this.txtMainLog.TabIndex = 1; this.txtMainLog.TabIndex = 1;
// //
// tabRegionServer // tabRegionServer
// //
this.tabRegionServer.Controls.Add(this.label1); this.tabRegionServer.Controls.Add(this.label1);
this.tabRegionServer.Controls.Add(this.txtInputRegionServer); this.tabRegionServer.Controls.Add(this.txtInputRegionServer);
this.tabRegionServer.Controls.Add(this.txtOpenSim); this.tabRegionServer.Controls.Add(this.txtOpenSim);
this.tabRegionServer.Location = new System.Drawing.Point(4, 22); this.tabRegionServer.Location = new System.Drawing.Point(4, 22);
this.tabRegionServer.Name = "tabRegionServer"; this.tabRegionServer.Name = "tabRegionServer";
this.tabRegionServer.Padding = new System.Windows.Forms.Padding(3); this.tabRegionServer.Padding = new System.Windows.Forms.Padding(3);
this.tabRegionServer.Size = new System.Drawing.Size(554, 204); this.tabRegionServer.Size = new System.Drawing.Size(554, 204);
this.tabRegionServer.TabIndex = 0; this.tabRegionServer.TabIndex = 0;
this.tabRegionServer.Text = "Region server"; this.tabRegionServer.Text = "Region server";
this.tabRegionServer.UseVisualStyleBackColor = true; this.tabRegionServer.UseVisualStyleBackColor = true;
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 183); this.label1.Location = new System.Drawing.Point(6, 183);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(57, 13); this.label1.Size = new System.Drawing.Size(57, 13);
this.label1.TabIndex = 4; this.label1.TabIndex = 4;
this.label1.Text = "Command:"; this.label1.Text = "Command:";
// //
// txtInputRegionServer // txtInputRegionServer
// //
this.txtInputRegionServer.Location = new System.Drawing.Point(69, 180); this.txtInputRegionServer.Location = new System.Drawing.Point(69, 180);
this.txtInputRegionServer.Name = "txtInputRegionServer"; this.txtInputRegionServer.Name = "txtInputRegionServer";
this.txtInputRegionServer.Size = new System.Drawing.Size(479, 20); this.txtInputRegionServer.Size = new System.Drawing.Size(479, 20);
this.txtInputRegionServer.TabIndex = 0; this.txtInputRegionServer.TabIndex = 0;
// //
// txtOpenSim // txtOpenSim
// //
this.txtOpenSim.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtOpenSim.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtOpenSim.Location = new System.Drawing.Point(6, 6); this.txtOpenSim.Location = new System.Drawing.Point(6, 6);
this.txtOpenSim.Multiline = true; this.txtOpenSim.Multiline = true;
this.txtOpenSim.Name = "txtOpenSim"; this.txtOpenSim.Name = "txtOpenSim";
this.txtOpenSim.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtOpenSim.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtOpenSim.Size = new System.Drawing.Size(542, 168); this.txtOpenSim.Size = new System.Drawing.Size(542, 168);
this.txtOpenSim.TabIndex = 0; this.txtOpenSim.TabIndex = 0;
// //
// tabUserServer // tabUserServer
// //
this.tabUserServer.Controls.Add(this.label2); this.tabUserServer.Controls.Add(this.label2);
this.tabUserServer.Controls.Add(this.txtInputUserServer); this.tabUserServer.Controls.Add(this.txtInputUserServer);
this.tabUserServer.Controls.Add(this.txtUserServer); this.tabUserServer.Controls.Add(this.txtUserServer);
this.tabUserServer.Location = new System.Drawing.Point(4, 22); this.tabUserServer.Location = new System.Drawing.Point(4, 22);
this.tabUserServer.Name = "tabUserServer"; this.tabUserServer.Name = "tabUserServer";
this.tabUserServer.Padding = new System.Windows.Forms.Padding(3); this.tabUserServer.Padding = new System.Windows.Forms.Padding(3);
this.tabUserServer.Size = new System.Drawing.Size(554, 204); this.tabUserServer.Size = new System.Drawing.Size(554, 204);
this.tabUserServer.TabIndex = 1; this.tabUserServer.TabIndex = 1;
this.tabUserServer.Text = "User server"; this.tabUserServer.Text = "User server";
this.tabUserServer.UseVisualStyleBackColor = true; this.tabUserServer.UseVisualStyleBackColor = true;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 181); this.label2.Location = new System.Drawing.Point(6, 181);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 13); this.label2.Size = new System.Drawing.Size(57, 13);
this.label2.TabIndex = 6; this.label2.TabIndex = 6;
this.label2.Text = "Command:"; this.label2.Text = "Command:";
// //
// txtInputUserServer // txtInputUserServer
// //
this.txtInputUserServer.Location = new System.Drawing.Point(69, 178); this.txtInputUserServer.Location = new System.Drawing.Point(69, 178);
this.txtInputUserServer.Name = "txtInputUserServer"; this.txtInputUserServer.Name = "txtInputUserServer";
this.txtInputUserServer.Size = new System.Drawing.Size(479, 20); this.txtInputUserServer.Size = new System.Drawing.Size(479, 20);
this.txtInputUserServer.TabIndex = 5; this.txtInputUserServer.TabIndex = 5;
// //
// txtUserServer // txtUserServer
// //
this.txtUserServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtUserServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtUserServer.Location = new System.Drawing.Point(6, 5); this.txtUserServer.Location = new System.Drawing.Point(6, 5);
this.txtUserServer.Multiline = true; this.txtUserServer.Multiline = true;
this.txtUserServer.Name = "txtUserServer"; this.txtUserServer.Name = "txtUserServer";
this.txtUserServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtUserServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtUserServer.Size = new System.Drawing.Size(542, 168); this.txtUserServer.Size = new System.Drawing.Size(542, 168);
this.txtUserServer.TabIndex = 1; this.txtUserServer.TabIndex = 1;
// //
// tabAssetServer // tabAssetServer
// //
this.tabAssetServer.Controls.Add(this.label3); this.tabAssetServer.Controls.Add(this.label3);
this.tabAssetServer.Controls.Add(this.txtInputAssetServer); this.tabAssetServer.Controls.Add(this.txtInputAssetServer);
this.tabAssetServer.Controls.Add(this.txtAssetServer); this.tabAssetServer.Controls.Add(this.txtAssetServer);
this.tabAssetServer.Location = new System.Drawing.Point(4, 22); this.tabAssetServer.Location = new System.Drawing.Point(4, 22);
this.tabAssetServer.Name = "tabAssetServer"; this.tabAssetServer.Name = "tabAssetServer";
this.tabAssetServer.Size = new System.Drawing.Size(554, 204); this.tabAssetServer.Size = new System.Drawing.Size(554, 204);
this.tabAssetServer.TabIndex = 2; this.tabAssetServer.TabIndex = 2;
this.tabAssetServer.Text = "Asset server"; this.tabAssetServer.Text = "Asset server";
this.tabAssetServer.UseVisualStyleBackColor = true; this.tabAssetServer.UseVisualStyleBackColor = true;
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 182); this.label3.Location = new System.Drawing.Point(6, 182);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(57, 13); this.label3.Size = new System.Drawing.Size(57, 13);
this.label3.TabIndex = 6; this.label3.TabIndex = 6;
this.label3.Text = "Command:"; this.label3.Text = "Command:";
// //
// txtInputAssetServer // txtInputAssetServer
// //
this.txtInputAssetServer.Location = new System.Drawing.Point(69, 179); this.txtInputAssetServer.Location = new System.Drawing.Point(69, 179);
this.txtInputAssetServer.Name = "txtInputAssetServer"; this.txtInputAssetServer.Name = "txtInputAssetServer";
this.txtInputAssetServer.Size = new System.Drawing.Size(479, 20); this.txtInputAssetServer.Size = new System.Drawing.Size(479, 20);
this.txtInputAssetServer.TabIndex = 5; this.txtInputAssetServer.TabIndex = 5;
// //
// txtAssetServer // txtAssetServer
// //
this.txtAssetServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtAssetServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtAssetServer.Location = new System.Drawing.Point(6, 5); this.txtAssetServer.Location = new System.Drawing.Point(6, 5);
this.txtAssetServer.Multiline = true; this.txtAssetServer.Multiline = true;
this.txtAssetServer.Name = "txtAssetServer"; this.txtAssetServer.Name = "txtAssetServer";
this.txtAssetServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtAssetServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtAssetServer.Size = new System.Drawing.Size(542, 168); this.txtAssetServer.Size = new System.Drawing.Size(542, 168);
this.txtAssetServer.TabIndex = 1; this.txtAssetServer.TabIndex = 1;
// //
// tabGridServer // tabGridServer
// //
this.tabGridServer.Controls.Add(this.label4); this.tabGridServer.Controls.Add(this.label4);
this.tabGridServer.Controls.Add(this.txtInputGridServer); this.tabGridServer.Controls.Add(this.txtInputGridServer);
this.tabGridServer.Controls.Add(this.txtGridServer); this.tabGridServer.Controls.Add(this.txtGridServer);
this.tabGridServer.Location = new System.Drawing.Point(4, 22); this.tabGridServer.Location = new System.Drawing.Point(4, 22);
this.tabGridServer.Name = "tabGridServer"; this.tabGridServer.Name = "tabGridServer";
this.tabGridServer.Size = new System.Drawing.Size(554, 204); this.tabGridServer.Size = new System.Drawing.Size(554, 204);
this.tabGridServer.TabIndex = 3; this.tabGridServer.TabIndex = 3;
this.tabGridServer.Text = "Grid server"; this.tabGridServer.Text = "Grid server";
this.tabGridServer.UseVisualStyleBackColor = true; this.tabGridServer.UseVisualStyleBackColor = true;
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 182); this.label4.Location = new System.Drawing.Point(6, 182);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 13); this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 6; this.label4.TabIndex = 6;
this.label4.Text = "Command:"; this.label4.Text = "Command:";
// //
// txtInputGridServer // txtInputGridServer
// //
this.txtInputGridServer.Location = new System.Drawing.Point(69, 179); this.txtInputGridServer.Location = new System.Drawing.Point(69, 179);
this.txtInputGridServer.Name = "txtInputGridServer"; this.txtInputGridServer.Name = "txtInputGridServer";
this.txtInputGridServer.Size = new System.Drawing.Size(479, 20); this.txtInputGridServer.Size = new System.Drawing.Size(479, 20);
this.txtInputGridServer.TabIndex = 5; this.txtInputGridServer.TabIndex = 5;
// //
// txtGridServer // txtGridServer
// //
this.txtGridServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.txtGridServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txtGridServer.Location = new System.Drawing.Point(6, 5); this.txtGridServer.Location = new System.Drawing.Point(6, 5);
this.txtGridServer.Multiline = true; this.txtGridServer.Multiline = true;
this.txtGridServer.Name = "txtGridServer"; this.txtGridServer.Name = "txtGridServer";
this.txtGridServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txtGridServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtGridServer.Size = new System.Drawing.Size(542, 168); this.txtGridServer.Size = new System.Drawing.Size(542, 168);
this.txtGridServer.TabIndex = 1; this.txtGridServer.TabIndex = 1;
// //
// gbLog // gbLog
// //
this.gbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.gbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.gbLog.Controls.Add(this.tabLogs); this.gbLog.Controls.Add(this.tabLogs);
this.gbLog.Location = new System.Drawing.Point(2, 41); this.gbLog.Location = new System.Drawing.Point(2, 41);
this.gbLog.Name = "gbLog"; this.gbLog.Name = "gbLog";
this.gbLog.Size = new System.Drawing.Size(574, 255); this.gbLog.Size = new System.Drawing.Size(574, 255);
this.gbLog.TabIndex = 1; this.gbLog.TabIndex = 1;
this.gbLog.TabStop = false; this.gbLog.TabStop = false;
this.gbLog.Text = "Logs"; this.gbLog.Text = "Logs";
// //
// btnStart // btnStart
// //
this.btnStart.Location = new System.Drawing.Point(8, 12); this.btnStart.Location = new System.Drawing.Point(8, 12);
this.btnStart.Name = "btnStart"; this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23); this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 2; this.btnStart.TabIndex = 2;
this.btnStart.Text = "Start"; this.btnStart.Text = "Start";
this.btnStart.UseVisualStyleBackColor = true; this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click); this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
// //
// btnStop // btnStop
// //
this.btnStop.Location = new System.Drawing.Point(89, 12); this.btnStop.Location = new System.Drawing.Point(89, 12);
this.btnStop.Name = "btnStop"; this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23); this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 3; this.btnStop.TabIndex = 3;
this.btnStop.Text = "Stop"; this.btnStop.Text = "Stop";
this.btnStop.UseVisualStyleBackColor = true; this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click); this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
// //
// rbGridRegionMode // rbGridRegionMode
// //
this.rbGridRegionMode.AutoSize = true; this.rbGridRegionMode.AutoSize = true;
this.rbGridRegionMode.Location = new System.Drawing.Point(407, 18); this.rbGridRegionMode.Location = new System.Drawing.Point(407, 18);
this.rbGridRegionMode.Name = "rbGridRegionMode"; this.rbGridRegionMode.Name = "rbGridRegionMode";
this.rbGridRegionMode.Size = new System.Drawing.Size(76, 17); this.rbGridRegionMode.Size = new System.Drawing.Size(76, 17);
this.rbGridRegionMode.TabIndex = 4; this.rbGridRegionMode.TabIndex = 4;
this.rbGridRegionMode.Text = "Grid region"; this.rbGridRegionMode.Text = "Grid region";
this.rbGridRegionMode.UseVisualStyleBackColor = true; this.rbGridRegionMode.UseVisualStyleBackColor = true;
this.rbGridRegionMode.CheckedChanged += new System.EventHandler(this.rbGridRegionMode_CheckedChanged); this.rbGridRegionMode.CheckedChanged += new System.EventHandler(this.rbGridRegionMode_CheckedChanged);
// //
// rbStandAloneMode // rbStandAloneMode
// //
this.rbStandAloneMode.AutoSize = true; this.rbStandAloneMode.AutoSize = true;
this.rbStandAloneMode.Checked = true; this.rbStandAloneMode.Checked = true;
this.rbStandAloneMode.Location = new System.Drawing.Point(319, 18); this.rbStandAloneMode.Location = new System.Drawing.Point(319, 18);
this.rbStandAloneMode.Name = "rbStandAloneMode"; this.rbStandAloneMode.Name = "rbStandAloneMode";
this.rbStandAloneMode.Size = new System.Drawing.Size(82, 17); this.rbStandAloneMode.Size = new System.Drawing.Size(82, 17);
this.rbStandAloneMode.TabIndex = 5; this.rbStandAloneMode.TabIndex = 5;
this.rbStandAloneMode.TabStop = true; this.rbStandAloneMode.TabStop = true;
this.rbStandAloneMode.Text = "Stand alone"; this.rbStandAloneMode.Text = "Stand alone";
this.rbStandAloneMode.UseVisualStyleBackColor = true; this.rbStandAloneMode.UseVisualStyleBackColor = true;
this.rbStandAloneMode.CheckedChanged += new System.EventHandler(this.rbStandAloneMode_CheckedChanged); this.rbStandAloneMode.CheckedChanged += new System.EventHandler(this.rbStandAloneMode_CheckedChanged);
// //
// rbGridServer // rbGridServer
// //
this.rbGridServer.AutoSize = true; this.rbGridServer.AutoSize = true;
this.rbGridServer.Location = new System.Drawing.Point(484, 18); this.rbGridServer.Location = new System.Drawing.Point(484, 18);
this.rbGridServer.Name = "rbGridServer"; this.rbGridServer.Name = "rbGridServer";
this.rbGridServer.Size = new System.Drawing.Size(76, 17); this.rbGridServer.Size = new System.Drawing.Size(76, 17);
this.rbGridServer.TabIndex = 6; this.rbGridServer.TabIndex = 6;
this.rbGridServer.Text = "Grid server"; this.rbGridServer.Text = "Grid server";
this.rbGridServer.UseVisualStyleBackColor = true; this.rbGridServer.UseVisualStyleBackColor = true;
this.rbGridServer.CheckedChanged += new System.EventHandler(this.rbGridServer_CheckedChanged); this.rbGridServer.CheckedChanged += new System.EventHandler(this.rbGridServer_CheckedChanged);
// //
// Main // Main
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(583, 299); this.ClientSize = new System.Drawing.Size(583, 299);
this.Controls.Add(this.rbGridServer); this.Controls.Add(this.rbGridServer);
this.Controls.Add(this.rbStandAloneMode); this.Controls.Add(this.rbStandAloneMode);
this.Controls.Add(this.rbGridRegionMode); this.Controls.Add(this.rbGridRegionMode);
this.Controls.Add(this.btnStop); this.Controls.Add(this.btnStop);
this.Controls.Add(this.btnStart); this.Controls.Add(this.btnStart);
this.Controls.Add(this.gbLog); this.Controls.Add(this.gbLog);
this.Name = "Main"; this.Name = "Main";
this.Text = "OpenSim"; this.Text = "OpenSim";
this.Load += new System.EventHandler(this.Main_Load); this.Load += new System.EventHandler(this.Main_Load);
this.tabLogs.ResumeLayout(false); this.tabLogs.ResumeLayout(false);
this.tabMainLog.ResumeLayout(false); this.tabMainLog.ResumeLayout(false);
this.tabMainLog.PerformLayout(); this.tabMainLog.PerformLayout();
this.tabRegionServer.ResumeLayout(false); this.tabRegionServer.ResumeLayout(false);
this.tabRegionServer.PerformLayout(); this.tabRegionServer.PerformLayout();
this.tabUserServer.ResumeLayout(false); this.tabUserServer.ResumeLayout(false);
this.tabUserServer.PerformLayout(); this.tabUserServer.PerformLayout();
this.tabAssetServer.ResumeLayout(false); this.tabAssetServer.ResumeLayout(false);
this.tabAssetServer.PerformLayout(); this.tabAssetServer.PerformLayout();
this.tabGridServer.ResumeLayout(false); this.tabGridServer.ResumeLayout(false);
this.tabGridServer.PerformLayout(); this.tabGridServer.PerformLayout();
this.gbLog.ResumeLayout(false); this.gbLog.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.TabControl tabLogs; private System.Windows.Forms.TabControl tabLogs;
private System.Windows.Forms.TabPage tabRegionServer; private System.Windows.Forms.TabPage tabRegionServer;
private System.Windows.Forms.TabPage tabUserServer; private System.Windows.Forms.TabPage tabUserServer;
private System.Windows.Forms.GroupBox gbLog; private System.Windows.Forms.GroupBox gbLog;
private System.Windows.Forms.TextBox txtOpenSim; private System.Windows.Forms.TextBox txtOpenSim;
private System.Windows.Forms.TextBox txtUserServer; private System.Windows.Forms.TextBox txtUserServer;
private System.Windows.Forms.TabPage tabAssetServer; private System.Windows.Forms.TabPage tabAssetServer;
private System.Windows.Forms.TextBox txtAssetServer; private System.Windows.Forms.TextBox txtAssetServer;
private System.Windows.Forms.TabPage tabGridServer; private System.Windows.Forms.TabPage tabGridServer;
private System.Windows.Forms.TextBox txtGridServer; private System.Windows.Forms.TextBox txtGridServer;
private System.Windows.Forms.TabPage tabMainLog; private System.Windows.Forms.TabPage tabMainLog;
private System.Windows.Forms.Button btnStart; private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnStop; private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.TextBox txtMainLog; private System.Windows.Forms.TextBox txtMainLog;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private InputTextBoxControl txtInputRegionServer; private InputTextBoxControl txtInputRegionServer;
private InputTextBoxControl txtInputUserServer; private InputTextBoxControl txtInputUserServer;
private InputTextBoxControl txtInputAssetServer; private InputTextBoxControl txtInputAssetServer;
private InputTextBoxControl txtInputGridServer; private InputTextBoxControl txtInputGridServer;
private System.Windows.Forms.RadioButton rbGridRegionMode; private System.Windows.Forms.RadioButton rbGridRegionMode;
private System.Windows.Forms.RadioButton rbStandAloneMode; private System.Windows.Forms.RadioButton rbStandAloneMode;
private System.Windows.Forms.RadioButton rbGridServer; private System.Windows.Forms.RadioButton rbGridServer;
} }
} }

View File

@ -1,242 +1,242 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
public partial class Main : Form public partial class Main : Form
{ {
public ProcessManager proc_OpenSim; public ProcessManager proc_OpenSim;
public ProcessManager proc_UserServer; public ProcessManager proc_UserServer;
public ProcessManager proc_GridServer; public ProcessManager proc_GridServer;
public ProcessManager proc_AssetServer; public ProcessManager proc_AssetServer;
public Main() public Main()
{ {
InitializeComponent(); InitializeComponent();
} }
private void Main_Load(object sender, EventArgs e) private void Main_Load(object sender, EventArgs e)
{ {
txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress); txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress);
txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress); txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress);
txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress); txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress);
txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress); txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress);
tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected); tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected);
UpdateTabVisibility(); UpdateTabVisibility();
} }
void tabLogs_Selected(object sender, TabControlEventArgs e) void tabLogs_Selected(object sender, TabControlEventArgs e)
{ {
if (e.TabPage == tabUserServer) if (e.TabPage == tabUserServer)
txtInputUserServer.Focus(); txtInputUserServer.Focus();
if (e.TabPage == tabGridServer) if (e.TabPage == tabGridServer)
txtInputGridServer.Focus(); txtInputGridServer.Focus();
if (e.TabPage == tabAssetServer) if (e.TabPage == tabAssetServer)
txtInputAssetServer.Focus(); txtInputAssetServer.Focus();
if (e.TabPage == tabRegionServer) if (e.TabPage == tabRegionServer)
txtInputRegionServer.Focus(); txtInputRegionServer.Focus();
} }
void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e) void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == 13) if (e.KeyChar == 13)
{ {
// We got a command // We got a command
e.Handled = true; e.Handled = true;
proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n"); proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n");
txtInputUserServer.Text = ""; txtInputUserServer.Text = "";
} }
} }
void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e) void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == 13) if (e.KeyChar == 13)
{ {
// We got a command // We got a command
e.Handled = true; e.Handled = true;
proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n"); proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n");
txtInputGridServer.Text = ""; txtInputGridServer.Text = "";
} }
} }
void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e) void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == 13) if (e.KeyChar == 13)
{ {
// We got a command // We got a command
e.Handled = true; e.Handled = true;
proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n"); proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n");
txtInputAssetServer.Text = ""; txtInputAssetServer.Text = "";
} }
} }
void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e) void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e)
{ {
if (e.KeyChar == 13) if (e.KeyChar == 13)
{ {
// We got a command // We got a command
e.Handled = true; e.Handled = true;
proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n"); proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n");
txtInputRegionServer.Text = ""; txtInputRegionServer.Text = "";
} }
} }
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
// //
// THIS PART NEEDS TO BE MOVED TO A SEPARATE THREAD OR A TIMER OF SOME SORT // THIS PART NEEDS TO BE MOVED TO A SEPARATE THREAD OR A TIMER OF SOME SORT
// should not block on wait // should not block on wait
// ALSO - IF SOME SERVICES ARE NOT CONFIGURED, POP UP CONFIGURATION BOX FOR THAT SERVICE! // ALSO - IF SOME SERVICES ARE NOT CONFIGURED, POP UP CONFIGURATION BOX FOR THAT SERVICE!
// //
btnStart.Enabled = false; btnStart.Enabled = false;
btnStop.Enabled = false; btnStop.Enabled = false;
if (rbGridServer.Checked) if (rbGridServer.Checked)
{ {
// Start UserServer // Start UserServer
proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", ""); proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", "");
txtMainLog.AppendText("Starting: User server" + "\r\n"); txtMainLog.AppendText("Starting: User server" + "\r\n");
proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
proc_UserServer.StartProcess(); proc_UserServer.StartProcess();
System.Threading.Thread.Sleep(3000); System.Threading.Thread.Sleep(3000);
// Start GridServer // Start GridServer
proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", ""); proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", "");
txtMainLog.AppendText("Starting: Grid server" + "\r\n"); txtMainLog.AppendText("Starting: Grid server" + "\r\n");
proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
proc_GridServer.StartProcess(); proc_GridServer.StartProcess();
System.Threading.Thread.Sleep(3000); System.Threading.Thread.Sleep(3000);
// Start AssetServer // Start AssetServer
proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", ""); proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", "");
txtMainLog.AppendText("Starting: Asset server" + "\r\n"); txtMainLog.AppendText("Starting: Asset server" + "\r\n");
proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
proc_AssetServer.StartProcess(); proc_AssetServer.StartProcess();
System.Threading.Thread.Sleep(3000); System.Threading.Thread.Sleep(3000);
} }
// Start OpenSim // Start OpenSim
string p = ""; string p = "";
if (rbGridServer.Checked) if (rbGridServer.Checked)
p = "-gridmode=true"; p = "-gridmode=true";
proc_OpenSim = new ProcessManager("OpenSim.EXE", p); proc_OpenSim = new ProcessManager("OpenSim.EXE", p);
txtMainLog.AppendText("Starting: OpenSim (Region server)" + "\r\n"); txtMainLog.AppendText("Starting: OpenSim (Region server)" + "\r\n");
proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
proc_OpenSim.StartProcess(); proc_OpenSim.StartProcess();
btnStart.Enabled = false; btnStart.Enabled = false;
btnStop.Enabled = true; btnStop.Enabled = true;
} }
public delegate void AppendText(string Text); public delegate void AppendText(string Text);
void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{ {
this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" }); this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" });
this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" }); this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" });
} }
void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{ {
this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" }); this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" });
this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" }); this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" });
} }
void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{ {
this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" }); this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" });
this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" }); this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" });
} }
void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{ {
this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" }); this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" });
this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" }); this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" });
} }
private void btnStop_Click(object sender, EventArgs e) private void btnStop_Click(object sender, EventArgs e)
{ {
btnStart.Enabled = false; btnStart.Enabled = false;
btnStop.Enabled = false; btnStop.Enabled = false;
if (proc_UserServer != null) if (proc_UserServer != null)
{ {
txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime.ToString() + "\r\n"); txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime.ToString() + "\r\n");
proc_UserServer.StopProcess(); proc_UserServer.StopProcess();
} }
if (proc_GridServer != null) if (proc_GridServer != null)
{ {
txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime.ToString() + "\r\n"); txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime.ToString() + "\r\n");
proc_GridServer.StopProcess(); proc_GridServer.StopProcess();
} }
if (proc_AssetServer != null) if (proc_AssetServer != null)
{ {
txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime.ToString() + "\r\n"); txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime.ToString() + "\r\n");
proc_AssetServer.StopProcess(); proc_AssetServer.StopProcess();
} }
if (proc_OpenSim != null) if (proc_OpenSim != null)
{ {
txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime.ToString() + "\r\n"); txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime.ToString() + "\r\n");
proc_OpenSim.StopProcess(); proc_OpenSim.StopProcess();
} }
btnStart.Enabled = true; btnStart.Enabled = true;
btnStop.Enabled = false; btnStop.Enabled = false;
} }
private void UpdateTabVisibility() private void UpdateTabVisibility()
{ {
if (rbStandAloneMode.Checked) if (rbStandAloneMode.Checked)
{ {
if (tabLogs.TabPages.Contains(tabUserServer)) if (tabLogs.TabPages.Contains(tabUserServer))
tabLogs.TabPages.Remove(tabUserServer); tabLogs.TabPages.Remove(tabUserServer);
if (tabLogs.TabPages.Contains(tabGridServer)) if (tabLogs.TabPages.Contains(tabGridServer))
tabLogs.TabPages.Remove(tabGridServer); tabLogs.TabPages.Remove(tabGridServer);
if (tabLogs.TabPages.Contains(tabAssetServer)) if (tabLogs.TabPages.Contains(tabAssetServer))
tabLogs.TabPages.Remove(tabAssetServer); tabLogs.TabPages.Remove(tabAssetServer);
} }
else else
{ {
if (!tabLogs.TabPages.Contains(tabUserServer)) if (!tabLogs.TabPages.Contains(tabUserServer))
tabLogs.TabPages.Add(tabUserServer); tabLogs.TabPages.Add(tabUserServer);
if (!tabLogs.TabPages.Contains(tabGridServer)) if (!tabLogs.TabPages.Contains(tabGridServer))
tabLogs.TabPages.Add(tabGridServer); tabLogs.TabPages.Add(tabGridServer);
if (!tabLogs.TabPages.Contains(tabAssetServer)) if (!tabLogs.TabPages.Contains(tabAssetServer))
tabLogs.TabPages.Add(tabAssetServer); tabLogs.TabPages.Add(tabAssetServer);
} }
} }
private void rbStandAloneMode_CheckedChanged(object sender, EventArgs e) private void rbStandAloneMode_CheckedChanged(object sender, EventArgs e)
{ {
UpdateTabVisibility(); UpdateTabVisibility();
} }
private void rbGridRegionMode_CheckedChanged(object sender, EventArgs e) private void rbGridRegionMode_CheckedChanged(object sender, EventArgs e)
{ {
UpdateTabVisibility(); UpdateTabVisibility();
} }
private void rbGridServer_CheckedChanged(object sender, EventArgs e) private void rbGridServer_CheckedChanged(object sender, EventArgs e)
{ {
UpdateTabVisibility(); UpdateTabVisibility();
} }
} }
} }

View File

@ -1,71 +1,71 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
public class ProcessManager : Process public class ProcessManager : Process
{ {
private string m_FileName; private string m_FileName;
private string m_Arguments; private string m_Arguments;
public ProcessManager(string FileName,string Arguments) public ProcessManager(string FileName,string Arguments)
{ {
m_FileName = FileName; m_FileName = FileName;
m_Arguments = Arguments; m_Arguments = Arguments;
// MyProc = new Process(); // MyProc = new Process();
StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory);
StartInfo.FileName = m_FileName; StartInfo.FileName = m_FileName;
//p.StartInfo.Arguments = ""; //p.StartInfo.Arguments = "";
StartInfo.UseShellExecute = false; StartInfo.UseShellExecute = false;
StartInfo.RedirectStandardError = true; StartInfo.RedirectStandardError = true;
StartInfo.RedirectStandardInput = true; StartInfo.RedirectStandardInput = true;
StartInfo.RedirectStandardOutput = true; StartInfo.RedirectStandardOutput = true;
StartInfo.CreateNoWindow = true; StartInfo.CreateNoWindow = true;
} }
public void StartProcess() public void StartProcess()
{ {
try try
{ {
Start(); Start();
BeginOutputReadLine(); BeginOutputReadLine();
BeginErrorReadLine(); BeginErrorReadLine();
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Exception Occurred :{0},{1}", Console.WriteLine("Exception Occurred :{0},{1}",
ex.Message, ex.StackTrace.ToString()); ex.Message, ex.StackTrace.ToString());
} }
} }
public void StopProcess() public void StopProcess()
{ {
try try
{ {
CancelErrorRead(); CancelErrorRead();
CancelErrorRead(); CancelErrorRead();
if (!HasExited) if (!HasExited)
{ {
StandardInput.WriteLine("quit"); StandardInput.WriteLine("quit");
StandardInput.WriteLine("shutdown"); StandardInput.WriteLine("shutdown");
System.Threading.Thread.Sleep(500); System.Threading.Thread.Sleep(500);
if (!HasExited) if (!HasExited)
{ {
Kill(); Kill();
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Exception Occurred :{0},{1}", Console.WriteLine("Exception Occurred :{0},{1}",
ex.Message, ex.StackTrace.ToString()); ex.Message, ex.StackTrace.ToString());
} }
} }
} }
} }

View File

@ -1,20 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
static class Program static class Program
{ {
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main()); Application.Run(new Main());
} }
} }
} }

View File

@ -1,33 +1,33 @@
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.GUI")] [assembly: AssemblyTitle("OpenSim.GUI")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.GUI")] [assembly: AssemblyProduct("OpenSim.GUI")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // 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 // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c8dbda49-66bd-476b-93b3-71774870b73e")] [assembly: Guid("c8dbda49-66bd-476b-93b3-71774870b73e")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,71 +1,71 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.312 // Runtime Version:2.0.50727.312
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OpenSim.GUI.Properties namespace OpenSim.GUI.Properties
{ {
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder // This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources
{ {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources()
{ {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager
{ {
get get
{ {
if ((resourceMan == null)) if ((resourceMan == null))
{ {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSim.GUI.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSim.GUI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture
{ {
get get
{ {
return resourceCulture; return resourceCulture;
} }
set set
{ {
resourceCulture = value; resourceCulture = value;
} }
} }
} }
} }

View File

@ -1,30 +1,30 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.312 // Runtime Version:2.0.50727.312
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace OpenSim.GUI.Properties namespace OpenSim.GUI.Properties
{ {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{ {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default public static Settings Default
{ {
get get
{ {
return defaultInstance; return defaultInstance;
} }
} }
} }
} }

View File

@ -1,61 +1,61 @@
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
partial class frmConfiguration partial class frmConfiguration
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
/// </summary> /// </summary>
private System.ComponentModel.IContainer components = null; private System.ComponentModel.IContainer components = null;
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
if (disposing && (components != null)) if (disposing && (components != null))
{ {
components.Dispose(); components.Dispose();
} }
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmConfiguration)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmConfiguration));
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
// //
this.textBox1.Location = new System.Drawing.Point(12, 12); this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Multiline = true; this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(570, 190); this.textBox1.Size = new System.Drawing.Size(570, 190);
this.textBox1.TabIndex = 0; this.textBox1.TabIndex = 0;
this.textBox1.Text = resources.GetString("textBox1.Text"); this.textBox1.Text = resources.GetString("textBox1.Text");
// //
// frmConfiguration // frmConfiguration
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(664, 413); this.ClientSize = new System.Drawing.Size(664, 413);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Name = "frmConfiguration"; this.Name = "frmConfiguration";
this.Text = "Configuration"; this.Text = "Configuration";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
#endregion #endregion
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
} }
} }

View File

@ -1,18 +1,18 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace OpenSim.GUI namespace OpenSim.GUI
{ {
public partial class frmConfiguration : Form public partial class frmConfiguration : Form
{ {
public frmConfiguration() public frmConfiguration()
{ {
InitializeComponent(); InitializeComponent();
} }
} }
} }