Deleted a few old files that are no longer used.

Deleted the GridInterfaces projects, and for now moved the old local asset server into Framework.Communications, as we prepare to rewrite the asset cache and asset server.
Deleted Framework.manager as I am sure this is no longer in use.
afrisby
MW 2007-08-27 15:34:21 +00:00
parent 6181191a03
commit 653a4ff22d
23 changed files with 408 additions and 2719 deletions

View File

@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Caches
/// </summary>
public AssetCache(IAssetServer assetServer)
{
Console.WriteLine("Creating Asset cache");
System.Console.WriteLine("Creating Asset cache");
_assetServer = assetServer;
_assetServer.SetReceiver(this);
Assets = new Dictionary<LLUUID, AssetInfo>();
@ -89,7 +89,7 @@ namespace OpenSim.Framework.Communications.Caches
public AssetCache(string assetServerDLLName, string assetServerURL, string assetServerKey)
{
Console.WriteLine("Creating Asset cache");
System.Console.WriteLine("Creating Asset cache");
_assetServer = this.LoadAssetDll(assetServerDLLName);
_assetServer.SetServerInfo(assetServerURL, assetServerKey);
_assetServer.SetReceiver(this);
@ -119,7 +119,7 @@ namespace OpenSim.Framework.Communications.Caches
}
catch (Exception e)
{
Console.WriteLine(e.Message + " : " + e.StackTrace);
System.Console.WriteLine(e.Message + " : " + e.StackTrace);
}
}
}

View File

@ -1,403 +1,392 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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.Region.GridInterfaces.Local
{
public class LocalAssetPlugin : IAssetPlugin
{
public LocalAssetPlugin()
{
}
public IAssetServer GetAssetServer()
{
return (new LocalAssetServer());
}
}
public class LocalAssetServer : IAssetServer
{
private IAssetReceiver _receiver;
private BlockingQueue<ARequest> _assetRequests;
private IObjectContainer db;
private Thread _localAssetServerThread;
public LocalAssetServer()
{
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 RequestAsset(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 UploadNewAsset(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://www.openmetaverse.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()
{
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 RequestAsset(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 UploadNewAsset(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

@ -70,7 +70,7 @@ namespace OpenSim.Framework.Communications.Caches
}
else
{
Console.WriteLine("CACHE", "User profile for user not found");
System.Console.WriteLine("CACHE", "User profile for user not found");
}
}
}

View File

@ -1,228 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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 libsecondlife;
namespace OpenSim.Framework.Types
{
public class PrimData
{
private const uint FULL_MASK_PERMISSIONS = 2147483647;
public LLUUID OwnerID;
public byte PCode;
public ushort PathBegin;
public ushort PathEnd;
public byte PathScaleX;
public byte PathScaleY;
public byte PathShearX;
public byte PathShearY;
public sbyte PathSkew;
public ushort ProfileBegin;
public ushort ProfileEnd;
public LLVector3 Scale;
public byte PathCurve;
public byte ProfileCurve;
public uint ParentID = 0;
public ushort ProfileHollow;
public sbyte PathRadiusOffset;
public byte PathRevolutions;
public sbyte PathTaperX;
public sbyte PathTaperY;
public sbyte PathTwist;
public sbyte PathTwistBegin;
public byte[] TextureEntry; // a LL textureEntry in byte[] format
public Int32 CreationDate;
public uint OwnerMask = FULL_MASK_PERMISSIONS;
public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
public uint GroupMask = FULL_MASK_PERMISSIONS;
public uint EveryoneMask = FULL_MASK_PERMISSIONS;
public uint BaseMask = FULL_MASK_PERMISSIONS;
//following only used during prim storage
public LLVector3 Position;
public LLQuaternion Rotation = new LLQuaternion(0, 1, 0, 0);
public uint LocalID;
public LLUUID FullID;
public PrimData()
{
}
public PrimData(byte[] data)
{
int i = 0;
this.OwnerID = new LLUUID(data, i); i += 16;
this.PCode = data[i++];
this.PathBegin = (ushort)(data[i++] + (data[i++] << 8));
this.PathEnd = (ushort)(data[i++] + (data[i++] << 8));
this.PathScaleX = data[i++];
this.PathScaleY = data[i++];
this.PathShearX = data[i++];
this.PathShearY = data[i++];
this.PathSkew = (sbyte)data[i++];
this.ProfileBegin = (ushort)(data[i++] + (data[i++] << 8));
this.ProfileEnd = (ushort)(data[i++] + (data[i++] << 8));
this.Scale = new LLVector3(data, i); i += 12;
this.PathCurve = data[i++];
this.ProfileCurve = data[i++];
this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.ProfileHollow = (ushort)(data[i++] + (data[i++] << 8));
this.PathRadiusOffset = (sbyte)data[i++];
this.PathRevolutions = data[i++];
this.PathTaperX = (sbyte)data[i++];
this.PathTaperY = (sbyte)data[i++];
this.PathTwist = (sbyte)data[i++];
this.PathTwistBegin = (sbyte)data[i++];
ushort length = (ushort)(data[i++] + (data[i++] << 8));
this.TextureEntry = new byte[length];
Array.Copy(data, i, TextureEntry, 0, length); i += length;
this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.Position = new LLVector3(data, i); i += 12;
this.Rotation = new LLQuaternion(data, i, true); i += 12;
this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24));
this.FullID = new LLUUID(data, i); i += 16;
}
public byte[] ToBytes()
{
int i = 0;
byte[] bytes = new byte[126 + TextureEntry.Length];
Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16;
bytes[i++] = this.PCode;
bytes[i++] = (byte)(this.PathBegin % 256);
bytes[i++] = (byte)((this.PathBegin >> 8) % 256);
bytes[i++] = (byte)(this.PathEnd % 256);
bytes[i++] = (byte)((this.PathEnd >> 8) % 256);
bytes[i++] = this.PathScaleX;
bytes[i++] = this.PathScaleY;
bytes[i++] = this.PathShearX;
bytes[i++] = this.PathShearY;
bytes[i++] = (byte)this.PathSkew;
bytes[i++] = (byte)(this.ProfileBegin % 256);
bytes[i++] = (byte)((this.ProfileBegin >> 8) % 256);
bytes[i++] = (byte)(this.ProfileEnd % 256);
bytes[i++] = (byte)((this.ProfileEnd >> 8) % 256);
Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = this.PathCurve;
bytes[i++] = this.ProfileCurve;
bytes[i++] = (byte)(ParentID % 256);
bytes[i++] = (byte)((ParentID >> 8) % 256);
bytes[i++] = (byte)((ParentID >> 16) % 256);
bytes[i++] = (byte)((ParentID >> 24) % 256);
bytes[i++] = (byte)(this.ProfileHollow % 256);
bytes[i++] = (byte)((this.ProfileHollow >> 8) % 256);
bytes[i++] = ((byte)this.PathRadiusOffset);
bytes[i++] = this.PathRevolutions;
bytes[i++] = ((byte)this.PathTaperX);
bytes[i++] = ((byte)this.PathTaperY);
bytes[i++] = ((byte)this.PathTwist);
bytes[i++] = ((byte)this.PathTwistBegin);
bytes[i++] = (byte)(TextureEntry.Length % 256);
bytes[i++] = (byte)((TextureEntry.Length >> 8) % 256);
Array.Copy(TextureEntry, 0, bytes, i, TextureEntry.Length); i += TextureEntry.Length;
bytes[i++] = (byte)(this.CreationDate % 256);
bytes[i++] = (byte)((this.CreationDate >> 8) % 256);
bytes[i++] = (byte)((this.CreationDate >> 16) % 256);
bytes[i++] = (byte)((this.CreationDate >> 24) % 256);
bytes[i++] = (byte)(this.OwnerMask % 256);
bytes[i++] = (byte)((this.OwnerMask >> 8) % 256);
bytes[i++] = (byte)((this.OwnerMask >> 16) % 256);
bytes[i++] = (byte)((this.OwnerMask >> 24) % 256);
bytes[i++] = (byte)(this.NextOwnerMask % 256);
bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256);
bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256);
bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256);
bytes[i++] = (byte)(this.GroupMask % 256);
bytes[i++] = (byte)((this.GroupMask >> 8) % 256);
bytes[i++] = (byte)((this.GroupMask >> 16) % 256);
bytes[i++] = (byte)((this.GroupMask >> 24) % 256);
bytes[i++] = (byte)(this.EveryoneMask % 256);
bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256);
bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256);
bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256);
bytes[i++] = (byte)(this.BaseMask % 256);
bytes[i++] = (byte)((this.BaseMask >> 8) % 256);
bytes[i++] = (byte)((this.BaseMask >> 16) % 256);
bytes[i++] = (byte)((this.BaseMask >> 24) % 256);
Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12;
if (this.Rotation == new LLQuaternion(0, 0, 0, 0))
{
this.Rotation = new LLQuaternion(0, 1, 0, 0);
}
Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12;
bytes[i++] = (byte)(this.LocalID % 256);
bytes[i++] = (byte)((this.LocalID >> 8) % 256);
bytes[i++] = (byte)((this.LocalID >> 16) % 256);
bytes[i++] = (byte)((this.LocalID >> 24) % 256);
Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16;
return bytes;
}
//public static PrimData DefaultCube()
//{
// PrimData primData = new PrimData();
// primData.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
// primData.FullID = LLUUID.Random();
// primData.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
// primData.Rotation = new LLQuaternion(0, 0, 0, 1);
// primData.PCode = 9;
// primData.ParentID = 0;
// primData.PathBegin = 0;
// primData.PathEnd = 0;
// primData.PathScaleX = 0;
// primData.PathScaleY = 0;
// primData.PathShearX = 0;
// primData.PathShearY = 0;
// primData.PathSkew = 0;
// primData.ProfileBegin = 0;
// primData.ProfileEnd = 0;
// primData.PathCurve = 16;
// primData.ProfileCurve = 1;
// primData.ProfileHollow = 0;
// primData.PathRadiusOffset = 0;
// primData.PathRevolutions = 0;
// primData.PathTaperX = 0;
// primData.PathTaperY = 0;
// primData.PathTwist = 0;
// primData.PathTwistBegin = 0;
// return primData;
//}
}
}

View File

@ -216,7 +216,7 @@ namespace OpenSim.Framework.Types
configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false);
configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false);
configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false);
configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "localworld.yap", false);
configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false);
configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false);
configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", "9000", false);
configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false);

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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 System.Security.Cryptography;
using libsecondlife;
using OpenSim.Framework.Inventory;
namespace OpenSim.Framework.User
{
public class UserProfile
{
public string firstname;
public string lastname;
public ulong homeregionhandle;
public LLVector3 homepos;
public LLVector3 homelookat;
public bool IsGridGod = false;
public bool IsLocal = true; // will be used in future for visitors from foreign grids
public string AssetURL;
public string MD5passwd;
public LLUUID CurrentSessionID;
public LLUUID CurrentSecureSessionID;
public LLUUID UUID;
public Dictionary<LLUUID, uint> Circuits = new Dictionary<LLUUID, uint>(); // tracks circuit codes
public AgentInventory Inventory;
public UserProfile()
{
Circuits = new Dictionary<LLUUID, uint>();
Inventory = new AgentInventory();
homeregionhandle = Helpers.UIntsToLong((1000 * 256), (1000 * 256));
homepos = new LLVector3();
homelookat = new LLVector3();
}
public void InitSessionData()
{
RNGCryptoServiceProvider rand = new RNGCryptoServiceProvider();
byte[] randDataS = new byte[16];
byte[] randDataSS = new byte[16];
rand.GetBytes(randDataS);
rand.GetBytes(randDataSS);
CurrentSecureSessionID = new LLUUID(randDataSS,0);
CurrentSessionID = new LLUUID(randDataS,0);
}
public void AddSimCircuit(uint circuitCode, LLUUID regionUUID)
{
if (this.Circuits.ContainsKey(regionUUID) == false)
this.Circuits.Add(regionUUID, circuitCode);
}
}
}

View File

@ -1,138 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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;
using libsecondlife;
using Nwc.XmlRpc;
using OpenSim.Framework.Servers;
namespace OpenSim.Framework.Manager
{
/// <summary>
/// Used to pass messages to the gridserver
/// </summary>
/// <param name="param">Pass this argument</param>
public delegate void GridManagerCallback(string param);
/// <summary>
/// Serverside listener for grid commands
/// </summary>
public class GridManagementAgent
{
/// <summary>
/// Passes grid server messages
/// </summary>
private GridManagerCallback thecallback;
/// <summary>
/// Security keys
/// </summary>
private string sendkey;
private string recvkey;
/// <summary>
/// Our component type
/// </summary>
private string component_type;
/// <summary>
/// List of active sessions
/// </summary>
private static ArrayList Sessions;
/// <summary>
/// Initialises a new GridManagementAgent
/// </summary>
/// <param name="app_httpd">HTTP Daemon for this server</param>
/// <param name="component_type">What component type are we?</param>
/// <param name="sendkey">Security send key</param>
/// <param name="recvkey">Security recieve key</param>
/// <param name="thecallback">Message callback</param>
public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
{
this.sendkey = sendkey;
this.recvkey = recvkey;
this.component_type = component_type;
this.thecallback = thecallback;
Sessions = new ArrayList();
app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
switch (component_type)
{
case "gridserver":
GridServerManager.sendkey = this.sendkey;
GridServerManager.recvkey = this.recvkey;
GridServerManager.thecallback = thecallback;
app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
break;
}
}
/// <summary>
/// Checks if a session exists
/// </summary>
/// <param name="sessionID">The session ID</param>
/// <returns>Exists?</returns>
public static bool SessionExists(LLUUID sessionID)
{
return Sessions.Contains(sessionID);
}
/// <summary>
/// Logs a new session to the grid manager
/// </summary>
/// <param name="request">the XMLRPC request</param>
/// <returns>An XMLRPC reply</returns>
public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable();
// TODO: Switch this over to using OpenSim.Framework.Data
if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
{
response.IsFault = false;
LLUUID new_session = LLUUID.Random();
Sessions.Add(new_session);
responseData["session_id"] = new_session.ToString();
responseData["msg"] = "Login OK";
}
else
{
response.IsFault = true;
responseData["error"] = "Invalid username or password";
}
response.Value = responseData;
return response;
}
}
}

View File

@ -1,93 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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;
using System.Threading;
using libsecondlife;
using Nwc.XmlRpc;
namespace OpenSim.Framework.Manager {
/// <summary>
/// A remote management system for the grid server
/// </summary>
public class GridServerManager
{
/// <summary>
/// Triggers events from the grid manager
/// </summary>
public static GridManagerCallback thecallback;
/// <summary>
/// Security keys
/// </summary>
public static string sendkey;
public static string recvkey;
/// <summary>
/// Disconnects the grid server and shuts it down
/// </summary>
/// <param name="request">XmlRpc Request</param>
/// <returns>An XmlRpc response containing either a "msg" or an "error"</returns>
public static XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0];
Hashtable responseData = new Hashtable();
if(requestData.ContainsKey("session_id")) {
if(GridManagementAgent.SessionExists(new LLUUID((string)requestData["session_id"]))) {
responseData["msg"]="Shutdown command accepted";
(new Thread(new ThreadStart(ShutdownServer))).Start();
} else {
response.IsFault=true;
responseData["error"]="bad session ID";
}
} else {
response.IsFault=true;
responseData["error"]="no session ID";
}
response.Value = responseData;
return response;
}
/// <summary>
/// Shuts down the grid server
/// </summary>
public static void ShutdownServer()
{
Console.WriteLine("Shutting down the grid server - recieved a grid manager request");
Console.WriteLine("Terminating in three seconds...");
Thread.Sleep(3000);
thecallback("shutdown");
}
}
}

View File

@ -34,7 +34,6 @@ using libsecondlife;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers;
using OpenSim.Framework.User;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Configuration;
@ -49,8 +48,6 @@ namespace OpenSim.Grid.UserServer
public UserManager m_userManager;
public UserLoginService m_loginService;
public Dictionary<LLUUID, UserProfile> UserSessions = new Dictionary<LLUUID, UserProfile>();
LogBase m_console;
[STAThread]

View File

@ -231,7 +231,11 @@ namespace OpenSim
protected override void Initialize()
{
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
LocalAssetServer assetServer = new LocalAssetServer();
assetServer.SetServerInfo(m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
m_assetCache = new AssetCache(assetServer);
// m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
}
protected override LogBase CreateLog()

View File

@ -1,357 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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 libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Communications.Caches;
namespace OpenSim.Region.ClientStack
{
partial class ClientView
{
public class AgentAssetUpload
{
private Dictionary<LLUUID, AssetTransaction> transactions = new Dictionary<LLUUID, AssetTransaction>();
private ClientView ourClient;
private AssetCache m_assetCache;
// private InventoryCache m_inventoryCache;
public AgentAssetUpload(ClientView client, AssetCache assetCache )
{
this.ourClient = client;
m_assetCache = assetCache;
// m_inventoryCache = inventoryCache;
}
public void AddUpload(LLUUID transactionID, AssetBase asset)
{
AssetTransaction upload = new AssetTransaction();
lock (this.transactions)
{
upload.Asset = asset;
upload.TransactionID = transactionID;
this.transactions.Add(transactionID, upload);
}
if (upload.Asset.Data.Length > 2)
{
//is complete
upload.UploadComplete = true;
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
response.AssetBlock.Type = asset.Type;
response.AssetBlock.Success = true;
response.AssetBlock.UUID = transactionID.Combine(this.ourClient.SecureSessionID);
this.ourClient.OutPacket(response);
m_assetCache.AddAsset(asset);
}
else
{
upload.UploadComplete = false;
upload.XferID = Util.GetNextXferID();
RequestXferPacket xfer = new RequestXferPacket();
xfer.XferID.ID = upload.XferID;
xfer.XferID.VFileType = upload.Asset.Type;
xfer.XferID.VFileID = transactionID.Combine(this.ourClient.SecureSessionID);
xfer.XferID.FilePath = 0;
xfer.XferID.Filename = new byte[0];
this.ourClient.OutPacket(xfer);
}
}
public AssetBase GetUpload(LLUUID transactionID)
{
if (this.transactions.ContainsKey(transactionID))
{
return this.transactions[transactionID].Asset;
}
return null;
}
public void HandleUploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
{
// Console.Write("asset upload request , type = " + pack.AssetBlock.Type.ToString());
AssetBase asset = null;
if (pack.AssetBlock.Type == 0)
{
//first packet for transaction
asset = new AssetBase();
asset.FullID = assetID;
asset.Type = pack.AssetBlock.Type;
asset.InvType = asset.Type;
asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
asset.Data = pack.AssetBlock.AssetData;
}
else if (pack.AssetBlock.Type == 13 | pack.AssetBlock.Type == 5 | pack.AssetBlock.Type == 7)
{
asset = new AssetBase();
asset.FullID = assetID;
// Console.WriteLine("skin asset id is " + assetID.ToStringHyphenated());
asset.Type = pack.AssetBlock.Type;
asset.InvType = asset.Type;
asset.Name = "NewClothing" + Util.RandomClass.Next(1, 1000).ToString("000");
asset.Data = pack.AssetBlock.AssetData;
}
if (asset != null)
{
this.AddUpload(pack.AssetBlock.TransactionID, asset);
}
else
{
//currently we don't support this asset type
//so lets just tell the client that the upload is complete
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
response.AssetBlock.Type = pack.AssetBlock.Type;
response.AssetBlock.Success = true;
response.AssetBlock.UUID = pack.AssetBlock.TransactionID.Combine(this.ourClient.SecureSessionID);
this.ourClient.OutPacket(response);
}
}
#region Xfer packet system for larger uploads
public void HandleXferPacket(SendXferPacketPacket xferPacket)
{
lock (this.transactions)
{
foreach (AssetTransaction trans in this.transactions.Values)
{
if (trans.XferID == xferPacket.XferID.ID)
{
if (trans.Asset.Data.Length > 1)
{
byte[] newArray = new byte[trans.Asset.Data.Length + xferPacket.DataPacket.Data.Length];
Array.Copy(trans.Asset.Data, 0, newArray, 0, trans.Asset.Data.Length);
Array.Copy(xferPacket.DataPacket.Data, 0, newArray, trans.Asset.Data.Length, xferPacket.DataPacket.Data.Length);
trans.Asset.Data = newArray;
}
else
{
byte[] newArray = new byte[xferPacket.DataPacket.Data.Length - 4];
Array.Copy(xferPacket.DataPacket.Data, 4, newArray, 0, xferPacket.DataPacket.Data.Length - 4);
trans.Asset.Data = newArray;
}
if ((xferPacket.XferID.Packet & 2147483648) != 0)
{
//end of transfer
trans.UploadComplete = true;
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
response.AssetBlock.Type = trans.Asset.Type;
response.AssetBlock.Success = true;
response.AssetBlock.UUID = trans.TransactionID.Combine(this.ourClient.SecureSessionID);
this.ourClient.OutPacket(response);
m_assetCache.AddAsset(trans.Asset);
//check if we should add it to inventory
if (trans.AddToInventory)
{
// m_assetCache.AddAsset(trans.Asset);
//m_inventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset);
}
}
break;
}
}
}
ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
confirmXfer.XferID.ID = xferPacket.XferID.ID;
confirmXfer.XferID.Packet = xferPacket.XferID.Packet;
this.ourClient.OutPacket(confirmXfer);
}
#endregion
public AssetBase AddUploadToAssetCache(LLUUID transactionID)
{
AssetBase asset = null;
if (this.transactions.ContainsKey(transactionID))
{
AssetTransaction trans = this.transactions[transactionID];
if (trans.UploadComplete)
{
m_assetCache.AddAsset(trans.Asset);
asset = trans.Asset;
}
}
return asset;
}
public void CreateInventoryItem(CreateInventoryItemPacket packet)
{
if (this.transactions.ContainsKey(packet.InventoryBlock.TransactionID))
{
AssetTransaction trans = this.transactions[packet.InventoryBlock.TransactionID];
trans.Asset.Description = Util.FieldToString(packet.InventoryBlock.Description);
trans.Asset.Name = Util.FieldToString(packet.InventoryBlock.Name);
trans.Asset.Type = packet.InventoryBlock.Type;
trans.Asset.InvType = packet.InventoryBlock.InvType;
if (trans.UploadComplete)
{
//already complete so we can add it to the inventory
//m_assetCache.AddAsset(trans.Asset);
// m_inventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset);
}
else
{
trans.AddToInventory = true;
trans.InventFolder = packet.InventoryBlock.FolderID;
}
}
}
private class AssetTransaction
{
public uint XferID;
public AssetBase Asset;
public bool AddToInventory;
public LLUUID InventFolder = LLUUID.Zero;
public bool UploadComplete = false;
public LLUUID TransactionID = LLUUID.Zero;
public AssetTransaction()
{
}
}
//new class , not currently used.
public class AssetXferUploader
{
private IClientAPI ourClient;
public bool UploadComplete = false;
public bool AddToInventory;
public LLUUID InventFolder = LLUUID.Zero;
public uint XferID;
public AssetBase Asset;
public LLUUID TransactionID = LLUUID.Zero;
public AssetXferUploader(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data)
{
ourClient = remoteClient;
Asset = new AssetBase();
Asset.FullID = assetID;
Asset.InvType = type;
Asset.Type = type;
Asset.Data = data;
Asset.Name = "blank";
Asset.Description = "empty";
TransactionID = transaction;
if (Asset.Data.Length > 2)
{
//data block should only have data in it, if there is no more data to be uploaded
this.SendCompleteMessage();
}
else
{
this.ReqestStartXfer();
}
}
protected void SendCompleteMessage()
{
UploadComplete = true;
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
response.AssetBlock.Type = Asset.Type;
response.AssetBlock.Success = true;
response.AssetBlock.UUID = Asset.FullID;
this.ourClient.OutPacket(response);
//TODO trigger event
}
protected void ReqestStartXfer()
{
UploadComplete = false;
XferID = Util.GetNextXferID();
RequestXferPacket xfer = new RequestXferPacket();
xfer.XferID.ID = XferID;
xfer.XferID.VFileType = Asset.Type;
xfer.XferID.VFileID = Asset.FullID;
xfer.XferID.FilePath = 0;
xfer.XferID.Filename = new byte[0];
this.ourClient.OutPacket(xfer);
}
public void HandleXferPacket(uint xferID, uint packetID, byte[] data)
{
if (XferID == xferID)
{
if (Asset.Data.Length > 1)
{
byte[] newArray = new byte[Asset.Data.Length + data.Length];
Array.Copy(Asset.Data, 0, newArray, 0, Asset.Data.Length);
Array.Copy(data, 0, newArray, Asset.Data.Length, data.Length);
Asset.Data = newArray;
}
else
{
byte[] newArray = new byte[data.Length - 4];
Array.Copy(data, 4, newArray, 0, data.Length - 4);
Asset.Data = newArray;
}
ConfirmXferPacketPacket confirmXfer = new ConfirmXferPacketPacket();
confirmXfer.XferID.ID = xferID;
confirmXfer.XferID.Packet = packetID;
this.ourClient.OutPacket(confirmXfer);
if ((packetID & 2147483648) != 0)
{
this.SendCompleteMessage();
}
}
}
}
}
}
}

View File

@ -1,724 +0,0 @@
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using Axiom.Math;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types;
using InventoryItem = OpenSim.Framework.Inventory.InventoryItem;
namespace OpenSim.Region.Environment.Scenes
{
public delegate void PrimCountTaintedDelegate();
public class Primitive : EntityBase
{
private const uint FULL_MASK_PERMISSIONS = 2147483647;
private LLVector3 m_positionLastFrame = new LLVector3(0, 0, 0);
private ulong m_regionHandle;
private byte m_updateFlag;
private uint m_flags = 32 + 65536 + 131072 + 256 + 4 + 8 + 2048 + 524288 + 268435456 + 128;
private Dictionary<LLUUID, InventoryItem> m_inventoryItems;
private string m_description = "";
public LLUUID CreatorID;
public LLUUID OwnerID;
public LLUUID LastOwnerID;
public Int32 CreationDate;
public uint ParentID = 0;
public uint OwnerMask = FULL_MASK_PERMISSIONS;
public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
public uint GroupMask = 0;// FULL_MASK_PERMISSIONS;
public uint EveryoneMask = 0;//FULL_MASK_PERMISSIONS;
public uint BaseMask = 0;//FULL_MASK_PERMISSIONS;
private PrimitiveBaseShape m_shape;
private byte[] m_particleSystem = new byte[0];
public SceneObjectOLD m_RootParent;
public bool m_isRootPrim;
public EntityBase m_Parent;
public event PrimCountTaintedDelegate OnPrimCountTainted;
#region Properties
/// <summary>
/// If rootprim, will return world position
/// otherwise will return local offset from rootprim
/// </summary>
public override LLVector3 AbsolutePosition
{
get
{
if (m_isRootPrim)
{
//if we are rootprim then our offset should be zero
return m_pos + m_Parent.AbsolutePosition;
}
else
{
return m_pos;
}
}
set
{
if (m_isRootPrim)
{
m_Parent.AbsolutePosition = value;
}
m_pos = value - m_Parent.AbsolutePosition;
}
}
public PrimitiveBaseShape Shape
{
get { return m_shape; }
}
public LLVector3 WorldPos
{
get
{
if (!m_isRootPrim)
{
Primitive parentPrim = (Primitive)m_Parent;
Vector3 offsetPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
offsetPos = parentPrim.Rotation * offsetPos;
return parentPrim.WorldPos + new LLVector3(offsetPos.x, offsetPos.y, offsetPos.z);
}
else
{
return AbsolutePosition;
}
}
}
public string Description
{
get { return m_description; }
set { m_description = value; }
}
public LLVector3 Scale
{
set { m_shape.Scale = value; }
get { return m_shape.Scale; }
}
private string m_sitName = "";
public string SitName
{
get { return m_sitName; }
}
private string m_touchName = "";
public string TouchName
{
get { return m_touchName; }
}
private string m_text = "";
public string Text
{
get { return m_text; }
set
{
m_text = value;
ScheduleFullUpdate();
}
}
#endregion
#region Constructors
public Primitive(ulong regionHandle, Scene scene, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent,
SceneObjectOLD rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{
m_regionHandle = regionHandle;
m_scene = scene;
m_inventoryItems = new Dictionary<LLUUID, InventoryItem>();
m_Parent = parent;
m_isRootPrim = isRoot;
m_RootParent = rootObject;
ClearUpdateSchedule();
CreateFromShape(ownerID, localID, pos, shape);
Rotation = Quaternion.Identity;
m_scene.AcknowledgeNewPrim(this);
OnPrimCountTainted();
}
/// <summary>
///
/// </summary>
/// <remarks>Empty constructor for duplication</remarks>
public Primitive()
{
}
#endregion
#region Destructors
~Primitive()
{
if (OnPrimCountTainted != null)
OnPrimCountTainted();
}
#endregion
#region Duplication
public Primitive Copy(EntityBase parent, SceneObjectOLD rootParent)
{
Primitive dupe = (Primitive)MemberwiseClone();
dupe.m_Parent = parent;
dupe.m_RootParent = rootParent;
// TODO: Copy this properly.
dupe.m_inventoryItems = m_inventoryItems;
dupe.m_children = new List<EntityBase>();
dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle;
dupe.m_scene = m_scene;
uint newLocalID = m_scene.PrimIDAllocate();
dupe.m_uuid = LLUUID.Random();
dupe.LocalId = newLocalID;
if (parent is SceneObjectGroup)
{
dupe.m_isRootPrim = true;
dupe.ParentID = 0;
}
else
{
dupe.m_isRootPrim = false;
dupe.ParentID = ((Primitive)parent).LocalId;
}
dupe.Scale = new LLVector3(Scale.X, Scale.Y, Scale.Z);
dupe.Rotation = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
dupe.m_pos = new LLVector3(m_pos.X, m_pos.Y, m_pos.Z);
rootParent.AddChildToList(dupe);
m_scene.AcknowledgeNewPrim(dupe);
dupe.TriggerOnPrimCountTainted();
foreach (Primitive prim in m_children)
{
Primitive primClone = prim.Copy(dupe, rootParent);
dupe.m_children.Add(primClone);
}
return dupe;
}
#endregion
#region Override from EntityBase
/// <summary>
///
/// </summary>
public override void Update()
{
if (m_updateFlag == 1) //some change has been made so update the clients
{
SendTerseUpdateToALLClients();
ClearUpdateSchedule();
}
else
{
if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
{
SendFullUpdateToAllClients();
ClearUpdateSchedule();
}
}
foreach (EntityBase child in m_children)
{
child.Update();
}
}
private void ClearUpdateSchedule()
{
m_updateFlag = 0;
}
#endregion
#region Setup
/// <summary>
///
/// </summary>
/// <param name="addPacket"></param>
/// <param name="ownerID"></param>
/// <param name="localID"></param>
public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{
CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
OwnerID = ownerID;
CreatorID = OwnerID;
LastOwnerID = LLUUID.Zero;
AbsolutePosition = pos;
m_uuid = LLUUID.Random();
m_localId = (uint)(localID);
m_shape = shape;
ScheduleFullUpdate();
}
private void ScheduleFullUpdate()
{
m_updateFlag = 2;
}
private void ScheduleTerseUpdate()
{
if (m_updateFlag < 1)
{
m_updateFlag = 1;
}
}
#endregion
#region Linking / unlinking
/// <summary>
///
/// </summary>
/// <param name="linkObject"></param>
public void AddNewChildren(SceneObjectOLD linkObject)
{
// Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
//TODO check permissions
m_children.Add(linkObject.rootPrimitive);
linkObject.rootPrimitive.SetNewParent(this, m_RootParent);
m_scene.DeleteEntity(linkObject.rootUUID);
linkObject.DeleteAllChildren();
OnPrimCountTainted();
}
/// <summary>
///
/// </summary>
/// <param name="newParent"></param>
/// <param name="rootParent"></param>
public void SetNewParent(Primitive newParent, SceneObjectOLD rootParent)
{
LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
m_isRootPrim = false;
m_Parent = newParent;
ParentID = newParent.LocalId;
m_RootParent = rootParent;
m_RootParent.AddChildToList(this);
AbsolutePosition = oldPos;
Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
axPos = m_Parent.Rotation.Inverse() * axPos;
m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
Rotation = m_Parent.Rotation.Inverse() * Rotation;
ScheduleFullUpdate();
foreach (Primitive child in m_children)
{
child.SetRootParent(rootParent, newParent, oldPos, oldRot);
}
m_children.Clear();
}
/// <summary>
///
/// </summary>
/// <param name="newRoot"></param>
public void SetRootParent(SceneObjectOLD newRoot, Primitive newParent, LLVector3 oldParentPosition,
Quaternion oldParentRotation)
{
LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
Vector3 axOldPos = new Vector3(oldPos.X, oldPos.Y, oldPos.Z);
axOldPos = oldParentRotation * axOldPos;
oldPos = new LLVector3(axOldPos.x, axOldPos.y, axOldPos.z);
oldPos += oldParentPosition;
Quaternion oldRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
m_isRootPrim = false;
m_Parent = newParent;
ParentID = newParent.LocalId;
newParent.AddToChildrenList(this);
m_RootParent = newRoot;
m_RootParent.AddChildToList(this);
AbsolutePosition = oldPos;
Vector3 axPos = new Vector3(m_pos.X, m_pos.Y, m_pos.Z);
axPos = m_Parent.Rotation.Inverse() * axPos;
m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
Rotation = oldParentRotation * Rotation;
Rotation = m_Parent.Rotation.Inverse() * Rotation;
ScheduleFullUpdate();
foreach (Primitive child in m_children)
{
child.SetRootParent(newRoot, newParent, oldPos, oldRot);
}
m_children.Clear();
}
/// <summary>
///
/// </summary>
/// <param name="offset"></param>
public void AddOffsetToChildren(LLVector3 offset)
{
foreach (Primitive prim in m_children)
{
prim.m_pos += offset;
prim.ScheduleTerseUpdate();
}
OnPrimCountTainted();
}
/// <summary>
///
/// </summary>
/// <param name="prim"></param>
public void AddToChildrenList(Primitive prim)
{
m_children.Add(prim);
}
#endregion
#region Resizing/Scale
/// <summary>
///
/// </summary>
/// <param name="scale"></param>
public void ResizeGoup(LLVector3 scale)
{
m_shape.Scale = scale;
ScheduleFullUpdate();
}
#endregion
#region Position
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void UpdateGroupPosition(LLVector3 pos)
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
AbsolutePosition = newPos;
ScheduleTerseUpdate();
OnPrimCountTainted();
}
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void UpdateSinglePosition(LLVector3 pos)
{
// Console.WriteLine("updating single prim position");
if (m_isRootPrim)
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
LLVector3 oldPos = new LLVector3(AbsolutePosition.X, AbsolutePosition.Y, AbsolutePosition.Z);
LLVector3 diff = oldPos - newPos;
Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
axDiff = Rotation.Inverse() * axDiff;
diff.X = axDiff.x;
diff.Y = axDiff.y;
diff.Z = axDiff.z;
AbsolutePosition = newPos;
foreach (Primitive prim in m_children)
{
prim.m_pos += diff;
prim.ScheduleTerseUpdate();
}
ScheduleTerseUpdate();
}
else
{
LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
m_pos = newPos;
ScheduleTerseUpdate();
}
}
#endregion
#region Rotation
/// <summary>
///
/// </summary>
/// <param name="rot"></param>
public void UpdateGroupRotation(LLQuaternion rot)
{
Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
ScheduleTerseUpdate();
}
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
/// <param name="rot"></param>
public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
{
Rotation = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
AbsolutePosition = pos;
ScheduleTerseUpdate();
}
/// <summary>
///
/// </summary>
/// <param name="rot"></param>
public void UpdateSingleRotation(LLQuaternion rot)
{
//Console.WriteLine("updating single prim rotation");
Quaternion axRot = new Quaternion(rot.W, rot.X, rot.Y, rot.Z);
Quaternion oldParentRot = new Quaternion(Rotation.w, Rotation.x, Rotation.y, Rotation.z);
Rotation = axRot;
foreach (Primitive prim in m_children)
{
Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
axPos = oldParentRot * axPos;
axPos = axRot.Inverse() * axPos;
prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
prim.Rotation = oldParentRot * prim.Rotation;
prim.Rotation = axRot.Inverse() * prim.Rotation;
prim.ScheduleTerseUpdate();
}
ScheduleTerseUpdate();
}
#endregion
#region Shape
/// <summary>
///
/// </summary>
/// <param name="shapeBlock"></param>
public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
{
m_shape.PathBegin = shapeBlock.PathBegin;
m_shape.PathEnd = shapeBlock.PathEnd;
m_shape.PathScaleX = shapeBlock.PathScaleX;
m_shape.PathScaleY = shapeBlock.PathScaleY;
m_shape.PathShearX = shapeBlock.PathShearX;
m_shape.PathShearY = shapeBlock.PathShearY;
m_shape.PathSkew = shapeBlock.PathSkew;
m_shape.ProfileBegin = shapeBlock.ProfileBegin;
m_shape.ProfileEnd = shapeBlock.ProfileEnd;
m_shape.PathCurve = shapeBlock.PathCurve;
m_shape.ProfileCurve = shapeBlock.ProfileCurve;
m_shape.ProfileHollow = shapeBlock.ProfileHollow;
m_shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
m_shape.PathRevolutions = shapeBlock.PathRevolutions;
m_shape.PathTaperX = shapeBlock.PathTaperX;
m_shape.PathTaperY = shapeBlock.PathTaperY;
m_shape.PathTwist = shapeBlock.PathTwist;
m_shape.PathTwistBegin = shapeBlock.PathTwistBegin;
ScheduleFullUpdate();
}
#endregion
#region Inventory
public void GetInventory(IClientAPI client, uint localID)
{
if (localID == this.m_localId)
{
client.SendTaskInventory(this.m_uuid, 0, new byte[0]);
}
}
#endregion
public void UpdateExtraParam(ushort type, bool inUse, byte[] data)
{
this.m_shape.ExtraParams = new byte[data.Length + 7];
int i =0;
uint length = (uint) data.Length;
this.m_shape.ExtraParams[i++] = 1;
this.m_shape.ExtraParams[i++] = (byte)(type % 256);
this.m_shape.ExtraParams[i++] = (byte)((type >> 8) % 256);
this.m_shape.ExtraParams[i++] = (byte)(length % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 8) % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 16) % 256);
this.m_shape.ExtraParams[i++] = (byte)((length >> 24) % 256);
Array.Copy(data, 0, this.m_shape.ExtraParams, i, data.Length);
this.ScheduleFullUpdate();
}
#region Texture
/// <summary>
///
/// </summary>
/// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry)
{
m_shape.TextureEntry = textureEntry;
ScheduleFullUpdate();
}
#endregion
public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem)
{
this.m_particleSystem = pSystem.GetBytes();
ScheduleFullUpdate();
}
#region Client Update Methods
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendFullUpdateForAllChildren(IClientAPI remoteClient)
{
SendFullUpdateToClient(remoteClient);
for (int i = 0; i < m_children.Count; i++)
{
if (m_children[i] is Primitive)
{
((Primitive)m_children[i]).SendFullUpdateForAllChildren(remoteClient);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient)
{
LLVector3 lPos;
lPos = AbsolutePosition;
LLQuaternion lRot;
lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w);
remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_shape, lPos, m_flags, m_uuid, OwnerID,
m_text, ParentID, this.m_particleSystem, lRot);
}
/// <summary>
///
/// </summary>
public void SendFullUpdateToAllClients()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
SendFullUpdateToClient(avatars[i].ControllingClient);
}
}
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendTerseUpdateForAllChildren(IClientAPI remoteClient)
{
SendTerseUpdateToClient(remoteClient);
for (int i = 0; i < m_children.Count; i++)
{
if (m_children[i] is Primitive)
{
((Primitive)m_children[i]).SendTerseUpdateForAllChildren(remoteClient);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="RemoteClient"></param>
public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{
LLVector3 lPos;
Quaternion lRot;
lPos = AbsolutePosition;
lRot = Rotation;
LLQuaternion mRot = new LLQuaternion(lRot.x, lRot.y, lRot.z, lRot.w);
RemoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalId, lPos, mRot);
}
/// <summary>
///
/// </summary>
public void SendTerseUpdateToALLClients()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
SendTerseUpdateToClient(avatars[i].ControllingClient);
}
}
#endregion
public void TriggerOnPrimCountTainted()
{
OnPrimCountTainted();
}
public override void SetText(string text, Vector3 color, double alpha)
{
throw new Exception("The method or operation is not implemented.");
}
}
}

View File

@ -281,11 +281,9 @@ namespace OpenSim.Region.Environment.Scenes
bool added = ((SceneObjectGroup)ent).AddInventoryItem(remoteClient, localID, item, copyID);
((SceneObjectGroup)ent).GetProperites(remoteClient);
}
}
}
}
}
}
@ -301,7 +299,6 @@ namespace OpenSim.Region.Environment.Scenes
{
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
@ -421,8 +418,6 @@ namespace OpenSim.Region.Environment.Scenes
new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
rootPart.RotationOffset.Y, rootPart.RotationOffset.Z));
}
}
}

View File

@ -513,13 +513,7 @@ namespace OpenSim.Region.Environment.Scenes
MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
}
/// <summary>
/// Loads a specific object from storage
/// </summary>
/// <param name="prim">The object to load</param>
public void PrimFromStorage(PrimData prim)
{
}
/// <summary>
/// Returns a new unallocated primitive ID
@ -603,7 +597,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Called by a prim when it has been created/cloned, so that its events can be subscribed to
/// </summary>
/// <param name="prim"></param>
public void AcknowledgeNewPrim(Primitive prim)
public void AcknowledgeNewPrim(SceneObjectGroup prim)
{
prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
}

View File

@ -1,319 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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 System.Text;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public class SceneObjectOLD : EntityBase
{
private Encoding enc = Encoding.ASCII;
private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
public Primitive rootPrimitive;
protected ulong m_regionHandle;
private EventManager m_eventManager;
public bool isSelected = false;
public LLUUID rootUUID
{
get
{
this.m_uuid = this.rootPrimitive.m_uuid;
return this.m_uuid;
}
}
public uint rootLocalID
{
get
{
this.m_localId = this.rootPrimitive.LocalId;
return this.LocalId;
}
}
public int primCount
{
get
{
return this.ChildPrimitives.Count;
}
}
public Dictionary<LLUUID, Primitive> Children
{
get
{
return this.ChildPrimitives;
}
}
/// <summary>
///
/// </summary>
public SceneObjectOLD(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{
m_regionHandle = world.RegionInfo.RegionHandle;
m_scene = world;
m_eventManager = eventManager;
this.AbsolutePosition = pos;
this.CreateRootFromShape(ownerID, localID, shape, pos);
registerEvents();
}
/// <summary>
///
/// </summary>
/// <remarks>Need a null constructor for duplication</remarks>
public SceneObjectOLD()
{
}
public void registerEvents()
{
m_eventManager.OnBackup += new EventManager.OnBackupDelegate(ProcessBackup);
m_eventManager.OnParcelPrimCountUpdate += new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
}
public void unregisterEvents()
{
m_eventManager.OnBackup -= new EventManager.OnBackupDelegate(ProcessBackup);
m_eventManager.OnParcelPrimCountUpdate -= new EventManager.OnParcelPrimCountUpdateDelegate(ProcessParcelPrimCountUpdate);
}
/// <summary>
/// Processes backup
/// </summary>
/// <param name="datastore"></param>
public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
{
// datastore.StoreObject(this);
}
/// <summary>
/// Sends my primitive info to the land manager for it to keep tally of all of the prims!
/// </summary>
private void ProcessParcelPrimCountUpdate()
{
// m_eventManager.TriggerParcelPrimCountAdd(this);
}
/// <summary>
///
/// </summary>
/// <param name="addPacket"></param>
/// <param name="agentID"></param>
/// <param name="localID"></param>
public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{
// this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_scene, agentID, localID, true, this, this, shape, pos);
this.m_children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
public void CreateFromBytes(byte[] data)
{
}
/// <summary>
/// Makes a copy of this SceneObject (and child primitives)
/// </summary>
/// <returns>A complete copy of the object</returns>
public new SceneObjectOLD Copy()
{
SceneObjectOLD dupe = new SceneObjectOLD();
dupe.m_scene = this.m_scene;
dupe.m_eventManager = this.m_eventManager;
dupe.m_regionHandle = this.m_regionHandle;
Primitive newRoot = this.rootPrimitive.Copy(dupe, dupe);
dupe.rootPrimitive = newRoot;
dupe.m_children.Add(dupe.rootPrimitive);
dupe.rootPrimitive.AbsolutePosition = this.AbsolutePosition;
dupe.Rotation = this.Rotation;
dupe.LocalId = m_scene.PrimIDAllocate();
dupe.registerEvents();
return dupe;
}
/// <summary>
///
/// </summary>
public void Serialise()
{
}
/// <summary>
///
/// </summary>
public void DeleteAllChildren()
{
this.m_children.Clear();
this.ChildPrimitives.Clear();
this.rootPrimitive = null;
unregisterEvents();
}
/// <summary>
///
/// </summary>
/// <param name="primObject"></param>
public void AddNewChildPrims(SceneObjectOLD primObject)
{
this.rootPrimitive.AddNewChildren(primObject);
}
public void AddChildToList(Primitive prim)
{
if (!this.ChildPrimitives.ContainsKey(prim.m_uuid))
{
this.ChildPrimitives.Add(prim.m_uuid, prim);
}
}
/// <summary>
///
/// </summary>
/// <param name="primID"></param>
/// <returns></returns>
public Primitive HasChildPrim(LLUUID primID)
{
if (this.ChildPrimitives.ContainsKey(primID))
{
return this.ChildPrimitives[primID];
}
return null;
}
/// <summary>
///
/// </summary>
/// <param name="localID"></param>
/// <returns></returns>
public Primitive HasChildPrim(uint localID)
{
Primitive returnPrim = null;
foreach (Primitive prim in this.ChildPrimitives.Values)
{
if (prim.LocalId == localID)
{
returnPrim = prim;
break;
}
}
return returnPrim;
}
public void SendAllChildPrimsToClient(IClientAPI client)
{
this.rootPrimitive.SendFullUpdateForAllChildren(client);
}
/// <summary>
///
/// </summary>
public override void BackUp()
{
}
/// <summary>
///
/// </summary>
/// <param name="offset"></param>
/// <param name="pos"></param>
/// <param name="remoteClient"></param>
public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
{
this.rootPrimitive.AbsolutePosition = pos;
this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
}
/// <summary>
///
/// </summary>
/// <param name="client"></param>
public void GetProperites(IClientAPI client)
{
ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
proper.ObjectData[0].ItemID = LLUUID.Zero;
proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
proper.ObjectData[0].FolderID = LLUUID.Zero;
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
proper.ObjectData[0].GroupID = LLUUID.Zero;
proper.ObjectData[0].InventorySerial = 0;
proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
proper.ObjectData[0].ObjectID = this.rootUUID;
proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
proper.ObjectData[0].TextureID = new byte[0];
proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0");
proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0");
proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0");
proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask;
proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask;
proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask;
proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask;
client.OutPacket(proper);
}
public override void SetText(string text, Axiom.Math.Vector3 color, double alpha)
{
throw new System.Exception("The method or operation is not implemented.");
}
}
}

View File

@ -14,7 +14,7 @@ using OpenSim.Framework.Data;
namespace OpenSim.Region.Environment.Scenes
{
// public delegate void PrimCountTaintedDelegate();
public delegate void PrimCountTaintedDelegate();
public class SceneObjectGroup : EntityBase
{

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.Scripting.Examples
}*/
}
string processPrimitiveToString(OpenSim.Region.Environment.Scenes.Primitive prim)
string processPrimitiveToString(OpenSim.Region.Environment.Scenes.SceneObjectPart prim)
{
/*string desc = prim.Description;
string name = prim.Name;

View File

@ -7,7 +7,6 @@ using OpenSim.Framework.Types;
using System.Timers;
using System.Diagnostics;
using System.IO;
using Primitive = OpenSim.Region.Environment.Scenes.Primitive;
namespace SimpleApp
{

View File

@ -12,7 +12,6 @@ using OpenSim.Region.Capabilities;
using OpenSim.Region.ClientStack;
using OpenSim.Region.Communications.Local;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Region.GridInterfaces.Local;
using System.Timers;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Data;

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Reflection;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("LocalGridServers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LocalGridServers")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System.Reflection;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("RemoteGridServers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RemoteGridServers")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")]

View File

@ -1,133 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.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.IO;
using System.Net;
using System.Text;
using System.Threading;
using libsecondlife;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
namespace OpenSim.Region.GridInterfaces.Remote
{
public class RemoteAssetServer : IAssetServer
{
private IAssetReceiver _receiver;
private BlockingQueue<ARequest> _assetRequests;
private Thread _remoteAssetServerThread;
private string AssetServerUrl;
private string AssetSendKey;
public RemoteAssetServer()
{
this._assetRequests = new BlockingQueue<ARequest>();
this._remoteAssetServerThread = new Thread(new ThreadStart(RunRequests));
this._remoteAssetServerThread.IsBackground = true;
this._remoteAssetServerThread.Start();
MainLog.Instance.Verbose("Remote Asset Server class created");
}
public void SetReceiver(IAssetReceiver receiver)
{
this._receiver = receiver;
}
public void RequestAsset(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 UploadNewAsset(AssetBase asset)
{
Encoding Windows1252Encoding = Encoding.GetEncoding(1252);
string ret = Windows1252Encoding.GetString(asset.Data);
byte[] buffer = Windows1252Encoding.GetBytes(ret);
WebClient client = new WebClient();
client.UploadData(this.AssetServerUrl + "assets/" + asset.FullID, buffer);
}
public void SetServerInfo(string ServerUrl, string ServerKey)
{
this.AssetServerUrl = ServerUrl;
this.AssetSendKey = ServerKey;
}
private void RunRequests()
{
while (true)
{
//we need to add support for the asset server not knowing about a requested asset
// 404... THE MAGIC FILE NOT FOUND ERROR, very useful for telling you things such as a file (or asset ;) ) not being found!!!!!!!!!!! it's 2:22AM
ARequest req = this._assetRequests.Dequeue();
LLUUID assetID = req.AssetID;
// OpenSim.Framework.Console.MainLog.Instance.Verbose(" RemoteAssetServer- Got a AssetServer request, processing it - " + this.AssetServerUrl + "assets/" + assetID);
WebRequest AssetLoad = WebRequest.Create(this.AssetServerUrl + "assets/" + assetID);
WebResponse AssetResponse = AssetLoad.GetResponse();
byte[] idata = new byte[(int)AssetResponse.ContentLength];
BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream());
idata = br.ReadBytes((int)AssetResponse.ContentLength);
br.Close();
AssetBase asset = new AssetBase();
asset.FullID = assetID;
asset.Data = idata;
_receiver.AssetReceived(asset, req.IsTexture);
}
}
public void Close()
{
}
}
public class RemoteAssetPlugin : IAssetPlugin
{
public RemoteAssetPlugin()
{
}
public IAssetServer GetAssetServer()
{
return (new RemoteAssetServer());
}
}
}

View File

@ -185,56 +185,6 @@
</Project>
<!-- Grid Server Plug-ins -->
<Project name="OpenSim.Region.GridInterfaces.Local" path="OpenSim/Region/GridInterfaces/Local" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/>
<Reference name="Db4objects.Db4o.dll"/>
<Reference name="libsecondlife.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="Nini.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.Region.GridInterfaces.Remote" path="OpenSim/Region/GridInterfaces/Remote" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/>
<Reference name="libsecondlife.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="XMLRPC.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.Region.Physics.Manager" path="OpenSim/Region/Physics/Manager" type="Library">
<Configuration name="Debug">
<Options>
@ -454,7 +404,9 @@
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Data" />
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Db4objects.Db4o.dll"/>
<Reference name="Nini.dll" />
<Files>
@ -615,30 +567,6 @@
</Files>
</Project>
<Project name="OpenSim.DataStore.DB4o" path="OpenSim/Region/Storage/OpenSim.DataStore.DB4o" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="System.Xml"/>
<Reference name="Db4objects.Db4o.dll"/>
<Reference name="libsecondlife.dll"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Framework.Console"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.DataStore.MonoSqlite" path="OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite" type="Library">
<Configuration name="Debug">
@ -733,7 +661,6 @@
<Reference name="OpenSim.Framework.Data"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Region.GridInterfaces.Local"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Region.Communications.Local"/>
@ -823,30 +750,6 @@
<!-- OGS projects -->
<Project name="OpenSim.Grid.Framework.Manager" path="OpenSim/Grid/Framework.Manager" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="libsecondlife.dll"/>
<Reference name="XMLRPC.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenSim.Grid.GridServer" path="OpenSim/Grid/GridServer" type="Exe">
<Configuration name="Debug">