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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,32 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ExtensionsScriptModule
{
// 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.
public class ScriptAPI
{
Scene scene;
ScriptInterpretedAPI interpretedAPI;
public ScriptAPI(Scene world, Key taskID)
{
scene = world;
interpretedAPI = new ScriptInterpretedAPI(world, taskID);
}
public Object CallMethod(String method, Object[] args)
{
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Key = libsecondlife.LLUUID;
using Rotation = libsecondlife.LLQuaternion;
using Vector = libsecondlife.LLVector3;
using LSLList = System.Collections.Generic.List<string>;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.ExtensionsScriptModule
{
// 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.
public class ScriptAPI
{
Scene scene;
ScriptInterpretedAPI interpretedAPI;
public ScriptAPI(Scene world, Key taskID)
{
scene = world;
interpretedAPI = new ScriptInterpretedAPI(world, taskID);
}
public Object CallMethod(String method, Object[] args)
{
return null;
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -612,7 +612,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: integer llGetRegionFlags()
int llGetRegionFlags();
//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);
//wiki: llResetLandBanList()
void llResetLandBanList();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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