* Optimized usings

* Shortened type references
* Removed redundant 'this' qualifier
afrisby
lbsa71 2007-10-30 09:05:31 +00:00
parent c32d1f0562
commit 67e12b95ea
353 changed files with 15459 additions and 10338 deletions

View File

@ -37,7 +37,7 @@ namespace OpenSim.Framework.Communications
public CAPSService(BaseHttpServer httpServer) public CAPSService(BaseHttpServer httpServer)
{ {
m_server = httpServer; m_server = httpServer;
this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); AddCapsSeedHandler("/CapsSeed/", CapsRequest);
} }
private void AddCapsSeedHandler(string path, RestMethod restMethod) private void AddCapsSeedHandler(string path, RestMethod restMethod)
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications
public string CapsRequest(string request, string path, string param) public string CapsRequest(string request, string path, string param)
{ {
System.Console.WriteLine("new caps request " + request +" from path "+ path); System.Console.WriteLine("new caps request " + request + " from path " + path);
return ""; return "";
} }
} }

View File

@ -29,12 +29,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
@ -54,15 +51,19 @@ namespace OpenSim.Framework.Communications.Cache
public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>();
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server //Assets requested from the asset server
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>();
//Textures requested from the asset server
public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>();
private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>(); private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>();
private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>(); private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>();
private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent = new Dictionary<LLUUID, Dictionary<LLUUID, int>>(); private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent =
new Dictionary<LLUUID, Dictionary<LLUUID, int>>();
public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>(); public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>();
@ -76,19 +77,18 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
public AssetCache(IAssetServer assetServer) public AssetCache(IAssetServer assetServer)
{ {
OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache"); MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache");
_assetServer = assetServer; _assetServer = assetServer;
_assetServer.SetReceiver(this); _assetServer.SetReceiver(this);
Assets = new Dictionary<LLUUID, AssetInfo>(); Assets = new Dictionary<LLUUID, AssetInfo>();
Textures = new Dictionary<LLUUID, TextureImage>(); Textures = new Dictionary<LLUUID, TextureImage>();
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); _assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
this._assetCacheThread.IsBackground = true; _assetCacheThread.IsBackground = true;
this._assetCacheThread.Start(); _assetCacheThread.Start();
this.TextureSenderThread = new Thread(new ThreadStart(this.ProcessTextureSenders));
this.TextureSenderThread.IsBackground = true;
this.TextureSenderThread.Start();
TextureSenderThread = new Thread(new ThreadStart(ProcessTextureSenders));
TextureSenderThread.IsBackground = true;
TextureSenderThread.Start();
} }
/// <summary> /// <summary>
@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications.Cache
{ {
try try
{ {
this.ProcessAssetQueue(); ProcessAssetQueue();
this.ProcessTextureQueue(); ProcessTextureQueue();
Thread.Sleep(500); Thread.Sleep(500);
} }
catch (Exception e) catch (Exception e)
@ -115,13 +115,13 @@ namespace OpenSim.Framework.Communications.Cache
public AssetBase GetAsset(LLUUID assetID) public AssetBase GetAsset(LLUUID assetID)
{ {
AssetBase asset = null; AssetBase asset = null;
if (this.Textures.ContainsKey(assetID)) if (Textures.ContainsKey(assetID))
{ {
asset = this.Textures[assetID]; asset = Textures[assetID];
} }
else if (this.Assets.ContainsKey(assetID)) else if (Assets.ContainsKey(assetID))
{ {
asset = this.Assets[assetID]; asset = Assets[assetID];
} }
return asset; return asset;
} }
@ -129,13 +129,13 @@ namespace OpenSim.Framework.Communications.Cache
public void GetAsset(LLUUID assetID, AssetRequestCallback callback) public void GetAsset(LLUUID assetID, AssetRequestCallback callback)
{ {
AssetBase asset = null; AssetBase asset = null;
if (this.Textures.ContainsKey(assetID)) if (Textures.ContainsKey(assetID))
{ {
asset = this.Textures[assetID]; asset = Textures[assetID];
} }
else if (this.Assets.ContainsKey(assetID)) else if (Assets.ContainsKey(assetID))
{ {
asset = this.Assets[assetID]; asset = Assets[assetID];
} }
if (asset != null) if (asset != null)
@ -145,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
NewAssetRequest req = new NewAssetRequest(assetID, callback); NewAssetRequest req = new NewAssetRequest(assetID, callback);
if (this.RequestLists.ContainsKey(assetID)) if (RequestLists.ContainsKey(assetID))
{ {
lock (RequestLists) lock (RequestLists)
{ {
@ -161,7 +161,7 @@ namespace OpenSim.Framework.Communications.Cache
RequestLists.Add(assetID, reqList); RequestLists.Add(assetID, reqList);
} }
} }
this._assetServer.FetchAsset(assetID, false); _assetServer.FetchAsset(assetID, false);
} }
} }
@ -171,7 +171,7 @@ namespace OpenSim.Framework.Communications.Cache
AssetBase asset = GetAsset(assetID); AssetBase asset = GetAsset(assetID);
if (asset == null) if (asset == null)
{ {
this._assetServer.FetchAsset(assetID, isTexture); _assetServer.FetchAsset(assetID, isTexture);
} }
return asset; return asset;
} }
@ -183,10 +183,11 @@ namespace OpenSim.Framework.Communications.Cache
{ {
//Console.WriteLine("which is a texture"); //Console.WriteLine("which is a texture");
if (!Textures.ContainsKey(asset.FullID)) if (!Textures.ContainsKey(asset.FullID))
{ //texture {
//texture
TextureImage textur = new TextureImage(asset); TextureImage textur = new TextureImage(asset);
Textures.Add(textur.FullID, textur); Textures.Add(textur.FullID, textur);
if(!asset.Temporary) if (!asset.Temporary)
_assetServer.StoreAndCommitAsset(asset); _assetServer.StoreAndCommitAsset(asset);
} }
else else
@ -219,49 +220,47 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
private void ProcessTextureQueue() private void ProcessTextureQueue()
{ {
if (this.TextureRequests.Count == 0) if (TextureRequests.Count == 0)
{ {
//no requests waiting //no requests waiting
return; return;
} }
int num; int num;
num = this.TextureRequests.Count; num = TextureRequests.Count;
AssetRequest req; AssetRequest req;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
req = (AssetRequest)this.TextureRequests[i]; req = (AssetRequest) TextureRequests[i];
if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) if (!SendingTextures.ContainsKey(req.ImageInfo.FullID))
{ {
//Console.WriteLine("new texture to send"); //Console.WriteLine("new texture to send");
TextureSender sender = new TextureSender(req); TextureSender sender = new TextureSender(req);
//sender.OnComplete += this.TextureSent; //sender.OnComplete += this.TextureSent;
this.SendingTextures.Add(req.ImageInfo.FullID, sender); SendingTextures.Add(req.ImageInfo.FullID, sender);
this.QueueTextures.Enqueue(sender); QueueTextures.Enqueue(sender);
}
} }
} TextureRequests.Clear();
this.TextureRequests.Clear();
} }
public void ProcessTextureSenders() public void ProcessTextureSenders()
{ {
while (true) while (true)
{ {
TextureSender sender = this.QueueTextures.Dequeue(); TextureSender sender = QueueTextures.Dequeue();
bool finished = sender.SendTexture(); bool finished = sender.SendTexture();
if (finished) if (finished)
{ {
this.TextureSent(sender); TextureSent(sender);
} }
else else
{ {
// Console.WriteLine("readding texture"); // Console.WriteLine("readding texture");
this.QueueTextures.Enqueue(sender); QueueTextures.Enqueue(sender);
} }
} }
} }
@ -271,9 +270,9 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="sender"></param> /// <param name="sender"></param>
public void TextureSent(TextureSender sender) public void TextureSent(TextureSender sender)
{ {
if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) if (SendingTextures.ContainsKey(sender.request.ImageInfo.FullID))
{ {
this.SendingTextures.Remove(sender.request.ImageInfo.FullID); SendingTextures.Remove(sender.request.ImageInfo.FullID);
// this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID);
} }
} }
@ -292,48 +291,48 @@ namespace OpenSim.Framework.Communications.Cache
//Console.WriteLine("asset recieved from asset server"); //Console.WriteLine("asset recieved from asset server");
TextureImage image = new TextureImage(asset); TextureImage image = new TextureImage(asset);
if (!this.Textures.ContainsKey(image.FullID)) if (!Textures.ContainsKey(image.FullID))
{ {
this.Textures.Add(image.FullID, image); Textures.Add(image.FullID, image);
if (this.RequestedTextures.ContainsKey(image.FullID)) if (RequestedTextures.ContainsKey(image.FullID))
{ {
AssetRequest req = this.RequestedTextures[image.FullID]; AssetRequest req = RequestedTextures[image.FullID];
req.ImageInfo = image; req.ImageInfo = image;
if (image.Data.LongLength > 600) if (image.Data.LongLength > 600)
{ {
//over 600 bytes so split up file //over 600 bytes so split up file
req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000; req.NumPackets = 1 + (int) (image.Data.Length - 600)/1000;
} }
else else
{ {
req.NumPackets = 1; req.NumPackets = 1;
} }
this.RequestedTextures.Remove(image.FullID); RequestedTextures.Remove(image.FullID);
this.TextureRequests.Add(req); TextureRequests.Add(req);
} }
} }
} }
else else
{ {
AssetInfo assetInf = new AssetInfo(asset); AssetInfo assetInf = new AssetInfo(asset);
if (!this.Assets.ContainsKey(assetInf.FullID)) if (!Assets.ContainsKey(assetInf.FullID))
{ {
this.Assets.Add(assetInf.FullID, assetInf); Assets.Add(assetInf.FullID, assetInf);
if (this.RequestedAssets.ContainsKey(assetInf.FullID)) if (RequestedAssets.ContainsKey(assetInf.FullID))
{ {
AssetRequest req = this.RequestedAssets[assetInf.FullID]; AssetRequest req = RequestedAssets[assetInf.FullID];
req.AssetInf = assetInf; req.AssetInf = assetInf;
if (assetInf.Data.LongLength > 600) if (assetInf.Data.LongLength > 600)
{ {
//over 600 bytes so split up file //over 600 bytes so split up file
req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; req.NumPackets = 1 + (int) (assetInf.Data.Length - 600 + 999)/1000;
} }
else else
{ {
req.NumPackets = 1; req.NumPackets = 1;
} }
this.RequestedAssets.Remove(assetInf.FullID); RequestedAssets.Remove(assetInf.FullID);
this.AssetRequests.Add(req); AssetRequests.Add(req);
} }
} }
} }
@ -373,6 +372,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
#region Assets #region Assets
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -396,11 +396,11 @@ namespace OpenSim.Framework.Communications.Cache
} }
//check to see if asset is in local cache, if not we need to request it from asset server. //check to see if asset is in local cache, if not we need to request it from asset server.
//Console.WriteLine("asset request " + requestID); //Console.WriteLine("asset request " + requestID);
if (!this.Assets.ContainsKey(requestID)) if (!Assets.ContainsKey(requestID))
{ {
//not found asset //not found asset
// so request from asset server // so request from asset server
if (!this.RequestedAssets.ContainsKey(requestID)) if (!RequestedAssets.ContainsKey(requestID))
{ {
AssetRequest request = new AssetRequest(); AssetRequest request = new AssetRequest();
request.RequestUser = userInfo; request.RequestUser = userInfo;
@ -408,13 +408,13 @@ namespace OpenSim.Framework.Communications.Cache
request.TransferRequestID = transferRequest.TransferInfo.TransferID; request.TransferRequestID = transferRequest.TransferInfo.TransferID;
request.AssetRequestSource = source; request.AssetRequestSource = source;
request.Params = transferRequest.TransferInfo.Params; request.Params = transferRequest.TransferInfo.Params;
this.RequestedAssets.Add(requestID, request); RequestedAssets.Add(requestID, request);
this._assetServer.FetchAsset(requestID, false); _assetServer.FetchAsset(requestID, false);
} }
return; return;
} }
//it is in our cache //it is in our cache
AssetInfo asset = this.Assets[requestID]; AssetInfo asset = Assets[requestID];
//work out how many packets it should be sent in //work out how many packets it should be sent in
// and add to the AssetRequests list // and add to the AssetRequests list
@ -429,14 +429,14 @@ namespace OpenSim.Framework.Communications.Cache
if (asset.Data.LongLength > 600) if (asset.Data.LongLength > 600)
{ {
//over 600 bytes so split up file //over 600 bytes so split up file
req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; req.NumPackets = 1 + (int) (asset.Data.Length - 600 + 999)/1000;
} }
else else
{ {
req.NumPackets = 1; req.NumPackets = 1;
} }
this.AssetRequests.Add(req); AssetRequests.Add(req);
} }
/// <summary> /// <summary>
@ -444,17 +444,17 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
private void ProcessAssetQueue() private void ProcessAssetQueue()
{ {
if (this.AssetRequests.Count == 0) if (AssetRequests.Count == 0)
{ {
//no requests waiting //no requests waiting
return; return;
} }
int num; int num;
if (this.AssetRequests.Count < 5) if (AssetRequests.Count < 5)
{ {
//lower than 5 so do all of them //lower than 5 so do all of them
num = this.AssetRequests.Count; num = AssetRequests.Count;
} }
else else
{ {
@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Cache
AssetRequest req; AssetRequest req;
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
req = (AssetRequest)this.AssetRequests[i]; req = (AssetRequest) AssetRequests[i];
//Console.WriteLine("sending asset " + req.RequestAssetID); //Console.WriteLine("sending asset " + req.RequestAssetID);
TransferInfoPacket Transfer = new TransferInfoPacket(); TransferInfoPacket Transfer = new TransferInfoPacket();
Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.ChannelType = 2;
@ -473,7 +473,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
Transfer.TransferInfo.Params = new byte[20]; Transfer.TransferInfo.Params = new byte[20];
Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
int assType = (int)req.AssetInf.Type; int assType = (int) req.AssetInf.Type;
Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
} }
else if (req.AssetRequestSource == 3) else if (req.AssetRequestSource == 3)
@ -483,7 +483,7 @@ namespace OpenSim.Framework.Communications.Cache
//Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
//Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
} }
Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length;
Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.TransferInfo.TransferID = req.TransferRequestID;
req.RequestUser.OutPacket(Transfer); req.RequestUser.OutPacket(Transfer);
@ -533,19 +533,19 @@ namespace OpenSim.Framework.Communications.Cache
req.RequestUser.OutPacket(TransferPacket); req.RequestUser.OutPacket(TransferPacket);
} }
} }
} }
//remove requests that have been completed //remove requests that have been completed
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
this.AssetRequests.RemoveAt(0); AssetRequests.RemoveAt(0);
}
} }
}
#endregion #endregion
#region Textures #region Textures
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -555,9 +555,9 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
//check to see if texture is in local cache, if not request from asset server //check to see if texture is in local cache, if not request from asset server
if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) if (!AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
{ {
this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>());
} }
/* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID))
{ {
@ -565,9 +565,9 @@ namespace OpenSim.Framework.Communications.Cache
return; return;
}*/ }*/
if (!this.Textures.ContainsKey(imageID)) if (!Textures.ContainsKey(imageID))
{ {
if (!this.RequestedTextures.ContainsKey(imageID)) if (!RequestedTextures.ContainsKey(imageID))
{ {
//not is cache so request from asset server //not is cache so request from asset server
AssetRequest request = new AssetRequest(); AssetRequest request = new AssetRequest();
@ -575,14 +575,14 @@ namespace OpenSim.Framework.Communications.Cache
request.RequestAssetID = imageID; request.RequestAssetID = imageID;
request.IsTextureRequest = true; request.IsTextureRequest = true;
request.DiscardLevel = discard; request.DiscardLevel = discard;
this.RequestedTextures.Add(imageID, request); RequestedTextures.Add(imageID, request);
this._assetServer.FetchAsset(imageID, true); _assetServer.FetchAsset(imageID, true);
} }
return; return;
} }
// System.Console.WriteLine("texture already in cache"); // System.Console.WriteLine("texture already in cache");
TextureImage imag = this.Textures[imageID]; TextureImage imag = Textures[imageID];
AssetRequest req = new AssetRequest(); AssetRequest req = new AssetRequest();
req.RequestUser = userInfo; req.RequestUser = userInfo;
req.RequestAssetID = imageID; req.RequestAssetID = imageID;
@ -594,7 +594,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
//Console.WriteLine("{0}", imag.Data.LongLength); //Console.WriteLine("{0}", imag.Data.LongLength);
//over 600 bytes so split up file //over 600 bytes so split up file
req.NumPackets = 2 + (int)(imag.Data.Length - 601) / 1000; req.NumPackets = 2 + (int) (imag.Data.Length - 601)/1000;
//Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets");
} }
else else
@ -603,12 +603,11 @@ namespace OpenSim.Framework.Communications.Cache
} }
if (packetNumber != 0) if (packetNumber != 0)
{ {
req.PacketCounter = (int)packetNumber; req.PacketCounter = (int) packetNumber;
} }
this.TextureRequests.Add(req); TextureRequests.Add(req);
} }
#endregion #endregion
public class AssetRequest public class AssetRequest
@ -630,7 +629,6 @@ namespace OpenSim.Framework.Communications.Cache
public AssetRequest() public AssetRequest()
{ {
} }
} }
@ -638,7 +636,6 @@ namespace OpenSim.Framework.Communications.Cache
{ {
public AssetInfo() public AssetInfo()
{ {
} }
public AssetInfo(AssetBase aBase) public AssetInfo(AssetBase aBase)
@ -656,7 +653,6 @@ namespace OpenSim.Framework.Communications.Cache
{ {
public TextureImage() public TextureImage()
{ {
} }
public TextureImage(AssetBase aBase) public TextureImage(AssetBase aBase)
@ -678,7 +674,6 @@ namespace OpenSim.Framework.Communications.Cache
public TextureSender(AssetRequest req) public TextureSender(AssetRequest req)
{ {
request = req; request = req;
} }
public bool SendTexture() public bool SendTexture()
@ -686,7 +681,8 @@ namespace OpenSim.Framework.Communications.Cache
SendPacket(); SendPacket();
counter++; counter++;
if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1)) if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) |
(request.DiscardLevel == -1))
{ {
return true; return true;
} }
@ -707,7 +703,7 @@ namespace OpenSim.Framework.Communications.Cache
im.Header.Reliable = false; im.Header.Reliable = false;
im.ImageID.Packets = 1; im.ImageID.Packets = 1;
im.ImageID.ID = req.ImageInfo.FullID; im.ImageID.ID = req.ImageInfo.FullID;
im.ImageID.Size = (uint)req.ImageInfo.Data.Length; im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
im.ImageData.Data = req.ImageInfo.Data; im.ImageData.Data = req.ImageInfo.Data;
im.ImageID.Codec = 2; im.ImageID.Codec = 2;
req.RequestUser.OutPacket(im); req.RequestUser.OutPacket(im);
@ -721,9 +717,9 @@ namespace OpenSim.Framework.Communications.Cache
//more than one packet so split file up //more than one packet so split file up
ImageDataPacket im = new ImageDataPacket(); ImageDataPacket im = new ImageDataPacket();
im.Header.Reliable = false; im.Header.Reliable = false;
im.ImageID.Packets = (ushort)(req.NumPackets); im.ImageID.Packets = (ushort) (req.NumPackets);
im.ImageID.ID = req.ImageInfo.FullID; im.ImageID.ID = req.ImageInfo.FullID;
im.ImageID.Size = (uint)req.ImageInfo.Data.Length; im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
im.ImageData.Data = new byte[600]; im.ImageData.Data = new byte[600];
Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
im.ImageID.Codec = 2; im.ImageID.Codec = 2;
@ -742,19 +738,18 @@ namespace OpenSim.Framework.Communications.Cache
//more than one packet so split file up //more than one packet so split file up
ImagePacketPacket im = new ImagePacketPacket(); ImagePacketPacket im = new ImagePacketPacket();
im.Header.Reliable = false; im.Header.Reliable = false;
im.ImageID.Packet = (ushort)(req.PacketCounter); im.ImageID.Packet = (ushort) (req.PacketCounter);
im.ImageID.ID = req.ImageInfo.FullID; im.ImageID.ID = req.ImageInfo.FullID;
int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1)); int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1));
if (size > 1000) size = 1000; if (size > 1000) size = 1000;
//Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
im.ImageData.Data = new byte[size]; im.ImageData.Data = new byte[size];
Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size); Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size);
req.RequestUser.OutPacket(im); req.RequestUser.OutPacket(im);
req.PacketCounter++; req.PacketCounter++;
//req.ImageInfo.last_used = time; //req.ImageInfo.last_used = time;
//System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID);
} }
} }
private void SaveAssetToFile(string filename, byte[] data) private void SaveAssetToFile(string filename, byte[] data)
@ -789,7 +784,5 @@ namespace OpenSim.Framework.Communications.Cache
AssetID = assetID; AssetID = assetID;
Callback = callback; Callback = callback;
} }
} }
} }

View File

@ -25,18 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading;
using Db4objects.Db4o; using Db4objects.Db4o;
using Db4objects.Db4o.Query; using Db4objects.Db4o.Query;
using libsecondlife; using libsecondlife;
using Nini.Config;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache
yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation"); MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation");
if (!yapfile) if (!yapfile)
{ {
@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache
db.Commit(); db.Commit();
} }
override public void Close() public override void Close()
{ {
base.Close(); base.Close();
if (db != null) if (db != null)
{ {
MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database");
db.Close(); db.Close();
} }
} }
override protected void RunRequests() protected override void RunRequests()
{ {
while (true) while (true)
{ {
byte[] idata = null; byte[] idata = null;
bool found = false; bool found = false;
AssetStorage foundAsset = null; AssetStorage foundAsset = null;
ARequest req = this._assetRequests.Dequeue(); ARequest req = _assetRequests.Dequeue();
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
if (result.Count > 0) if (result.Count > 0)
{ {
foundAsset = (AssetStorage)result.Next(); foundAsset = (AssetStorage) result.Next();
found = true; found = true;
} }
@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache
//asset.FullID = ; //asset.FullID = ;
_receiver.AssetNotFound(req.AssetID); _receiver.AssetNotFound(req.AssetID);
} }
}
} }
} protected override void StoreAsset(AssetBase asset)
override protected void StoreAsset(AssetBase asset)
{ {
AssetStorage store = new AssetStorage(); AssetStorage store = new AssetStorage();
store.Data = asset.Data; store.Data = asset.Data;
@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
_findID = find; _findID = find;
} }
public bool Match(AssetStorage asset) public bool Match(AssetStorage asset)
{ {
return (asset.UUID == _findID); return (asset.UUID == _findID);

View File

@ -5,8 +5,6 @@ using System.Threading;
using libsecondlife; using libsecondlife;
using Nini.Config; using Nini.Config;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -36,13 +34,12 @@ namespace OpenSim.Framework.Communications.Cache
public AssetServerBase() public AssetServerBase()
{ {
MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system");
_assetRequests = new BlockingQueue<ARequest>();
OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting asset storage system"); _localAssetServerThread = new Thread(RunRequests);
this._assetRequests = new BlockingQueue<ARequest>(); _localAssetServerThread.IsBackground = true;
_localAssetServerThread.Start();
this._localAssetServerThread = new Thread(RunRequests);
this._localAssetServerThread.IsBackground = true;
this._localAssetServerThread.Start();
} }
public void LoadAsset(AssetBase info, bool image, string filename) public void LoadAsset(AssetBase info, bool image, string filename)
@ -57,7 +54,7 @@ namespace OpenSim.Framework.Communications.Cache
FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
byte[] idata = new byte[numBytes]; byte[] idata = new byte[numBytes];
BinaryReader br = new BinaryReader(fStream); BinaryReader br = new BinaryReader(fStream);
idata = br.ReadBytes((int)numBytes); idata = br.ReadBytes((int) numBytes);
br.Close(); br.Close();
fStream.Close(); fStream.Close();
info.Data = idata; info.Data = idata;
@ -66,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
public void SetReceiver(IAssetReceiver receiver) public void SetReceiver(IAssetReceiver receiver)
{ {
this._receiver = receiver; _receiver = receiver;
} }
public void FetchAsset(LLUUID assetID, bool isTexture) public void FetchAsset(LLUUID assetID, bool isTexture)
@ -74,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache
ARequest req = new ARequest(); ARequest req = new ARequest();
req.AssetID = assetID; req.AssetID = assetID;
req.IsTexture = isTexture; req.IsTexture = isTexture;
this._assetRequests.Enqueue(req); _assetRequests.Enqueue(req);
} }
public void UpdateAsset(AssetBase asset) public void UpdateAsset(AssetBase asset)
@ -102,7 +99,6 @@ namespace OpenSim.Framework.Communications.Cache
public void SetServerInfo(string ServerUrl, string ServerKey) public void SetServerInfo(string ServerUrl, string ServerKey)
{ {
} }
public virtual List<AssetBase> GetDefaultAssets() public virtual List<AssetBase> GetDefaultAssets()
@ -175,8 +171,8 @@ namespace OpenSim.Framework.Communications.Cache
// System.Console.WriteLine("loading asset into database"); // System.Console.WriteLine("loading asset into database");
string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
string name = source.Configs[i].GetString("name", ""); string name = source.Configs[i].GetString("name", "");
sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
string fileName = source.Configs[i].GetString("fileName", ""); string fileName = source.Configs[i].GetString("fileName", "");
AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);

View File

@ -25,15 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Data;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -41,7 +34,10 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// Fields // Fields
public CommunicationsManager CommsManager; public CommunicationsManager CommsManager;
public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>();
public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
new Dictionary<LLUUID, AgentAssetTransactions>();
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
@ -53,10 +49,10 @@ namespace OpenSim.Framework.Communications.Cache
// Methods // Methods
public AgentAssetTransactions AddUser(LLUUID userID) public AgentAssetTransactions AddUser(LLUUID userID)
{ {
if (!this.AgentTransactions.ContainsKey(userID)) if (!AgentTransactions.ContainsKey(userID))
{ {
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
this.AgentTransactions.Add(userID, transactions); AgentTransactions.Add(userID, transactions);
return transactions; return transactions;
} }
return null; return null;
@ -64,27 +60,30 @@ namespace OpenSim.Framework.Communications.Cache
public AgentAssetTransactions GetUserTransActions(LLUUID userID) public AgentAssetTransactions GetUserTransActions(LLUUID userID)
{ {
if (this.AgentTransactions.ContainsKey(userID)) if (AgentTransactions.ContainsKey(userID))
{ {
return this.AgentTransactions[userID]; return AgentTransactions[userID];
} }
return null; return null;
} }
public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{ {
AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
name, invType, type, wearableType, nextOwnerMask);
}
} }
} public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
byte[] data, bool storeLocal)
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal)
{ {
// Console.WriteLine("asset upload of " + assetID); // Console.WriteLine("asset upload of " + assetID);
AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
@ -97,7 +96,7 @@ namespace OpenSim.Framework.Communications.Cache
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{ {
AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
transactions.HandleXfer(xferID, packetID, data); transactions.HandleXfer(xferID, packetID, data);

View File

@ -26,17 +26,12 @@
* *
*/ */
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
using OpenSim.Region.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Capabilities;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -53,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache
// Methods // Methods
public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile)
{ {
this.UserID = agentID; UserID = agentID;
Manager = manager; Manager = manager;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
} }
@ -61,24 +56,24 @@ namespace OpenSim.Framework.Communications.Cache
public AssetCapsUploader RequestCapsUploader() public AssetCapsUploader RequestCapsUploader()
{ {
AssetCapsUploader uploader = new AssetCapsUploader(); AssetCapsUploader uploader = new AssetCapsUploader();
this.CapsUploaders.Add(uploader); CapsUploaders.Add(uploader);
return uploader; return uploader;
} }
public NoteCardCapsUpdate RequestNoteCardUpdater() public NoteCardCapsUpdate RequestNoteCardUpdater()
{ {
NoteCardCapsUpdate update = new NoteCardCapsUpdate(); NoteCardCapsUpdate update = new NoteCardCapsUpdate();
this.NotecardUpdaters.Add(update); NotecardUpdaters.Add(update);
return update; return update;
} }
public AssetXferUploader RequestXferUploader(LLUUID transactionID) public AssetXferUploader RequestXferUploader(LLUUID transactionID)
{ {
if (!this.XferUploaders.ContainsKey(transactionID)) if (!XferUploaders.ContainsKey(transactionID))
{ {
AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
this.XferUploaders.Add(transactionID, uploader); XferUploaders.Add(transactionID, uploader);
return uploader; return uploader;
} }
return null; return null;
@ -86,7 +81,7 @@ namespace OpenSim.Framework.Communications.Cache
public void HandleXfer(ulong xferID, uint packetID, byte[] data) public void HandleXfer(ulong xferID, uint packetID, byte[] data)
{ {
foreach (AssetXferUploader uploader in this.XferUploaders.Values) foreach (AssetXferUploader uploader in XferUploaders.Values)
{ {
if (uploader.XferID == xferID) if (uploader.XferID == xferID)
{ {
@ -96,17 +91,21 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{ {
if (this.XferUploaders.ContainsKey(transactionID)) if (XferUploaders.ContainsKey(transactionID))
{ {
this.XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
callbackID, description, name, invType, type,
wearableType, nextOwnerMask);
} }
} }
public AssetBase GetTransactionAsset(LLUUID transactionID) public AssetBase GetTransactionAsset(LLUUID transactionID)
{ {
if (this.XferUploaders.ContainsKey(transactionID)) if (XferUploaders.ContainsKey(transactionID))
{ {
return XferUploaders[transactionID].GetAssetData(); return XferUploaders[transactionID].GetAssetData();
} }
@ -130,15 +129,16 @@ namespace OpenSim.Framework.Communications.Cache
public event UpLoadedAsset OnUpLoad; public event UpLoadedAsset OnUpLoad;
// Methods // Methods
public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile) public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem,
LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile)
{ {
this.m_assetName = assetName; m_assetName = assetName;
this.m_assetDescription = assetDescription; m_assetDescription = assetDescription;
this.m_folderID = folderID; m_folderID = folderID;
this.newAssetID = assetID; newAssetID = assetID;
this.inventoryItemID = inventoryItem; inventoryItemID = inventoryItem;
this.uploaderPath = path; uploaderPath = path;
this.httpListener = httpServer; httpListener = httpServer;
m_dumpImageToFile = dumpImageToFile; m_dumpImageToFile = dumpImageToFile;
} }
@ -156,18 +156,18 @@ namespace OpenSim.Framework.Communications.Cache
LLUUID inventoryItemID = this.inventoryItemID; LLUUID inventoryItemID = this.inventoryItemID;
string text = ""; string text = "";
LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
complete.new_asset = this.newAssetID.ToStringHyphenated(); complete.new_asset = newAssetID.ToStringHyphenated();
complete.new_inventory_item = inventoryItemID; complete.new_inventory_item = inventoryItemID;
complete.state = "complete"; complete.state = "complete";
text = LLSDHelpers.SerialiseLLSDReply(complete); text = LLSDHelpers.SerialiseLLSDReply(complete);
this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if (this.m_dumpImageToFile) if (m_dumpImageToFile)
{ {
this.SaveImageToFile(this.m_assetName + ".jp2", data); SaveImageToFile(m_assetName + ".jp2", data);
} }
if (this.OnUpLoad != null) if (OnUpLoad != null)
{ {
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , ""); OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
} }
return text; return text;
} }
@ -196,90 +196,91 @@ namespace OpenSim.Framework.Communications.Cache
public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
{ {
this.m_userTransactions = transactions; m_userTransactions = transactions;
m_dumpAssetToFile = dumpAssetToFile; m_dumpAssetToFile = dumpAssetToFile;
} }
// Methods // Methods
public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) public void HandleXferPacket(ulong xferID, uint packetID, byte[] data)
{ {
if (this.XferID == xferID) if (XferID == xferID)
{ {
if (this.Asset.Data.Length > 1) if (Asset.Data.Length > 1)
{ {
byte[] destinationArray = new byte[this.Asset.Data.Length + data.Length]; byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
Array.Copy(this.Asset.Data, 0, destinationArray, 0, this.Asset.Data.Length); Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
Array.Copy(data, 0, destinationArray, this.Asset.Data.Length, data.Length); Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
this.Asset.Data = destinationArray; Asset.Data = destinationArray;
} }
else else
{ {
byte[] buffer2 = new byte[data.Length - 4]; byte[] buffer2 = new byte[data.Length - 4];
Array.Copy(data, 4, buffer2, 0, data.Length - 4); Array.Copy(data, 4, buffer2, 0, data.Length - 4);
this.Asset.Data = buffer2; Asset.Data = buffer2;
} }
ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
newPack.XferID.ID = xferID; newPack.XferID.ID = xferID;
newPack.XferID.Packet = packetID; newPack.XferID.Packet = packetID;
this.ourClient.OutPacket(newPack); ourClient.OutPacket(newPack);
if ((packetID & 0x80000000) != 0) if ((packetID & 0x80000000) != 0)
{ {
this.SendCompleteMessage(); SendCompleteMessage();
} }
} }
} }
public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
bool storeLocal)
{ {
this.ourClient = remoteClient; ourClient = remoteClient;
this.Asset = new AssetBase(); Asset = new AssetBase();
this.Asset.FullID = assetID; Asset.FullID = assetID;
this.Asset.InvType = type; Asset.InvType = type;
this.Asset.Type = type; Asset.Type = type;
this.Asset.Data = data; Asset.Data = data;
this.Asset.Name = "blank"; Asset.Name = "blank";
this.Asset.Description = "empty"; Asset.Description = "empty";
this.TransactionID = transaction; TransactionID = transaction;
this.m_storeLocal = storeLocal; m_storeLocal = storeLocal;
if (this.Asset.Data.Length > 2) if (Asset.Data.Length > 2)
{ {
this.SendCompleteMessage(); SendCompleteMessage();
} }
else else
{ {
this.ReqestStartXfer(); ReqestStartXfer();
} }
} }
protected void ReqestStartXfer() protected void ReqestStartXfer()
{ {
this.UploadComplete = false; UploadComplete = false;
this.XferID = Util.GetNextXferID(); XferID = Util.GetNextXferID();
RequestXferPacket newPack = new RequestXferPacket(); RequestXferPacket newPack = new RequestXferPacket();
newPack.XferID.ID = this.XferID; newPack.XferID.ID = XferID;
newPack.XferID.VFileType = this.Asset.Type; newPack.XferID.VFileType = Asset.Type;
newPack.XferID.VFileID = this.Asset.FullID; newPack.XferID.VFileID = Asset.FullID;
newPack.XferID.FilePath = 0; newPack.XferID.FilePath = 0;
newPack.XferID.Filename = new byte[0]; newPack.XferID.Filename = new byte[0];
this.ourClient.OutPacket(newPack); ourClient.OutPacket(newPack);
} }
protected void SendCompleteMessage() protected void SendCompleteMessage()
{ {
this.UploadComplete = true; UploadComplete = true;
AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
newPack.AssetBlock.Type = this.Asset.Type; newPack.AssetBlock.Type = Asset.Type;
newPack.AssetBlock.Success = true; newPack.AssetBlock.Success = true;
newPack.AssetBlock.UUID = this.Asset.FullID; newPack.AssetBlock.UUID = Asset.FullID;
this.ourClient.OutPacket(newPack); ourClient.OutPacket(newPack);
this.m_finished = true; m_finished = true;
if (m_createItem) if (m_createItem)
{ {
DoCreateItem(); DoCreateItem();
} }
else if (m_storeLocal) else if (m_storeLocal)
{ {
this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
} }
// Console.WriteLine("upload complete "+ this.TransactionID); // Console.WriteLine("upload complete "+ this.TransactionID);
@ -287,8 +288,10 @@ namespace OpenSim.Framework.Communications.Cache
if (m_dumpAssetToFile) if (m_dumpAssetToFile)
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
string filename = String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type ); string filename =
SaveAssetToFile(filename, this.Asset.Data); String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day,
now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
SaveAssetToFile(filename, Asset.Data);
} }
} }
@ -301,20 +304,22 @@ namespace OpenSim.Framework.Communications.Cache
fs.Close(); fs.Close();
} }
public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{ {
if (this.TransactionID == transactionID) if (TransactionID == transactionID)
{ {
this.InventFolder = folderID; InventFolder = folderID;
this.m_name = name; m_name = name;
this.m_description = description; m_description = description;
this.type = type; this.type = type;
this.invType = invType; this.invType = invType;
this.nextPerm = nextOwnerMask; nextPerm = nextOwnerMask;
this.Asset.Name = name; Asset.Name = name;
this.Asset.Description = description; Asset.Description = description;
this.Asset.Type = type; Asset.Type = type;
this.Asset.InvType = invType; Asset.InvType = invType;
m_createItem = true; m_createItem = true;
if (m_finished) if (m_finished)
{ {
@ -326,22 +331,23 @@ namespace OpenSim.Framework.Communications.Cache
private void DoCreateItem() private void DoCreateItem()
{ {
//really need to fix this call, if lbsa71 saw this he would die. //really need to fix this call, if lbsa71 saw this he would die.
this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
CachedUserInfo userInfo = m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); CachedUserInfo userInfo =
m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = this.ourClient.AgentId; item.avatarID = ourClient.AgentId;
item.creatorsID = ourClient.AgentId; item.creatorsID = ourClient.AgentId;
item.inventoryID = LLUUID.Random(); item.inventoryID = LLUUID.Random();
item.assetID = Asset.FullID; item.assetID = Asset.FullID;
item.inventoryDescription = this.m_description; item.inventoryDescription = m_description;
item.inventoryName = m_name; item.inventoryName = m_name;
item.assetType = type; item.assetType = type;
item.invType = this.invType; item.invType = invType;
item.parentFolderID = this.InventFolder; item.parentFolderID = InventFolder;
item.inventoryCurrentPermissions = 2147483647; item.inventoryCurrentPermissions = 2147483647;
item.inventoryNextPermissions = this.nextPerm; item.inventoryNextPermissions = nextPerm;
userInfo.AddItem(ourClient.AgentId, item); userInfo.AddItem(ourClient.AgentId, item);
ourClient.SendInventoryItemUpdate(item); ourClient.SendInventoryItemUpdate(item);
@ -350,14 +356,13 @@ namespace OpenSim.Framework.Communications.Cache
public void UpdateInventoryItem(LLUUID itemID) public void UpdateInventoryItem(LLUUID itemID)
{ {
} }
public AssetBase GetAssetData() public AssetBase GetAssetData()
{ {
if (m_finished) if (m_finished)
{ {
return this.Asset; return Asset;
} }
return null; return null;
} }
@ -379,10 +384,10 @@ namespace OpenSim.Framework.Communications.Cache
// Methods // Methods
public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer)
{ {
this.inventoryItemID = inventoryItem; inventoryItemID = inventoryItem;
this.uploaderPath = path; uploaderPath = path;
this.httpListener = httpServer; httpListener = httpServer;
this.newAssetID = LLUUID.Random(); newAssetID = LLUUID.Random();
} }
private void SaveImageToFile(string filename, byte[] data) private void SaveImageToFile(string filename, byte[] data)
@ -399,18 +404,18 @@ namespace OpenSim.Framework.Communications.Cache
LLUUID inventoryItemID = this.inventoryItemID; LLUUID inventoryItemID = this.inventoryItemID;
string text = ""; string text = "";
LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
complete.new_asset = this.newAssetID.ToStringHyphenated(); complete.new_asset = newAssetID.ToStringHyphenated();
complete.new_inventory_item = inventoryItemID; complete.new_inventory_item = inventoryItemID;
complete.state = "complete"; complete.state = "complete";
text = LLSDHelpers.SerialiseLLSDReply(complete); text = LLSDHelpers.SerialiseLLSDReply(complete);
this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if (this.SaveImages) if (SaveImages)
{ {
this.SaveImageToFile(this.m_assetName + "notecard.txt", data); SaveImageToFile(m_assetName + "notecard.txt", data);
} }
if (this.OnUpLoad != null) if (OnUpLoad != null)
{ {
this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" ); OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
} }
return text; return text;
} }

View File

@ -26,7 +26,6 @@
* *
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -45,22 +44,22 @@ namespace OpenSim.Framework.Communications.Cache
// Methods // Methods
public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
{ {
if (userID == this.UserProfile.UUID) if (userID == UserProfile.UUID)
{ {
if (this.RootFolder == null) if (RootFolder == null)
{ {
if (folderInfo.parentID == LLUUID.Zero) if (folderInfo.parentID == LLUUID.Zero)
{ {
this.RootFolder = folderInfo; RootFolder = folderInfo;
} }
} }
else if (this.RootFolder.folderID == folderInfo.parentID) else if (RootFolder.folderID == folderInfo.parentID)
{ {
this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
} }
else else
{ {
InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID); InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID);
if (folder != null) if (folder != null)
{ {
folder.SubFolders.Add(folderInfo.folderID, folderInfo); folder.SubFolders.Add(folderInfo.folderID, folderInfo);
@ -71,15 +70,15 @@ namespace OpenSim.Framework.Communications.Cache
public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
{ {
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) if ((userID == UserProfile.UUID) && (RootFolder != null))
{ {
if (itemInfo.parentFolderID == this.RootFolder.folderID) if (itemInfo.parentFolderID == RootFolder.folderID)
{ {
this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
} }
else else
{ {
InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID);
if (folder != null) if (folder != null)
{ {
folder.Items.Add(itemInfo.inventoryID, itemInfo); folder.Items.Add(itemInfo.inventoryID, itemInfo);
@ -90,30 +89,30 @@ namespace OpenSim.Framework.Communications.Cache
public void AddItem(LLUUID userID, InventoryItemBase itemInfo) public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
{ {
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) if ((userID == UserProfile.UUID) && (RootFolder != null))
{ {
this.ItemReceive(userID, itemInfo); ItemReceive(userID, itemInfo);
this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
} }
} }
public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
{ {
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) if ((userID == UserProfile.UUID) && (RootFolder != null))
{ {
this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
} }
} }
public bool DeleteItem(LLUUID userID, InventoryItemBase item) public bool DeleteItem(LLUUID userID, InventoryItemBase item)
{ {
bool result = false; bool result = false;
if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) if ((userID == UserProfile.UUID) && (RootFolder != null))
{ {
result = RootFolder.DeleteItem(item.inventoryID); result = RootFolder.DeleteItem(item.inventoryID);
if (result) if (result)
{ {
this.m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item);
} }
} }
return result; return result;

View File

@ -25,19 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading;
using System.Reflection;
using System.Xml.Serialization; using System.Xml.Serialization;
using libsecondlife; using libsecondlife;
using Nini.Config;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -63,7 +57,6 @@ namespace OpenSim.Framework.Communications.Cache
Stream s = null; Stream s = null;
try try
{ {
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
RestClient rc = new RestClient(_assetServerUrl); RestClient rc = new RestClient(_assetServerUrl);
@ -77,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache
if (s.Length > 0) if (s.Length > 0)
{ {
XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
AssetBase asset = (AssetBase)xs.Deserialize(s); AssetBase asset = (AssetBase) xs.Deserialize(s);
_receiver.AssetReceived(asset, isTexture); _receiver.AssetReceived(asset, isTexture);
} }
@ -106,7 +99,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
MemoryStream s = new MemoryStream(); MemoryStream s = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
xs.Serialize(s, asset); xs.Serialize(s, asset);
RestClient rc = new RestClient(_assetServerUrl); RestClient rc = new RestClient(_assetServerUrl);
rc.AddResourcePath("assets"); rc.AddResourcePath("assets");
@ -129,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache
throw new Exception("The method or operation is not implemented."); throw new Exception("The method or operation is not implemented.");
} }
public System.Collections.Generic.List<AssetBase> GetDefaultAssets() public List<AssetBase> GetDefaultAssets()
{ {
throw new Exception("The method or operation is not implemented."); throw new Exception("The method or operation is not implemented.");
} }

View File

@ -25,14 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -44,17 +38,16 @@ namespace OpenSim.Framework.Communications.Cache
public InventoryFolderImpl(InventoryFolderBase folderbase) public InventoryFolderImpl(InventoryFolderBase folderbase)
{ {
this.agentID = folderbase.agentID; agentID = folderbase.agentID;
this.folderID = folderbase.folderID; folderID = folderbase.folderID;
this.name = folderbase.name; name = folderbase.name;
this.parentID = folderbase.parentID; parentID = folderbase.parentID;
this.type = folderbase.type; type = folderbase.type;
this.version = folderbase.version; version = folderbase.version;
} }
public InventoryFolderImpl() public InventoryFolderImpl()
{ {
} }
// Methods // Methods
@ -65,19 +58,19 @@ namespace OpenSim.Framework.Communications.Cache
subFold.folderID = folderID; subFold.folderID = folderID;
subFold.type = (short) type; subFold.type = (short) type;
subFold.parentID = this.folderID; subFold.parentID = this.folderID;
subFold.agentID = this.agentID; subFold.agentID = agentID;
this.SubFolders.Add(subFold.folderID, subFold); SubFolders.Add(subFold.folderID, subFold);
return subFold; return subFold;
} }
public InventoryItemBase HasItem(LLUUID itemID) public InventoryItemBase HasItem(LLUUID itemID)
{ {
InventoryItemBase base2 = null; InventoryItemBase base2 = null;
if (this.Items.ContainsKey(itemID)) if (Items.ContainsKey(itemID))
{ {
return this.Items[itemID]; return Items[itemID];
} }
foreach (InventoryFolderImpl folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
base2 = folder.HasItem(itemID); base2 = folder.HasItem(itemID);
if (base2 != null) if (base2 != null)
@ -91,12 +84,12 @@ namespace OpenSim.Framework.Communications.Cache
public bool DeleteItem(LLUUID itemID) public bool DeleteItem(LLUUID itemID)
{ {
bool found = false; bool found = false;
if (this.Items.ContainsKey(itemID)) if (Items.ContainsKey(itemID))
{ {
Items.Remove(itemID); Items.Remove(itemID);
return true; return true;
} }
foreach (InventoryFolderImpl folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
found = folder.DeleteItem(itemID); found = folder.DeleteItem(itemID);
if (found == true) if (found == true)
@ -111,13 +104,13 @@ namespace OpenSim.Framework.Communications.Cache
public InventoryFolderImpl HasSubFolder(LLUUID folderID) public InventoryFolderImpl HasSubFolder(LLUUID folderID)
{ {
InventoryFolderImpl returnFolder = null; InventoryFolderImpl returnFolder = null;
if (this.SubFolders.ContainsKey(folderID)) if (SubFolders.ContainsKey(folderID))
{ {
returnFolder = this.SubFolders[folderID]; returnFolder = SubFolders[folderID];
} }
else else
{ {
foreach (InventoryFolderImpl folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
returnFolder = folder.HasSubFolder(folderID); returnFolder = folder.HasSubFolder(folderID);
if (returnFolder != null) if (returnFolder != null)
@ -132,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
public List<InventoryItemBase> RequestListOfItems() public List<InventoryItemBase> RequestListOfItems()
{ {
List<InventoryItemBase> itemList = new List<InventoryItemBase>(); List<InventoryItemBase> itemList = new List<InventoryItemBase>();
foreach (InventoryItemBase item in this.Items.Values) foreach (InventoryItemBase item in Items.Values)
{ {
itemList.Add(item); itemList.Add(item);
} }

View File

@ -26,12 +26,8 @@
* *
*/ */
using System;
using System.IO; using System.IO;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using Nini.Config; using Nini.Config;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
@ -40,43 +36,42 @@ namespace OpenSim.Framework.Communications.Cache
/// Basically a hack to give us a Inventory library while we don't have a inventory server /// Basically a hack to give us a Inventory library while we don't have a inventory server
/// once the server is fully implemented then should read the data from that /// once the server is fully implemented then should read the data from that
/// </summary> /// </summary>
public class LibraryRootFolder : Cache.InventoryFolderImpl public class LibraryRootFolder : InventoryFolderImpl
{ {
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
private Cache.InventoryFolderImpl m_textureFolder; private InventoryFolderImpl m_textureFolder;
public LibraryRootFolder() public LibraryRootFolder()
{ {
this.agentID = libOwner; agentID = libOwner;
this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
this.name = "OpenSim Library"; name = "OpenSim Library";
this.parentID = LLUUID.Zero; parentID = LLUUID.Zero;
this.type = (short)-1; type = (short) -1;
this.version = (ushort)1; version = (ushort) 1;
Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); InventoryFolderImpl folderInfo = new InventoryFolderImpl();
folderInfo.agentID = libOwner; folderInfo.agentID = libOwner;
folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001");
folderInfo.name = "Texture Library"; folderInfo.name = "Texture Library";
folderInfo.parentID = this.folderID; folderInfo.parentID = folderID;
folderInfo.type = -1; folderInfo.type = -1;
folderInfo.version = 1; folderInfo.version = 1;
this.SubFolders.Add(folderInfo.folderID, folderInfo); SubFolders.Add(folderInfo.folderID, folderInfo);
this.m_textureFolder = folderInfo; m_textureFolder = folderInfo;
this.CreateLibraryItems(); CreateLibraryItems();
string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
XmlConfigSource source = new XmlConfigSource(filePath); XmlConfigSource source = new XmlConfigSource(filePath);
this.ReadItemsFromFile(source); ReadItemsFromFile(source);
} }
} }
private void CreateLibraryItems() private void CreateLibraryItems()
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
item.creatorsID = libOwner; item.creatorsID = libOwner;
@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryEveryOnePermissions = 0x7FFFFFFF;
item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF;
item.inventoryNextPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryEveryOnePermissions = 0x7FFFFFFF;
item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF;
item.inventoryNextPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryEveryOnePermissions = 0x7FFFFFFF;
item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF;
item.inventoryNextPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryEveryOnePermissions = 0x7FFFFFFF;
item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF;
item.inventoryNextPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryEveryOnePermissions = 0x7FFFFFFF;
item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF;
item.inventoryNextPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryName = "Default Shape"; item.inventoryName = "Default Shape";
item.assetType = 13; item.assetType = 13;
item.invType = 18; item.invType = 18;
item.parentFolderID = this.folderID; item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 0; item.inventoryCurrentPermissions = 0;
item.inventoryNextPermissions = 0; item.inventoryNextPermissions = 0;
this.Items.Add(item.inventoryID, item); Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryName = "Default Skin"; item.inventoryName = "Default Skin";
item.assetType = 13; item.assetType = 13;
item.invType = 18; item.invType = 18;
item.parentFolderID = this.folderID; item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 0; item.inventoryCurrentPermissions = 0;
item.inventoryNextPermissions = 0; item.inventoryNextPermissions = 0;
this.Items.Add(item.inventoryID, item); Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryName = "Default Shirt"; item.inventoryName = "Default Shirt";
item.assetType = 5; item.assetType = 5;
item.invType = 18; item.invType = 18;
item.parentFolderID = this.folderID; item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 0; item.inventoryCurrentPermissions = 0;
item.inventoryNextPermissions = 0; item.inventoryNextPermissions = 0;
this.Items.Add(item.inventoryID, item); Items.Add(item.inventoryID, item);
item = new InventoryItemBase(); item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache
item.inventoryName = "Default Pants"; item.inventoryName = "Default Pants";
item.assetType = 5; item.assetType = 5;
item.invType = 18; item.invType = 18;
item.parentFolderID = this.folderID; item.parentFolderID = folderID;
item.inventoryCurrentPermissions = 0; item.inventoryCurrentPermissions = 0;
item.inventoryNextPermissions = 0; item.inventoryNextPermissions = 0;
this.Items.Add(item.inventoryID, item); Items.Add(item.inventoryID, item);
} }
private void ReadItemsFromFile(IConfigSource source) private void ReadItemsFromFile(IConfigSource source)
@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = libOwner; item.avatarID = libOwner;
item.creatorsID = libOwner; item.creatorsID = libOwner;
item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); item.inventoryID =
new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated()));
item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
item.inventoryDescription = source.Configs[i].GetString("description", ""); item.inventoryDescription = source.Configs[i].GetString("description", "");
item.inventoryName = source.Configs[i].GetString("name", ""); item.inventoryName = source.Configs[i].GetString("name", "");
item.assetType = source.Configs[i].GetInt("assetType", 0); item.assetType = source.Configs[i].GetInt("assetType", 0);
item.invType = source.Configs[i].GetInt("inventoryType", 0); item.invType = source.Configs[i].GetInt("inventoryType", 0);
item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
if (item.assetType == 0) if (item.assetType == 0)
{ {
item.parentFolderID = this.m_textureFolder.folderID; item.parentFolderID = m_textureFolder.folderID;
this.m_textureFolder.Items.Add(item.inventoryID, item); m_textureFolder.Items.Add(item.inventoryID, item);
} }
else else
{ {
item.parentFolderID = this.folderID; item.parentFolderID = folderID;
this.Items.Add(item.inventoryID, item); Items.Add(item.inventoryID, item);
} }
} }
} }
} }
} }

View File

@ -26,14 +26,8 @@
* *
*/ */
using System; using System;
using System.IO;
using System.Threading;
using System.Reflection; using System.Reflection;
using libsecondlife;
using Nini.Config;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -62,11 +56,14 @@ namespace OpenSim.Framework.Communications.Cache
if (typeInterface != null) if (typeInterface != null)
{ {
IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); IAssetProvider plug =
(IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
m_assetProviderPlugin = plug; m_assetProviderPlugin = plug;
m_assetProviderPlugin.Initialise(); m_assetProviderPlugin.Initialise();
MainLog.Instance.Verbose("AssetStorage","Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); MainLog.Instance.Verbose("AssetStorage",
"Added " + m_assetProviderPlugin.Name + " " +
m_assetProviderPlugin.Version);
} }
typeInterface = null; typeInterface = null;
@ -84,11 +81,11 @@ namespace OpenSim.Framework.Communications.Cache
m_assetProviderPlugin.CommitAssets(); m_assetProviderPlugin.CommitAssets();
} }
override protected void RunRequests() protected override void RunRequests()
{ {
while (true) while (true)
{ {
ARequest req = this._assetRequests.Dequeue(); ARequest req = _assetRequests.Dequeue();
//MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID); //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
@ -105,9 +102,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
_receiver.AssetNotFound(req.AssetID); _receiver.AssetNotFound(req.AssetID);
} }
} }
} }
protected override void StoreAsset(AssetBase asset) protected override void StoreAsset(AssetBase asset)

View File

@ -25,16 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache
// Methods // Methods
public UserProfileCache(CommunicationsManager parent) public UserProfileCache(CommunicationsManager parent)
{ {
this.m_parent = parent; m_parent = parent;
} }
/// <summary> /// <summary>
@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache
// Potential fix - Multithreading issue. // Potential fix - Multithreading issue.
lock (UserProfiles) lock (UserProfiles)
{ {
if (!this.UserProfiles.ContainsKey(userID)) if (!UserProfiles.ContainsKey(userID))
{ {
CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); CachedUserInfo userInfo = new CachedUserInfo(m_parent);
userInfo.UserProfile = this.RequestUserProfileForUser(userID); userInfo.UserProfile = RequestUserProfileForUser(userID);
if (userInfo.UserProfile != null) if (userInfo.UserProfile != null)
{ {
this.RequestInventoryForUser(userID, userInfo); RequestInventoryForUser(userID, userInfo);
this.UserProfiles.Add(userID, userInfo); UserProfiles.Add(userID, userInfo);
} }
else else
{ {
@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache
public CachedUserInfo GetUserDetails(LLUUID userID) public CachedUserInfo GetUserDetails(LLUUID userID)
{ {
if (this.UserProfiles.ContainsKey(userID)) if (UserProfiles.ContainsKey(userID))
{ {
return this.UserProfiles[userID]; return UserProfiles[userID];
} }
return null; return null;
} }
public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
string folderName, LLUUID parentID)
{ {
if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) if (UserProfiles.ContainsKey(remoteClient.AgentId))
{ {
if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) if (UserProfiles[remoteClient.AgentId].RootFolder != null)
{ {
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; CachedUserInfo info = UserProfiles[remoteClient.AgentId];
if (info.RootFolder.folderID == parentID) if (info.RootFolder.folderID == parentID)
{ {
InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); InventoryFolderImpl createdFolder =
info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
if (createdFolder != null) if (createdFolder != null)
{ {
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
} }
} }
else else
@ -125,27 +119,30 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder)
{ {
InventoryFolderImpl fold = null; InventoryFolderImpl fold = null;
if (folderID == libraryRoot.folderID ) if (folderID == libraryRoot.folderID)
{ {
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID,
libraryRoot.RequestListOfItems());
} }
else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) else if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
{ {
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
} }
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) else if (UserProfiles.ContainsKey(remoteClient.AgentId))
{ {
if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) if (UserProfiles[remoteClient.AgentId].RootFolder != null)
{ {
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; CachedUserInfo info = UserProfiles[remoteClient.AgentId];
if (info.RootFolder.folderID == folderID) if (info.RootFolder.folderID == folderID)
{ {
if (fetchItems) if (fetchItems)
{ {
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
info.RootFolder.RequestListOfItems());
} }
} }
else else
@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache
InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID);
if ((folder != null) && fetchItems) if ((folder != null) && fetchItems)
{ {
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
folder.RequestListOfItems());
} }
} }
} }
@ -166,11 +164,11 @@ namespace OpenSim.Framework.Communications.Cache
{ {
//Console.WriteLine("request info for library item"); //Console.WriteLine("request info for library item");
} }
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) else if (UserProfiles.ContainsKey(remoteClient.AgentId))
{ {
if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) if (UserProfiles[remoteClient.AgentId].RootFolder != null)
{ {
InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); InventoryItemBase item = UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID);
if (item != null) if (item != null)
{ {
remoteClient.SendInventoryItemDetails(ownerID, item); remoteClient.SendInventoryItemDetails(ownerID, item);
@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="userID"></param> /// <param name="userID"></param>
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
{ {
this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
} }
/// <summary> /// <summary>
@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="userID"></param> /// <param name="userID"></param>
private UserProfileData RequestUserProfileForUser(LLUUID userID) private UserProfileData RequestUserProfileForUser(LLUUID userID)
{ {
return this.m_parent.UserService.GetUserProfile(userID); return m_parent.UserService.GetUserProfile(userID);
} }
/// <summary> /// <summary>

View File

@ -28,18 +28,23 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities
{ {
public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); public delegate void UpLoadedAsset(
string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data,
string inventoryType, string assetType);
public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
public class Caps public class Caps
@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities
public ItemUpdatedCallback ItemUpdatedCall = null; public ItemUpdatedCallback ItemUpdatedCall = null;
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath,
LLUUID agent, bool dumpAssetsToFile)
{ {
assetCache = assetCach; assetCache = assetCach;
m_capsObjectPath = capsPath; m_capsObjectPath = capsPath;
@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities
/// </summary> /// </summary>
public void RegisterHandlers() public void RegisterHandlers()
{ {
OpenSim.Framework.Console.MainLog.Instance.Verbose("CAPS","Registering CAPS handlers"); MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers");
string capsBase = "/CAPS/" + m_capsObjectPath; string capsBase = "/CAPS/" + m_capsObjectPath;
try try
{ {
httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); httpListener.AddStreamHandler(
httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
GetMapLayer));
httpListener.AddStreamHandler(
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
capsBase + m_newInventory,
NewAgentInventoryRequest));
AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
//AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture);
@ -114,7 +125,7 @@ namespace OpenSim.Region.Capabilities
public string CapsRequest(string request, string path, string param) public string CapsRequest(string request, string path, string param)
{ {
// Console.WriteLine("caps request " + request); // Console.WriteLine("caps request " + request);
string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities());
return result; return result;
} }
@ -125,7 +136,8 @@ namespace OpenSim.Region.Capabilities
protected LLSDCapsDetails GetCapabilities() protected LLSDCapsDetails GetCapabilities()
{ {
LLSDCapsDetails caps = new LLSDCapsDetails(); LLSDCapsDetails caps = new LLSDCapsDetails();
string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" +
m_capsObjectPath;
caps.MapLayer = capsBaseUrl + m_mapLayerPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath;
// caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities
public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
{ {
LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse());
return mapResponse; return mapResponse;
} }
@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities
} }
#region EventQueue (Currently not enabled) #region EventQueue (Currently not enabled)
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -185,9 +198,9 @@ namespace OpenSim.Region.Capabilities
{ {
string res = ""; string res = "";
if (this.CapsEventQueue.Count > 0) if (CapsEventQueue.Count > 0)
{ {
lock (this.CapsEventQueue) lock (CapsEventQueue)
{ {
string item = CapsEventQueue.Dequeue(); string item = CapsEventQueue.Dequeue();
res = item; res = item;
@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities
} }
else else
{ {
res = this.CreateEmptyEventResponse(); res = CreateEmptyEventResponse();
} }
return res; return res;
} }
@ -215,7 +228,7 @@ namespace OpenSim.Region.Capabilities
string res = LLSDHelpers.SerialiseLLSDReply(eventItem); string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
eventQueueCount++; eventQueueCount++;
this.CapsEventQueue.Enqueue(res); CapsEventQueue.Enqueue(res);
return res; return res;
} }
@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities
eventQueueCount++; eventQueueCount++;
return res; return res;
} }
#endregion #endregion
/// <summary> /// <summary>
@ -243,7 +257,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns> /// <returns></returns>
public string NoteCardAgentInventory(string request, string path, string param) public string NoteCardAgentInventory(string request, string path, string param)
{ {
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
@ -251,11 +265,14 @@ namespace OpenSim.Region.Capabilities
LLUUID newInvItem = llsdRequest.item_id; LLUUID newInvItem = llsdRequest.item_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); ItemUpdater uploader =
uploader.OnUpLoad += this.ItemUpdated; new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
uploader.OnUpLoad += ItemUpdated;
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); httpListener.AddStreamHandler(
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL; uploadResponse.uploader = uploaderURL;
@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities
LLUUID parentFolder = llsdRequest.folder_id; LLUUID parentFolder = llsdRequest.folder_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); AssetUploader uploader =
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
uploaderPath;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL; uploadResponse.uploader = uploaderURL;
uploadResponse.state = "upload"; uploadResponse.state = "upload";
uploader.OnUpLoad += this.UploadCompleteHandler; uploader.OnUpLoad += UploadCompleteHandler;
return uploadResponse; return uploadResponse;
} }
@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities
/// <param name="assetID"></param> /// <param name="assetID"></param>
/// <param name="inventoryItem"></param> /// <param name="inventoryItem"></param>
/// <param name="data"></param> /// <param name="data"></param>
public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID,
LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType,
string assetType)
{ {
sbyte assType = 0; sbyte assType = 0;
sbyte inType = 0; sbyte inType = 0;
@ -321,7 +344,7 @@ namespace OpenSim.Region.Capabilities
asset.InvType = inType; asset.InvType = inType;
asset.Name = assetName; asset.Name = assetName;
asset.Data = data; asset.Data = data;
this.assetCache.AddAsset(asset); assetCache.AddAsset(asset);
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.avatarID = agentID; item.avatarID = agentID;
@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities
{ {
AddNewInventoryItem(agentID, item); AddNewInventoryItem(agentID, item);
} }
} }
public LLUUID ItemUpdated(LLUUID itemID, byte[] data) public LLUUID ItemUpdated(LLUUID itemID, byte[] data)
{ {
if (ItemUpdatedCall != null) if (ItemUpdatedCall != null)
{ {
return ItemUpdatedCall(this.agentID, itemID, data); return ItemUpdatedCall(agentID, itemID, data);
} }
return LLUUID.Zero; return LLUUID.Zero;
} }
@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities
private string m_invType = ""; private string m_invType = "";
private string m_assetType = ""; private string m_assetType = "";
public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem,
LLUUID parentFolderID, string invType, string assetType, string path,
BaseHttpServer httpServer, bool dumpAssetsToFile)
{ {
m_assetName = assetName; m_assetName = assetName;
m_assetDes = description; m_assetDes = description;
@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns> /// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param) public string uploaderCaps(byte[] data, string path, string param)
{ {
LLUUID inv = this.inventoryItemID; LLUUID inv = inventoryItemID;
string res = ""; string res = "";
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
uploadComplete.new_asset = newAssetID.ToStringHyphenated(); uploadComplete.new_asset = newAssetID.ToStringHyphenated();
@ -402,9 +426,9 @@ namespace OpenSim.Region.Capabilities
httpListener.RemoveStreamHandler("POST", uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if (this.m_dumpAssetsToFile) if (m_dumpAssetsToFile)
{ {
this.SaveAssetToFile(m_assetName + ".jp2", data); SaveAssetToFile(m_assetName + ".jp2", data);
} }
if (OnUpLoad != null) if (OnUpLoad != null)
@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities
private BaseHttpServer httpListener; private BaseHttpServer httpListener;
private bool m_dumpAssetToFile; private bool m_dumpAssetToFile;
public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) public ItemUpdater(LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile)
{ {
m_dumpAssetToFile = dumpAssetToFile; m_dumpAssetToFile = dumpAssetToFile;
@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns> /// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param) public string uploaderCaps(byte[] data, string path, string param)
{ {
LLUUID inv = this.inventoryItemID; LLUUID inv = inventoryItemID;
string res = ""; string res = "";
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
LLUUID assetID = LLUUID.Zero; LLUUID assetID = LLUUID.Zero;
@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities
httpListener.RemoveStreamHandler("POST", uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if (this.m_dumpAssetToFile) if (m_dumpAssetToFile)
{ {
this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
} }
return res; return res;
@ -489,5 +513,3 @@ namespace OpenSim.Region.Capabilities
} }
} }
} }

View File

@ -36,7 +36,6 @@ namespace OpenSim.Region.Capabilities
public LLSDArray() public LLSDArray()
{ {
} }
} }
} }

View File

@ -39,7 +39,6 @@ namespace OpenSim.Region.Capabilities
public LLSDAssetUploadComplete() public LLSDAssetUploadComplete()
{ {
} }
} }
} }

View File

@ -26,9 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities
{ {
[LLSDMap] [LLSDMap]
@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities
public LLSDAssetUploadResponse() public LLSDAssetUploadResponse()
{ {
} }
} }
} }

View File

@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
public LLSDCapEvent() public LLSDCapEvent()
{ {
} }
} }
} }

View File

@ -42,10 +42,6 @@ namespace OpenSim.Region.Capabilities
public LLSDCapsDetails() public LLSDCapsDetails()
{ {
} }
} }
} }

View File

@ -32,7 +32,6 @@ namespace OpenSim.Region.Capabilities
{ {
public LLSDEmpty() public LLSDEmpty()
{ {
} }
} }
} }

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities
public static void SerializeLLSDType(XmlTextWriter writer, object obj) public static void SerializeLLSDType(XmlTextWriter writer, object obj)
{ {
Type myType = obj.GetType(); Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
if (llsdattributes.Length > 0) if (llsdattributes.Length > 0)
{ {
switch (llsdattributes[0].ObjectType) switch (llsdattributes[0].ObjectType)
@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities
for (int i = 0; i < fields.Length; i++) for (int i = 0; i < fields.Length; i++)
{ {
object fieldValue = fields[i].GetValue(obj); object fieldValue = fields[i].GetValue(obj);
LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); LLSDType[] fieldAttributes =
(LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
if (fieldAttributes.Length > 0) if (fieldAttributes.Length > 0)
{ {
writer.WriteStartElement(String.Empty, "key", String.Empty); writer.WriteStartElement(String.Empty, "key", String.Empty);
@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities
case "ARRAY": case "ARRAY":
// LLSDArray arrayObject = obj as LLSDArray; // LLSDArray arrayObject = obj as LLSDArray;
// ArrayList a = arrayObject.Array; // ArrayList a = arrayObject.Array;
ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj);
if (a != null) if (a != null)
{ {
writer.WriteStartElement(String.Empty, "array", String.Empty); writer.WriteStartElement(String.Empty, "array", String.Empty);
@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities
public static object DeserialiseLLSDMap(Hashtable llsd, object obj) public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
{ {
Type myType = obj.GetType(); Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
if (llsdattributes.Length > 0) if (llsdattributes.Length > 0)
{ {
switch (llsdattributes[0].ObjectType) switch (llsdattributes[0].ObjectType)
@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities
IDictionaryEnumerator enumerator = llsd.GetEnumerator(); IDictionaryEnumerator enumerator = llsd.GetEnumerator();
while (enumerator.MoveNext()) while (enumerator.MoveNext())
{ {
FieldInfo field = myType.GetField((string)enumerator.Key); FieldInfo field = myType.GetField((string) enumerator.Key);
if (field != null) if (field != null)
{ {
if (enumerator.Value is Hashtable) if (enumerator.Value is Hashtable)
@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities
return obj; return obj;
} }
} }
} }

View File

@ -26,9 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities

View File

@ -40,7 +40,6 @@ namespace OpenSim.Region.Capabilities
public LLSDMapLayer() public LLSDMapLayer()
{ {
} }
} }
} }

View File

@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
public LLSDMapLayerResponse() public LLSDMapLayerResponse()
{ {
} }
} }
} }

View File

@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
public LLSDMapRequest() public LLSDMapRequest()
{ {
} }
} }
} }

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities
{ {
public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);

View File

@ -26,13 +26,11 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Servers;
using System.IO;
using System.Collections; using System.Collections;
using System.IO;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Servers;
namespace OpenSim.Region.Capabilities namespace OpenSim.Region.Capabilities
{ {
@ -42,7 +40,7 @@ namespace OpenSim.Region.Capabilities
private LLSDMethod<TRequest, TResponse> m_method; private LLSDMethod<TRequest, TResponse> m_method;
public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
: base(httpMethod, path ) : base(httpMethod, path)
{ {
m_method = method; m_method = method;
} }
@ -55,7 +53,7 @@ namespace OpenSim.Region.Capabilities
//string requestBody = streamReader.ReadToEnd(); //string requestBody = streamReader.ReadToEnd();
//streamReader.Close(); //streamReader.Close();
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
TRequest llsdRequest = new TRequest(); TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
@ -63,8 +61,7 @@ namespace OpenSim.Region.Capabilities
Encoding encoding = new UTF8Encoding(false); Encoding encoding = new UTF8Encoding(false);
return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
} }
} }
} }

View File

@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities
public LLSDTest() public LLSDTest()
{ {
} }
} }
} }

View File

@ -37,22 +37,18 @@ namespace OpenSim.Region.Capabilities
public LLSDType(string type) public LLSDType(string type)
{ {
myType = type; myType = type;
} }
public string ObjectType public string ObjectType
{ {
get get { return myType; }
{
return myType;
}
} }
} }
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
public class LLSDMap : LLSDType public class LLSDMap : LLSDType
{ {
public LLSDMap() : base( "MAP" ) public LLSDMap() : base("MAP")
{ {
} }
} }

View File

@ -28,69 +28,77 @@
using System; using System;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
public class CommunicationsManager public class CommunicationsManager
{ {
protected IUserService m_userService; protected IUserService m_userService;
public IUserService UserService public IUserService UserService
{ {
get { return m_userService; } get { return m_userService; }
} }
protected IGridServices m_gridService; protected IGridServices m_gridService;
public IGridServices GridService public IGridServices GridService
{ {
get { return m_gridService; } get { return m_gridService; }
} }
protected IInventoryServices m_inventoryService; protected IInventoryServices m_inventoryService;
public IInventoryServices InventoryService public IInventoryServices InventoryService
{ {
get { return m_inventoryService; } get { return m_inventoryService; }
} }
protected IInterRegionCommunications m_interRegion; protected IInterRegionCommunications m_interRegion;
public IInterRegionCommunications InterRegion public IInterRegionCommunications InterRegion
{ {
get { return m_interRegion; } get { return m_interRegion; }
} }
protected UserProfileCache m_userProfileCache; protected UserProfileCache m_userProfileCache;
public UserProfileCache UserProfileCache public UserProfileCache UserProfileCache
{ {
get { return m_userProfileCache; } get { return m_userProfileCache; }
} }
protected AssetTransactionManager m_transactionsManager; protected AssetTransactionManager m_transactionsManager;
public AssetTransactionManager TransactionsManager public AssetTransactionManager TransactionsManager
{ {
get { return m_transactionsManager; } get { return m_transactionsManager; }
} }
protected AssetCache m_assetCache; protected AssetCache m_assetCache;
public AssetCache AssetCache public AssetCache AssetCache
{ {
get { return m_assetCache; } get { return m_assetCache; }
} }
protected NetworkServersInfo m_networkServersInfo; protected NetworkServersInfo m_networkServersInfo;
public NetworkServersInfo NetworkServersInfo public NetworkServersInfo NetworkServersInfo
{ {
get { return m_networkServersInfo; } get { return m_networkServersInfo; }
} }
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile) public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
bool dumpAssetsToFile)
{ {
m_networkServersInfo = serversInfo; m_networkServersInfo = serversInfo;
m_assetCache = assetCache; m_assetCache = assetCache;
m_userProfileCache = new UserProfileCache(this); m_userProfileCache = new UserProfileCache(this);
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile ); m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
} }
public void doCreate(string[] cmmdParams) public void doCreate(string[] cmmdParams)
@ -106,7 +114,6 @@ namespace OpenSim.Framework.Communications
if (cmmdParams.Length < 2) if (cmmdParams.Length < 2)
{ {
firstName = MainLog.Instance.CmdPrompt("First name", "Default"); firstName = MainLog.Instance.CmdPrompt("First name", "Default");
lastName = MainLog.Instance.CmdPrompt("Last name", "User"); lastName = MainLog.Instance.CmdPrompt("Last name", "User");
password = MainLog.Instance.PasswdPrompt("Password"); password = MainLog.Instance.PasswdPrompt("Password");
@ -120,7 +127,6 @@ namespace OpenSim.Framework.Communications
password = cmmdParams[3]; password = cmmdParams[3];
regX = Convert.ToUInt32(cmmdParams[4]); regX = Convert.ToUInt32(cmmdParams[4]);
regY = Convert.ToUInt32(cmmdParams[5]); regY = Convert.ToUInt32(cmmdParams[5]);
} }
AddUser(firstName, lastName, password, regX, regY); AddUser(firstName, lastName, password, regX, regY);
@ -140,7 +146,7 @@ namespace OpenSim.Framework.Communications
} }
else else
{ {
this.m_inventoryService.CreateNewUserInventory(userProf.UUID); m_inventoryService.CreateNewUserInventory(userProf.UUID);
System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
return userProf.UUID; return userProf.UUID;
} }

View File

@ -27,10 +27,6 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {

View File

@ -26,7 +26,6 @@
* *
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {

View File

@ -26,16 +26,14 @@
* *
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
public interface IInventoryServices public interface IInventoryServices

View File

@ -30,10 +30,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
@ -67,10 +65,10 @@ namespace OpenSim.Framework.Communications
if (typeInterface != null) if (typeInterface != null)
{ {
IInventoryData plug = IInventoryData plug =
(IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(); plug.Initialise();
this.m_plugins.Add(plug.getName(), plug); m_plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface"); MainLog.Instance.Verbose("INVENTORY", "Added IInventoryData Interface");
} }
} }
} }
@ -168,7 +166,7 @@ namespace OpenSim.Framework.Communications
{ {
foreach (InventoryFolderBase folder in inventory.Folders.Values) foreach (InventoryFolderBase folder in inventory.Folders.Values)
{ {
this.AddFolder(folder); AddFolder(folder);
} }
} }
@ -176,7 +174,7 @@ namespace OpenSim.Framework.Communications
{ {
UsersInventory inven = new UsersInventory(); UsersInventory inven = new UsersInventory();
inven.CreateNewInventorySet(user); inven.CreateNewInventorySet(user);
this.AddNewInventorySet(inven); AddNewInventorySet(inven);
} }
public class UsersInventory public class UsersInventory
@ -186,7 +184,6 @@ namespace OpenSim.Framework.Communications
public UsersInventory() public UsersInventory()
{ {
} }
public virtual void CreateNewInventorySet(LLUUID user) public virtual void CreateNewInventorySet(LLUUID user)
@ -231,7 +228,9 @@ namespace OpenSim.Framework.Communications
} }
} }
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack);
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder);
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);

View File

@ -34,12 +34,10 @@ using OpenSim.Framework.Console;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
/// <summary> /// <summary>
/// A temp class to handle login response. /// A temp class to handle login response.
/// Should make use of UserProfileManager where possible. /// Should make use of UserProfileManager where possible.
/// </summary> /// </summary>
public class LoginResponse public class LoginResponse
{ {
private Hashtable loginFlagsHash; private Hashtable loginFlagsHash;
@ -103,119 +101,133 @@ namespace OpenSim.Framework.UserManagement
public LoginResponse() public LoginResponse()
{ {
this.loginFlags = new ArrayList(); loginFlags = new ArrayList();
this.globalTextures = new ArrayList(); globalTextures = new ArrayList();
this.eventCategories = new ArrayList(); eventCategories = new ArrayList();
this.uiConfig = new ArrayList(); uiConfig = new ArrayList();
this.classifiedCategories = new ArrayList(); classifiedCategories = new ArrayList();
this.loginError = new Hashtable(); loginError = new Hashtable();
this.uiConfigHash = new Hashtable(); uiConfigHash = new Hashtable();
this.defaultXmlRpcResponse = new XmlRpcResponse(); defaultXmlRpcResponse = new XmlRpcResponse();
this.userProfile = new UserInfo(); userProfile = new UserInfo();
this.inventoryRoot = new ArrayList(); inventoryRoot = new ArrayList();
this.initialOutfit = new ArrayList(); initialOutfit = new ArrayList();
this.agentInventory = new ArrayList(); agentInventory = new ArrayList();
this.inventoryLibrary = new ArrayList(); inventoryLibrary = new ArrayList();
this.inventoryLibraryOwner = new ArrayList(); inventoryLibraryOwner = new ArrayList();
this.xmlRpcResponse = new XmlRpcResponse(); xmlRpcResponse = new XmlRpcResponse();
this.defaultXmlRpcResponse = new XmlRpcResponse(); defaultXmlRpcResponse = new XmlRpcResponse();
this.SetDefaultValues(); SetDefaultValues();
} // LoginServer } // LoginServer
public void SetDefaultValues() public void SetDefaultValues()
{ {
this.DST = "N"; DST = "N";
this.StipendSinceLogin = "N"; StipendSinceLogin = "N";
this.Gendered = "Y"; Gendered = "Y";
this.EverLoggedIn = "Y"; EverLoggedIn = "Y";
this.login = "false"; login = "false";
this.firstname = "Test"; firstname = "Test";
this.lastname = "User"; lastname = "User";
this.agentAccess = "M"; agentAccess = "M";
this.startLocation = "last"; startLocation = "last";
this.allowFirstLife = "Y"; allowFirstLife = "Y";
this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
this.ErrorReason = "key"; ErrorReason = "key";
this.welcomeMessage = "Welcome to OpenSim!"; welcomeMessage = "Welcome to OpenSim!";
this.seedCapability = ""; seedCapability = "";
this.home = "{'region_handle':[r" + (1000 * 256).ToString() + ",r" + (1000 * 256).ToString() + "], 'position':[r" + this.userProfile.homepos.X.ToString() + ",r" + this.userProfile.homepos.Y.ToString() + ",r" + this.userProfile.homepos.Z.ToString() + "], 'look_at':[r" + this.userProfile.homelookat.X.ToString() + ",r" + this.userProfile.homelookat.Y.ToString() + ",r" + this.userProfile.homelookat.Z.ToString() + "]}"; home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" +
this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
this.RegionX = (uint)255232; userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
this.RegionY = (uint)254976; userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
RegionX = (uint) 255232;
RegionY = (uint) 254976;
// Classifieds; // Classifieds;
this.AddClassifiedCategory((Int32)1, "Shopping"); AddClassifiedCategory((Int32) 1, "Shopping");
this.AddClassifiedCategory((Int32)2, "Land Rental"); AddClassifiedCategory((Int32) 2, "Land Rental");
this.AddClassifiedCategory((Int32)3, "Property Rental"); AddClassifiedCategory((Int32) 3, "Property Rental");
this.AddClassifiedCategory((Int32)4, "Special Attraction"); AddClassifiedCategory((Int32) 4, "Special Attraction");
this.AddClassifiedCategory((Int32)5, "New Products"); AddClassifiedCategory((Int32) 5, "New Products");
this.AddClassifiedCategory((Int32)6, "Employment"); AddClassifiedCategory((Int32) 6, "Employment");
this.AddClassifiedCategory((Int32)7, "Wanted"); AddClassifiedCategory((Int32) 7, "Wanted");
this.AddClassifiedCategory((Int32)8, "Service"); AddClassifiedCategory((Int32) 8, "Service");
this.AddClassifiedCategory((Int32)9, "Personal"); AddClassifiedCategory((Int32) 9, "Personal");
this.SessionID = LLUUID.Random(); SessionID = LLUUID.Random();
this.SecureSessionID = LLUUID.Random(); SecureSessionID = LLUUID.Random();
this.AgentID = LLUUID.Random(); AgentID = LLUUID.Random();
Hashtable InitialOutfitHash = new Hashtable(); Hashtable InitialOutfitHash = new Hashtable();
InitialOutfitHash["folder_name"] = "Nightclub Female"; InitialOutfitHash["folder_name"] = "Nightclub Female";
InitialOutfitHash["gender"] = "female"; InitialOutfitHash["gender"] = "female";
this.initialOutfit.Add(InitialOutfitHash); initialOutfit.Add(InitialOutfitHash);
} // SetDefaultValues } // SetDefaultValues
#region Login Failure Methods #region Login Failure Methods
public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
{ {
// Overwrite any default values; // Overwrite any default values;
this.xmlRpcResponse = new XmlRpcResponse(); xmlRpcResponse = new XmlRpcResponse();
// Ensure Login Failed message/reason; // Ensure Login Failed message/reason;
this.ErrorMessage = message; ErrorMessage = message;
this.ErrorReason = reason; ErrorReason = reason;
this.loginError["reason"] = this.ErrorReason; loginError["reason"] = ErrorReason;
this.loginError["message"] = this.ErrorMessage; loginError["message"] = ErrorMessage;
this.loginError["login"] = login; loginError["login"] = login;
this.xmlRpcResponse.Value = this.loginError; xmlRpcResponse.Value = loginError;
return (this.xmlRpcResponse); return (xmlRpcResponse);
} // GenerateResponse } // GenerateResponse
public XmlRpcResponse CreateFailedResponse() public XmlRpcResponse CreateFailedResponse()
{ {
return (this.CreateLoginFailedResponse()); return (CreateLoginFailedResponse());
} // CreateErrorConnectingToGridResponse() } // CreateErrorConnectingToGridResponse()
public XmlRpcResponse CreateLoginFailedResponse() public XmlRpcResponse CreateLoginFailedResponse()
{ {
return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); return
(GenerateFailureResponse("key",
"Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
"false"));
} // LoginFailedResponse } // LoginFailedResponse
public XmlRpcResponse CreateAlreadyLoggedInResponse() public XmlRpcResponse CreateAlreadyLoggedInResponse()
{ {
return (this.GenerateFailureResponse("presence", "You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner", "false")); return
(GenerateFailureResponse("presence",
"You appear to be already logged in, if this is not the case please wait for your session to timeout, if this takes longer than a few minutes please contact the grid owner",
"false"));
} // CreateAlreadyLoggedInResponse() } // CreateAlreadyLoggedInResponse()
public XmlRpcResponse CreateDeadRegionResponse() public XmlRpcResponse CreateDeadRegionResponse()
{ {
return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); return
(GenerateFailureResponse("key",
"The region you are attempting to log into is not responding. Please select another region and try again.",
"false"));
} }
public XmlRpcResponse CreateGridErrorResponse() public XmlRpcResponse CreateGridErrorResponse()
{ {
return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); return
(GenerateFailureResponse("key",
"Error connecting to grid. Could not percieve credentials from login XML.",
"false"));
} }
#endregion #endregion
@ -224,68 +236,67 @@ namespace OpenSim.Framework.UserManagement
{ {
try try
{ {
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
this.loginFlagsHash = new Hashtable(); loginFlagsHash = new Hashtable();
this.loginFlagsHash["daylight_savings"] = this.DST; loginFlagsHash["daylight_savings"] = DST;
this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; loginFlagsHash["stipend_since_login"] = StipendSinceLogin;
this.loginFlagsHash["gendered"] = this.Gendered; loginFlagsHash["gendered"] = Gendered;
this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; loginFlagsHash["ever_logged_in"] = EverLoggedIn;
this.loginFlags.Add(this.loginFlagsHash); loginFlags.Add(loginFlagsHash);
responseData["first_name"] = this.Firstname; responseData["first_name"] = Firstname;
responseData["last_name"] = this.Lastname; responseData["last_name"] = Lastname;
responseData["agent_access"] = this.agentAccess; responseData["agent_access"] = agentAccess;
this.globalTexturesHash = new Hashtable(); globalTexturesHash = new Hashtable();
this.globalTexturesHash["sun_texture_id"] = this.SunTexture; globalTexturesHash["sun_texture_id"] = SunTexture;
this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; globalTexturesHash["cloud_texture_id"] = CloudTexture;
this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; globalTexturesHash["moon_texture_id"] = MoonTexture;
this.globalTextures.Add(this.globalTexturesHash); globalTextures.Add(globalTexturesHash);
// this.eventCategories.Add(this.eventCategoriesHash); // this.eventCategories.Add(this.eventCategoriesHash);
this.AddToUIConfig("allow_first_life", this.allowFirstLife); AddToUIConfig("allow_first_life", allowFirstLife);
this.uiConfig.Add(this.uiConfigHash); uiConfig.Add(uiConfigHash);
responseData["sim_port"] =(Int32) this.SimPort; responseData["sim_port"] = (Int32) SimPort;
responseData["sim_ip"] = this.SimAddress; responseData["sim_ip"] = SimAddress;
responseData["agent_id"] = this.AgentID.ToStringHyphenated(); responseData["agent_id"] = AgentID.ToStringHyphenated();
responseData["session_id"] = this.SessionID.ToStringHyphenated(); responseData["session_id"] = SessionID.ToStringHyphenated();
responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); responseData["secure_session_id"] = SecureSessionID.ToStringHyphenated();
responseData["circuit_code"] = this.CircuitCode; responseData["circuit_code"] = CircuitCode;
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
responseData["login-flags"] = this.loginFlags; responseData["login-flags"] = loginFlags;
responseData["global-textures"] = this.globalTextures; responseData["global-textures"] = globalTextures;
responseData["seed_capability"] = this.seedCapability; responseData["seed_capability"] = seedCapability;
responseData["event_categories"] = this.eventCategories; responseData["event_categories"] = eventCategories;
responseData["event_notifications"] = new ArrayList(); // todo responseData["event_notifications"] = new ArrayList(); // todo
responseData["classified_categories"] = this.classifiedCategories; responseData["classified_categories"] = classifiedCategories;
responseData["ui-config"] = this.uiConfig; responseData["ui-config"] = uiConfig;
responseData["inventory-skeleton"] = this.agentInventory; responseData["inventory-skeleton"] = agentInventory;
responseData["inventory-skel-lib"] = this.inventoryLibrary; responseData["inventory-skel-lib"] = inventoryLibrary;
responseData["inventory-root"] = this.inventoryRoot; responseData["inventory-root"] = inventoryRoot;
responseData["gestures"] = new ArrayList(); // todo responseData["gestures"] = new ArrayList(); // todo
responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; responseData["inventory-lib-owner"] = inventoryLibraryOwner;
responseData["initial-outfit"] = this.initialOutfit; responseData["initial-outfit"] = initialOutfit;
responseData["start_location"] = this.startLocation; responseData["start_location"] = startLocation;
responseData["seed_capability"] = this.seedCapability; responseData["seed_capability"] = seedCapability;
responseData["home"] = this.home; responseData["home"] = home;
responseData["look_at"] = this.lookAt; responseData["look_at"] = lookAt;
responseData["message"] = this.welcomeMessage; responseData["message"] = welcomeMessage;
responseData["region_x"] = (Int32)this.RegionX * 256; responseData["region_x"] = (Int32) RegionX*256;
responseData["region_y"] = (Int32)this.RegionY * 256; responseData["region_y"] = (Int32) RegionY*256;
//responseData["inventory-lib-root"] = new ArrayList(); // todo //responseData["inventory-lib-root"] = new ArrayList(); // todo
//responseData["buddy-list"] = new ArrayList(); // todo //responseData["buddy-list"] = new ArrayList(); // todo
responseData["login"] = "true"; responseData["login"] = "true";
this.xmlRpcResponse.Value = responseData; xmlRpcResponse.Value = responseData;
return (this.xmlRpcResponse); return (xmlRpcResponse);
} }
catch (Exception e) catch (Exception e)
{ {
@ -293,10 +304,8 @@ namespace OpenSim.Framework.UserManagement
"CLIENT", "CLIENT",
"LoginResponse: Error creating XML-RPC Response: " + e.Message "LoginResponse: Error creating XML-RPC Response: " + e.Message
); );
return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
} }
} // ToXmlRpcResponse } // ToXmlRpcResponse
public void SetEventCategories(string category, string value) public void SetEventCategories(string category, string value)
@ -307,7 +316,7 @@ namespace OpenSim.Framework.UserManagement
public void AddToUIConfig(string itemName, string item) public void AddToUIConfig(string itemName, string item)
{ {
this.uiConfigHash[itemName] = item; uiConfigHash[itemName] = item;
} // SetUIConfig } // SetUIConfig
public void AddClassifiedCategory(Int32 ID, string categoryName) public void AddClassifiedCategory(Int32 ID, string categoryName)
@ -315,372 +324,193 @@ namespace OpenSim.Framework.UserManagement
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
hash["category_name"] = categoryName; hash["category_name"] = categoryName;
hash["category_id"] = ID; hash["category_id"] = ID;
this.classifiedCategories.Add(hash); classifiedCategories.Add(hash);
// this.classifiedCategoriesHash.Clear(); // this.classifiedCategoriesHash.Clear();
} // SetClassifiedCategory } // SetClassifiedCategory
#region Properties #region Properties
public string Login public string Login
{ {
get get { return login; }
{ set { login = value; }
return this.login;
}
set
{
this.login = value;
}
} // Login } // Login
public string DST public string DST
{ {
get get { return dst; }
{ set { dst = value; }
return this.dst;
}
set
{
this.dst = value;
}
} // DST } // DST
public string StipendSinceLogin public string StipendSinceLogin
{ {
get get { return stipendSinceLogin; }
{ set { stipendSinceLogin = value; }
return this.stipendSinceLogin;
}
set
{
this.stipendSinceLogin = value;
}
} // StipendSinceLogin } // StipendSinceLogin
public string Gendered public string Gendered
{ {
get get { return gendered; }
{ set { gendered = value; }
return this.gendered;
}
set
{
this.gendered = value;
}
} // Gendered } // Gendered
public string EverLoggedIn public string EverLoggedIn
{ {
get get { return everLoggedIn; }
{ set { everLoggedIn = value; }
return this.everLoggedIn;
}
set
{
this.everLoggedIn = value;
}
} // EverLoggedIn } // EverLoggedIn
public int SimPort public int SimPort
{ {
get get { return simPort; }
{ set { simPort = value; }
return this.simPort;
}
set
{
this.simPort = value;
}
} // SimPort } // SimPort
public string SimAddress public string SimAddress
{ {
get get { return simAddress; }
{ set { simAddress = value; }
return this.simAddress;
}
set
{
this.simAddress = value;
}
} // SimAddress } // SimAddress
public LLUUID AgentID public LLUUID AgentID
{ {
get get { return agentID; }
{ set { agentID = value; }
return this.agentID;
}
set
{
this.agentID = value;
}
} // AgentID } // AgentID
public LLUUID SessionID public LLUUID SessionID
{ {
get get { return sessionID; }
{ set { sessionID = value; }
return this.sessionID;
}
set
{
this.sessionID = value;
}
} // SessionID } // SessionID
public LLUUID SecureSessionID public LLUUID SecureSessionID
{ {
get get { return secureSessionID; }
{ set { secureSessionID = value; }
return this.secureSessionID;
}
set
{
this.secureSessionID = value;
}
} // SecureSessionID } // SecureSessionID
public Int32 CircuitCode public Int32 CircuitCode
{ {
get get { return circuitCode; }
{ set { circuitCode = value; }
return this.circuitCode;
}
set
{
this.circuitCode = value;
}
} // CircuitCode } // CircuitCode
public uint RegionX public uint RegionX
{ {
get get { return regionX; }
{ set { regionX = value; }
return this.regionX;
}
set
{
this.regionX = value;
}
} // RegionX } // RegionX
public uint RegionY public uint RegionY
{ {
get get { return regionY; }
{ set { regionY = value; }
return this.regionY;
}
set
{
this.regionY = value;
}
} // RegionY } // RegionY
public string SunTexture public string SunTexture
{ {
get get { return sunTexture; }
{ set { sunTexture = value; }
return this.sunTexture;
}
set
{
this.sunTexture = value;
}
} // SunTexture } // SunTexture
public string CloudTexture public string CloudTexture
{ {
get get { return cloudTexture; }
{ set { cloudTexture = value; }
return this.cloudTexture;
}
set
{
this.cloudTexture = value;
}
} // CloudTexture } // CloudTexture
public string MoonTexture public string MoonTexture
{ {
get get { return moonTexture; }
{ set { moonTexture = value; }
return this.moonTexture;
}
set
{
this.moonTexture = value;
}
} // MoonTexture } // MoonTexture
public string Firstname public string Firstname
{ {
get get { return firstname; }
{ set { firstname = value; }
return this.firstname;
}
set
{
this.firstname = value;
}
} // Firstname } // Firstname
public string Lastname public string Lastname
{ {
get get { return lastname; }
{ set { lastname = value; }
return this.lastname;
}
set
{
this.lastname = value;
}
} // Lastname } // Lastname
public string AgentAccess public string AgentAccess
{ {
get get { return agentAccess; }
{ set { agentAccess = value; }
return this.agentAccess;
}
set
{
this.agentAccess = value;
}
} }
public string StartLocation public string StartLocation
{ {
get get { return startLocation; }
{ set { startLocation = value; }
return this.startLocation;
}
set
{
this.startLocation = value;
}
} // StartLocation } // StartLocation
public string LookAt public string LookAt
{ {
get get { return lookAt; }
{ set { lookAt = value; }
return this.lookAt;
}
set
{
this.lookAt = value;
}
} }
public string SeedCapability public string SeedCapability
{ {
get get { return seedCapability; }
{ set { seedCapability = value; }
return this.seedCapability;
}
set
{
this.seedCapability = value;
}
} // SeedCapability } // SeedCapability
public string ErrorReason public string ErrorReason
{ {
get get { return errorReason; }
{ set { errorReason = value; }
return this.errorReason;
}
set
{
this.errorReason = value;
}
} // ErrorReason } // ErrorReason
public string ErrorMessage public string ErrorMessage
{ {
get get { return errorMessage; }
{ set { errorMessage = value; }
return this.errorMessage;
}
set
{
this.errorMessage = value;
}
} // ErrorMessage } // ErrorMessage
public ArrayList InventoryRoot public ArrayList InventoryRoot
{ {
get get { return inventoryRoot; }
{ set { inventoryRoot = value; }
return this.inventoryRoot;
}
set
{
this.inventoryRoot = value;
}
} }
public ArrayList InventorySkeleton public ArrayList InventorySkeleton
{ {
get get { return agentInventory; }
{ set { agentInventory = value; }
return this.agentInventory;
}
set
{
this.agentInventory = value;
}
} }
public ArrayList InventoryLibrary public ArrayList InventoryLibrary
{ {
get get { return inventoryLibrary; }
{ set { inventoryLibrary = value; }
return this.inventoryLibrary;
}
set
{
this.inventoryLibrary = value;
}
} }
public ArrayList InventoryLibraryOwner public ArrayList InventoryLibraryOwner
{ {
get get { return inventoryLibraryOwner; }
{ set { inventoryLibraryOwner = value; }
return this.inventoryLibraryOwner;
}
set
{
this.inventoryLibraryOwner = value;
}
} }
public string Home public string Home
{ {
get get { return home; }
{ set { home = value; }
return this.home;
}
set
{
this.home = value;
}
} }
public string Message public string Message
{ {
get get { return welcomeMessage; }
{ set { welcomeMessage = value; }
return this.welcomeMessage;
} }
set
{
this.welcomeMessage = value;
}
}
#endregion
#endregion
public class UserInfo public class UserInfo
{ {
@ -692,5 +522,3 @@ namespace OpenSim.Framework.UserManagement
} }
} }
} }

View File

@ -28,16 +28,10 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Security.Cryptography;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework;
using InventoryFolder = OpenSim.Framework.InventoryFolder;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
public class LoginService public class LoginService
@ -61,12 +55,12 @@ namespace OpenSim.Framework.UserManagement
/// <returns>The response to send</returns> /// <returns>The response to send</returns>
public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
{ {
MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
MainLog.Instance.Verbose("LOGIN","Attempting login now...");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") &&
requestData.Contains("passwd"));
bool GoodLogin = false; bool GoodLogin = false;
UserProfileData userProfile; UserProfileData userProfile;
@ -74,9 +68,9 @@ namespace OpenSim.Framework.UserManagement
if (GoodXML) if (GoodXML)
{ {
string firstname = (string)requestData["first"]; string firstname = (string) requestData["first"];
string lastname = (string)requestData["last"]; string lastname = (string) requestData["last"];
string passwd = (string)requestData["passwd"]; string passwd = (string) requestData["passwd"];
userProfile = GetTheUser(firstname, lastname); userProfile = GetTheUser(firstname, lastname);
if (userProfile == null) if (userProfile == null)
@ -110,7 +104,7 @@ namespace OpenSim.Framework.UserManagement
LLUUID agentID = userProfile.UUID; LLUUID agentID = userProfile.UUID;
// Inventory Library Section // Inventory Library Section
InventoryData inventData = this.CreateInventoryData(agentID); InventoryData inventData = CreateInventoryData(agentID);
ArrayList AgentInventoryArray = inventData.InventoryArray; ArrayList AgentInventoryArray = inventData.InventoryArray;
Hashtable InventoryRootHash = new Hashtable(); Hashtable InventoryRootHash = new Hashtable();
@ -120,7 +114,7 @@ namespace OpenSim.Framework.UserManagement
userProfile.rootInventoryFolderID = inventData.RootFolderID; userProfile.rootInventoryFolderID = inventData.RootFolderID;
// Circuit Code // Circuit Code
uint circode = (uint)(Util.RandomClass.Next()); uint circode = (uint) (Util.RandomClass.Next());
logResponse.Lastname = userProfile.surname; logResponse.Lastname = userProfile.surname;
logResponse.Firstname = userProfile.username; logResponse.Firstname = userProfile.username;
@ -129,20 +123,20 @@ namespace OpenSim.Framework.UserManagement
logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
logResponse.InventoryRoot = InventoryRoot; logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = this.GetInventoryLibrary(); logResponse.InventoryLibrary = GetInventoryLibrary();
logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); logResponse.InventoryLibraryOwner = GetLibraryOwner();
logResponse.CircuitCode = (Int32)circode; logResponse.CircuitCode = (Int32) circode;
//logResponse.RegionX = 0; //overwritten //logResponse.RegionX = 0; //overwritten
//logResponse.RegionY = 0; //overwritten //logResponse.RegionY = 0; //overwritten
logResponse.Home = "!!null temporary value {home}!!"; // Overwritten logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
//logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
//logResponse.SimAddress = "127.0.0.1"; //overwritten //logResponse.SimAddress = "127.0.0.1"; //overwritten
//logResponse.SimPort = 0; //overwritten //logResponse.SimPort = 0; //overwritten
logResponse.Message = this.GetMessage(); logResponse.Message = GetMessage();
try try
{ {
this.CustomiseResponse(logResponse, userProfile); CustomiseResponse(logResponse, userProfile);
} }
catch (Exception e) catch (Exception e)
{ {
@ -152,7 +146,6 @@ namespace OpenSim.Framework.UserManagement
} }
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
return logResponse.ToXmlRpcResponse(); return logResponse.ToXmlRpcResponse();
} }
catch (Exception E) catch (Exception E)
@ -162,7 +155,6 @@ namespace OpenSim.Framework.UserManagement
//} //}
} }
return response; return response;
} }
/// <summary> /// <summary>
@ -194,8 +186,7 @@ namespace OpenSim.Framework.UserManagement
/// <returns>Authenticated?</returns> /// <returns>Authenticated?</returns>
public virtual bool AuthenticateUser(UserProfileData profile, string password) public virtual bool AuthenticateUser(UserProfileData profile, string password)
{ {
MainLog.Instance.Verbose("LOGIN", "Authenticating " + profile.username + " " + profile.surname);
MainLog.Instance.Verbose("LOGIN","Authenticating " + profile.username + " " + profile.surname);
password = password.Remove(0, 3); //remove $1$ password = password.Remove(0, 3); //remove $1$
@ -211,7 +202,7 @@ namespace OpenSim.Framework.UserManagement
/// <param name="request"></param> /// <param name="request"></param>
public void CreateAgent(UserProfileData profile, XmlRpcRequest request) public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
{ {
this.m_userManager.CreateAgent(profile, request); m_userManager.CreateAgent(profile, request);
} }
/// <summary> /// <summary>
@ -222,7 +213,7 @@ namespace OpenSim.Framework.UserManagement
/// <returns></returns> /// <returns></returns>
public virtual UserProfileData GetTheUser(string firstname, string lastname) public virtual UserProfileData GetTheUser(string firstname, string lastname)
{ {
return this.m_userManager.GetUserProfile(firstname, lastname); return m_userManager.GetUserProfile(firstname, lastname);
} }
/// <summary> /// <summary>
@ -286,8 +277,8 @@ namespace OpenSim.Framework.UserManagement
TempHash = new Hashtable(); TempHash = new Hashtable();
TempHash["name"] = InvFolder.FolderName; TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version; TempHash["version"] = (Int32) InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.DefaultType; TempHash["type_default"] = (Int32) InvFolder.DefaultType;
TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
AgentInventoryArray.Add(TempHash); AgentInventoryArray.Add(TempHash);
} }

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -27,25 +27,29 @@
*/ */
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenGrid.Framework.Communications")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenGrid.Framework.Communications")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -56,5 +60,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -1,13 +1,10 @@
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Threading; using System.Threading;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
internal class SimpleAsyncResult : IAsyncResult internal class SimpleAsyncResult : IAsyncResult
{ {
private readonly AsyncCallback m_callback; private readonly AsyncCallback m_callback;
/// <summary> /// <summary>
@ -36,7 +33,6 @@ namespace OpenSim.Framework.Communications
m_completedSynchronously = 1; m_completedSynchronously = 1;
} }
#region IAsyncResult Members #region IAsyncResult Members
public object AsyncState public object AsyncState
@ -45,7 +41,6 @@ namespace OpenSim.Framework.Communications
} }
public WaitHandle AsyncWaitHandle public WaitHandle AsyncWaitHandle
{ {
get get
@ -82,15 +77,14 @@ namespace OpenSim.Framework.Communications
get { return Thread.VolatileRead(ref m_completed) == 1; } get { return Thread.VolatileRead(ref m_completed) == 1; }
} }
#endregion #endregion
#region class Methods #region class Methods
internal void SetAsCompleted(bool completedSynchronously) internal void SetAsCompleted(bool completedSynchronously)
{ {
m_completed = 1; m_completed = 1;
if(completedSynchronously) if (completedSynchronously)
m_completedSynchronously = 1; m_completedSynchronously = 1;
else else
m_completedSynchronously = 0; m_completedSynchronously = 0;
@ -112,9 +106,9 @@ namespace OpenSim.Framework.Communications
private void SignalCompletion() private void SignalCompletion()
{ {
if(m_waitHandle != null) m_waitHandle.Set(); if (m_waitHandle != null) m_waitHandle.Set();
if(m_callback != null) m_callback(this); if (m_callback != null) m_callback(this);
} }
public void EndInvoke() public void EndInvoke()
@ -140,7 +134,9 @@ namespace OpenSim.Framework.Communications
private T m_result = default(T); private T m_result = default(T);
public AsyncResult(AsyncCallback asyncCallback, Object state) : public AsyncResult(AsyncCallback asyncCallback, Object state) :
base(asyncCallback, state) { } base(asyncCallback, state)
{
}
public void SetAsCompleted(T result, bool completedSynchronously) public void SetAsCompleted(T result, bool completedSynchronously)
@ -153,11 +149,10 @@ namespace OpenSim.Framework.Communications
base.SetAsCompleted(completedSynchronously); base.SetAsCompleted(completedSynchronously);
} }
new public T EndInvoke() public new T EndInvoke()
{ {
base.EndInvoke(); base.EndInvoke();
return m_result; return m_result;
} }
} }
} }

View File

@ -1,12 +1,10 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Web;
using System.Text; using System.Text;
using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Web;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
@ -29,9 +27,10 @@ namespace OpenSim.Framework.Communications
/// </remarks> /// </remarks>
public class RestClient public class RestClient
{ {
private string realuri;
string realuri;
#region member variables #region member variables
/// <summary> /// <summary>
/// The base Uri of the web-service e.g. http://www.google.com /// The base Uri of the web-service e.g. http://www.google.com
/// </summary> /// </summary>
@ -60,7 +59,7 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// MemoryStream representing the resultiong resource /// MemoryStream representing the resultiong resource
/// </summary> /// </summary>
Stream _resource; private Stream _resource;
/// <summary> /// <summary>
/// WebRequest object, held as a member variable /// WebRequest object, held as a member variable
@ -80,12 +79,12 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// Default time out period /// Default time out period
/// </summary> /// </summary>
const int DefaultTimeout = 10 * 1000; // 10 seconds timeout private const int DefaultTimeout = 10*1000; // 10 seconds timeout
/// <summary> /// <summary>
/// Default Buffer size of a block requested from the web-server /// Default Buffer size of a block requested from the web-server
/// </summary> /// </summary>
const int BufferSize = 4096; // Read blocks of 4 KB. private const int BufferSize = 4096; // Read blocks of 4 KB.
/// <summary> /// <summary>
@ -97,6 +96,7 @@ namespace OpenSim.Framework.Communications
#endregion member variables #endregion member variables
#region constructors #region constructors
/// <summary> /// <summary>
/// Instantiate a new RestClient /// Instantiate a new RestClient
/// </summary> /// </summary>
@ -111,7 +111,8 @@ namespace OpenSim.Framework.Communications
_lock = new object(); _lock = new object();
} }
object _lock; private object _lock;
#endregion constructors #endregion constructors
/// <summary> /// <summary>
@ -120,8 +121,8 @@ namespace OpenSim.Framework.Communications
/// <param name="element">path entry</param> /// <param name="element">path entry</param>
public void AddResourcePath(string element) public void AddResourcePath(string element)
{ {
if(isSlashed(element)) if (isSlashed(element))
_pathElements.Add(element.Substring(0, element.Length-1)); _pathElements.Add(element.Substring(0, element.Length - 1));
else else
_pathElements.Add(element); _pathElements.Add(element);
} }
@ -178,7 +179,7 @@ namespace OpenSim.Framework.Communications
/// Build a Uri based on the intial Url, path elements and parameters /// Build a Uri based on the intial Url, path elements and parameters
/// </summary> /// </summary>
/// <returns>fully constructed Uri</returns> /// <returns>fully constructed Uri</returns>
Uri buildUri() private Uri buildUri()
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(_url); sb.Append(_url);
@ -196,7 +197,8 @@ namespace OpenSim.Framework.Communications
{ {
sb.Append("?"); sb.Append("?");
firstElement = false; firstElement = false;
} else }
else
sb.Append("&"); sb.Append("&");
sb.Append(kv.Key); sb.Append(kv.Key);
@ -209,7 +211,9 @@ namespace OpenSim.Framework.Communications
realuri = sb.ToString(); realuri = sb.ToString();
return new Uri(sb.ToString()); return new Uri(sb.ToString());
} }
#region Async communications with server #region Async communications with server
/// <summary> /// <summary>
/// Async method, invoked when a block of data has been received from the service /// Async method, invoked when a block of data has been received from the service
/// </summary> /// </summary>
@ -218,13 +222,14 @@ namespace OpenSim.Framework.Communications
{ {
try try
{ {
Stream s = (Stream)ar.AsyncState; Stream s = (Stream) ar.AsyncState;
int read = s.EndRead(ar); int read = s.EndRead(ar);
if (read > 0) if (read > 0)
{ {
_resource.Write(_readbuf, 0, read); _resource.Write(_readbuf, 0, read);
IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); IAsyncResult asynchronousResult =
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
// TODO! Implement timeout, without killing the server // TODO! Implement timeout, without killing the server
//ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
@ -251,12 +256,13 @@ namespace OpenSim.Framework.Communications
try try
{ {
// grab response // grab response
WebRequest wr = (WebRequest)ar.AsyncState; WebRequest wr = (WebRequest) ar.AsyncState;
_response = (HttpWebResponse)wr.EndGetResponse(ar); _response = (HttpWebResponse) wr.EndGetResponse(ar);
// get response stream, and setup async reading // get response stream, and setup async reading
Stream s = _response.GetResponseStream(); Stream s = _response.GetResponseStream();
IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); IAsyncResult asynchronousResult =
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
// TODO! Implement timeout, without killing the server // TODO! Implement timeout, without killing the server
// wait until completed, or we timed out // wait until completed, or we timed out
@ -281,6 +287,7 @@ namespace OpenSim.Framework.Communications
} }
} }
} }
#endregion Async communications with server #endregion Async communications with server
/// <summary> /// <summary>
@ -290,17 +297,17 @@ namespace OpenSim.Framework.Communications
{ {
lock (_lock) lock (_lock)
{ {
_request = (HttpWebRequest)WebRequest.Create(buildUri()); _request = (HttpWebRequest) WebRequest.Create(buildUri());
_request.KeepAlive = false; _request.KeepAlive = false;
_request.ContentType = "application/xml"; _request.ContentType = "application/xml";
_request.Timeout = 200000; _request.Timeout = 200000;
_asyncException = null; _asyncException = null;
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
_response = (HttpWebResponse)_request.GetResponse(); _response = (HttpWebResponse) _request.GetResponse();
Stream src = _response.GetResponseStream(); Stream src = _response.GetResponseStream();
int length = src.Read(_readbuf, 0, BufferSize); int length = src.Read(_readbuf, 0, BufferSize);
while(length > 0) while (length > 0)
{ {
_resource.Write(_readbuf, 0, length); _resource.Write(_readbuf, 0, length);
length = src.Read(_readbuf, 0, BufferSize); length = src.Read(_readbuf, 0, BufferSize);
@ -329,7 +336,7 @@ namespace OpenSim.Framework.Communications
public Stream Request(Stream src) public Stream Request(Stream src)
{ {
_request = (HttpWebRequest)WebRequest.Create(buildUri()); _request = (HttpWebRequest) WebRequest.Create(buildUri());
_request.KeepAlive = false; _request.KeepAlive = false;
_request.ContentType = "application/xml"; _request.ContentType = "application/xml";
_request.Timeout = 900000; _request.Timeout = 900000;
@ -340,13 +347,13 @@ namespace OpenSim.Framework.Communications
src.Seek(0, SeekOrigin.Begin); src.Seek(0, SeekOrigin.Begin);
Stream dst = _request.GetRequestStream(); Stream dst = _request.GetRequestStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int length = src.Read(buf,0, 1024); int length = src.Read(buf, 0, 1024);
while (length > 0) while (length > 0)
{ {
dst.Write(buf, 0, length); dst.Write(buf, 0, length);
length = src.Read(buf, 0, 1024); length = src.Read(buf, 0, 1024);
} }
_response = (HttpWebResponse)_request.GetResponse(); _response = (HttpWebResponse) _request.GetResponse();
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
@ -357,8 +364,8 @@ namespace OpenSim.Framework.Communications
return null; return null;
} }
#region Async Invocation #region Async Invocation
public IAsyncResult BeginRequest(AsyncCallback callback, object state) public IAsyncResult BeginRequest(AsyncCallback callback, object state)
{ {
/// <summary> /// <summary>
@ -371,7 +378,7 @@ namespace OpenSim.Framework.Communications
public Stream EndRequest(IAsyncResult asyncResult) public Stream EndRequest(IAsyncResult asyncResult)
{ {
AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
// Wait for operation to complete, then return result or // Wait for operation to complete, then return result or
// throw exception // throw exception
@ -381,7 +388,7 @@ namespace OpenSim.Framework.Communications
private void RequestHelper(Object asyncResult) private void RequestHelper(Object asyncResult)
{ {
// We know that it's really an AsyncResult<DateTime> object // We know that it's really an AsyncResult<DateTime> object
AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
try try
{ {
// Perform the operation; if sucessful set the result // Perform the operation; if sucessful set the result
@ -394,6 +401,7 @@ namespace OpenSim.Framework.Communications
ar.HandleException(e, false); ar.HandleException(e, false);
} }
} }
#endregion Async Invocation #endregion Async Invocation
} }
} }

View File

@ -33,18 +33,15 @@ using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
using libsecondlife; using libsecondlife;
using Nwc.XmlRpc; using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.UserManagement
{ {
public abstract class UserManagerBase : IUserService public abstract class UserManagerBase : IUserService
{ {
public UserConfig _config; public UserConfig _config;
Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
/// <summary> /// <summary>
/// Adds a new user server plugin - user servers will be requested in the order they were loaded. /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
@ -78,11 +75,12 @@ namespace OpenSim.Framework.UserManagement
public void AddPlugin(IUserData plug) public void AddPlugin(IUserData plug)
{ {
plug.Initialise(); plug.Initialise();
this._plugins.Add(plug.getName(), plug); _plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); MainLog.Instance.Verbose("Userstorage: Added IUserData Interface");
} }
#region Get UserProfile #region Get UserProfile
/// <summary> /// <summary>
/// Loads a user profile from a database by UUID /// Loads a user profile from a database by UUID
/// </summary> /// </summary>
@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement
catch (Exception e) catch (Exception e)
{ {
System.Console.WriteLine("EEK!"); System.Console.WriteLine("EEK!");
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement
{ {
try try
{ {
UserProfileData profile = plugin.Value.GetUserByName(fname,lname); UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
profile.currentAgent = getUserAgent(profile.UUID); profile.currentAgent = getUserAgent(profile.UUID);
@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -170,11 +168,14 @@ namespace OpenSim.Framework.UserManagement
{ {
foreach (KeyValuePair<string, IUserData> plugin in _plugins) foreach (KeyValuePair<string, IUserData> plugin in _plugins)
{ {
try { try
{
plugin.Value.UpdateUserProfile(data); plugin.Value.UpdateUserProfile(data);
return true; return true;
} catch (Exception e) { }
MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); catch (Exception e)
{
MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -184,6 +185,7 @@ namespace OpenSim.Framework.UserManagement
#endregion #endregion
#region Get UserAgent #region Get UserAgent
/// <summary> /// <summary>
/// Loads a user agent by uuid (not called directly) /// Loads a user agent by uuid (not called directly)
/// </summary> /// </summary>
@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement
{ {
try try
{ {
return plugin.Value.GetAgentByName(fname,lname); return plugin.Value.GetAgentByName(fname, lname);
} }
catch (Exception e) catch (Exception e)
{ {
MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
} }
} }
@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement
#endregion #endregion
#region CreateAgent #region CreateAgent
/// <summary> /// <summary>
/// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
/// </summary> /// </summary>
@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement
/// <param name="request">The users loginrequest</param> /// <param name="request">The users loginrequest</param>
public void CreateAgent(UserProfileData profile, XmlRpcRequest request) public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
{ {
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
UserAgentData agent = new UserAgentData(); UserAgentData agent = new UserAgentData();
@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement
// If user specified additional start, use that // If user specified additional start, use that
if (requestData.ContainsKey("start")) if (requestData.ContainsKey("start"))
{ {
string startLoc = ((string)requestData["start"]).Trim(); string startLoc = ((string) requestData["start"]).Trim();
if (!(startLoc == "last" || startLoc == "home")) if (!(startLoc == "last" || startLoc == "home"))
{ {
// Format: uri:Ahern&162&213&34 // Format: uri:Ahern&162&213&34
@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement
} }
catch (Exception) catch (Exception)
{ {
} }
} }
} }
@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement
try try
{ {
plugin.Value.AddNewUserProfile(user); plugin.Value.AddNewUserProfile(user);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -26,21 +26,18 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Net;
using System.IO; using System.IO;
using System.Net;
using System.Text; using System.Text;
using OpenSim.Framework.Console;
using OpenSim.Framework;
namespace OpenSim.Framework.Configuration.HTTP namespace OpenSim.Framework.Configuration.HTTP
{ {
public class HTTPConfiguration : IGenericConfig public class HTTPConfiguration : IGenericConfig
{ {
RemoteConfigSettings remoteConfigSettings; private RemoteConfigSettings remoteConfigSettings;
XmlConfiguration xmlConfig; private XmlConfiguration xmlConfig;
private string configFileName = ""; private string configFileName = "";
@ -62,8 +59,9 @@ namespace OpenSim.Framework.Configuration.HTTP
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192]; byte[] buf = new byte[8192];
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); HttpWebRequest request =
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
Stream resStream = response.GetResponseStream(); Stream resStream = response.GetResponseStream();
@ -78,13 +76,14 @@ namespace OpenSim.Framework.Configuration.HTTP
tempString = Encoding.ASCII.GetString(buf, 0, count); tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString); sb.Append(tempString);
} }
} } while (count > 0);
while (count > 0);
LoadDataFromString(sb.ToString()); LoadDataFromString(sb.ToString());
} }
catch (WebException) catch (WebException)
{ {
Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); MainLog.Instance.Warn("Unable to connect to remote configuration file (" +
remoteConfigSettings.baseConfigURL + configFileName +
"). Creating local file instead.");
xmlConfig.SetFileName(configFileName); xmlConfig.SetFileName(configFileName);
xmlConfig.LoadData(); xmlConfig.LoadData();
} }
@ -93,7 +92,6 @@ namespace OpenSim.Framework.Configuration.HTTP
public void LoadDataFromString(string data) public void LoadDataFromString(string data)
{ {
xmlConfig.LoadDataFromString(data); xmlConfig.LoadDataFromString(data);
} }
public string GetAttribute(string attributeName) public string GetAttribute(string attributeName)

View File

@ -26,12 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework;
namespace OpenSim.Framework.Configuration.HTTP namespace OpenSim.Framework.Configuration.HTTP
{ {
public class RemoteConfigSettings public class RemoteConfigSettings
@ -39,22 +33,28 @@ namespace OpenSim.Framework.Configuration.HTTP
private ConfigurationMember configMember; private ConfigurationMember configMember;
public string baseConfigURL = ""; public string baseConfigURL = "";
public RemoteConfigSettings(string filename) public RemoteConfigSettings(string filename)
{ {
configMember = new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, handleIncomingConfiguration); configMember =
new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
handleIncomingConfiguration);
configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
{ {
configMember.addConfigurationOption("base_config_url", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "URL Containing Configuration Files", "http://localhost/", false); configMember.addConfigurationOption("base_config_url",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"URL Containing Configuration Files", "http://localhost/", false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{ {
if (configuration_key == "base_config_url") if (configuration_key == "base_config_url")
{ {
baseConfigURL = (string)configuration_result; baseConfigURL = (string) configuration_result;
} }
return true; return true;
} }

View File

@ -25,12 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using OpenSim.Framework;
namespace OpenSim.Framework.Configuration namespace OpenSim.Framework.Configuration
{ {
public class XmlConfiguration : IGenericConfig public class XmlConfiguration : IGenericConfig
@ -56,6 +55,7 @@ namespace OpenSim.Framework.Configuration
if (configNode.Name != "Config") if (configNode.Name != "Config")
throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
} }
public void LoadData() public void LoadData()
{ {
lock (this) lock (this)
@ -81,7 +81,7 @@ namespace OpenSim.Framework.Configuration
if (createdFile) if (createdFile)
{ {
this.Commit(); Commit();
} }
} }
} }
@ -93,12 +93,13 @@ namespace OpenSim.Framework.Configuration
LoadDataToClass(); LoadDataToClass();
} }
public string GetAttribute(string attributeName) public string GetAttribute(string attributeName)
{ {
string result = null; string result = null;
if (configNode.Attributes[attributeName] != null) if (configNode.Attributes[attributeName] != null)
{ {
result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value;
} }
return result; return result;
} }
@ -107,7 +108,7 @@ namespace OpenSim.Framework.Configuration
{ {
if (configNode.Attributes[attributeName] != null) if (configNode.Attributes[attributeName] != null)
{ {
((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
} }
else else
{ {
@ -134,6 +135,5 @@ namespace OpenSim.Framework.Configuration
rootNode = null; rootNode = null;
doc = null; doc = null;
} }
} }
} }

View File

@ -27,24 +27,26 @@
*/ */
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// Information about this assembly is defined by the following // Information about this assembly is defined by the following
// attributes. // attributes.
// //
// change them to the information which is associated with the assembly // change them to the information which is associated with the assembly
// you compile. // you compile.
[assembly: AssemblyTitle("ServerConsole")] [assembly : AssemblyTitle("ServerConsole")]
[assembly: AssemblyDescription("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyCompany("")]
[assembly: AssemblyProduct("ServerConsole")] [assembly : AssemblyProduct("ServerConsole")]
[assembly: AssemblyCopyright("")] [assembly : AssemblyCopyright("")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly : AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible. // 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. // If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The assembly version has following format : // The assembly version has following format :
// //
@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
// You can specify all values by your own or you can build default build and revision // You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default): // numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.*")] [assembly : AssemblyVersion("1.0.*")]

View File

@ -26,10 +26,10 @@
* *
*/ */
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Diagnostics;
using System.Collections.Generic;
namespace OpenSim.Framework.Console namespace OpenSim.Framework.Console
{ {
@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console
{ {
private object m_syncRoot = new object(); private object m_syncRoot = new object();
StreamWriter Log; private StreamWriter Log;
public conscmd_callback cmdparser; public conscmd_callback cmdparser;
public string componentname; public string componentname;
private bool m_verbose; private bool m_verbose;
@ -57,7 +57,7 @@ namespace OpenSim.Framework.Console
{ {
this.componentname = componentname; this.componentname = componentname;
this.cmdparser = cmdparser; this.cmdparser = cmdparser;
this.m_verbose = verbose; m_verbose = verbose;
System.Console.WriteLine("Creating new local console"); System.Console.WriteLine("Creating new local console");
if (String.IsNullOrEmpty(LogFile)) if (String.IsNullOrEmpty(LogFile))
@ -87,8 +87,8 @@ namespace OpenSim.Framework.Console
/// <returns>an ansii color</returns> /// <returns>an ansii color</returns>
private ConsoleColor DeriveColor(string input) private ConsoleColor DeriveColor(string input)
{ {
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; int colIdx = (input.ToUpper().GetHashCode()%6) + 9;
return (ConsoleColor)colIdx; return (ConsoleColor) colIdx;
} }
/// <summary> /// <summary>
@ -236,7 +236,7 @@ namespace OpenSim.Framework.Console
{ {
lock (m_syncRoot) lock (m_syncRoot)
{ {
string now = System.DateTime.Now.ToString("[MM-dd hh:mm:ss] "); string now = DateTime.Now.ToString("[MM-dd hh:mm:ss] ");
Log.Write(now); Log.Write(now);
Log.WriteLine(format, args); Log.WriteLine(format, args);
Log.Flush(); Log.Flush();
@ -306,7 +306,7 @@ namespace OpenSim.Framework.Console
public int Read() public int Read()
{ {
int TempInt = System.Console.Read(); int TempInt = System.Console.Read();
Log.Write((char)TempInt); Log.Write((char) TempInt);
return TempInt; return TempInt;
} }
@ -359,7 +359,7 @@ namespace OpenSim.Framework.Console
{ {
// FIXME: Needs to be better abstracted // FIXME: Needs to be better abstracted
Log.WriteLine(prompt); Log.WriteLine(prompt);
this.Notice(prompt); Notice(prompt);
ConsoleColor oldfg = System.Console.ForegroundColor; ConsoleColor oldfg = System.Console.ForegroundColor;
System.Console.ForegroundColor = System.Console.BackgroundColor; System.Console.ForegroundColor = System.Console.BackgroundColor;
string temp = System.Console.ReadLine(); string temp = System.Console.ReadLine();
@ -370,8 +370,8 @@ namespace OpenSim.Framework.Console
// Displays a command prompt and waits for the user to enter a string, then returns that string // Displays a command prompt and waits for the user to enter a string, then returns that string
public string CmdPrompt(string prompt) public string CmdPrompt(string prompt)
{ {
this.Notice(String.Format("{0}: ", prompt)); Notice(String.Format("{0}: ", prompt));
return this.ReadLine(); return ReadLine();
} }
// Displays a command prompt and returns a default value if the user simply presses enter // Displays a command prompt and returns a default value if the user simply presses enter
@ -423,8 +423,7 @@ namespace OpenSim.Framework.Console
public void MainLogPrompt() public void MainLogPrompt()
{ {
string tempstr = CmdPrompt(componentname + "# ");
string tempstr = this.CmdPrompt(this.componentname + "# ");
MainLogRunCommand(tempstr); MainLogRunCommand(tempstr);
} }
@ -436,7 +435,7 @@ namespace OpenSim.Framework.Console
Array.Reverse(tempstrarray); Array.Reverse(tempstrarray);
Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
Array.Reverse(tempstrarray); Array.Reverse(tempstrarray);
string[] cmdparams = (string[])tempstrarray; string[] cmdparams = (string[]) tempstrarray;
try try
{ {
RunCmd(cmd, cmdparams); RunCmd(cmd, cmdparams);
@ -454,7 +453,7 @@ namespace OpenSim.Framework.Console
string result = String.Empty; string result = String.Empty;
string stacktrace = Environment.StackTrace; string stacktrace = Environment.StackTrace;
List<string> lines = new List<string>(stacktrace.Split(new string[] { "at " }, StringSplitOptions.None)); List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None));
if (lines.Count > 4) if (lines.Count > 4)
{ {

View File

@ -27,8 +27,8 @@
*/ */
namespace OpenSim.Framework.Console namespace OpenSim.Framework.Console
{ {
public class MainLog { public class MainLog
{
private static LogBase instance; private static LogBase instance;
public static LogBase Instance public static LogBase Instance
@ -37,5 +37,4 @@ namespace OpenSim.Framework.Console
set { instance = value; } set { instance = value; }
} }
} }
} }

View File

@ -34,17 +34,18 @@ namespace OpenSim.Framework.Data.DB4o
/// <summary> /// <summary>
/// A grid server storage mechanism employing the DB4o database system /// A grid server storage mechanism employing the DB4o database system
/// </summary> /// </summary>
class DB4oGridData : IGridData internal class DB4oGridData : IGridData
{ {
/// <summary> /// <summary>
/// The database manager object /// The database manager object
/// </summary> /// </summary>
DB4oGridManager manager; private DB4oGridManager manager;
/// <summary> /// <summary>
/// Called when the plugin is first loaded (as constructors are not called) /// Called when the plugin is first loaded (as constructors are not called)
/// </summary> /// </summary>
public void Initialise() { public void Initialise()
{
manager = new DB4oGridManager("gridserver.yap"); manager = new DB4oGridManager("gridserver.yap");
} }
@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o
if (manager.simProfiles.ContainsKey(uuid)) if (manager.simProfiles.ContainsKey(uuid))
return manager.simProfiles[uuid]; return manager.simProfiles[uuid];
} }
throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() +
"). Total Registered Regions: " + manager.simProfiles.Count);
} }
/// <summary> /// <summary>
@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o
/// <param name="handle">The location the region is logging into (unused in Db4o)</param> /// <param name="handle">The location the region is logging into (unused in Db4o)</param>
/// <param name="key">The shared secret</param> /// <param name="key">The shared secret</param>
/// <returns>Authenticated?</returns> /// <returns>Authenticated?</returns>
public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { public bool AuthenticateSim(LLUUID uuid, ulong handle, string key)
{
if (manager.simProfiles[uuid].regionRecvKey == key) if (manager.simProfiles[uuid].regionRecvKey == key)
return true; return true;
return false; return false;

View File

@ -29,23 +29,23 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Db4objects.Db4o; using Db4objects.Db4o;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Data.DB4o namespace OpenSim.Framework.Data.DB4o
{ {
/// <summary> /// <summary>
/// A Database manager for Db4o /// A Database manager for Db4o
/// </summary> /// </summary>
class DB4oGridManager internal class DB4oGridManager
{ {
/// <summary> /// <summary>
/// A list of the current regions connected (in-memory cache) /// A list of the current regions connected (in-memory cache)
/// </summary> /// </summary>
public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>();
/// <summary> /// <summary>
/// Database File Name /// Database File Name
/// </summary> /// </summary>
string dbfl; private string dbfl;
/// <summary> /// <summary>
/// Creates a new grid storage manager /// Creates a new grid storage manager
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
dbfl = db4odb; dbfl = db4odb;
IObjectContainer database; IObjectContainer database;
database = Db4oFactory.OpenFile(dbfl); database = Db4oFactory.OpenFile(dbfl);
IObjectSet result = database.Get(typeof(RegionProfileData)); IObjectSet result = database.Get(typeof (RegionProfileData));
// Loads the file into the in-memory cache // Loads the file into the in-memory cache
foreach (RegionProfileData row in result) foreach (RegionProfileData row in result)
{ {
@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o
return false; return false;
} }
} }
} }
/// <summary> /// <summary>
/// A manager for the DB4o database (user profiles) /// A manager for the DB4o database (user profiles)
/// </summary> /// </summary>
class DB4oUserManager internal class DB4oUserManager
{ {
/// <summary> /// <summary>
/// A list of the user profiles (in memory cache) /// A list of the user profiles (in memory cache)
/// </summary> /// </summary>
public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
/// <summary> /// <summary>
/// Database filename /// Database filename
/// </summary> /// </summary>
string dbfl; private string dbfl;
/// <summary> /// <summary>
/// Initialises a new DB manager /// Initialises a new DB manager
@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o
IObjectContainer database; IObjectContainer database;
database = Db4oFactory.OpenFile(dbfl); database = Db4oFactory.OpenFile(dbfl);
// Load to cache // Load to cache
IObjectSet result = database.Get(typeof(UserProfileData)); IObjectSet result = database.Get(typeof (UserProfileData));
foreach (UserProfileData row in result) foreach (UserProfileData row in result)
{ {
if (userProfiles.ContainsKey(row.UUID)) if (userProfiles.ContainsKey(row.UUID))

View File

@ -28,8 +28,6 @@
using System; using System;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework;
namespace OpenSim.Framework.Data.DB4o namespace OpenSim.Framework.Data.DB4o
{ {
@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o
/// <summary> /// <summary>
/// The database manager /// The database manager
/// </summary> /// </summary>
DB4oUserManager manager; private DB4oUserManager manager;
/// <summary> /// <summary>
/// Artificial constructor called upon plugin load /// Artificial constructor called upon plugin load
/// </summary> /// </summary>
public void Initialise() public void Initialise()
{ {
manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap"));
} }
/// <summary> /// <summary>
@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
/// <returns>A user profile</returns> /// <returns>A user profile</returns>
public UserProfileData GetUserByUUID(LLUUID uuid) public UserProfileData GetUserByUUID(LLUUID uuid)
{ {
if(manager.userProfiles.ContainsKey(uuid)) if (manager.userProfiles.ContainsKey(uuid))
return manager.userProfiles[uuid]; return manager.userProfiles[uuid];
return null; return null;
} }
@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o
{ {
try try
{ {
return GetUserByName(fname,lname).currentAgent; return GetUserByName(fname, lname).currentAgent;
} }
catch (Exception) catch (Exception)
{ {
@ -157,16 +155,18 @@ namespace OpenSim.Framework.Data.DB4o
/// <returns>True on success, false on error</returns> /// <returns>True on success, false on error</returns>
public bool UpdateUserProfile(UserProfileData user) public bool UpdateUserProfile(UserProfileData user)
{ {
try { try
{
return manager.UpdateRecord(user); return manager.UpdateRecord(user);
} catch (Exception e) { }
catch (Exception e)
{
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
return false; return false;
} }
} }
/// <summary> /// <summary>
/// Creates a new user agent /// Creates a new user agent
/// </summary> /// </summary>

View File

@ -1,24 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
[assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -185,10 +185,10 @@ namespace OpenSim.Framework.Data.MSSQL
byte[] hash = HashProvider.ComputeHash(stream); byte[] hash = HashProvider.ComputeHash(stream);
return false; return false;
} }
public ReservationData GetReservationAtPoint(uint x, uint y) public ReservationData GetReservationAtPoint(uint x, uint y)
{ {
return null; return null;
} }
} }
} }

View File

@ -36,12 +36,12 @@ namespace OpenSim.Framework.Data.MSSQL
/// <summary> /// <summary>
/// A management class for the MS SQL Storage Engine /// A management class for the MS SQL Storage Engine
/// </summary> /// </summary>
class MSSqlManager internal class MSSqlManager
{ {
/// <summary> /// <summary>
/// The database connection object /// The database connection object
/// </summary> /// </summary>
IDbConnection dbcon; private IDbConnection dbcon;
/// <summary> /// <summary>
/// Initialises and creates a new Sql connection and maintains it. /// Initialises and creates a new Sql connection and maintains it.
@ -55,7 +55,8 @@ namespace OpenSim.Framework.Data.MSSQL
{ {
try try
{ {
string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username +
";Password=" + password + ";Pooling=" + cpooling + ";";
dbcon = new SqlConnection(connectionString); dbcon = new SqlConnection(connectionString);
dbcon.Open(); dbcon.Open();
@ -83,14 +84,14 @@ namespace OpenSim.Framework.Data.MSSQL
/// <returns>A Sql DB Command</returns> /// <returns>A Sql DB Command</returns>
public IDbCommand Query(string sql, Dictionary<string, string> parameters) public IDbCommand Query(string sql, Dictionary<string, string> parameters)
{ {
SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters) foreach (KeyValuePair<string, string> param in parameters)
{ {
dbcommand.Parameters.AddWithValue(param.Key, param.Value); dbcommand.Parameters.AddWithValue(param.Key, param.Value);
} }
return (IDbCommand)dbcommand; return (IDbCommand) dbcommand;
} }
/// <summary> /// <summary>
@ -105,42 +106,42 @@ namespace OpenSim.Framework.Data.MSSQL
if (reader.Read()) if (reader.Read())
{ {
// Region Main // Region Main
regionprofile.regionHandle = (ulong)reader["regionHandle"]; regionprofile.regionHandle = (ulong) reader["regionHandle"];
regionprofile.regionName = (string)reader["regionName"]; regionprofile.regionName = (string) reader["regionName"];
regionprofile.UUID = new LLUUID((string)reader["uuid"]); regionprofile.UUID = new LLUUID((string) reader["uuid"]);
// Secrets // Secrets
regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; regionprofile.regionRecvKey = (string) reader["regionRecvKey"];
regionprofile.regionSecret = (string)reader["regionSecret"]; regionprofile.regionSecret = (string) reader["regionSecret"];
regionprofile.regionSendKey = (string)reader["regionSendKey"]; regionprofile.regionSendKey = (string) reader["regionSendKey"];
// Region Server // Region Server
regionprofile.regionDataURI = (string)reader["regionDataURI"]; regionprofile.regionDataURI = (string) reader["regionDataURI"];
regionprofile.regionOnline = false; // Needs to be pinged before this can be set. regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
regionprofile.serverIP = (string)reader["serverIP"]; regionprofile.serverIP = (string) reader["serverIP"];
regionprofile.serverPort = (uint)reader["serverPort"]; regionprofile.serverPort = (uint) reader["serverPort"];
regionprofile.serverURI = (string)reader["serverURI"]; regionprofile.serverURI = (string) reader["serverURI"];
// Location // Location
regionprofile.regionLocX = (uint)((int)reader["locX"]); regionprofile.regionLocX = (uint) ((int) reader["locX"]);
regionprofile.regionLocY = (uint)((int)reader["locY"]); regionprofile.regionLocY = (uint) ((int) reader["locY"]);
regionprofile.regionLocZ = (uint)((int)reader["locZ"]); regionprofile.regionLocZ = (uint) ((int) reader["locZ"]);
// Neighbours - 0 = No Override // Neighbours - 0 = No Override
regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; regionprofile.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; regionprofile.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; regionprofile.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; regionprofile.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
// Assets // Assets
regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; regionprofile.regionAssetURI = (string) reader["regionAssetURI"];
regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"];
// Userserver // Userserver
regionprofile.regionUserURI = (string)reader["regionUserURI"]; regionprofile.regionUserURI = (string) reader["regionUserURI"];
regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"];
regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"];
} }
else else
{ {
@ -156,12 +157,15 @@ namespace OpenSim.Framework.Data.MSSQL
/// <returns>Successful?</returns> /// <returns>Successful?</returns>
public bool insertRow(RegionProfileData profile) public bool insertRow(RegionProfileData profile)
{ {
string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; string sql =
sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; sql +=
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();

View File

@ -1,24 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
[assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -28,18 +28,17 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using MySql.Data.MySqlClient; using System.Data;
using libsecondlife; using libsecondlife;
using MySql.Data.MySqlClient;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
{ {
class MySQLAssetData : IAssetProvider internal class MySQLAssetData : IAssetProvider
{ {
MySQLManager _dbConnection; private MySQLManager _dbConnection;
#region IAssetProvider Members #region IAssetProvider Members
private void UpgradeAssetsTable(string oldVersion) private void UpgradeAssetsTable(string oldVersion)
@ -58,14 +57,12 @@ namespace OpenSim.Framework.Data.MySQL
/// </summary> /// </summary>
private void TestTables() private void TestTables()
{ {
Dictionary<string, string> tableList = new Dictionary<string, string>(); Dictionary<string, string> tableList = new Dictionary<string, string>();
tableList["assets"] = null; tableList["assets"] = null;
_dbConnection.GetTableVersion(tableList); _dbConnection.GetTableVersion(tableList);
UpgradeAssetsTable(tableList["assets"]); UpgradeAssetsTable(tableList["assets"]);
} }
public AssetBase FetchAsset(LLUUID assetID) public AssetBase FetchAsset(LLUUID assetID)
@ -73,21 +70,24 @@ namespace OpenSim.Framework.Data.MySQL
AssetBase asset = null; AssetBase asset = null;
lock (_dbConnection) lock (_dbConnection)
{ {
MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); MySqlCommand cmd =
new MySqlCommand(
"SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id",
_dbConnection.Connection);
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
p.Value = assetID.GetBytes(); p.Value = assetID.GetBytes();
using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if (dbReader.Read()) if (dbReader.Read())
{ {
asset = new AssetBase(); asset = new AssetBase();
asset.Data = (byte[])dbReader["data"]; asset.Data = (byte[]) dbReader["data"];
asset.Description = (string)dbReader["description"]; asset.Description = (string) dbReader["description"];
asset.FullID = assetID; asset.FullID = assetID;
asset.InvType = (sbyte)dbReader["invType"]; asset.InvType = (sbyte) dbReader["invType"];
asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
asset.Name = (string)dbReader["name"]; asset.Name = (string) dbReader["name"];
asset.Type = (sbyte)dbReader["assetType"]; asset.Type = (sbyte) dbReader["assetType"];
} }
} }
} }
@ -96,8 +96,11 @@ namespace OpenSim.Framework.Data.MySQL
public void CreateAsset(AssetBase asset) public void CreateAsset(AssetBase asset)
{ {
MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + MySqlCommand cmd =
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); new MySqlCommand(
"REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)",
_dbConnection.Connection);
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
p.Value = asset.FullID.GetBytes(); p.Value = asset.FullID.GetBytes();
cmd.Parameters.AddWithValue("?name", asset.Name); cmd.Parameters.AddWithValue("?name", asset.Name);

View File

@ -25,13 +25,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
@ -59,7 +59,9 @@ namespace OpenSim.Framework.Data.MySQL
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort);
} }
/// <summary> /// <summary>
@ -108,7 +110,10 @@ namespace OpenSim.Framework.Data.MySQL
param["?xmax"] = xmax.ToString(); param["?xmax"] = xmax.ToString();
param["?ymax"] = ymax.ToString(); param["?ymax"] = ymax.ToString();
IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); IDbCommand result =
database.Query(
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
param);
IDataReader reader = result.ExecuteReader(); IDataReader reader = result.ExecuteReader();
RegionProfileData row; RegionProfileData row;
@ -123,7 +128,6 @@ namespace OpenSim.Framework.Data.MySQL
result.Dispose(); result.Dispose();
return rows.ToArray(); return rows.ToArray();
} }
} }
catch (Exception e) catch (Exception e)
@ -266,7 +270,10 @@ namespace OpenSim.Framework.Data.MySQL
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
param["?x"] = x.ToString(); param["?x"] = x.ToString();
param["?y"] = y.ToString(); param["?y"] = y.ToString();
IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); IDbCommand result =
database.Query(
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
param);
IDataReader reader = result.ExecuteReader(); IDataReader reader = result.ExecuteReader();
ReservationData row = database.readReservationRow(reader); ReservationData row = database.readReservationRow(reader);
@ -284,6 +291,4 @@ namespace OpenSim.Framework.Data.MySQL
} }
} }
} }
} }

View File

@ -26,13 +26,10 @@
* *
*/ */
using System; using System;
using System.IO;
using System.Data;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
{ {
@ -59,7 +56,9 @@ namespace OpenSim.Framework.Data.MySQL
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort);
TestTables(database.Connection); TestTables(database.Connection);
} }
@ -99,7 +98,6 @@ namespace OpenSim.Framework.Data.MySQL
private void TestTables(MySqlConnection conn) private void TestTables(MySqlConnection conn)
{ {
Dictionary<string, string> tableList = new Dictionary<string, string>(); Dictionary<string, string> tableList = new Dictionary<string, string>();
tableList["inventoryfolders"] = null; tableList["inventoryfolders"] = null;
@ -110,6 +108,7 @@ namespace OpenSim.Framework.Data.MySQL
UpgradeFoldersTable(tableList["inventoryfolders"]); UpgradeFoldersTable(tableList["inventoryfolders"]);
UpgradeItemsTable(tableList["inventoryitems"]); UpgradeItemsTable(tableList["inventoryitems"]);
} }
#endregion #endregion
/// <summary> /// <summary>
@ -151,11 +150,13 @@ namespace OpenSim.Framework.Data.MySQL
{ {
List<InventoryItemBase> items = new List<InventoryItemBase>(); List<InventoryItemBase> items = new List<InventoryItemBase>();
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid",
database.Connection);
result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
while(reader.Read()) while (reader.Read())
items.Add(readInventoryItem(reader)); items.Add(readInventoryItem(reader));
reader.Close(); reader.Close();
@ -183,13 +184,16 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (database) lock (database)
{ {
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand(
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
database.Connection);
result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated());
result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = new List<InventoryFolderBase>(); List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while(reader.Read()) while (reader.Read())
items.Add(readInventoryFolder(reader)); items.Add(readInventoryFolder(reader));
@ -218,17 +222,21 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (database) lock (database)
{ {
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand(
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
database.Connection);
result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated());
result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = new List<InventoryFolderBase>(); List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while(reader.Read()) while (reader.Read())
items.Add(readInventoryFolder(reader)); items.Add(readInventoryFolder(reader));
InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). InventoryFolderBase rootFolder = items[0];
//should only be one folder with parent set to zero (the root one).
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();
@ -254,13 +262,15 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (database) lock (database)
{ {
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid",
database.Connection);
result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
List<InventoryFolderBase> items = new List<InventoryFolderBase>(); List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while(reader.Read()) while (reader.Read())
items.Add(readInventoryFolder(reader)); items.Add(readInventoryFolder(reader));
reader.Close(); reader.Close();
@ -288,19 +298,19 @@ namespace OpenSim.Framework.Data.MySQL
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.inventoryID = new LLUUID((string)reader["inventoryID"]); item.inventoryID = new LLUUID((string) reader["inventoryID"]);
item.assetID = new LLUUID((string)reader["assetID"]); item.assetID = new LLUUID((string) reader["assetID"]);
item.assetType = (int)reader["assetType"]; item.assetType = (int) reader["assetType"];
item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
item.avatarID = new LLUUID((string)reader["avatarID"]); item.avatarID = new LLUUID((string) reader["avatarID"]);
item.inventoryName = (string)reader["inventoryName"]; item.inventoryName = (string) reader["inventoryName"];
item.inventoryDescription = (string)reader["inventoryDescription"]; item.inventoryDescription = (string) reader["inventoryDescription"];
item.inventoryNextPermissions = (uint)reader["inventoryNextPermissions"]; item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"];
item.inventoryCurrentPermissions = (uint)reader["inventoryCurrentPermissions"]; item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"];
item.invType = (int)reader["invType"]; item.invType = (int) reader["invType"];
item.creatorsID = new LLUUID((string)reader["creatorID"]); item.creatorsID = new LLUUID((string) reader["creatorID"]);
item.inventoryBasePermissions = (uint)reader["inventoryBasePermissions"]; item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"];
item.inventoryEveryOnePermissions = (uint)reader["inventoryEveryOnePermissions"]; item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
return item; return item;
} }
catch (MySqlException e) catch (MySqlException e)
@ -324,12 +334,13 @@ namespace OpenSim.Framework.Data.MySQL
{ {
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
InventoryItemBase item = null; InventoryItemBase item = null;
if(reader.Read()) if (reader.Read())
item = readInventoryItem(reader); item = readInventoryItem(reader);
reader.Close(); reader.Close();
@ -356,12 +367,12 @@ namespace OpenSim.Framework.Data.MySQL
try try
{ {
InventoryFolderBase folder = new InventoryFolderBase(); InventoryFolderBase folder = new InventoryFolderBase();
folder.agentID = new LLUUID((string)reader["agentID"]); folder.agentID = new LLUUID((string) reader["agentID"]);
folder.parentID = new LLUUID((string)reader["parentFolderID"]); folder.parentID = new LLUUID((string) reader["parentFolderID"]);
folder.folderID = new LLUUID((string)reader["folderID"]); folder.folderID = new LLUUID((string) reader["folderID"]);
folder.name = (string)reader["folderName"]; folder.name = (string) reader["folderName"];
folder.type = (short)reader["type"]; folder.type = (short) reader["type"];
folder.version = (ushort)((int)reader["version"]); folder.version = (ushort) ((int) reader["version"]);
return folder; return folder;
} }
catch (Exception e) catch (Exception e)
@ -384,7 +395,8 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (database) lock (database)
{ {
MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); MySqlCommand result =
new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection);
result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
@ -410,8 +422,10 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="item">The inventory item</param> /// <param name="item">The inventory item</param>
public void addInventoryItem(InventoryItemBase item) public void addInventoryItem(InventoryItemBase item)
{ {
string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; string sql =
sql += "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES ";
sql +=
"(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)";
try try
{ {
@ -424,7 +438,8 @@ namespace OpenSim.Framework.Data.MySQL
result.Parameters.AddWithValue("?inventoryName", item.inventoryName); result.Parameters.AddWithValue("?inventoryName", item.inventoryName);
result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription);
result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString()); result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString());
result.Parameters.AddWithValue("?inventoryCurrentPermissions", item.inventoryCurrentPermissions.ToString()); result.Parameters.AddWithValue("?inventoryCurrentPermissions",
item.inventoryCurrentPermissions.ToString());
result.Parameters.AddWithValue("?invType", item.invType); result.Parameters.AddWithValue("?invType", item.invType);
result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated()); result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated());
result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions);
@ -455,7 +470,8 @@ namespace OpenSim.Framework.Data.MySQL
{ {
try try
{ {
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
@ -472,7 +488,8 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="folder">Folder to create</param> /// <param name="folder">Folder to create</param>
public void addInventoryFolder(InventoryFolderBase folder) public void addInventoryFolder(InventoryFolderBase folder)
{ {
string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; string sql =
"REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
MySqlCommand cmd = new MySqlCommand(sql, database.Connection); MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
@ -480,7 +497,7 @@ namespace OpenSim.Framework.Data.MySQL
cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated());
cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated());
cmd.Parameters.AddWithValue("?folderName", folder.name); cmd.Parameters.AddWithValue("?folderName", folder.name);
cmd.Parameters.AddWithValue("?type", (short)folder.type); cmd.Parameters.AddWithValue("?type", (short) folder.type);
cmd.Parameters.AddWithValue("?version", folder.version); cmd.Parameters.AddWithValue("?version", folder.version);
try try
@ -536,7 +553,8 @@ namespace OpenSim.Framework.Data.MySQL
{ {
try try
{ {
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
@ -551,7 +569,8 @@ namespace OpenSim.Framework.Data.MySQL
{ {
try try
{ {
MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }

View File

@ -25,14 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
{ {
/// <summary> /// <summary>
/// An interface to the log database for MySQL /// An interface to the log database for MySQL
/// </summary> /// </summary>
class MySQLLogData : ILogData internal class MySQLLogData : ILogData
{ {
/// <summary> /// <summary>
/// The database manager /// The database manager
@ -52,7 +50,9 @@ namespace OpenSim.Framework.Data.MySQL
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort);
} }
/// <summary> /// <summary>
@ -64,7 +64,8 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="arguments">The arguments passed to the method</param> /// <param name="arguments">The arguments passed to the method</param>
/// <param name="priority">How critical is this?</param> /// <param name="priority">How critical is this?</param>
/// <param name="logMessage">The message to log</param> /// <param name="logMessage">The message to log</param>
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage)
{ {
try try
{ {

View File

@ -25,16 +25,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
using System.IO;
using System.Data;
using System.Reflection;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using libsecondlife; using libsecondlife;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
@ -42,16 +40,17 @@ namespace OpenSim.Framework.Data.MySQL
/// <summary> /// <summary>
/// A MySQL Database manager /// A MySQL Database manager
/// </summary> /// </summary>
class MySQLManager internal class MySQLManager
{ {
/// <summary> /// <summary>
/// The database connection object /// The database connection object
/// </summary> /// </summary>
MySqlConnection dbcon; private MySqlConnection dbcon;
/// <summary> /// <summary>
/// Connection string for ADO.net /// Connection string for ADO.net
/// </summary> /// </summary>
string connectionString; private string connectionString;
/// <summary> /// <summary>
/// Initialises and creates a new MySQL connection and maintains it. /// Initialises and creates a new MySQL connection and maintains it.
@ -61,11 +60,13 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="username">The username logging into the database</param> /// <param name="username">The username logging into the database</param>
/// <param name="password">The password for the user logging in</param> /// <param name="password">The password for the user logging in</param>
/// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) public MySQLManager(string hostname, string database, string username, string password, string cpooling,
string port)
{ {
try try
{ {
connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" +
username + ";Password=" + password + ";Pooling=" + cpooling + ";";
dbcon = new MySqlConnection(connectionString); dbcon = new MySqlConnection(connectionString);
dbcon.Open(); dbcon.Open();
@ -123,12 +124,14 @@ namespace OpenSim.Framework.Data.MySQL
/// <returns>A string containing the DB provider</returns> /// <returns>A string containing the DB provider</returns>
public string getVersion() public string getVersion()
{ {
System.Reflection.Module module = this.GetType().Module; Module module = GetType().Module;
string dllName = module.Assembly.ManifestModule.Name; string dllName = module.Assembly.ManifestModule.Name;
Version dllVersion = module.Assembly.GetName().Version; Version dllVersion = module.Assembly.GetName().Version;
return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); return
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
dllVersion.Revision);
} }
@ -139,7 +142,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <returns>string contained within the embedded resource</returns> /// <returns>string contained within the embedded resource</returns>
private string getResourceString(string name) private string getResourceString(string name)
{ {
Assembly assem = this.GetType().Assembly; Assembly assem = GetType().Assembly;
string[] names = assem.GetManifestResourceNames(); string[] names = assem.GetManifestResourceNames();
foreach (string s in names) foreach (string s in names)
@ -173,7 +176,10 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (dbcon) lock (dbcon)
{ {
MySqlCommand tablesCmd = new MySqlCommand("SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", dbcon); MySqlCommand tablesCmd =
new MySqlCommand(
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
dbcon);
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
using (MySqlDataReader tables = tablesCmd.ExecuteReader()) using (MySqlDataReader tables = tablesCmd.ExecuteReader())
{ {
@ -181,9 +187,9 @@ namespace OpenSim.Framework.Data.MySQL
{ {
try try
{ {
string tableName = (string)tables["TABLE_NAME"]; string tableName = (string) tables["TABLE_NAME"];
string comment = (string)tables["TABLE_COMMENT"]; string comment = (string) tables["TABLE_COMMENT"];
if(tableList.ContainsKey(tableName)) if (tableList.ContainsKey(tableName))
tableList[tableName] = comment; tableList[tableName] = comment;
} }
catch (Exception e) catch (Exception e)
@ -209,14 +215,14 @@ namespace OpenSim.Framework.Data.MySQL
{ {
try try
{ {
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters) foreach (KeyValuePair<string, string> param in parameters)
{ {
dbcommand.Parameters.AddWithValue(param.Key, param.Value); dbcommand.Parameters.AddWithValue(param.Key, param.Value);
} }
return (IDbCommand)dbcommand; return (IDbCommand) dbcommand;
} }
catch catch
{ {
@ -227,7 +233,9 @@ namespace OpenSim.Framework.Data.MySQL
{ {
dbcon.Close(); dbcon.Close();
} }
catch { } catch
{
}
// Try reopen it // Try reopen it
try try
@ -243,14 +251,14 @@ namespace OpenSim.Framework.Data.MySQL
// Run the query again // Run the query again
try try
{ {
MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters) foreach (KeyValuePair<string, string> param in parameters)
{ {
dbcommand.Parameters.AddWithValue(param.Key, param.Value); dbcommand.Parameters.AddWithValue(param.Key, param.Value);
} }
return (IDbCommand)dbcommand; return (IDbCommand) dbcommand;
} }
catch (Exception e) catch (Exception e)
{ {
@ -275,20 +283,20 @@ namespace OpenSim.Framework.Data.MySQL
{ {
// Region Main // Region Main
retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
retval.regionName = (string)reader["regionName"]; retval.regionName = (string) reader["regionName"];
retval.UUID = new LLUUID((string)reader["uuid"]); retval.UUID = new LLUUID((string) reader["uuid"]);
// Secrets // Secrets
retval.regionRecvKey = (string)reader["regionRecvKey"]; retval.regionRecvKey = (string) reader["regionRecvKey"];
retval.regionSecret = (string)reader["regionSecret"]; retval.regionSecret = (string) reader["regionSecret"];
retval.regionSendKey = (string)reader["regionSendKey"]; retval.regionSendKey = (string) reader["regionSendKey"];
// Region Server // Region Server
retval.regionDataURI = (string)reader["regionDataURI"]; retval.regionDataURI = (string) reader["regionDataURI"];
retval.regionOnline = false; // Needs to be pinged before this can be set. retval.regionOnline = false; // Needs to be pinged before this can be set.
retval.serverIP = (string)reader["serverIP"]; retval.serverIP = (string) reader["serverIP"];
retval.serverPort = (uint)reader["serverPort"]; retval.serverPort = (uint) reader["serverPort"];
retval.serverURI = (string)reader["serverURI"]; retval.serverURI = (string) reader["serverURI"];
retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
@ -304,14 +312,14 @@ namespace OpenSim.Framework.Data.MySQL
retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
// Assets // Assets
retval.regionAssetURI = (string)reader["regionAssetURI"]; retval.regionAssetURI = (string) reader["regionAssetURI"];
retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
// Userserver // Userserver
retval.regionUserURI = (string)reader["regionUserURI"]; retval.regionUserURI = (string) reader["regionUserURI"];
retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
retval.regionUserSendKey = (string)reader["regionUserSendKey"]; retval.regionUserSendKey = (string) reader["regionUserSendKey"];
// World Map Addition // World Map Addition
string tempRegionMap = reader["regionMapTexture"].ToString(); string tempRegionMap = reader["regionMapTexture"].ToString();
@ -341,17 +349,16 @@ namespace OpenSim.Framework.Data.MySQL
ReservationData retval = new ReservationData(); ReservationData retval = new ReservationData();
if (reader.Read()) if (reader.Read())
{ {
retval.gridRecvKey = (string)reader["gridRecvKey"]; retval.gridRecvKey = (string) reader["gridRecvKey"];
retval.gridSendKey = (string)reader["gridSendKey"]; retval.gridSendKey = (string) reader["gridSendKey"];
retval.reservationCompany = (string)reader["resCompany"]; retval.reservationCompany = (string) reader["resCompany"];
retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString());
retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString());
retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString());
retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString());
retval.reservationName = (string)reader["resName"]; retval.reservationName = (string) reader["resName"];
retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; retval.status = Convert.ToInt32(reader["status"].ToString()) == 1;
retval.userUUID = new LLUUID((string)reader["userUUID"]); retval.userUUID = new LLUUID((string) reader["userUUID"]);
} }
else else
{ {
@ -359,6 +366,7 @@ namespace OpenSim.Framework.Data.MySQL
} }
return retval; return retval;
} }
/// <summary> /// <summary>
/// Reads an agent row from a database reader /// Reads an agent row from a database reader
/// </summary> /// </summary>
@ -371,12 +379,12 @@ namespace OpenSim.Framework.Data.MySQL
if (reader.Read()) if (reader.Read())
{ {
// Agent IDs // Agent IDs
retval.UUID = new LLUUID((string)reader["UUID"]); retval.UUID = new LLUUID((string) reader["UUID"]);
retval.sessionID = new LLUUID((string)reader["sessionID"]); retval.sessionID = new LLUUID((string) reader["sessionID"]);
retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]);
// Agent Who? // Agent Who?
retval.agentIP = (string)reader["agentIP"]; retval.agentIP = (string) reader["agentIP"];
retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
@ -385,9 +393,9 @@ namespace OpenSim.Framework.Data.MySQL
retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
// Current position // Current position
retval.currentRegion = (string)reader["currentRegion"]; retval.currentRegion = (string) reader["currentRegion"];
retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos);
} }
else else
{ {
@ -407,12 +415,12 @@ namespace OpenSim.Framework.Data.MySQL
if (reader.Read()) if (reader.Read())
{ {
retval.UUID = new LLUUID((string)reader["UUID"]); retval.UUID = new LLUUID((string) reader["UUID"]);
retval.username = (string)reader["username"]; retval.username = (string) reader["username"];
retval.surname = (string)reader["lastname"]; retval.surname = (string) reader["lastname"];
retval.passwordHash = (string)reader["passwordHash"]; retval.passwordHash = (string) reader["passwordHash"];
retval.passwordSalt = (string)reader["passwordSalt"]; retval.passwordSalt = (string) reader["passwordSalt"];
retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
retval.homeLocation = new LLVector3( retval.homeLocation = new LLVector3(
@ -427,18 +435,17 @@ namespace OpenSim.Framework.Data.MySQL
retval.created = Convert.ToInt32(reader["created"].ToString()); retval.created = Convert.ToInt32(reader["created"].ToString());
retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
retval.userInventoryURI = (string)reader["userInventoryURI"]; retval.userInventoryURI = (string) reader["userInventoryURI"];
retval.userAssetURI = (string)reader["userAssetURI"]; retval.userAssetURI = (string) reader["userAssetURI"];
retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
retval.profileAboutText = (string)reader["profileAboutText"]; retval.profileAboutText = (string) reader["profileAboutText"];
retval.profileFirstText = (string)reader["profileFirstText"]; retval.profileFirstText = (string) reader["profileFirstText"];
retval.profileImage = new LLUUID((string)reader["profileImage"]);
retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
retval.profileImage = new LLUUID((string) reader["profileImage"]);
retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]);
} }
else else
{ {
@ -448,7 +455,6 @@ namespace OpenSim.Framework.Data.MySQL
} }
/// <summary> /// <summary>
/// Inserts a new row into the log database /// Inserts a new row into the log database
/// </summary> /// </summary>
@ -459,7 +465,8 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="priority">How critical is this?</param> /// <param name="priority">How critical is this?</param>
/// <param name="logMessage">Extra message info</param> /// <param name="logMessage">Extra message info</param>
/// <returns>Saved successfully?</returns> /// <returns>Saved successfully?</returns>
public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage)
{ {
string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
@ -519,18 +526,26 @@ namespace OpenSim.Framework.Data.MySQL
/// <param name="profileImage">UUID for profile image</param> /// <param name="profileImage">UUID for profile image</param>
/// <param name="firstImage">UUID for firstlife image</param> /// <param name="firstImage">UUID for firstlife image</param>
/// <returns>Success?</returns> /// <returns>Success?</returns>
public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
string aboutText, string firstText,
LLUUID profileImage, LLUUID firstImage)
{ {
string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; string sql =
sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; sql +=
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
sql +=
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES ";
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; sql +=
sql += "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
sql +=
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; sql += "?profileFirstText, ?profileImage, ?profileFirstImage)";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();
@ -554,8 +569,8 @@ namespace OpenSim.Framework.Data.MySQL
parameters["?profileWantDoMask"] = "0"; parameters["?profileWantDoMask"] = "0";
parameters["?profileAboutText"] = ""; parameters["?profileAboutText"] = "";
parameters["?profileFirstText"] = ""; parameters["?profileFirstText"] = "";
parameters["?profileImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); parameters["?profileImage"] = LLUUID.Zero.ToStringHyphenated();
parameters["?profileFirstImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); parameters["?profileFirstImage"] = LLUUID.Zero.ToStringHyphenated();
bool returnval = false; bool returnval = false;
@ -585,13 +600,18 @@ namespace OpenSim.Framework.Data.MySQL
/// <returns>Success?</returns> /// <returns>Success?</returns>
public bool insertRegion(RegionProfileData regiondata) public bool insertRegion(RegionProfileData regiondata)
{ {
string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; string sql =
sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; sql +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql +=
"regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES ";
sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; sql +=
sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
sql +=
"?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();
@ -626,7 +646,6 @@ namespace OpenSim.Framework.Data.MySQL
try try
{ {
IDbCommand result = Query(sql, parameters); IDbCommand result = Query(sql, parameters);
//Console.WriteLine(result.CommandText); //Console.WriteLine(result.CommandText);

View File

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.MySQL namespace OpenSim.Framework.Data.MySQL
@ -37,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL
/// <summary> /// <summary>
/// A database interface class to a user profile storage system /// A database interface class to a user profile storage system
/// </summary> /// </summary>
class MySQLUserData : IUserData internal class MySQLUserData : IUserData
{ {
/// <summary> /// <summary>
/// Database manager for MySQL /// Database manager for MySQL
@ -59,7 +58,9 @@ namespace OpenSim.Framework.Data.MySQL
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort);
} }
/// <summary> /// <summary>
@ -88,7 +89,8 @@ namespace OpenSim.Framework.Data.MySQL
param["?first"] = user; param["?first"] = user;
param["?second"] = last; param["?second"] = last;
IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); IDbCommand result =
database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
IDataReader reader = result.ExecuteReader(); IDataReader reader = result.ExecuteReader();
UserProfileData row = database.readUserRow(reader); UserProfileData row = database.readUserRow(reader);
@ -205,9 +207,14 @@ namespace OpenSim.Framework.Data.MySQL
{ {
lock (database) lock (database)
{ {
database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); user.homeLocation.Z,
user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
user.lastLogin, user.userInventoryURI, user.userAssetURI,
user.profileCanDoMask, user.profileWantDoMask,
user.profileAboutText, user.profileFirstText, user.profileImage,
user.profileFirstImage);
} }
} }
catch (Exception e) catch (Exception e)
@ -215,7 +222,6 @@ namespace OpenSim.Framework.Data.MySQL
database.Reconnect(); database.Reconnect();
MainLog.Instance.Error(e.ToString()); MainLog.Instance.Error(e.ToString());
} }
} }
/// <summary> /// <summary>

View File

@ -1,24 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
[assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -1,24 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("0.4.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("0.4.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -26,15 +26,11 @@
* *
*/ */
using System; using System;
using System.IO;
using libsecondlife;
using OpenSim.Framework;
using System.Data; using System.Data;
using System.Data.SqlTypes; using System.Reflection;
using libsecondlife;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Framework.Interfaces;
namespace OpenSim.Framework.Data.SQLite namespace OpenSim.Framework.Data.SQLite
{ {
@ -46,11 +42,11 @@ namespace OpenSim.Framework.Data.SQLite
/// <summary> /// <summary>
/// The database manager /// The database manager
/// </summary> /// </summary>
/// <summary> /// <summary>
/// Artificial constructor called upon plugin load /// Artificial constructor called upon plugin load
/// </summary> /// </summary>
private const string assetSelect = "select * from assets"; private const string assetSelect = "select * from assets";
private DataSet ds; private DataSet ds;
private SqliteDataAdapter da; private SqliteDataAdapter da;
@ -62,7 +58,8 @@ namespace OpenSim.Framework.Data.SQLite
ds = new DataSet(); ds = new DataSet();
da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn));
lock (ds) { lock (ds)
{
ds.Tables.Add(createAssetsTable()); ds.Tables.Add(createAssetsTable());
setupAssetCommands(da, conn); setupAssetCommands(da, conn);
@ -104,7 +101,8 @@ namespace OpenSim.Framework.Data.SQLite
LogAssetLoad(asset); LogAssetLoad(asset);
DataTable assets = ds.Tables["assets"]; DataTable assets = ds.Tables["assets"];
lock(ds) { lock (ds)
{
DataRow row = assets.Rows.Find(asset.FullID); DataRow row = assets.Rows.Find(asset.FullID);
if (row == null) if (row == null)
{ {
@ -126,7 +124,8 @@ namespace OpenSim.Framework.Data.SQLite
MainLog.Instance.Verbose("ASSETSTORAGE", MainLog.Instance.Verbose("ASSETSTORAGE",
string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)",
asset.FullID, asset.Name, asset.Description, asset.Type, asset.InvType, temporary, local, asset.Data.Length) ); asset.FullID, asset.Name, asset.Description, asset.Type,
asset.InvType, temporary, local, asset.Data.Length));
} }
public bool ExistsAsset(LLUUID uuid) public bool ExistsAsset(LLUUID uuid)
@ -137,9 +136,11 @@ namespace OpenSim.Framework.Data.SQLite
public void DeleteAsset(LLUUID uuid) public void DeleteAsset(LLUUID uuid)
{ {
lock (ds) { lock (ds)
{
DataRow row = ds.Tables["assets"].Rows.Find(uuid); DataRow row = ds.Tables["assets"].Rows.Find(uuid);
if (row != null) { if (row != null)
{
row.Delete(); row.Delete();
} }
} }
@ -148,7 +149,8 @@ namespace OpenSim.Framework.Data.SQLite
public void CommitAssets() // force a sync to the database public void CommitAssets() // force a sync to the database
{ {
MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); MainLog.Instance.Verbose("AssetStorage", "Attempting commit");
lock (ds) { lock (ds)
{
da.Update(ds, "assets"); da.Update(ds, "assets");
ds.AcceptChanges(); ds.AcceptChanges();
} }
@ -166,16 +168,16 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable assets = new DataTable("assets"); DataTable assets = new DataTable("assets");
createCol(assets, "UUID", typeof(System.String)); createCol(assets, "UUID", typeof (String));
createCol(assets, "Name", typeof(System.String)); createCol(assets, "Name", typeof (String));
createCol(assets, "Description", typeof(System.String)); createCol(assets, "Description", typeof (String));
createCol(assets, "Type", typeof(System.Int32)); createCol(assets, "Type", typeof (Int32));
createCol(assets, "InvType", typeof(System.Int32)); createCol(assets, "InvType", typeof (Int32));
createCol(assets, "Local", typeof(System.Boolean)); createCol(assets, "Local", typeof (Boolean));
createCol(assets, "Temporary", typeof(System.Boolean)); createCol(assets, "Temporary", typeof (Boolean));
createCol(assets, "Data", typeof(System.Byte[])); createCol(assets, "Data", typeof (Byte[]));
// Add in contraints // Add in contraints
assets.PrimaryKey = new DataColumn[] { assets.Columns["UUID"] }; assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]};
return assets; return assets;
} }
@ -194,14 +196,14 @@ namespace OpenSim.Framework.Data.SQLite
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = new LLUUID((String)row["UUID"]); asset.FullID = new LLUUID((String) row["UUID"]);
asset.Name = (String)row["Name"]; asset.Name = (String) row["Name"];
asset.Description = (String)row["Description"]; asset.Description = (String) row["Description"];
asset.Type = Convert.ToSByte(row["Type"]); asset.Type = Convert.ToSByte(row["Type"]);
asset.InvType = Convert.ToSByte(row["InvType"]); asset.InvType = Convert.ToSByte(row["InvType"]);
asset.Local = Convert.ToBoolean(row["Local"]); asset.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[])row["Data"]; asset.Data = (byte[]) row["Data"];
return asset; return asset;
} }
@ -225,8 +227,10 @@ namespace OpenSim.Framework.Data.SQLite
row["Data"] = asset.Data; row["Data"] = asset.Data;
// ADO.NET doesn't handle NULL very well // ADO.NET doesn't handle NULL very well
foreach (DataColumn col in ds.Tables["assets"].Columns) { foreach (DataColumn col in ds.Tables["assets"].Columns)
if (row[col] == null) { {
if (row[col] == null)
{
row[col] = ""; row[col] = "";
} }
} }
@ -250,7 +254,7 @@ namespace OpenSim.Framework.Data.SQLite
da.UpdateCommand.Connection = conn; da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID"); SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
@ -269,9 +273,12 @@ namespace OpenSim.Framework.Data.SQLite
SqliteCommand cmd = new SqliteCommand(assetSelect, conn); SqliteCommand cmd = new SqliteCommand(assetSelect, conn);
SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
DataSet tmpDS = new DataSet(); DataSet tmpDS = new DataSet();
try { try
{
pDa.Fill(tmpDS, "assets"); pDa.Fill(tmpDS, "assets");
} catch (Mono.Data.SqliteClient.SqliteSyntaxException) { }
catch (SqliteSyntaxException)
{
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
InitDB(conn); InitDB(conn);
} }
@ -279,14 +286,18 @@ namespace OpenSim.Framework.Data.SQLite
} }
#region IPlugin interface #region IPlugin interface
public string Version {
public string Version
{
get get
{ {
System.Reflection.Module module = this.GetType().Module; Module module = GetType().Module;
string dllName = module.Assembly.ManifestModule.Name; string dllName = module.Assembly.ManifestModule.Name;
Version dllVersion = module.Assembly.GetName().Version; Version dllVersion = module.Assembly.GetName().Version;
return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); return
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
dllVersion.Revision);
} }
} }
@ -295,9 +306,11 @@ namespace OpenSim.Framework.Data.SQLite
Initialise("AssetStorage.db", ""); Initialise("AssetStorage.db", "");
} }
public string Name { public string Name
{
get { return "SQLite Asset storage engine"; } get { return "SQLite Asset storage engine"; }
} }
#endregion #endregion
} }
} }

View File

@ -26,13 +26,8 @@
* *
*/ */
using System; using System;
using System.IO;
using libsecondlife;
using OpenSim.Framework;
using System.Data; using System.Data;
using System.Data.SqlTypes;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.SQLite namespace OpenSim.Framework.Data.SQLite
{ {
@ -49,7 +44,7 @@ namespace OpenSim.Framework.Data.SQLite
* *
**********************************************************************/ **********************************************************************/
protected static void createCol(DataTable dt, string name, System.Type type) protected static void createCol(DataTable dt, string name, Type type)
{ {
DataColumn col = new DataColumn(name, type); DataColumn col = new DataColumn(name, type);
dt.Columns.Add(col); dt.Columns.Add(col);
@ -77,7 +72,8 @@ namespace OpenSim.Framework.Data.SQLite
* generate these strings instead of typing them out. * generate these strings instead of typing them out.
*/ */
string[] cols = new string[dt.Columns.Count]; string[] cols = new string[dt.Columns.Count];
for (int i = 0; i < dt.Columns.Count; i++) { for (int i = 0; i < dt.Columns.Count; i++)
{
DataColumn col = dt.Columns[i]; DataColumn col = dt.Columns[i];
cols[i] = col.ColumnName; cols[i] = col.ColumnName;
} }
@ -106,7 +102,8 @@ namespace OpenSim.Framework.Data.SQLite
foreach (DataColumn col in dt.Columns) foreach (DataColumn col in dt.Columns)
{ {
if (subsql.Length > 0) if (subsql.Length > 0)
{ // a map function would rock so much here {
// a map function would rock so much here
subsql += ", "; subsql += ", ";
} }
subsql += col.ColumnName + "= :" + col.ColumnName; subsql += col.ColumnName + "= :" + col.ColumnName;
@ -133,11 +130,12 @@ namespace OpenSim.Framework.Data.SQLite
foreach (DataColumn col in dt.Columns) foreach (DataColumn col in dt.Columns)
{ {
if (subsql.Length > 0) if (subsql.Length > 0)
{ // a map function would rock so much here {
// a map function would rock so much here
subsql += ",\n"; subsql += ",\n";
} }
subsql += col.ColumnName + " " + sqliteType(col.DataType); subsql += col.ColumnName + " " + sqliteType(col.DataType);
if(col == dt.PrimaryKey[0]) if (col == dt.PrimaryKey[0])
{ {
subsql += " primary key"; subsql += " primary key";
} }
@ -167,7 +165,7 @@ namespace OpenSim.Framework.Data.SQLite
/// for us. /// for us.
///</summary> ///</summary>
///<returns>a built sqlite parameter</returns> ///<returns>a built sqlite parameter</returns>
protected static SqliteParameter createSqliteParameter(string name, System.Type type) protected static SqliteParameter createSqliteParameter(string name, Type type)
{ {
SqliteParameter param = new SqliteParameter(); SqliteParameter param = new SqliteParameter();
param.ParameterName = ":" + name; param.ParameterName = ":" + name;
@ -185,23 +183,40 @@ namespace OpenSim.Framework.Data.SQLite
protected static DbType dbtypeFromType(Type type) protected static DbType dbtypeFromType(Type type)
{ {
if (type == typeof(System.String)) { if (type == typeof (String))
{
return DbType.String; return DbType.String;
} else if (type == typeof(System.Int32)) { }
else if (type == typeof (Int32))
{
return DbType.Int32; return DbType.Int32;
} else if (type == typeof(System.UInt32)) { }
else if (type == typeof (UInt32))
{
return DbType.UInt32; return DbType.UInt32;
} else if (type == typeof(System.Int64)) { }
else if (type == typeof (Int64))
{
return DbType.Int64; return DbType.Int64;
} else if (type == typeof(System.UInt64)) { }
else if (type == typeof (UInt64))
{
return DbType.UInt64; return DbType.UInt64;
} else if (type == typeof(System.Double)) { }
else if (type == typeof (Double))
{
return DbType.Double; return DbType.Double;
} else if (type == typeof(System.Boolean)) { }
else if (type == typeof (Boolean))
{
return DbType.Boolean; return DbType.Boolean;
} else if (type == typeof(System.Byte[])) { }
else if (type == typeof (Byte[]))
{
return DbType.Binary; return DbType.Binary;
} else { }
else
{
return DbType.String; return DbType.String;
} }
} }
@ -210,23 +225,40 @@ namespace OpenSim.Framework.Data.SQLite
// slightly differently. // slightly differently.
protected static string sqliteType(Type type) protected static string sqliteType(Type type)
{ {
if (type == typeof(System.String)) { if (type == typeof (String))
{
return "varchar(255)"; return "varchar(255)";
} else if (type == typeof(System.Int32)) { }
else if (type == typeof (Int32))
{
return "integer"; return "integer";
} else if (type == typeof(System.UInt32)) { }
else if (type == typeof (UInt32))
{
return "integer"; return "integer";
} else if (type == typeof(System.Int64)) { }
else if (type == typeof (Int64))
{
return "varchar(255)"; return "varchar(255)";
} else if (type == typeof(System.UInt64)) { }
else if (type == typeof (UInt64))
{
return "varchar(255)"; return "varchar(255)";
} else if (type == typeof(System.Double)) { }
else if (type == typeof (Double))
{
return "float"; return "float";
} else if (type == typeof(System.Boolean)) { }
else if (type == typeof (Boolean))
{
return "integer"; return "integer";
} else if (type == typeof(System.Byte[])) { }
else if (type == typeof (Byte[]))
{
return "blob"; return "blob";
} else { }
else
{
return "string"; return "string";
} }
} }

View File

@ -28,22 +28,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Reflection;
using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Framework;
using libsecondlife;
using System.Data; using System.Data;
using System.Data.SqlTypes; using System.Reflection;
using libsecondlife;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.SQLite namespace OpenSim.Framework.Data.SQLite
{ {
public class SQLiteInventoryStore : SQLiteBase, IInventoryData public class SQLiteInventoryStore : SQLiteBase, IInventoryData
{ {
private const string invItemsSelect = "select * from inventoryitems"; private const string invItemsSelect = "select * from inventoryitems";
@ -96,14 +88,14 @@ namespace OpenSim.Framework.Data.SQLite
public InventoryItemBase buildItem(DataRow row) public InventoryItemBase buildItem(DataRow row)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.inventoryID = new LLUUID((string)row["UUID"]); item.inventoryID = new LLUUID((string) row["UUID"]);
item.assetID = new LLUUID((string)row["assetID"]); item.assetID = new LLUUID((string) row["assetID"]);
item.assetType = Convert.ToInt32(row["assetType"]); item.assetType = Convert.ToInt32(row["assetType"]);
item.invType = Convert.ToInt32(row["invType"]); item.invType = Convert.ToInt32(row["invType"]);
item.parentFolderID = new LLUUID((string)row["parentFolderID"]); item.parentFolderID = new LLUUID((string) row["parentFolderID"]);
item.avatarID = new LLUUID((string)row["avatarID"]); item.avatarID = new LLUUID((string) row["avatarID"]);
item.creatorsID = new LLUUID((string)row["creatorsID"]); item.creatorsID = new LLUUID((string) row["creatorsID"]);
item.inventoryName =(string) row["inventoryName"]; item.inventoryName = (string) row["inventoryName"];
item.inventoryDescription = (string) row["inventoryDescription"]; item.inventoryDescription = (string) row["inventoryDescription"];
item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
@ -147,7 +139,7 @@ namespace OpenSim.Framework.Data.SQLite
fillFolderRow(inventoryRow, folder); fillFolderRow(inventoryRow, folder);
} }
this.invFoldersDa.Update(ds, "inventoryfolders"); invFoldersDa.Update(ds, "inventoryfolders");
} }
private void addItem(InventoryItemBase item) private void addItem(InventoryItemBase item)
@ -165,7 +157,7 @@ namespace OpenSim.Framework.Data.SQLite
{ {
fillItemRow(inventoryRow, item); fillItemRow(inventoryRow, item);
} }
this.invItemsDa.Update(ds, "inventoryitems"); invItemsDa.Update(ds, "inventoryitems");
} }
public void Shutdown() public void Shutdown()
@ -195,12 +187,14 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A string containing the plugin version</returns> /// <returns>A string containing the plugin version</returns>
public string getVersion() public string getVersion()
{ {
System.Reflection.Module module = this.GetType().Module; Module module = GetType().Module;
string dllName = module.Assembly.ManifestModule.Name; string dllName = module.Assembly.ManifestModule.Name;
Version dllVersion = module.Assembly.GetName().Version; Version dllVersion = module.Assembly.GetName().Version;
return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); return
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
dllVersion.Revision);
} }
/// <summary> /// <summary>
@ -306,7 +300,7 @@ namespace OpenSim.Framework.Data.SQLite
List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
getInventoryFolders(ref folders, parentID); getInventoryFolders(ref folders, parentID);
for(int i=0; i<folders.Count; i++) for (int i = 0; i < folders.Count; i++)
getInventoryFolders(ref folders, folders[i].folderID); getInventoryFolders(ref folders, folders[i].folderID);
return folders; return folders;
@ -320,9 +314,12 @@ namespace OpenSim.Framework.Data.SQLite
public InventoryItemBase getInventoryItem(LLUUID item) public InventoryItemBase getInventoryItem(LLUUID item)
{ {
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); DataRow row = ds.Tables["inventoryitems"].Rows.Find(item);
if (row != null) { if (row != null)
{
return buildItem(row); return buildItem(row);
} else { }
else
{
return null; return null;
} }
} }
@ -334,7 +331,6 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A class containing folder information</returns> /// <returns>A class containing folder information</returns>
public InventoryFolderBase getInventoryFolder(LLUUID folder) public InventoryFolderBase getInventoryFolder(LLUUID folder)
{ {
// TODO: Deep voodoo here. If you enable this code then // TODO: Deep voodoo here. If you enable this code then
// multi region breaks. No idea why, but I figured it was // multi region breaks. No idea why, but I figured it was
// better to leave multi region at this point. It does mean // better to leave multi region at this point. It does mean
@ -342,9 +338,12 @@ namespace OpenSim.Framework.Data.SQLite
// clothes and the like. :( // clothes and the like. :(
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder);
if (row != null) { if (row != null)
{
return buildFolder(row); return buildFolder(row);
} else { }
else
{
return null; return null;
} }
} }
@ -355,7 +354,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="item">The item to be created</param> /// <param name="item">The item to be created</param>
public void addInventoryItem(InventoryItemBase item) public void addInventoryItem(InventoryItemBase item)
{ {
this.addItem(item); addItem(item);
} }
/// <summary> /// <summary>
@ -364,7 +363,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="item">The updated item</param> /// <param name="item">The updated item</param>
public void updateInventoryItem(InventoryItemBase item) public void updateInventoryItem(InventoryItemBase item)
{ {
this.addItem(item); addItem(item);
} }
/// <summary> /// <summary>
@ -381,7 +380,7 @@ namespace OpenSim.Framework.Data.SQLite
inventoryRow.Delete(); inventoryRow.Delete();
} }
this.invItemsDa.Update(ds, "inventoryitems"); invItemsDa.Update(ds, "inventoryitems");
} }
@ -394,7 +393,7 @@ namespace OpenSim.Framework.Data.SQLite
{ {
List<InventoryItemBase> items = getInventoryInFolder(folderId); List<InventoryItemBase> items = getInventoryInFolder(folderId);
foreach(InventoryItemBase i in items) foreach (InventoryItemBase i in items)
deleteInventoryItem(i.inventoryID); deleteInventoryItem(i.inventoryID);
} }
@ -404,7 +403,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="folder">The inventory folder</param> /// <param name="folder">The inventory folder</param>
public void addInventoryFolder(InventoryFolderBase folder) public void addInventoryFolder(InventoryFolderBase folder)
{ {
this.addFolder(folder); addFolder(folder);
} }
/// <summary> /// <summary>
@ -413,7 +412,7 @@ namespace OpenSim.Framework.Data.SQLite
/// <param name="folder">The inventory folder</param> /// <param name="folder">The inventory folder</param>
public void updateInventoryFolder(InventoryFolderBase folder) public void updateInventoryFolder(InventoryFolderBase folder)
{ {
this.addFolder(folder); addFolder(folder);
} }
@ -450,7 +449,7 @@ namespace OpenSim.Framework.Data.SQLite
inventoryRow.Delete(); inventoryRow.Delete();
} }
this.invFoldersDa.Update(ds, "inventoryfolders"); invFoldersDa.Update(ds, "inventoryfolders");
} }
/*********************************************************************** /***********************************************************************
@ -463,23 +462,23 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable inv = new DataTable("inventoryitems"); DataTable inv = new DataTable("inventoryitems");
createCol(inv, "UUID", typeof(System.String)); //inventoryID createCol(inv, "UUID", typeof (String)); //inventoryID
createCol(inv, "assetID", typeof(System.String)); createCol(inv, "assetID", typeof (String));
createCol(inv, "assetType", typeof(System.Int32)); createCol(inv, "assetType", typeof (Int32));
createCol(inv, "invType", typeof(System.Int32)); createCol(inv, "invType", typeof (Int32));
createCol(inv, "parentFolderID", typeof(System.String)); createCol(inv, "parentFolderID", typeof (String));
createCol(inv, "avatarID", typeof(System.String)); createCol(inv, "avatarID", typeof (String));
createCol(inv, "creatorsID", typeof(System.String)); createCol(inv, "creatorsID", typeof (String));
createCol(inv, "inventoryName", typeof(System.String)); createCol(inv, "inventoryName", typeof (String));
createCol(inv, "inventoryDescription", typeof(System.String)); createCol(inv, "inventoryDescription", typeof (String));
// permissions // permissions
createCol(inv, "inventoryNextPermissions", typeof(System.Int32)); createCol(inv, "inventoryNextPermissions", typeof (Int32));
createCol(inv, "inventoryCurrentPermissions", typeof(System.Int32)); createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
createCol(inv, "inventoryBasePermissions", typeof(System.Int32)); createCol(inv, "inventoryBasePermissions", typeof (Int32));
createCol(inv, "inventoryEveryOnePermissions", typeof(System.Int32)); createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]};
return inv; return inv;
} }
@ -487,14 +486,14 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable fol = new DataTable("inventoryfolders"); DataTable fol = new DataTable("inventoryfolders");
createCol(fol, "UUID", typeof(System.String)); //folderID createCol(fol, "UUID", typeof (String)); //folderID
createCol(fol, "name", typeof(System.String)); createCol(fol, "name", typeof (String));
createCol(fol, "agentID", typeof(System.String)); createCol(fol, "agentID", typeof (String));
createCol(fol, "parentID", typeof(System.String)); createCol(fol, "parentID", typeof (String));
createCol(fol, "type", typeof(System.Int32)); createCol(fol, "type", typeof (Int32));
createCol(fol, "version", typeof(System.Int32)); createCol(fol, "version", typeof (Int32));
fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
return fol; return fol;
} }
@ -507,7 +506,7 @@ namespace OpenSim.Framework.Data.SQLite
da.UpdateCommand.Connection = conn; da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID"); SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
@ -521,7 +520,7 @@ namespace OpenSim.Framework.Data.SQLite
da.UpdateCommand.Connection = conn; da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID"); SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
@ -529,10 +528,10 @@ namespace OpenSim.Framework.Data.SQLite
private InventoryFolderBase buildFolder(DataRow row) private InventoryFolderBase buildFolder(DataRow row)
{ {
InventoryFolderBase folder = new InventoryFolderBase(); InventoryFolderBase folder = new InventoryFolderBase();
folder.folderID = new LLUUID((string)row["UUID"]); folder.folderID = new LLUUID((string) row["UUID"]);
folder.name = (string)row["name"]; folder.name = (string) row["name"];
folder.agentID = new LLUUID((string)row["agentID"]); folder.agentID = new LLUUID((string) row["agentID"]);
folder.parentID = new LLUUID((string)row["parentID"]); folder.parentID = new LLUUID((string) row["parentID"]);
folder.type = Convert.ToInt16(row["type"]); folder.type = Convert.ToInt16(row["type"]);
folder.version = Convert.ToUInt16(row["version"]); folder.version = Convert.ToUInt16(row["version"]);
return folder; return folder;
@ -554,6 +553,7 @@ namespace OpenSim.Framework.Data.SQLite
* Test and Initialization code * Test and Initialization code
* *
**********************************************************************/ **********************************************************************/
private void InitDB(SqliteConnection conn) private void InitDB(SqliteConnection conn)
{ {
string createInventoryItems = defineTable(createInventoryItemsTable()); string createInventoryItems = defineTable(createInventoryItemsTable());
@ -575,10 +575,13 @@ namespace OpenSim.Framework.Data.SQLite
SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd); SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd);
DataSet tmpDS = new DataSet(); DataSet tmpDS = new DataSet();
try { try
{
pDa.Fill(tmpDS, "inventoryitems"); pDa.Fill(tmpDS, "inventoryitems");
sDa.Fill(tmpDS, "inventoryfolders"); sDa.Fill(tmpDS, "inventoryfolders");
} catch (Mono.Data.SqliteClient.SqliteSyntaxException) { }
catch (SqliteSyntaxException)
{
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
InitDB(conn); InitDB(conn);
} }
@ -586,14 +589,18 @@ namespace OpenSim.Framework.Data.SQLite
pDa.Fill(tmpDS, "inventoryitems"); pDa.Fill(tmpDS, "inventoryitems");
sDa.Fill(tmpDS, "inventoryfolders"); sDa.Fill(tmpDS, "inventoryfolders");
foreach (DataColumn col in createInventoryItemsTable().Columns) { foreach (DataColumn col in createInventoryItemsTable().Columns)
if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName) ) { {
if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
return false; return false;
} }
} }
foreach (DataColumn col in createInventoryFoldersTable().Columns) { foreach (DataColumn col in createInventoryFoldersTable().Columns)
if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName) ) { {
if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName))
{
MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
return false; return false;
} }
@ -602,7 +609,3 @@ namespace OpenSim.Framework.Data.SQLite
} }
} }
} }

View File

@ -30,13 +30,14 @@ using System.Collections.Generic;
using System.Data; using System.Data;
using System.Data.SQLite; using System.Data.SQLite;
using libsecondlife; using libsecondlife;
using Mono.Data.SqliteClient;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
namespace OpenSim.Framework.Data.SQLite namespace OpenSim.Framework.Data.SQLite
{ {
class SQLiteManager : SQLiteBase internal class SQLiteManager : SQLiteBase
{ {
IDbConnection dbcon; private IDbConnection dbcon;
/// <summary> /// <summary>
/// Initialises and creates a new SQLite connection and maintains it. /// Initialises and creates a new SQLite connection and maintains it.
@ -78,15 +79,15 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A SQLite DB Command</returns> /// <returns>A SQLite DB Command</returns>
public IDbCommand Query(string sql, Dictionary<string, string> parameters) public IDbCommand Query(string sql, Dictionary<string, string> parameters)
{ {
SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
dbcommand.CommandText = sql; dbcommand.CommandText = sql;
foreach (KeyValuePair<string, string> param in parameters) foreach (KeyValuePair<string, string> param in parameters)
{ {
SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
dbcommand.Parameters.Add(paramx); dbcommand.Parameters.Add(paramx);
} }
return (IDbCommand)dbcommand; return (IDbCommand) dbcommand;
} }
private bool TestTables(SQLiteConnection conn) private bool TestTables(SQLiteConnection conn)
@ -98,7 +99,7 @@ namespace OpenSim.Framework.Data.SQLite
{ {
pDa.Fill(tmpDS, "regions"); pDa.Fill(tmpDS, "regions");
} }
catch (Mono.Data.SqliteClient.SqliteSyntaxException) catch (SqliteSyntaxException)
{ {
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
InitDB(conn); InitDB(conn);
@ -110,39 +111,39 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable regions = new DataTable("regions"); DataTable regions = new DataTable("regions");
createCol(regions, "regionHandle", typeof(ulong)); createCol(regions, "regionHandle", typeof (ulong));
createCol(regions, "regionName", typeof(System.String)); createCol(regions, "regionName", typeof (String));
createCol(regions, "uuid", typeof(System.String)); createCol(regions, "uuid", typeof (String));
createCol(regions, "regionRecvKey", typeof(System.String)); createCol(regions, "regionRecvKey", typeof (String));
createCol(regions, "regionSecret", typeof(System.String)); createCol(regions, "regionSecret", typeof (String));
createCol(regions, "regionSendKey", typeof(System.String)); createCol(regions, "regionSendKey", typeof (String));
createCol(regions, "regionDataURI", typeof(System.String)); createCol(regions, "regionDataURI", typeof (String));
createCol(regions, "serverIP", typeof(System.String)); createCol(regions, "serverIP", typeof (String));
createCol(regions, "serverPort", typeof(System.String)); createCol(regions, "serverPort", typeof (String));
createCol(regions, "serverURI", typeof(System.String)); createCol(regions, "serverURI", typeof (String));
createCol(regions, "locX", typeof( uint)); createCol(regions, "locX", typeof (uint));
createCol(regions, "locY", typeof( uint)); createCol(regions, "locY", typeof (uint));
createCol(regions, "locZ", typeof( uint)); createCol(regions, "locZ", typeof (uint));
createCol(regions, "eastOverrideHandle", typeof( ulong )); createCol(regions, "eastOverrideHandle", typeof (ulong));
createCol(regions, "westOverrideHandle", typeof( ulong )); createCol(regions, "westOverrideHandle", typeof (ulong));
createCol(regions, "southOverrideHandle", typeof( ulong )); createCol(regions, "southOverrideHandle", typeof (ulong));
createCol(regions, "northOverrideHandle", typeof( ulong )); createCol(regions, "northOverrideHandle", typeof (ulong));
createCol(regions, "regionAssetURI", typeof(System.String)); createCol(regions, "regionAssetURI", typeof (String));
createCol(regions, "regionAssetRecvKey", typeof(System.String)); createCol(regions, "regionAssetRecvKey", typeof (String));
createCol(regions, "regionAssetSendKey", typeof(System.String)); createCol(regions, "regionAssetSendKey", typeof (String));
createCol(regions, "regionUserURI", typeof(System.String)); createCol(regions, "regionUserURI", typeof (String));
createCol(regions, "regionUserRecvKey", typeof(System.String)); createCol(regions, "regionUserRecvKey", typeof (String));
createCol(regions, "regionUserSendKey", typeof(System.String)); createCol(regions, "regionUserSendKey", typeof (String));
// Add in contraints // Add in contraints
regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
return regions; return regions;
} }
@ -168,42 +169,42 @@ namespace OpenSim.Framework.Data.SQLite
if (reader.Read()) if (reader.Read())
{ {
// Region Main // Region Main
retval.regionHandle = (ulong)reader["regionHandle"]; retval.regionHandle = (ulong) reader["regionHandle"];
retval.regionName = (string)reader["regionName"]; retval.regionName = (string) reader["regionName"];
retval.UUID = new LLUUID((string)reader["uuid"]); retval.UUID = new LLUUID((string) reader["uuid"]);
// Secrets // Secrets
retval.regionRecvKey = (string)reader["regionRecvKey"]; retval.regionRecvKey = (string) reader["regionRecvKey"];
retval.regionSecret = (string)reader["regionSecret"]; retval.regionSecret = (string) reader["regionSecret"];
retval.regionSendKey = (string)reader["regionSendKey"]; retval.regionSendKey = (string) reader["regionSendKey"];
// Region Server // Region Server
retval.regionDataURI = (string)reader["regionDataURI"]; retval.regionDataURI = (string) reader["regionDataURI"];
retval.regionOnline = false; // Needs to be pinged before this can be set. retval.regionOnline = false; // Needs to be pinged before this can be set.
retval.serverIP = (string)reader["serverIP"]; retval.serverIP = (string) reader["serverIP"];
retval.serverPort = (uint)reader["serverPort"]; retval.serverPort = (uint) reader["serverPort"];
retval.serverURI = (string)reader["serverURI"]; retval.serverURI = (string) reader["serverURI"];
// Location // Location
retval.regionLocX = (uint)((int)reader["locX"]); retval.regionLocX = (uint) ((int) reader["locX"]);
retval.regionLocY = (uint)((int)reader["locY"]); retval.regionLocY = (uint) ((int) reader["locY"]);
retval.regionLocZ = (uint)((int)reader["locZ"]); retval.regionLocZ = (uint) ((int) reader["locZ"]);
// Neighbours - 0 = No Override // Neighbours - 0 = No Override
retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
// Assets // Assets
retval.regionAssetURI = (string)reader["regionAssetURI"]; retval.regionAssetURI = (string) reader["regionAssetURI"];
retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
// Userserver // Userserver
retval.regionUserURI = (string)reader["regionUserURI"]; retval.regionUserURI = (string) reader["regionUserURI"];
retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
retval.regionUserSendKey = (string)reader["regionUserSendKey"]; retval.regionUserSendKey = (string) reader["regionUserSendKey"];
} }
else else
{ {
@ -219,12 +220,15 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>Success?</returns> /// <returns>Success?</returns>
public bool insertRow(RegionProfileData profile) public bool insertRow(RegionProfileData profile)
{ {
string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; string sql =
sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; sql +=
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();

View File

@ -26,12 +26,8 @@
* *
*/ */
using System; using System;
using System.IO;
using libsecondlife;
using OpenSim.Framework;
using OpenSim.Framework;
using System.Data; using System.Data;
using System.Data.SqlTypes; using libsecondlife;
using Mono.Data.SqliteClient; using Mono.Data.SqliteClient;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
@ -45,11 +41,11 @@ namespace OpenSim.Framework.Data.SQLite
/// <summary> /// <summary>
/// The database manager /// The database manager
/// </summary> /// </summary>
/// <summary> /// <summary>
/// Artificial constructor called upon plugin load /// Artificial constructor called upon plugin load
/// </summary> /// </summary>
private const string userSelect = "select * from users"; private const string userSelect = "select * from users";
private DataSet ds; private DataSet ds;
private SqliteDataAdapter da; private SqliteDataAdapter da;
@ -61,7 +57,8 @@ namespace OpenSim.Framework.Data.SQLite
ds = new DataSet(); ds = new DataSet();
da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
lock (ds) { lock (ds)
{
ds.Tables.Add(createUsersTable()); ds.Tables.Add(createUsersTable());
ds.Tables.Add(createUserAgentsTable()); ds.Tables.Add(createUserAgentsTable());
@ -79,16 +76,21 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>A user profile</returns> /// <returns>A user profile</returns>
public UserProfileData GetUserByUUID(LLUUID uuid) public UserProfileData GetUserByUUID(LLUUID uuid)
{ {
lock (ds) { lock (ds)
{
DataRow row = ds.Tables["users"].Rows.Find(uuid); DataRow row = ds.Tables["users"].Rows.Find(uuid);
if(row != null) { if (row != null)
{
UserProfileData user = buildUserProfile(row); UserProfileData user = buildUserProfile(row);
row = ds.Tables["useragents"].Rows.Find(uuid); row = ds.Tables["useragents"].Rows.Find(uuid);
if(row != null) { if (row != null)
{
user.currentAgent = buildUserAgent(row); user.currentAgent = buildUserAgent(row);
} }
return user; return user;
} else { }
else
{
return null; return null;
} }
} }
@ -113,16 +115,21 @@ namespace OpenSim.Framework.Data.SQLite
public UserProfileData GetUserByName(string fname, string lname) public UserProfileData GetUserByName(string fname, string lname)
{ {
string select = "surname = '" + lname + "' and username = '" + fname + "'"; string select = "surname = '" + lname + "' and username = '" + fname + "'";
lock (ds) { lock (ds)
{
DataRow[] rows = ds.Tables["users"].Select(select); DataRow[] rows = ds.Tables["users"].Select(select);
if(rows.Length > 0) { if (rows.Length > 0)
{
UserProfileData user = buildUserProfile(rows[0]); UserProfileData user = buildUserProfile(rows[0]);
DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID); DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID);
if(row != null) { if (row != null)
{
user.currentAgent = buildUserAgent(row); user.currentAgent = buildUserAgent(row);
} }
return user; return user;
} else { }
else
{
return null; return null;
} }
} }
@ -165,7 +172,7 @@ namespace OpenSim.Framework.Data.SQLite
{ {
try try
{ {
return GetUserByName(fname,lname).currentAgent; return GetUserByName(fname, lname).currentAgent;
} }
catch (Exception) catch (Exception)
{ {
@ -180,7 +187,8 @@ namespace OpenSim.Framework.Data.SQLite
public void AddNewUserProfile(UserProfileData user) public void AddNewUserProfile(UserProfileData user)
{ {
DataTable users = ds.Tables["users"]; DataTable users = ds.Tables["users"];
lock (ds) { lock (ds)
{
DataRow row = users.Rows.Find(user.UUID); DataRow row = users.Rows.Find(user.UUID);
if (row == null) if (row == null)
{ {
@ -193,7 +201,8 @@ namespace OpenSim.Framework.Data.SQLite
fillUserRow(row, user); fillUserRow(row, user);
} }
if(user.currentAgent != null) { if (user.currentAgent != null)
{
DataTable ua = ds.Tables["useragents"]; DataTable ua = ds.Tables["useragents"];
row = ua.Rows.Find(user.UUID); row = ua.Rows.Find(user.UUID);
if (row == null) if (row == null)
@ -207,7 +216,8 @@ namespace OpenSim.Framework.Data.SQLite
fillUserAgentRow(row, user.currentAgent); fillUserAgentRow(row, user.currentAgent);
} }
} }
MainLog.Instance.Verbose("SQLITE", "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored"); MainLog.Instance.Verbose("SQLITE",
"Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored");
// save changes off to disk // save changes off to disk
da.Update(ds, "users"); da.Update(ds, "users");
} }
@ -220,10 +230,13 @@ namespace OpenSim.Framework.Data.SQLite
/// <returns>True on success, false on error</returns> /// <returns>True on success, false on error</returns>
public bool UpdateUserProfile(UserProfileData user) public bool UpdateUserProfile(UserProfileData user)
{ {
try { try
{
AddNewUserProfile(user); AddNewUserProfile(user);
return true; return true;
} catch (Exception) { }
catch (Exception)
{
return false; return false;
} }
} }
@ -297,33 +310,33 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable users = new DataTable("users"); DataTable users = new DataTable("users");
createCol(users, "UUID", typeof(System.String)); createCol(users, "UUID", typeof (String));
createCol(users, "username", typeof(System.String)); createCol(users, "username", typeof (String));
createCol(users, "surname", typeof(System.String)); createCol(users, "surname", typeof (String));
createCol(users, "passwordHash", typeof(System.String)); createCol(users, "passwordHash", typeof (String));
createCol(users, "passwordSalt", typeof(System.String)); createCol(users, "passwordSalt", typeof (String));
createCol(users, "homeRegionX", typeof(System.Int32)); createCol(users, "homeRegionX", typeof (Int32));
createCol(users, "homeRegionY", typeof(System.Int32)); createCol(users, "homeRegionY", typeof (Int32));
createCol(users, "homeLocationX", typeof(System.Double)); createCol(users, "homeLocationX", typeof (Double));
createCol(users, "homeLocationY", typeof(System.Double)); createCol(users, "homeLocationY", typeof (Double));
createCol(users, "homeLocationZ", typeof(System.Double)); createCol(users, "homeLocationZ", typeof (Double));
createCol(users, "homeLookAtX", typeof(System.Double)); createCol(users, "homeLookAtX", typeof (Double));
createCol(users, "homeLookAtY", typeof(System.Double)); createCol(users, "homeLookAtY", typeof (Double));
createCol(users, "homeLookAtZ", typeof(System.Double)); createCol(users, "homeLookAtZ", typeof (Double));
createCol(users, "created", typeof(System.Int32)); createCol(users, "created", typeof (Int32));
createCol(users, "lastLogin", typeof(System.Int32)); createCol(users, "lastLogin", typeof (Int32));
createCol(users, "rootInventoryFolderID", typeof(System.String)); createCol(users, "rootInventoryFolderID", typeof (String));
createCol(users, "userInventoryURI", typeof(System.String)); createCol(users, "userInventoryURI", typeof (String));
createCol(users, "userAssetURI", typeof(System.String)); createCol(users, "userAssetURI", typeof (String));
createCol(users, "profileCanDoMask", typeof(System.Int32)); createCol(users, "profileCanDoMask", typeof (Int32));
createCol(users, "profileWantDoMask", typeof(System.Int32)); createCol(users, "profileWantDoMask", typeof (Int32));
createCol(users, "profileAboutText", typeof(System.String)); createCol(users, "profileAboutText", typeof (String));
createCol(users, "profileFirstText", typeof(System.String)); createCol(users, "profileFirstText", typeof (String));
createCol(users, "profileImage", typeof(System.String)); createCol(users, "profileImage", typeof (String));
createCol(users, "profileFirstImage", typeof(System.String)); createCol(users, "profileFirstImage", typeof (String));
// Add in contraints // Add in contraints
users.PrimaryKey = new DataColumn[] { users.Columns["UUID"] }; users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
return users; return users;
} }
@ -331,23 +344,23 @@ namespace OpenSim.Framework.Data.SQLite
{ {
DataTable ua = new DataTable("useragents"); DataTable ua = new DataTable("useragents");
// this is the UUID of the user // this is the UUID of the user
createCol(ua, "UUID", typeof(System.String)); createCol(ua, "UUID", typeof (String));
createCol(ua, "agentIP", typeof(System.String)); createCol(ua, "agentIP", typeof (String));
createCol(ua, "agentPort", typeof(System.Int32)); createCol(ua, "agentPort", typeof (Int32));
createCol(ua, "agentOnline", typeof(System.Boolean)); createCol(ua, "agentOnline", typeof (Boolean));
createCol(ua, "sessionID", typeof(System.String)); createCol(ua, "sessionID", typeof (String));
createCol(ua, "secureSessionID", typeof(System.String)); createCol(ua, "secureSessionID", typeof (String));
createCol(ua, "regionID", typeof(System.String)); createCol(ua, "regionID", typeof (String));
createCol(ua, "loginTime", typeof(System.Int32)); createCol(ua, "loginTime", typeof (Int32));
createCol(ua, "logoutTime", typeof(System.Int32)); createCol(ua, "logoutTime", typeof (Int32));
createCol(ua, "currentRegion", typeof(System.String)); createCol(ua, "currentRegion", typeof (String));
createCol(ua, "currentHandle", typeof(System.Int32)); createCol(ua, "currentHandle", typeof (Int32));
// vectors // vectors
createCol(ua, "currentPosX", typeof(System.Double)); createCol(ua, "currentPosX", typeof (Double));
createCol(ua, "currentPosY", typeof(System.Double)); createCol(ua, "currentPosY", typeof (Double));
createCol(ua, "currentPosZ", typeof(System.Double)); createCol(ua, "currentPosZ", typeof (Double));
// constraints // constraints
ua.PrimaryKey = new DataColumn[] { ua.Columns["UUID"] }; ua.PrimaryKey = new DataColumn[] {ua.Columns["UUID"]};
return ua; return ua;
} }
@ -366,11 +379,11 @@ namespace OpenSim.Framework.Data.SQLite
// interesting has to be done to actually get these values // interesting has to be done to actually get these values
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
UserProfileData user = new UserProfileData(); UserProfileData user = new UserProfileData();
user.UUID = new LLUUID((String)row["UUID"]); user.UUID = new LLUUID((String) row["UUID"]);
user.username = (String)row["username"]; user.username = (String) row["username"];
user.surname = (String)row["surname"]; user.surname = (String) row["surname"];
user.passwordHash = (String)row["passwordHash"]; user.passwordHash = (String) row["passwordHash"];
user.passwordSalt = (String)row["passwordSalt"]; user.passwordSalt = (String) row["passwordSalt"];
user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]);
user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]);
@ -386,15 +399,15 @@ namespace OpenSim.Framework.Data.SQLite
); );
user.created = Convert.ToInt32(row["created"]); user.created = Convert.ToInt32(row["created"]);
user.lastLogin = Convert.ToInt32(row["lastLogin"]); user.lastLogin = Convert.ToInt32(row["lastLogin"]);
user.rootInventoryFolderID = new LLUUID((String)row["rootInventoryFolderID"]); user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]);
user.userInventoryURI = (String)row["userInventoryURI"]; user.userInventoryURI = (String) row["userInventoryURI"];
user.userAssetURI = (String)row["userAssetURI"]; user.userAssetURI = (String) row["userAssetURI"];
user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]);
user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]);
user.profileAboutText = (String)row["profileAboutText"]; user.profileAboutText = (String) row["profileAboutText"];
user.profileFirstText = (String)row["profileFirstText"]; user.profileFirstText = (String) row["profileFirstText"];
user.profileImage = new LLUUID((String)row["profileImage"]); user.profileImage = new LLUUID((String) row["profileImage"]);
user.profileFirstImage = new LLUUID((String)row["profileFirstImage"]); user.profileFirstImage = new LLUUID((String) row["profileFirstImage"]);
return user; return user;
} }
@ -429,8 +442,10 @@ namespace OpenSim.Framework.Data.SQLite
row["profileFirstImage"] = user.profileFirstImage; row["profileFirstImage"] = user.profileFirstImage;
// ADO.NET doesn't handle NULL very well // ADO.NET doesn't handle NULL very well
foreach (DataColumn col in ds.Tables["users"].Columns) { foreach (DataColumn col in ds.Tables["users"].Columns)
if (row[col] == null) { {
if (row[col] == null)
{
row[col] = ""; row[col] = "";
} }
} }
@ -440,16 +455,16 @@ namespace OpenSim.Framework.Data.SQLite
{ {
UserAgentData ua = new UserAgentData(); UserAgentData ua = new UserAgentData();
ua.UUID = new LLUUID((String)row["UUID"]); ua.UUID = new LLUUID((String) row["UUID"]);
ua.agentIP = (String)row["agentIP"]; ua.agentIP = (String) row["agentIP"];
ua.agentPort = Convert.ToUInt32(row["agentPort"]); ua.agentPort = Convert.ToUInt32(row["agentPort"]);
ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); ua.agentOnline = Convert.ToBoolean(row["agentOnline"]);
ua.sessionID = new LLUUID((String)row["sessionID"]); ua.sessionID = new LLUUID((String) row["sessionID"]);
ua.secureSessionID = new LLUUID((String)row["secureSessionID"]); ua.secureSessionID = new LLUUID((String) row["secureSessionID"]);
ua.regionID = new LLUUID((String)row["regionID"]); ua.regionID = new LLUUID((String) row["regionID"]);
ua.loginTime = Convert.ToInt32(row["loginTime"]); ua.loginTime = Convert.ToInt32(row["loginTime"]);
ua.logoutTime = Convert.ToInt32(row["logoutTime"]); ua.logoutTime = Convert.ToInt32(row["logoutTime"]);
ua.currentRegion = new LLUUID((String)row["currentRegion"]); ua.currentRegion = new LLUUID((String) row["currentRegion"]);
ua.currentHandle = Convert.ToUInt32(row["currentHandle"]); ua.currentHandle = Convert.ToUInt32(row["currentHandle"]);
ua.currentPos = new LLVector3( ua.currentPos = new LLVector3(
Convert.ToSingle(row["currentPosX"]), Convert.ToSingle(row["currentPosX"]),
@ -496,7 +511,7 @@ namespace OpenSim.Framework.Data.SQLite
da.UpdateCommand.Connection = conn; da.UpdateCommand.Connection = conn;
SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID"); SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID");
delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
@ -515,14 +530,16 @@ namespace OpenSim.Framework.Data.SQLite
SqliteCommand cmd = new SqliteCommand(userSelect, conn); SqliteCommand cmd = new SqliteCommand(userSelect, conn);
SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
DataSet tmpDS = new DataSet(); DataSet tmpDS = new DataSet();
try { try
{
pDa.Fill(tmpDS, "users"); pDa.Fill(tmpDS, "users");
} catch (Mono.Data.SqliteClient.SqliteSyntaxException) { }
catch (SqliteSyntaxException)
{
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
InitDB(conn); InitDB(conn);
} }
return true; return true;
} }
} }
} }

View File

@ -106,6 +106,5 @@ namespace OpenSim.Framework.Data
DataResponse AddProfile(RegionProfileData profile); DataResponse AddProfile(RegionProfileData profile);
ReservationData GetReservationAtPoint(uint x, uint y); ReservationData GetReservationAtPoint(uint x, uint y);
} }
} }

View File

@ -63,7 +63,9 @@ namespace OpenSim.Framework.Data
/// </summary> /// </summary>
public interface ILogData public interface ILogData
{ {
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
string logMessage);
/// <summary> /// <summary>
/// Initialises the interface /// Initialises the interface
/// </summary> /// </summary>
@ -86,5 +88,4 @@ namespace OpenSim.Framework.Data
/// <returns>A string containing the plugin version</returns> /// <returns>A string containing the plugin version</returns>
string getVersion(); string getVersion();
} }
} }

View File

@ -27,6 +27,7 @@
*/ */
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
/* /*
Taken from public code listing at by Alex Pinsker Taken from public code listing at by Alex Pinsker
http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
@ -52,7 +53,8 @@ namespace OpenSim.Framework.Data
RegexOptions.Compiled | RegexOptions.Compiled |
RegexOptions.CultureInvariant); RegexOptions.CultureInvariant);
} }
static private Regex _iniKeyValuePatternRegex;
private static Regex _iniKeyValuePatternRegex;
public IniFile(string iniFileName) public IniFile(string iniFileName)
{ {
@ -81,9 +83,7 @@ namespace OpenSim.Framework.Data
return value; return value;
} }
} }
} while (reader.Peek() != -1);
}
while (reader.Peek() != -1);
} }
return null; return null;
} }
@ -91,6 +91,8 @@ namespace OpenSim.Framework.Data
public string IniFileName public string IniFileName
{ {
get { return _iniFileName; } get { return _iniFileName; }
} private string _iniFileName; }
private string _iniFileName;
} }
} }

View File

@ -1,24 +1,28 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Framework.Data")]
[assembly: AssemblyDescription("")] [assembly : AssemblyTitle("OpenSim.Framework.Data")]
[assembly: AssemblyConfiguration("")] [assembly : AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly : AssemblyConfiguration("")]
[assembly: AssemblyProduct("OpenSim.Framework.Data")] [assembly : AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2007")] [assembly : AssemblyProduct("OpenSim.Framework.Data")]
[assembly: AssemblyTrademark("")] [assembly : AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyCulture("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]
[assembly : AssemblyFileVersion("1.0.0.0")]

View File

@ -25,11 +25,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using libsecondlife;
using Nwc.XmlRpc;
using System; using System;
using System.Collections; using System.Collections;
using libsecondlife;
using Nwc.XmlRpc;
namespace OpenSim.Framework.Data namespace OpenSim.Framework.Data
{ {
@ -57,6 +57,7 @@ namespace OpenSim.Framework.Data
/// Coordinates of the region /// Coordinates of the region
/// </summary> /// </summary>
public uint regionLocX; public uint regionLocX;
public uint regionLocY; public uint regionLocY;
public uint regionLocZ; // Reserved (round-robin, layers, etc) public uint regionLocZ; // Reserved (round-robin, layers, etc)
@ -65,6 +66,7 @@ namespace OpenSim.Framework.Data
/// </summary> /// </summary>
/// <remarks>Not very secure, needs improvement.</remarks> /// <remarks>Not very secure, needs improvement.</remarks>
public string regionSendKey = ""; public string regionSendKey = "";
public string regionRecvKey = ""; public string regionRecvKey = "";
public string regionSecret = ""; public string regionSecret = "";
@ -77,6 +79,7 @@ namespace OpenSim.Framework.Data
/// Information about the server that the region is currently hosted on /// Information about the server that the region is currently hosted on
/// </summary> /// </summary>
public string serverIP = ""; public string serverIP = "";
public uint serverPort; public uint serverPort;
public string serverURI = ""; public string serverURI = "";
@ -88,6 +91,7 @@ namespace OpenSim.Framework.Data
/// Set of optional overrides. Can be used to create non-eulicidean spaces. /// Set of optional overrides. Can be used to create non-eulicidean spaces.
/// </summary> /// </summary>
public ulong regionNorthOverrideHandle; public ulong regionNorthOverrideHandle;
public ulong regionSouthOverrideHandle; public ulong regionSouthOverrideHandle;
public ulong regionEastOverrideHandle; public ulong regionEastOverrideHandle;
public ulong regionWestOverrideHandle; public ulong regionWestOverrideHandle;
@ -102,6 +106,7 @@ namespace OpenSim.Framework.Data
/// Region Asset Details /// Region Asset Details
/// </summary> /// </summary>
public string regionAssetURI = ""; public string regionAssetURI = "";
public string regionAssetSendKey = ""; public string regionAssetSendKey = "";
public string regionAssetRecvKey = ""; public string regionAssetRecvKey = "";
@ -109,6 +114,7 @@ namespace OpenSim.Framework.Data
/// Region Userserver Details /// Region Userserver Details
/// </summary> /// </summary>
public string regionUserURI = ""; public string regionUserURI = "";
public string regionUserSendKey = ""; public string regionUserSendKey = "";
public string regionUserRecvKey = ""; public string regionUserRecvKey = "";
@ -124,7 +130,8 @@ namespace OpenSim.Framework.Data
/// <param name="gridserver_url"></param> /// <param name="gridserver_url"></param>
/// <param name="?"></param> /// <param name="?"></param>
/// <returns></returns> /// <returns></returns>
public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
string gridserver_sendkey, string gridserver_recvkey)
{ {
Hashtable requestData = new Hashtable(); Hashtable requestData = new Hashtable();
requestData["region_uuid"] = region_uuid.UUID.ToString(); requestData["region_uuid"] = region_uuid.UUID.ToString();
@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
Hashtable responseData = (Hashtable)GridResp.Value; Hashtable responseData = (Hashtable) GridResp.Value;
if (responseData.ContainsKey("error")) if (responseData.ContainsKey("error"))
{ {
@ -142,21 +149,23 @@ namespace OpenSim.Framework.Data
} }
RegionProfileData simData = new RegionProfileData(); RegionProfileData simData = new RegionProfileData();
simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
simData.serverIP = (string)responseData["sim_ip"]; simData.serverIP = (string) responseData["sim_ip"];
simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
simData.UUID = new LLUUID((string)responseData["region_UUID"]); simData.UUID = new LLUUID((string) responseData["region_UUID"]);
simData.regionName = (string)responseData["region_name"]; simData.regionName = (string) responseData["region_name"];
return simData; return simData;
} }
public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey)
public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
string gridserver_sendkey, string gridserver_recvkey)
{ {
Hashtable requestData = new Hashtable(); Hashtable requestData = new Hashtable();
requestData["region_handle"] = region_handle.ToString(); requestData["region_handle"] = region_handle.ToString();
@ -166,7 +175,7 @@ namespace OpenSim.Framework.Data
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
Hashtable responseData = (Hashtable)GridResp.Value; Hashtable responseData = (Hashtable) GridResp.Value;
if (responseData.ContainsKey("error")) if (responseData.ContainsKey("error"))
{ {
@ -174,17 +183,17 @@ namespace OpenSim.Framework.Data
} }
RegionProfileData simData = new RegionProfileData(); RegionProfileData simData = new RegionProfileData();
simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
simData.serverIP = (string)responseData["sim_ip"]; simData.serverIP = (string) responseData["sim_ip"];
simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
simData.UUID = new LLUUID((string)responseData["region_UUID"]); simData.UUID = new LLUUID((string) responseData["region_UUID"]);
simData.regionName = (string)responseData["region_name"]; simData.regionName = (string) responseData["region_name"];
return simData; return simData;
} }

View File

@ -27,7 +27,6 @@
*/ */
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -37,15 +36,15 @@ namespace OpenSim.Framework
// permissions rather than just the first. Deny permissions will // permissions rather than just the first. Deny permissions will
// override all others. // override all others.
#region ACL Core Class #region ACL Core Class
/// <summary> /// <summary>
/// Access Control List Engine /// Access Control List Engine
/// </summary> /// </summary>
public class ACL public class ACL
{ {
Dictionary<string, Role> Roles = new Dictionary<string, Role>(); private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
public ACL AddRole(Role role) public ACL AddRole(Role role)
{ {
@ -114,9 +113,11 @@ namespace OpenSim.Framework
return this; return this;
} }
} }
#endregion #endregion
#region Exceptions #region Exceptions
/// <summary> /// <summary>
/// Thrown when an ACL attempts to add a duplicate role. /// Thrown when an ACL attempts to add a duplicate role.
/// </summary> /// </summary>
@ -139,6 +140,7 @@ namespace OpenSim.Framework
return "This ACL already contains a role called '" + m_role.Name + "'."; return "This ACL already contains a role called '" + m_role.Name + "'.";
} }
} }
#endregion #endregion
#region Roles and Resources #region Roles and Resources
@ -146,7 +148,12 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// Does this Role have permission to access a specified Resource? /// Does this Role have permission to access a specified Resource?
/// </summary> /// </summary>
public enum Permission { Deny, None, Allow }; public enum Permission
{
Deny,
None,
Allow
} ;
/// <summary> /// <summary>
/// A role class, for use with Users or Groups /// A role class, for use with Users or Groups
@ -227,7 +234,7 @@ namespace OpenSim.Framework
#region Tests #region Tests
class ACLTester internal class ACLTester
{ {
public ACLTester() public ACLTester()
{ {
@ -249,7 +256,6 @@ namespace OpenSim.Framework
acl.GrantPermission("Guests", "CanBuild"); acl.GrantPermission("Guests", "CanBuild");
acl.HasPermission("JoeGuest", "CanBuild"); acl.HasPermission("JoeGuest", "CanBuild");
} }
} }

View File

@ -27,8 +27,6 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -38,15 +36,14 @@ namespace OpenSim.Framework
public AgentCircuitManager() public AgentCircuitManager()
{ {
} }
public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
{ {
AgentCircuitData validcircuit = null; AgentCircuitData validcircuit = null;
if (this.AgentCircuits.ContainsKey(circuitcode)) if (AgentCircuits.ContainsKey(circuitcode))
{ {
validcircuit = this.AgentCircuits[circuitcode]; validcircuit = AgentCircuits[circuitcode];
} }
AuthenticateResponse user = new AuthenticateResponse(); AuthenticateResponse user = new AuthenticateResponse();
if (validcircuit == null) if (validcircuit == null)
@ -79,50 +76,50 @@ namespace OpenSim.Framework
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{ {
if (this.AgentCircuits.ContainsKey(circuitCode)) if (AgentCircuits.ContainsKey(circuitCode))
{ {
this.AgentCircuits[circuitCode] = agentData; AgentCircuits[circuitCode] = agentData;
} }
else else
{ {
this.AgentCircuits.Add(circuitCode, agentData); AgentCircuits.Add(circuitCode, agentData);
} }
} }
public LLVector3 GetPosition(uint circuitCode) public LLVector3 GetPosition(uint circuitCode)
{ {
LLVector3 vec = new LLVector3(); LLVector3 vec = new LLVector3();
if (this.AgentCircuits.ContainsKey(circuitCode)) if (AgentCircuits.ContainsKey(circuitCode))
{ {
vec = this.AgentCircuits[circuitCode].startpos; vec = AgentCircuits[circuitCode].startpos;
} }
return vec; return vec;
} }
public void UpdateAgentData(AgentCircuitData agentData) public void UpdateAgentData(AgentCircuitData agentData)
{ {
if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) if (AgentCircuits.ContainsKey((uint) agentData.circuitcode))
{ {
this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos;
// Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
} }
} }
public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
{ {
if (this.AgentCircuits.ContainsKey(circuitcode)) if (AgentCircuits.ContainsKey(circuitcode))
{ {
this.AgentCircuits[circuitcode].child = childstatus; AgentCircuits[circuitcode].child = childstatus;
} }
} }
public bool GetAgentChildStatus(uint circuitcode) public bool GetAgentChildStatus(uint circuitcode)
{ {
if (this.AgentCircuits.ContainsKey(circuitcode)) if (AgentCircuits.ContainsKey(circuitcode))
{ {
return this.AgentCircuits[circuitcode].child; return AgentCircuits[circuitcode].child;
} }
return false; return false;
} }

View File

@ -25,15 +25,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using libsecondlife;
using System; using System;
using libsecondlife;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
[Serializable] [Serializable]
public class AgentCircuitData public class AgentCircuitData
{ {
public AgentCircuitData() { } public AgentCircuitData()
{
}
public LLUUID AgentID; public LLUUID AgentID;
public LLUUID SessionID; public LLUUID SessionID;
public LLUUID SecureSessionID; public LLUUID SecureSessionID;

View File

@ -28,8 +28,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -47,7 +45,7 @@ namespace OpenSim.Framework
{ {
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
InventoryItems = new Dictionary<LLUUID, InventoryItem>(); InventoryItems = new Dictionary<LLUUID, InventoryItem>();
this.Initialise(); Initialise();
} }
public virtual void Initialise() public virtual void Initialise()
@ -63,27 +61,27 @@ namespace OpenSim.Framework
{ {
InventoryFolder Folder = new InventoryFolder(); InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID; Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID; Folder.OwnerID = AgentID;
Folder.DefaultType = type; Folder.DefaultType = type;
this.InventoryFolders.Add(Folder.FolderID, Folder); InventoryFolders.Add(Folder.FolderID, Folder);
return (true); return (true);
} }
public void CreateRootFolder(LLUUID newAgentID, bool createTextures) public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
{ {
this.AgentID = newAgentID; AgentID = newAgentID;
InventoryRoot = new InventoryFolder(); InventoryRoot = new InventoryFolder();
InventoryRoot.FolderID = LLUUID.Random(); InventoryRoot.FolderID = LLUUID.Random();
InventoryRoot.ParentID = new LLUUID(); InventoryRoot.ParentID = new LLUUID();
InventoryRoot.Version = 1; InventoryRoot.Version = 1;
InventoryRoot.DefaultType = 8; InventoryRoot.DefaultType = 8;
InventoryRoot.OwnerID = this.AgentID; InventoryRoot.OwnerID = AgentID;
InventoryRoot.FolderName = "My Inventory"; InventoryRoot.FolderName = "My Inventory";
InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
InventoryRoot.OwnerID = this.AgentID; InventoryRoot.OwnerID = AgentID;
if (createTextures) if (createTextures)
{ {
this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
} }
} }
@ -91,32 +89,32 @@ namespace OpenSim.Framework
{ {
InventoryFolder Folder = new InventoryFolder(); InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID; Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID; Folder.OwnerID = AgentID;
Folder.DefaultType = type; Folder.DefaultType = type;
Folder.FolderName = folderName; Folder.FolderName = folderName;
this.InventoryFolders.Add(Folder.FolderID, Folder); InventoryFolders.Add(Folder.FolderID, Folder);
return (true); return (true);
} }
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
{ {
if (!this.InventoryFolders.ContainsKey(folderID)) if (!InventoryFolders.ContainsKey(folderID))
{ {
System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
InventoryFolder Folder = new InventoryFolder(); InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID; Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID; Folder.OwnerID = AgentID;
Folder.DefaultType = type; Folder.DefaultType = type;
Folder.FolderName = folderName; Folder.FolderName = folderName;
Folder.ParentID = parentID; Folder.ParentID = parentID;
this.InventoryFolders.Add(Folder.FolderID, Folder); InventoryFolders.Add(Folder.FolderID, Folder);
} }
return (true); return (true);
} }
public bool HasFolder(LLUUID folderID) public bool HasFolder(LLUUID folderID)
{ {
if (this.InventoryFolders.ContainsKey(folderID)) if (InventoryFolders.ContainsKey(folderID))
{ {
return true; return true;
} }
@ -125,7 +123,7 @@ namespace OpenSim.Framework
public LLUUID GetFolderID(string folderName) public LLUUID GetFolderID(string folderName)
{ {
foreach (InventoryFolder inv in this.InventoryFolders.Values) foreach (InventoryFolder inv in InventoryFolders.Values)
{ {
if (inv.FolderName == folderName) if (inv.FolderName == folderName)
{ {
@ -137,11 +135,12 @@ namespace OpenSim.Framework
public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
{ {
if(this.InventoryItems.ContainsKey(itemID)) if (InventoryItems.ContainsKey(itemID))
{ {
InventoryItem Item = this.InventoryItems[itemID]; InventoryItem Item = InventoryItems[itemID];
Item.AssetID = asset.FullID; Item.AssetID = asset.FullID;
System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() +
" so it now is set to asset " + asset.FullID.ToStringHyphenated());
//TODO need to update the rest of the info //TODO need to update the rest of the info
} }
return true; return true;
@ -150,10 +149,10 @@ namespace OpenSim.Framework
public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
{ {
System.Console.WriteLine("updating inventory item details"); System.Console.WriteLine("updating inventory item details");
if (this.InventoryItems.ContainsKey(itemID)) if (InventoryItems.ContainsKey(itemID))
{ {
System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name));
InventoryItem Item = this.InventoryItems[itemID]; InventoryItem Item = InventoryItems[itemID];
Item.Name = Util.FieldToString(packet.Name); Item.Name = Util.FieldToString(packet.Name);
System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
//TODO need to update the rest of the info //TODO need to update the rest of the info
@ -163,7 +162,7 @@ namespace OpenSim.Framework
public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
{ {
if (this.InventoryFolders.ContainsKey(folderID)) if (InventoryFolders.ContainsKey(folderID))
{ {
LLUUID NewItemID = LLUUID.Random(); LLUUID NewItemID = LLUUID.Random();
@ -176,7 +175,7 @@ namespace OpenSim.Framework
Item.Name = asset.Name; Item.Name = asset.Name;
Item.Description = asset.Description; Item.Description = asset.Description;
Item.InvType = asset.InvType; Item.InvType = asset.InvType;
this.InventoryItems.Add(Item.ItemID, Item); InventoryItems.Add(Item.ItemID, Item);
InventoryFolder Folder = InventoryFolders[Item.FolderID]; InventoryFolder Folder = InventoryFolders[Item.FolderID];
Folder.Items.Add(Item); Folder.Items.Add(Item);
return (Item.ItemID); return (Item.ItemID);
@ -190,10 +189,10 @@ namespace OpenSim.Framework
public bool DeleteFromInventory(LLUUID itemID) public bool DeleteFromInventory(LLUUID itemID)
{ {
bool res = false; bool res = false;
if (this.InventoryItems.ContainsKey(itemID)) if (InventoryItems.ContainsKey(itemID))
{ {
InventoryItem item = this.InventoryItems[itemID]; InventoryItem item = InventoryItems[itemID];
this.InventoryItems.Remove(itemID); InventoryItems.Remove(itemID);
foreach (InventoryFolder fold in InventoryFolders.Values) foreach (InventoryFolder fold in InventoryFolders.Values)
{ {
if (fold.Items.Contains(item)) if (fold.Items.Contains(item))
@ -203,7 +202,6 @@ namespace OpenSim.Framework
} }
} }
res = true; res = true;
} }
return res; return res;
} }
@ -225,7 +223,6 @@ namespace OpenSim.Framework
Items = new List<InventoryItem>(); Items = new List<InventoryItem>();
//Subfolders = new List<InventoryFolder>(); //Subfolders = new List<InventoryFolder>();
} }
} }
public class InventoryItem public class InventoryItem
@ -237,12 +234,12 @@ namespace OpenSim.Framework
public LLUUID CreatorID; public LLUUID CreatorID;
public sbyte InvType; public sbyte InvType;
public sbyte Type; public sbyte Type;
public string Name =""; public string Name = "";
public string Description; public string Description;
public InventoryItem() public InventoryItem()
{ {
this.CreatorID = LLUUID.Zero; CreatorID = LLUUID.Zero;
} }
public string ExportString() public string ExportString()
@ -251,9 +248,9 @@ namespace OpenSim.Framework
string result = ""; string result = "";
result += "\tinv_object\t0\n\t{\n"; result += "\tinv_object\t0\n\t{\n";
result += "\t\tobj_id\t%s\n"; result += "\t\tobj_id\t%s\n";
result += "\t\tparent_id\t"+ ItemID.ToString() +"\n"; result += "\t\tparent_id\t" + ItemID.ToString() + "\n";
result += "\t\ttype\t"+ typ +"\n"; result += "\t\ttype\t" + typ + "\n";
result += "\t\tname\t" + Name+"|\n"; result += "\t\tname\t" + Name + "|\n";
result += "\t}\n"; result += "\t}\n";
return result; return result;
} }

View File

@ -36,10 +36,9 @@ namespace OpenSim.Framework
public AvatarWearable() public AvatarWearable()
{ {
} }
public AvatarWearable( LLUUID itemId, LLUUID assetId ) public AvatarWearable(LLUUID itemId, LLUUID assetId)
{ {
AssetID = assetId; AssetID = assetId;
ItemID = itemId; ItemID = itemId;

View File

@ -44,7 +44,6 @@ namespace OpenSim.Framework
public AssetBase() public AssetBase()
{ {
} }
public AssetBase(LLUUID assetId, string name) public AssetBase(LLUUID assetId, string name)

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
/// <summary> /// <summary>
@ -48,18 +44,22 @@ namespace OpenSim.Framework
public AssetConfig(string description, string filename) public AssetConfig(string description, string filename)
{ {
configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
{ {
configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); configMember.addConfigurationOption("default_startup_message",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Default Startup Message", "Welcome to OGS", false);
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Http Listener port", DefaultHttpPort.ToString(), false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -67,13 +67,13 @@ namespace OpenSim.Framework
switch (configuration_key) switch (configuration_key)
{ {
case "default_startup_message": case "default_startup_message":
this.DefaultStartupMsg = (string)configuration_result; DefaultStartupMsg = (string) configuration_result;
break; break;
case "database_provider": case "database_provider":
this.DatabaseProvider = (string)configuration_result; DatabaseProvider = (string) configuration_result;
break; break;
case "http_port": case "http_port":
HttpPort = (uint)configuration_result; HttpPort = (uint) configuration_result;
break; break;
} }

View File

@ -38,12 +38,12 @@ namespace OpenSim.Framework
public AssetLandmark(AssetBase a) public AssetLandmark(AssetBase a)
{ {
this.Data = a.Data; Data = a.Data;
this.FullID = a.FullID; FullID = a.FullID;
this.Type = a.Type; Type = a.Type;
this.InvType = a.InvType; InvType = a.InvType;
this.Name = a.Name; Name = a.Name;
this.Description = a.Description; Description = a.Description;
InternData(); InternData();
} }

View File

@ -31,12 +31,13 @@ namespace OpenSim.Framework
{ {
public class AssetStorage public class AssetStorage
{ {
public AssetStorage()
public AssetStorage() { {
} }
public AssetStorage(LLUUID assetUUID) { public AssetStorage(LLUUID assetUUID)
UUID=assetUUID; {
UUID = assetUUID;
} }
public byte[] Data; public byte[] Data;

View File

@ -25,8 +25,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class AuthenticateResponse public class AuthenticateResponse
@ -36,8 +34,6 @@ namespace OpenSim.Framework
public AuthenticateResponse() public AuthenticateResponse()
{ {
} }
} }
} }

View File

@ -26,16 +26,14 @@
* *
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public delegate void ForEachClientDelegate(IClientAPI client); public delegate void ForEachClientDelegate(IClientAPI client);
public class ClientManager public class ClientManager
{ {
private Dictionary<uint, IClientAPI> m_clients; private Dictionary<uint, IClientAPI> m_clients;
@ -63,7 +61,7 @@ namespace OpenSim.Framework
m_clients.Add(id, client); m_clients.Add(id, client);
} }
public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet) public void InPacket(uint circuitCode, Packet packet)
{ {
IClientAPI client; IClientAPI client;
@ -83,10 +81,10 @@ namespace OpenSim.Framework
} }
} }
public void CloseAllCircuits( LLUUID agentId ) public void CloseAllCircuits(LLUUID agentId)
{ {
uint[] circuits = GetAllCircuits(agentId); uint[] circuits = GetAllCircuits(agentId);
foreach (uint circuit in circuits ) foreach (uint circuit in circuits)
{ {
IClientAPI client; IClientAPI client;
if (m_clients.TryGetValue(circuit, out client)) if (m_clients.TryGetValue(circuit, out client))
@ -103,9 +101,9 @@ namespace OpenSim.Framework
foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) foreach (KeyValuePair<uint, IClientAPI> pair in m_clients)
{ {
if( pair.Value.AgentId == agentId ) if (pair.Value.AgentId == agentId)
{ {
circuits.Add( pair.Key ); circuits.Add(pair.Key);
} }
} }

View File

@ -27,22 +27,19 @@
*/ */
using System; using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Net;
using libsecondlife;
using OpenSim.Framework.Console;
using System.Globalization; using System.Globalization;
using System.Net;
using System.Reflection;
using libsecondlife;
using OpenSim.Framework.Console;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class ConfigurationMember public class ConfigurationMember
{ {
public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
public delegate void ConfigurationOptionsLoad(); public delegate void ConfigurationOptionsLoad();
private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
@ -53,22 +50,26 @@ namespace OpenSim.Framework
private ConfigurationOptionResult resultFunction; private ConfigurationOptionResult resultFunction;
private IGenericConfig configurationPlugin = null; private IGenericConfig configurationPlugin = null;
/// <summary> /// <summary>
/// This is the default configuration DLL loaded /// This is the default configuration DLL loaded
/// </summary> /// </summary>
private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
public ConfigurationMember(string configuration_filename, string configuration_description,
ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
{ {
this.configurationFilename = configuration_filename; configurationFilename = configuration_filename;
this.configurationDescription = configuration_description; configurationDescription = configuration_description;
this.loadFunction = load_function; loadFunction = load_function;
this.resultFunction = result_function; resultFunction = result_function;
} }
public void setConfigurationFilename(string filename) public void setConfigurationFilename(string filename)
{ {
configurationFilename = filename; configurationFilename = filename;
} }
public void setConfigurationDescription(string desc) public void setConfigurationDescription(string desc)
{ {
configurationDescription = desc; configurationDescription = desc;
@ -83,7 +84,11 @@ namespace OpenSim.Framework
{ {
configurationPluginFilename = dll_filename; configurationPluginFilename = dll_filename;
} }
public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt)
public void addConfigurationOption(string configuration_key,
ConfigurationOption.ConfigurationTypes configuration_type,
string configuration_question, string configuration_default,
bool use_default_no_prompt)
{ {
ConfigurationOption configOption = new ConfigurationOption(); ConfigurationOption configOption = new ConfigurationOption();
configOption.configurationKey = configuration_key; configOption.configurationKey = configuration_key;
@ -92,7 +97,8 @@ namespace OpenSim.Framework
configOption.configurationType = configuration_type; configOption.configurationType = configuration_type;
configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) if ((configuration_key != "" && configuration_question != "") ||
(configuration_key != "" && use_default_no_prompt))
{ {
if (!configurationOptions.Contains(configOption)) if (!configurationOptions.Contains(configOption))
{ {
@ -101,32 +107,37 @@ namespace OpenSim.Framework
} }
else else
{ {
MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); MainLog.Instance.Notice(
"Required fields for adding a configuration option is invalid. Will not add this option (" +
configuration_key + ")");
} }
} }
public void performConfigurationRetrieve() public void performConfigurationRetrieve()
{ {
configurationPlugin = this.LoadConfigDll(configurationPluginFilename); configurationPlugin = LoadConfigDll(configurationPluginFilename);
configurationOptions.Clear(); configurationOptions.Clear();
if(loadFunction == null) if (loadFunction == null)
{ {
MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); MainLog.Instance.Error("Load Function for '" + configurationDescription +
"' is null. Refusing to run configuration.");
return; return;
} }
if(resultFunction == null) if (resultFunction == null)
{ {
MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); MainLog.Instance.Error("Result Function for '" + configurationDescription +
"' is null. Refusing to run configuration.");
return; return;
} }
MainLog.Instance.Verbose("Calling Configuration Load Function..."); MainLog.Instance.Verbose("Calling Configuration Load Function...");
this.loadFunction(); loadFunction();
if(configurationOptions.Count <= 0) if (configurationOptions.Count <= 0)
{ {
MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions +
"'. Refusing to continue configuration.");
return; return;
} }
@ -157,7 +168,6 @@ namespace OpenSim.Framework
bool ignoreNextFromConfig = false; bool ignoreNextFromConfig = false;
while (convertSuccess == false) while (convertSuccess == false)
{ {
string console_result = ""; string console_result = "";
string attribute = null; string attribute = null;
if (useFile) if (useFile)
@ -180,14 +190,18 @@ namespace OpenSim.Framework
} }
else else
{ {
if (configurationDescription.Trim() != "") if (configurationDescription.Trim() != "")
{ {
console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); console_result =
MainLog.Instance.CmdPrompt(
configurationDescription + ": " + configOption.configurationQuestion,
configOption.configurationDefault);
} }
else else
{ {
console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); console_result =
MainLog.Instance.CmdPrompt(configOption.configurationQuestion,
configOption.configurationDefault);
} }
} }
} }
@ -252,7 +266,6 @@ namespace OpenSim.Framework
{ {
convertSuccess = true; convertSuccess = true;
return_result = intResult; return_result = intResult;
} }
errorMessage = "a signed 32 bit integer (int)"; errorMessage = "a signed 32 bit integer (int)";
break; break;
@ -307,7 +320,6 @@ namespace OpenSim.Framework
{ {
convertSuccess = true; convertSuccess = true;
return_result = uintResult; return_result = uintResult;
} }
errorMessage = "an unsigned 32 bit integer (uint)"; errorMessage = "an unsigned 32 bit integer (uint)";
break; break;
@ -322,7 +334,9 @@ namespace OpenSim.Framework
break; break;
case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
float floatResult; float floatResult;
if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) if (
float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
out floatResult))
{ {
convertSuccess = true; convertSuccess = true;
return_result = floatResult; return_result = floatResult;
@ -331,7 +345,9 @@ namespace OpenSim.Framework
break; break;
case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
double doubleResult; double doubleResult;
if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) if (
Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
out doubleResult))
{ {
convertSuccess = true; convertSuccess = true;
return_result = doubleResult; return_result = doubleResult;
@ -348,9 +364,10 @@ namespace OpenSim.Framework
} }
if (!this.resultFunction(configOption.configurationKey, return_result)) if (!resultFunction(configOption.configurationKey, return_result))
{ {
Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); MainLog.Instance.Notice(
"The handler for the last configuration option denied that input, please try again.");
convertSuccess = false; convertSuccess = false;
ignoreNextFromConfig = true; ignoreNextFromConfig = true;
} }
@ -359,19 +376,27 @@ namespace OpenSim.Framework
{ {
if (configOption.configurationUseDefaultNoPrompt) if (configOption.configurationUseDefaultNoPrompt)
{ {
MainLog.Instance.Error("CONFIG", string.Format("[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); MainLog.Instance.Error("CONFIG",
string.Format(
"[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
configOption.configurationKey, console_result, errorMessage,
configurationFilename));
convertSuccess = true; convertSuccess = true;
} }
else else
{ {
MainLog.Instance.Warn("CONFIG", string.Format("[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n", configOption.configurationKey, console_result, errorMessage, configurationFilename)); MainLog.Instance.Warn("CONFIG",
string.Format(
"[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
configOption.configurationKey, console_result, errorMessage,
configurationFilename));
ignoreNextFromConfig = true; ignoreNextFromConfig = true;
} }
} }
} }
} }
if(useFile) if (useFile)
{ {
configurationPlugin.Commit(); configurationPlugin.Commit();
configurationPlugin.Close(); configurationPlugin.Close();
@ -393,7 +418,8 @@ namespace OpenSim.Framework
if (typeInterface != null) if (typeInterface != null)
{ {
plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug =
(IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
} }
} }
} }
@ -405,10 +431,10 @@ namespace OpenSim.Framework
public void forceSetConfigurationOption(string configuration_key, string configuration_value) public void forceSetConfigurationOption(string configuration_key, string configuration_value)
{ {
this.configurationPlugin.LoadData(); configurationPlugin.LoadData();
this.configurationPlugin.SetAttribute(configuration_key, configuration_value); configurationPlugin.SetAttribute(configuration_key, configuration_value);
this.configurationPlugin.Commit(); configurationPlugin.Commit();
this.configurationPlugin.Close(); configurationPlugin.Close();
} }
} }
} }

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class ConfigurationOption public class ConfigurationOption
@ -52,7 +48,7 @@ namespace OpenSim.Framework
TYPE_LLVECTOR3, TYPE_LLVECTOR3,
TYPE_FLOAT, TYPE_FLOAT,
TYPE_DOUBLE TYPE_DOUBLE
}; } ;
public string configurationKey = ""; public string configurationKey = "";
public string configurationQuestion = ""; public string configurationQuestion = "";

View File

@ -27,31 +27,23 @@
*/ */
using System; using System;
using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Text;
using System.Threading; using System.Threading;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class Culture public class Culture
{ {
private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true); private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true);
public static NumberFormatInfo NumberFormatInfo public static NumberFormatInfo NumberFormatInfo
{ {
get get { return m_cultureInfo.NumberFormat; }
{
return m_cultureInfo.NumberFormat;
}
} }
public static IFormatProvider FormatProvider public static IFormatProvider FormatProvider
{ {
get get { return m_cultureInfo; }
{
return m_cultureInfo;
}
} }
public static void SetCurrentCulture() public static void SetCurrentCulture()

View File

@ -25,24 +25,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using System.Globalization;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class EstateSettings public class EstateSettings
{ {
//Settings to this island //Settings to this island
private float m_billableFactor; private float m_billableFactor;
public float billableFactor public float billableFactor
{ {
get get { return m_billableFactor; }
{
return m_billableFactor;
}
set set
{ {
m_billableFactor = value; m_billableFactor = value;
@ -52,12 +48,10 @@ namespace OpenSim.Framework
private uint m_estateID; private uint m_estateID;
public uint estateID public uint estateID
{ {
get get { return m_estateID; }
{
return m_estateID;
}
set set
{ {
m_estateID = value; m_estateID = value;
@ -67,12 +61,10 @@ namespace OpenSim.Framework
private uint m_parentEstateID; private uint m_parentEstateID;
public uint parentEstateID public uint parentEstateID
{ {
get get { return m_parentEstateID; }
{
return m_parentEstateID;
}
set set
{ {
m_parentEstateID = value; m_parentEstateID = value;
@ -81,12 +73,10 @@ namespace OpenSim.Framework
} }
private byte m_maxAgents; private byte m_maxAgents;
public byte maxAgents public byte maxAgents
{ {
get get { return m_maxAgents; }
{
return m_maxAgents;
}
set set
{ {
m_maxAgents = value; m_maxAgents = value;
@ -95,12 +85,10 @@ namespace OpenSim.Framework
} }
private float m_objectBonusFactor; private float m_objectBonusFactor;
public float objectBonusFactor public float objectBonusFactor
{ {
get get { return m_objectBonusFactor; }
{
return m_objectBonusFactor;
}
set set
{ {
m_objectBonusFactor = value; m_objectBonusFactor = value;
@ -109,12 +97,10 @@ namespace OpenSim.Framework
} }
private int m_redirectGridX; private int m_redirectGridX;
public int redirectGridX public int redirectGridX
{ {
get get { return m_redirectGridX; }
{
return m_redirectGridX;
}
set set
{ {
m_redirectGridX = value; m_redirectGridX = value;
@ -123,12 +109,10 @@ namespace OpenSim.Framework
} }
private int m_redirectGridY; private int m_redirectGridY;
public int redirectGridY public int redirectGridY
{ {
get get { return m_redirectGridY; }
{
return m_redirectGridY;
}
set set
{ {
m_redirectGridY = value; m_redirectGridY = value;
@ -137,12 +121,10 @@ namespace OpenSim.Framework
} }
private Simulator.RegionFlags m_regionFlags; private Simulator.RegionFlags m_regionFlags;
public Simulator.RegionFlags regionFlags public Simulator.RegionFlags regionFlags
{ {
get get { return m_regionFlags; }
{
return m_regionFlags;
}
set set
{ {
m_regionFlags = value; m_regionFlags = value;
@ -152,12 +134,10 @@ namespace OpenSim.Framework
private Simulator.SimAccess m_simAccess; private Simulator.SimAccess m_simAccess;
public Simulator.SimAccess simAccess public Simulator.SimAccess simAccess
{ {
get get { return m_simAccess; }
{
return m_simAccess;
}
set set
{ {
m_simAccess = value; m_simAccess = value;
@ -166,12 +146,10 @@ namespace OpenSim.Framework
} }
private float m_sunHour; private float m_sunHour;
public float sunHour public float sunHour
{ {
get get { return m_sunHour; }
{
return m_sunHour;
}
set set
{ {
m_sunHour = value; m_sunHour = value;
@ -180,12 +158,10 @@ namespace OpenSim.Framework
} }
private float m_terrainRaiseLimit; private float m_terrainRaiseLimit;
public float terrainRaiseLimit public float terrainRaiseLimit
{ {
get get { return m_terrainRaiseLimit; }
{
return m_terrainRaiseLimit;
}
set set
{ {
m_terrainRaiseLimit = value; m_terrainRaiseLimit = value;
@ -194,12 +170,10 @@ namespace OpenSim.Framework
} }
private float m_terrainLowerLimit; private float m_terrainLowerLimit;
public float terrainLowerLimit public float terrainLowerLimit
{ {
get get { return m_terrainLowerLimit; }
{
return m_terrainLowerLimit;
}
set set
{ {
m_terrainLowerLimit = value; m_terrainLowerLimit = value;
@ -208,12 +182,10 @@ namespace OpenSim.Framework
} }
private bool m_useFixedSun; private bool m_useFixedSun;
public bool useFixedSun public bool useFixedSun
{ {
get get { return m_useFixedSun; }
{
return m_useFixedSun;
}
set set
{ {
m_useFixedSun = value; m_useFixedSun = value;
@ -223,12 +195,10 @@ namespace OpenSim.Framework
private int m_pricePerMeter; private int m_pricePerMeter;
public int pricePerMeter public int pricePerMeter
{ {
get get { return m_pricePerMeter; }
{
return m_pricePerMeter;
}
set set
{ {
m_pricePerMeter = value; m_pricePerMeter = value;
@ -238,12 +208,10 @@ namespace OpenSim.Framework
private ushort m_regionWaterHeight; private ushort m_regionWaterHeight;
public ushort regionWaterHeight public ushort regionWaterHeight
{ {
get get { return m_regionWaterHeight; }
{
return m_regionWaterHeight;
}
set set
{ {
m_regionWaterHeight = value; m_regionWaterHeight = value;
@ -253,12 +221,10 @@ namespace OpenSim.Framework
private bool m_regionAllowTerraform; private bool m_regionAllowTerraform;
public bool regionAllowTerraform public bool regionAllowTerraform
{ {
get get { return m_regionAllowTerraform; }
{
return m_regionAllowTerraform;
}
set set
{ {
m_regionAllowTerraform = value; m_regionAllowTerraform = value;
@ -270,12 +236,10 @@ namespace OpenSim.Framework
// Region Information // Region Information
// Low resolution 'base' textures. No longer used. // Low resolution 'base' textures. No longer used.
private LLUUID m_terrainBase0; private LLUUID m_terrainBase0;
public LLUUID terrainBase0 public LLUUID terrainBase0
{ {
get get { return m_terrainBase0; }
{
return m_terrainBase0;
}
set set
{ {
m_terrainBase0 = value; m_terrainBase0 = value;
@ -284,12 +248,10 @@ namespace OpenSim.Framework
} }
private LLUUID m_terrainBase1; private LLUUID m_terrainBase1;
public LLUUID terrainBase1 public LLUUID terrainBase1
{ {
get get { return m_terrainBase1; }
{
return m_terrainBase1;
}
set set
{ {
m_terrainBase1 = value; m_terrainBase1 = value;
@ -298,12 +260,10 @@ namespace OpenSim.Framework
} }
private LLUUID m_terrainBase2; private LLUUID m_terrainBase2;
public LLUUID terrainBase2 public LLUUID terrainBase2
{ {
get get { return m_terrainBase2; }
{
return m_terrainBase2;
}
set set
{ {
m_terrainBase2 = value; m_terrainBase2 = value;
@ -312,12 +272,10 @@ namespace OpenSim.Framework
} }
private LLUUID m_terrainBase3; private LLUUID m_terrainBase3;
public LLUUID terrainBase3 public LLUUID terrainBase3
{ {
get get { return m_terrainBase3; }
{
return m_terrainBase3;
}
set set
{ {
m_terrainBase3 = value; m_terrainBase3 = value;
@ -328,53 +286,46 @@ namespace OpenSim.Framework
// Higher resolution terrain textures // Higher resolution terrain textures
private LLUUID m_terrainDetail0; private LLUUID m_terrainDetail0;
public LLUUID terrainDetail0 public LLUUID terrainDetail0
{ {
get get { return m_terrainDetail0; }
{
return m_terrainDetail0;
}
set set
{ {
m_terrainDetail0 = value; m_terrainDetail0 = value;
configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString());
} }
} }
private LLUUID m_terrainDetail1; private LLUUID m_terrainDetail1;
public LLUUID terrainDetail1 public LLUUID terrainDetail1
{ {
get get { return m_terrainDetail1; }
{
return m_terrainDetail1;
}
set set
{ {
m_terrainDetail1 = value; m_terrainDetail1 = value;
configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString());
} }
} }
private LLUUID m_terrainDetail2; private LLUUID m_terrainDetail2;
public LLUUID terrainDetail2 public LLUUID terrainDetail2
{ {
get get { return m_terrainDetail2; }
{
return m_terrainDetail2;
}
set set
{ {
m_terrainDetail2 = value; m_terrainDetail2 = value;
configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString());
} }
} }
private LLUUID m_terrainDetail3; private LLUUID m_terrainDetail3;
public LLUUID terrainDetail3 public LLUUID terrainDetail3
{ {
get get { return m_terrainDetail3; }
{
return m_terrainDetail3;
}
set set
{ {
m_terrainDetail3 = value; m_terrainDetail3 = value;
@ -384,12 +335,10 @@ namespace OpenSim.Framework
// First quad - each point is bilinearly interpolated at each meter of terrain // First quad - each point is bilinearly interpolated at each meter of terrain
private float m_terrainStartHeight0; private float m_terrainStartHeight0;
public float terrainStartHeight0 public float terrainStartHeight0
{ {
get get { return m_terrainStartHeight0; }
{
return m_terrainStartHeight0;
}
set set
{ {
m_terrainStartHeight0 = value; m_terrainStartHeight0 = value;
@ -399,12 +348,10 @@ namespace OpenSim.Framework
private float m_terrainStartHeight1; private float m_terrainStartHeight1;
public float terrainStartHeight1 public float terrainStartHeight1
{ {
get get { return m_terrainStartHeight1; }
{
return m_terrainStartHeight1;
}
set set
{ {
m_terrainStartHeight1 = value; m_terrainStartHeight1 = value;
@ -413,12 +360,10 @@ namespace OpenSim.Framework
} }
private float m_terrainStartHeight2; private float m_terrainStartHeight2;
public float terrainStartHeight2 public float terrainStartHeight2
{ {
get get { return m_terrainStartHeight2; }
{
return m_terrainStartHeight2;
}
set set
{ {
m_terrainStartHeight2 = value; m_terrainStartHeight2 = value;
@ -427,28 +372,25 @@ namespace OpenSim.Framework
} }
private float m_terrainStartHeight3; private float m_terrainStartHeight3;
public float terrainStartHeight3 public float terrainStartHeight3
{ {
get get { return m_terrainStartHeight3; }
{
return m_terrainStartHeight3;
}
set set
{ {
m_terrainStartHeight3 = value; m_terrainStartHeight3 = value;
configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString());
} }
} }
// Second quad - also bilinearly interpolated. // Second quad - also bilinearly interpolated.
// Terrain texturing is done that: // Terrain texturing is done that:
// 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
private float m_terrainHeightRange0; private float m_terrainHeightRange0;
public float terrainHeightRange0 public float terrainHeightRange0
{ {
get get { return m_terrainHeightRange0; }
{
return m_terrainHeightRange0;
}
set set
{ {
m_terrainHeightRange0 = value; m_terrainHeightRange0 = value;
@ -457,12 +399,10 @@ namespace OpenSim.Framework
} }
private float m_terrainHeightRange1; private float m_terrainHeightRange1;
public float terrainHeightRange1 public float terrainHeightRange1
{ {
get get { return m_terrainHeightRange1; }
{
return m_terrainHeightRange1;
}
set set
{ {
m_terrainHeightRange1 = value; m_terrainHeightRange1 = value;
@ -471,12 +411,10 @@ namespace OpenSim.Framework
} }
private float m_terrainHeightRange2; private float m_terrainHeightRange2;
public float terrainHeightRange2 public float terrainHeightRange2
{ {
get get { return m_terrainHeightRange2; }
{
return m_terrainHeightRange2;
}
set set
{ {
m_terrainHeightRange2 = value; m_terrainHeightRange2 = value;
@ -485,26 +423,23 @@ namespace OpenSim.Framework
} }
private float m_terrainHeightRange3; private float m_terrainHeightRange3;
public float terrainHeightRange3 public float terrainHeightRange3
{ {
get get { return m_terrainHeightRange3; }
{
return m_terrainHeightRange3;
}
set set
{ {
m_terrainHeightRange3 = value; m_terrainHeightRange3 = value;
configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString());
} }
} }
// Terrain Default (Must be in F32 Format!) // Terrain Default (Must be in F32 Format!)
private string m_terrainFile; private string m_terrainFile;
public string terrainFile public string terrainFile
{ {
get get { return m_terrainFile; }
{
return m_terrainFile;
}
set set
{ {
m_terrainFile = value; m_terrainFile = value;
@ -513,12 +448,10 @@ namespace OpenSim.Framework
} }
private double m_terrainMultiplier; private double m_terrainMultiplier;
public double terrainMultiplier public double terrainMultiplier
{ {
get get { return m_terrainMultiplier; }
{
return m_terrainMultiplier;
}
set set
{ {
m_terrainMultiplier = value; m_terrainMultiplier = value;
@ -527,12 +460,10 @@ namespace OpenSim.Framework
} }
private float m_waterHeight; private float m_waterHeight;
public float waterHeight public float waterHeight
{ {
get get { return m_waterHeight; }
{
return m_waterHeight;
}
set set
{ {
m_waterHeight = value; m_waterHeight = value;
@ -541,73 +472,112 @@ namespace OpenSim.Framework
} }
private LLUUID m_terrainImageID; private LLUUID m_terrainImageID;
public LLUUID terrainImageID public LLUUID terrainImageID
{ {
get get { return m_terrainImageID; }
{
return m_terrainImageID;
}
set set
{ {
m_terrainImageID = value; m_terrainImageID = value;
configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString());
} }
} }
private ConfigurationMember configMember; private ConfigurationMember configMember;
public EstateSettings() public EstateSettings()
{ {
// Temporary hack to prevent multiple loadings. // Temporary hack to prevent multiple loadings.
if (configMember == null) if (configMember == null)
{ {
configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); configMember =
new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS",
loadConfigurationOptions, handleIncomingConfiguration);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
{ {
configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "","0.0",true); configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "",
configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "","0",true); "0.0", true);
configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0",
configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", true); true);
configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"", "0", true);
configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40",
true);
configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "1.0", true); configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); "", "1.0", true);
configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "",
configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); "0", true);
configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", true); configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "",
configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); "0", true);
configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "",
configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); "0", true);
configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "false", true); configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21",
configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "1", true); true);
configMember.addConfigurationOption("region_water_height", ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0",
configMember.addConfigurationOption("region_allow_terraform", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); true);
configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
"", "0", true);
configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
"", "0", true);
configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "",
"false", true);
configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"", "1", true);
configMember.addConfigurationOption("region_water_height",
ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true);
configMember.addConfigurationOption("region_allow_terraform",
ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true);
configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "abb783e6-3e93-26c0-248a-247666855da3", true); "b8d3965a-ad78-bf43-699b-bff8eca6c975", true);
configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "179cdabd-398a-9b6b-1391-4dc333ba321f", true); configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); "abb783e6-3e93-26c0-248a-247666855da3", true);
configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
"179cdabd-398a-9b6b-1391-4dc333ba321f", true);
configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
"beb169c7-11ea-fff2-efe5-0f24dc881df2", true);
configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); "", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("terrain_start_height_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); configMember.addConfigurationOption("terrain_start_height_0",
configMember.addConfigurationOption("terrain_start_height_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); configMember.addConfigurationOption("terrain_start_height_1",
configMember.addConfigurationOption("terrain_start_height_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_2",
ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_start_height_3",
ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
configMember.addConfigurationOption("terrain_height_range_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); configMember.addConfigurationOption("terrain_height_range_0",
configMember.addConfigurationOption("terrain_height_range_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); configMember.addConfigurationOption("terrain_height_range_1",
configMember.addConfigurationOption("terrain_height_range_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_2",
ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_height_range_3",
ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", "default.r32", true); configMember.addConfigurationOption("terrain_file",
configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "",
configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", "20.0", true); "default.r32", true);
configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
"", "60.0", true);
configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "",
"20.0", true);
configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"", "00000000-0000-0000-0000-000000000000", true);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -615,119 +585,119 @@ namespace OpenSim.Framework
switch (configuration_key) switch (configuration_key)
{ {
case "billable_factor": case "billable_factor":
this.m_billableFactor = (float)configuration_result; m_billableFactor = (float) configuration_result;
break; break;
case "estate_id": case "estate_id":
this.m_estateID = (uint)configuration_result; m_estateID = (uint) configuration_result;
break; break;
case "parent_estate_id": case "parent_estate_id":
this.m_parentEstateID = (uint)configuration_result; m_parentEstateID = (uint) configuration_result;
break; break;
case "max_agents": case "max_agents":
this.m_maxAgents = (byte)configuration_result; m_maxAgents = (byte) configuration_result;
break; break;
case "object_bonus_factor": case "object_bonus_factor":
this.m_objectBonusFactor = (float)configuration_result; m_objectBonusFactor = (float) configuration_result;
break; break;
case "redirect_grid_x": case "redirect_grid_x":
this.m_redirectGridX = (int)configuration_result; m_redirectGridX = (int) configuration_result;
break; break;
case "redirect_grid_y": case "redirect_grid_y":
this.m_redirectGridY = (int)configuration_result; m_redirectGridY = (int) configuration_result;
break; break;
case "region_flags": case "region_flags":
this.m_regionFlags = (Simulator.RegionFlags)((uint)configuration_result); m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result);
break; break;
case "sim_access": case "sim_access":
this.m_simAccess = (Simulator.SimAccess)((byte)configuration_result); m_simAccess = (Simulator.SimAccess) ((byte) configuration_result);
break; break;
case "sun_hour": case "sun_hour":
this.m_sunHour = (float)configuration_result; m_sunHour = (float) configuration_result;
break; break;
case "terrain_raise_limit": case "terrain_raise_limit":
this.m_terrainRaiseLimit = (float)configuration_result; m_terrainRaiseLimit = (float) configuration_result;
break; break;
case "terrain_lower_limit": case "terrain_lower_limit":
this.m_terrainLowerLimit = (float)configuration_result; m_terrainLowerLimit = (float) configuration_result;
break; break;
case "use_fixed_sun": case "use_fixed_sun":
this.m_useFixedSun = (bool)configuration_result; m_useFixedSun = (bool) configuration_result;
break; break;
case "price_per_meter": case "price_per_meter":
this.m_pricePerMeter = System.Convert.ToInt32(configuration_result); m_pricePerMeter = Convert.ToInt32(configuration_result);
break; break;
case "region_water_height": case "region_water_height":
this.m_regionWaterHeight = (ushort)configuration_result; m_regionWaterHeight = (ushort) configuration_result;
break; break;
case "region_allow_terraform": case "region_allow_terraform":
this.m_regionAllowTerraform = (bool)configuration_result; m_regionAllowTerraform = (bool) configuration_result;
break; break;
case "terrain_base_0": case "terrain_base_0":
this.m_terrainBase0 = (LLUUID)configuration_result; m_terrainBase0 = (LLUUID) configuration_result;
break; break;
case "terrain_base_1": case "terrain_base_1":
this.m_terrainBase1 = (LLUUID)configuration_result; m_terrainBase1 = (LLUUID) configuration_result;
break; break;
case "terrain_base_2": case "terrain_base_2":
this.m_terrainBase2 = (LLUUID)configuration_result; m_terrainBase2 = (LLUUID) configuration_result;
break; break;
case "terrain_base_3": case "terrain_base_3":
this.m_terrainBase3 = (LLUUID)configuration_result; m_terrainBase3 = (LLUUID) configuration_result;
break; break;
case "terrain_detail_0": case "terrain_detail_0":
this.m_terrainDetail0 = (LLUUID)configuration_result; m_terrainDetail0 = (LLUUID) configuration_result;
break; break;
case "terrain_detail_1": case "terrain_detail_1":
this.m_terrainDetail1 = (LLUUID)configuration_result; m_terrainDetail1 = (LLUUID) configuration_result;
break; break;
case "terrain_detail_2": case "terrain_detail_2":
this.m_terrainDetail2 = (LLUUID)configuration_result; m_terrainDetail2 = (LLUUID) configuration_result;
break; break;
case "terrain_detail_3": case "terrain_detail_3":
this.m_terrainDetail3 = (LLUUID)configuration_result; m_terrainDetail3 = (LLUUID) configuration_result;
break; break;
case "terrain_start_height_0": case "terrain_start_height_0":
this.m_terrainStartHeight0 = (float)configuration_result; m_terrainStartHeight0 = (float) configuration_result;
break; break;
case "terrain_start_height_1": case "terrain_start_height_1":
this.m_terrainStartHeight1 = (float)configuration_result; m_terrainStartHeight1 = (float) configuration_result;
break; break;
case "terrain_start_height_2": case "terrain_start_height_2":
this.m_terrainStartHeight2 = (float)configuration_result; m_terrainStartHeight2 = (float) configuration_result;
break; break;
case "terrain_start_height_3": case "terrain_start_height_3":
this.m_terrainStartHeight3 = (float)configuration_result; m_terrainStartHeight3 = (float) configuration_result;
break; break;
case "terrain_height_range_0": case "terrain_height_range_0":
this.m_terrainHeightRange0 = (float)configuration_result; m_terrainHeightRange0 = (float) configuration_result;
break; break;
case "terrain_height_range_1": case "terrain_height_range_1":
this.m_terrainHeightRange1 = (float)configuration_result; m_terrainHeightRange1 = (float) configuration_result;
break; break;
case "terrain_height_range_2": case "terrain_height_range_2":
this.m_terrainHeightRange2 = (float)configuration_result; m_terrainHeightRange2 = (float) configuration_result;
break; break;
case "terrain_height_range_3": case "terrain_height_range_3":
this.m_terrainHeightRange3 = (float)configuration_result; m_terrainHeightRange3 = (float) configuration_result;
break; break;
case "terrain_file": case "terrain_file":
this.m_terrainFile = (string)configuration_result; m_terrainFile = (string) configuration_result;
break; break;
case "terrain_multiplier": case "terrain_multiplier":
this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result); m_terrainMultiplier = Convert.ToDouble(configuration_result);
break; break;
case "water_height": case "water_height":
double tmpVal = (double) configuration_result; double tmpVal = (double) configuration_result;
this.m_waterHeight = (float) tmpVal; m_waterHeight = (float) tmpVal;
break; break;
case "terrain_image_id": case "terrain_image_id":
this.m_terrainImageID = (LLUUID)configuration_result; m_terrainImageID = (LLUUID) configuration_result;
break; break;
} }

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class GridConfig public class GridConfig
@ -52,28 +48,47 @@ namespace OpenSim.Framework
public uint HttpPort = DefaultHttpPort; public uint HttpPort = DefaultHttpPort;
private ConfigurationMember configMember; private ConfigurationMember configMember;
public GridConfig(string description, string filename) public GridConfig(string description, string filename)
{ {
configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); configMember =
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
{ {
configMember.addConfigurationOption("grid_owner", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "OGS Grid Owner", "OGS development team", false); configMember.addConfigurationOption("grid_owner",
configMember.addConfigurationOption("default_asset_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Asset Server URI", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", false); ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to asset server", "null", false); "OGS Grid Owner", "OGS development team", false);
configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from asset server", "null", false); configMember.addConfigurationOption("default_asset_server",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Default Asset Server URI",
"http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/",
false);
configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Key to send to asset server", "null", false);
configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Key to expect from asset server", "null", false);
configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); configMember.addConfigurationOption("default_user_server",
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); "Default User Server URI",
"http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false);
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Key to send to user server", "null", false);
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Key to expect from user server", "null", false);
configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to a simulator", "null", false); configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from a simulator", "null", false); "Key to send to a simulator", "null", false);
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"Key to expect from a simulator", "null", false);
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
"Http Listener port", DefaultHttpPort.ToString(), false);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@ -81,37 +96,37 @@ namespace OpenSim.Framework
switch (configuration_key) switch (configuration_key)
{ {
case "grid_owner": case "grid_owner":
this.GridOwner = (string)configuration_result; GridOwner = (string) configuration_result;
break; break;
case "default_asset_server": case "default_asset_server":
this.DefaultAssetServer = (string)configuration_result; DefaultAssetServer = (string) configuration_result;
break; break;
case "asset_send_key": case "asset_send_key":
this.AssetSendKey = (string)configuration_result; AssetSendKey = (string) configuration_result;
break; break;
case "asset_recv_key": case "asset_recv_key":
this.AssetRecvKey = (string)configuration_result; AssetRecvKey = (string) configuration_result;
break; break;
case "default_user_server": case "default_user_server":
this.DefaultUserServer = (string)configuration_result; DefaultUserServer = (string) configuration_result;
break; break;
case "user_send_key": case "user_send_key":
this.UserSendKey = (string)configuration_result; UserSendKey = (string) configuration_result;
break; break;
case "user_recv_key": case "user_recv_key":
this.UserRecvKey = (string)configuration_result; UserRecvKey = (string) configuration_result;
break; break;
case "sim_send_key": case "sim_send_key":
this.SimSendKey = (string)configuration_result; SimSendKey = (string) configuration_result;
break; break;
case "sim_recv_key": case "sim_recv_key":
this.SimRecvKey = (string)configuration_result; SimRecvKey = (string) configuration_result;
break; break;
case "database_provider": case "database_provider":
this.DatabaseProvider = (string)configuration_result; DatabaseProvider = (string) configuration_result;
break; break;
case "http_port": case "http_port":
HttpPort = (uint)configuration_result; HttpPort = (uint) configuration_result;
break; break;
} }

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework;
using libsecondlife; using libsecondlife;
namespace OpenSim.Framework namespace OpenSim.Framework

View File

@ -28,14 +28,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
/// <summary> /// <summary>
/// Description of IAssetServer. /// Description of IAssetServer.
/// </summary> /// </summary>
public interface IAssetServer public interface IAssetServer
{ {
void SetReceiver(IAssetReceiver receiver); void SetReceiver(IAssetReceiver receiver);

View File

@ -30,31 +30,28 @@ using System.Collections.Generic;
using System.Net; using System.Net;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
// Base Args Interface // Base Args Interface
public interface IEventArgs public interface IEventArgs
{ {
IScene Scene IScene Scene { get; set; }
{
get;
set;
}
IClientAPI Sender IClientAPI Sender { get; set; }
{
get;
set;
}
} }
public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e);
public enum ChatTypeEnum { Whisper = 0, Say = 1, Shout = 2, Broadcast = 0xFF }; public enum ChatTypeEnum
{
Whisper = 0,
Say = 1,
Shout = 2,
Broadcast = 0xFF
} ;
/// <summary> /// <summary>
/// ChatFromViewer Arguments /// ChatFromViewer Arguments
@ -163,68 +160,127 @@ namespace OpenSim.Framework
public delegate void TextureRequest(Object sender, TextureRequestArgs e); public delegate void TextureRequest(Object sender, TextureRequestArgs e);
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list public delegate void ImprovedInstantMessage(
LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp,
string fromAgentName, string message, byte dialog); // Cut down from full list
public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
public delegate void ModifyTerrain(
float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq);
public delegate void LinkObjects(uint parent, List<uint> children); public delegate void LinkObjects(uint parent, List<uint> children);
public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY);
public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
public delegate void TeleportLocationRequest(
IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
public delegate void DisconnectUser(); public delegate void DisconnectUser();
public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
public delegate void GenericCall(IClientAPI remoteClient); public delegate void GenericCall(IClientAPI remoteClient);
public delegate void GenericCall2(); public delegate void GenericCall2();
public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary.
public delegate void GenericCall3(Packet packet);
// really don't want to be passing packets in these events, so this is very temporary.
public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
public delegate void GenericCall5(IClientAPI remoteClient, bool status); public delegate void GenericCall5(IClientAPI remoteClient, bool status);
public delegate void GenericCall6(LLUUID uid); public delegate void GenericCall6(LLUUID uid);
public delegate void GenericCall7(uint localID, string message); public delegate void GenericCall7(uint localID, string message);
public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data);
public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags);
public delegate void StatusChange(bool status); public delegate void StatusChange(bool status);
public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID);
public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
public delegate void ParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); public delegate void ParcelPropertiesRequest(
int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client);
public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); public delegate void CreateInventoryFolder(
public delegate void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
public delegate void CreateNewInventoryItem(
IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name,
sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask);
public delegate void FetchInventoryDescendents(
IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID);
public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID);
public delegate void UpdateInventoryItemTransaction(
IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID);
public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); public delegate void UDPAssetUploadRequest(
IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal);
public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName);
public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
public interface IClientAPI public interface IClientAPI
@ -298,37 +354,17 @@ namespace OpenSim.Framework
event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
event EstateOwnerMessageRequest OnEstateOwnerMessage; event EstateOwnerMessageRequest OnEstateOwnerMessage;
LLVector3 StartPos LLVector3 StartPos { get; set; }
{
get;
set;
}
LLUUID AgentId LLUUID AgentId { get; }
{
get;
}
LLUUID SessionId LLUUID SessionId { get; }
{
get;
}
string FirstName string FirstName { get; }
{
get;
}
string LastName string LastName { get; }
{
get;
}
uint CircuitCode uint CircuitCode { get; set; }
{
get;
set;
}
void OutPacket(Packet newPack); void OutPacket(Packet newPack);
void SendWearables(AvatarWearable[] wearables); void SendWearables(AvatarWearable[] wearables);
@ -339,27 +375,45 @@ namespace OpenSim.Framework
void SendRegionHandshake(RegionInfo regionInfo); void SendRegionHandshake(RegionInfo regionInfo);
void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp);
void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp);
void SendLayerData(float[] map); void SendLayerData(float[] map);
void SendLayerData(int px, int py, float[] map); void SendLayerData(int px, int py, float[] map);
void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint ); void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
AgentCircuitData RequestClientInfo(); AgentCircuitData RequestClientInfo();
void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL );
void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint,
string capsURL);
void SendMapBlock(List<MapBlockData> mapBlocks); void SendMapBlock(List<MapBlockData> mapBlocks);
void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags);
void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL);
void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID,
uint flags, string capsURL);
void SendTeleportCancel(); void SendTeleportCancel();
void SendTeleportLocationStart(); void SendTeleportLocationStart();
void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID); void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID,
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); LLVector3 Pos, byte[] textureEntry, uint parentID);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLVector3 velocity, LLQuaternion rotation);
void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem, LLQuaternion rotation);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text,
uint parentID, byte[] particleSystem, LLQuaternion rotation);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLQuaternion rotation);
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
@ -375,10 +429,13 @@ namespace OpenSim.Framework
void SendAlertMessage(string message); void SendAlertMessage(string message);
void SendAgentAlertMessage(string message, bool modal); void SendAgentAlertMessage(string message, bool modal);
void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
bool AddMoney( int debit ); bool AddMoney(int debit);
void SendViewerTime(int phase); void SendViewerTime(int phase);
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
void SetDebug(int newDebug); void SetDebug(int newDebug);
void InPacket(Packet NewPack); void InPacket(Packet NewPack);
void Close(); void Close();

View File

@ -26,10 +26,6 @@
* *
*/ */
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
/// <summary> /// <summary>

View File

@ -27,14 +27,15 @@
*/ */
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
public delegate void UpdateNeighbours(List<RegionInfo> neighbours); public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
public interface IRegionCommsListener public interface IRegionCommsListener

View File

@ -26,7 +26,6 @@
* *
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -39,9 +38,6 @@ namespace OpenSim.Framework
object SyncRoot { get; } object SyncRoot { get; }
uint NextLocalId { get; } uint NextLocalId { get; }
ClientManager ClientManager ClientManager ClientManager { get; }
{
get;
}
} }
} }

View File

@ -26,7 +26,6 @@
* *
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {

View File

@ -26,7 +26,6 @@
* *
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
namespace OpenSim.Framework.Interfaces namespace OpenSim.Framework.Interfaces
{ {

View File

@ -39,50 +39,62 @@ namespace OpenSim.Framework
/// A UUID containing the ID for the inventory item itself /// A UUID containing the ID for the inventory item itself
/// </summary> /// </summary>
public LLUUID inventoryID; public LLUUID inventoryID;
/// <summary> /// <summary>
/// The UUID of the associated asset on the asset server /// The UUID of the associated asset on the asset server
/// </summary> /// </summary>
public LLUUID assetID; public LLUUID assetID;
/// <summary> /// <summary>
/// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
/// </summary> /// </summary>
public int assetType; public int assetType;
/// <summary> /// <summary>
/// The type of inventory item. (Can be slightly different to the asset type /// The type of inventory item. (Can be slightly different to the asset type
/// </summary> /// </summary>
public int invType; public int invType;
/// <summary> /// <summary>
/// The folder this item is contained in /// The folder this item is contained in
/// </summary> /// </summary>
public LLUUID parentFolderID; public LLUUID parentFolderID;
/// <summary> /// <summary>
/// The owner of this inventory item /// The owner of this inventory item
/// </summary> /// </summary>
public LLUUID avatarID; public LLUUID avatarID;
/// <summary> /// <summary>
/// The creator of this item /// The creator of this item
/// </summary> /// </summary>
public LLUUID creatorsID; public LLUUID creatorsID;
/// <summary> /// <summary>
/// The name of the inventory item (must be less than 64 characters) /// The name of the inventory item (must be less than 64 characters)
/// </summary> /// </summary>
public string inventoryName; public string inventoryName;
/// <summary> /// <summary>
/// The description of the inventory item (must be less than 64 characters) /// The description of the inventory item (must be less than 64 characters)
/// </summary> /// </summary>
public string inventoryDescription; public string inventoryDescription;
/// <summary> /// <summary>
/// A mask containing the permissions for the next owner (cannot be enforced) /// A mask containing the permissions for the next owner (cannot be enforced)
/// </summary> /// </summary>
public uint inventoryNextPermissions; public uint inventoryNextPermissions;
/// <summary> /// <summary>
/// A mask containing permissions for the current owner (cannot be enforced) /// A mask containing permissions for the current owner (cannot be enforced)
/// </summary> /// </summary>
public uint inventoryCurrentPermissions; public uint inventoryCurrentPermissions;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public uint inventoryBasePermissions; public uint inventoryBasePermissions;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -98,22 +110,27 @@ namespace OpenSim.Framework
/// The name of the folder (64 characters or less) /// The name of the folder (64 characters or less)
/// </summary> /// </summary>
public string name; public string name;
/// <summary> /// <summary>
/// The agent who's inventory this is contained by /// The agent who's inventory this is contained by
/// </summary> /// </summary>
public LLUUID agentID; public LLUUID agentID;
/// <summary> /// <summary>
/// The folder this folder is contained in /// The folder this folder is contained in
/// </summary> /// </summary>
public LLUUID parentID; public LLUUID parentID;
/// <summary> /// <summary>
/// The UUID for this folder /// The UUID for this folder
/// </summary> /// </summary>
public LLUUID folderID; public LLUUID folderID;
/// <summary> /// <summary>
/// Tyep of Items normally stored in this folder /// Tyep of Items normally stored in this folder
/// </summary> /// </summary>
public short type; public short type;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -29,7 +29,6 @@ using libsecondlife;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class LandData public class LandData
{ {
public byte[] landBitmapByteArray = new byte[512]; public byte[] landBitmapByteArray = new byte[512];
@ -54,7 +53,13 @@ namespace OpenSim.Framework
public int simwideArea = 0; public int simwideArea = 0;
public int salePrice = 0; //Unemeplemented. Parcels price. public int salePrice = 0; //Unemeplemented. Parcels price.
public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased;
public uint landFlags = (uint)Parcel.ParcelFlags.AllowFly | (uint)Parcel.ParcelFlags.AllowLandmark | (uint)Parcel.ParcelFlags.AllowAllObjectEntry | (uint)Parcel.ParcelFlags.AllowDeedToGroup | (uint)Parcel.ParcelFlags.AllowTerraform | (uint)Parcel.ParcelFlags.CreateObjects | (uint)Parcel.ParcelFlags.AllowOtherScripts | (uint)Parcel.ParcelFlags.SoundLocal ;
public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark |
(uint) Parcel.ParcelFlags.AllowAllObjectEntry |
(uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform |
(uint) Parcel.ParcelFlags.CreateObjects | (uint) Parcel.ParcelFlags.AllowOtherScripts |
(uint) Parcel.ParcelFlags.SoundLocal;
public byte landingType = 0; public byte landingType = 0;
public byte mediaAutoScale = 0; public byte mediaAutoScale = 0;
public LLUUID mediaID = LLUUID.Zero; public LLUUID mediaID = LLUUID.Zero;
@ -78,43 +83,41 @@ namespace OpenSim.Framework
{ {
LandData landData = new LandData(); LandData landData = new LandData();
landData.AABBMax = this.AABBMax; landData.AABBMax = AABBMax;
landData.AABBMin = this.AABBMin; landData.AABBMin = AABBMin;
landData.area = this.area; landData.area = area;
landData.auctionID = this.auctionID; landData.auctionID = auctionID;
landData.authBuyerID = this.authBuyerID; landData.authBuyerID = authBuyerID;
landData.category = this.category; landData.category = category;
landData.claimDate = this.claimDate; landData.claimDate = claimDate;
landData.claimPrice = this.claimPrice; landData.claimPrice = claimPrice;
landData.globalID = this.globalID; landData.globalID = globalID;
landData.groupID = this.groupID; landData.groupID = groupID;
landData.groupPrims = this.groupPrims; landData.groupPrims = groupPrims;
landData.otherPrims = this.otherPrims; landData.otherPrims = otherPrims;
landData.ownerPrims = this.ownerPrims; landData.ownerPrims = ownerPrims;
landData.selectedPrims = this.selectedPrims; landData.selectedPrims = selectedPrims;
landData.isGroupOwned = this.isGroupOwned; landData.isGroupOwned = isGroupOwned;
landData.localID = this.localID; landData.localID = localID;
landData.landingType = this.landingType; landData.landingType = landingType;
landData.mediaAutoScale = this.mediaAutoScale; landData.mediaAutoScale = mediaAutoScale;
landData.mediaID = this.mediaID; landData.mediaID = mediaID;
landData.mediaURL = this.mediaURL; landData.mediaURL = mediaURL;
landData.musicURL = this.musicURL; landData.musicURL = musicURL;
landData.ownerID = this.ownerID; landData.ownerID = ownerID;
landData.landBitmapByteArray = (byte[])this.landBitmapByteArray.Clone(); landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone();
landData.landDesc = this.landDesc; landData.landDesc = landDesc;
landData.landFlags = this.landFlags; landData.landFlags = landFlags;
landData.landName = this.landName; landData.landName = landName;
landData.landStatus = this.landStatus; landData.landStatus = landStatus;
landData.passHours = this.passHours; landData.passHours = passHours;
landData.passPrice = this.passPrice; landData.passPrice = passPrice;
landData.salePrice = this.salePrice; landData.salePrice = salePrice;
landData.snapshotID = this.snapshotID; landData.snapshotID = snapshotID;
landData.userLocation = this.userLocation; landData.userLocation = userLocation;
landData.userLookAt = this.userLookAt; landData.userLookAt = userLookAt;
return landData; return landData;
} }
} }
} }

View File

@ -39,7 +39,7 @@ namespace OpenSim.Framework
public LLUUID InventoryFolder; public LLUUID InventoryFolder;
public LLUUID BaseFolder; public LLUUID BaseFolder;
public uint CircuitCode; public uint CircuitCode;
public string CapsPath =""; public string CapsPath = "";
public LLVector3 StartPos; public LLVector3 StartPos;
public Login() public Login()

View File

@ -45,7 +45,6 @@ namespace OpenSim.Framework
public MapBlockData() public MapBlockData()
{ {
} }
} }
} }

View File

@ -25,12 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System;
using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework;
using Nini.Config; using Nini.Config;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class NetworkServersInfo public class NetworkServersInfo
@ -63,12 +60,14 @@ namespace OpenSim.Framework
} }
private uint? m_defaultHomeLocX; private uint? m_defaultHomeLocX;
public uint DefaultHomeLocX public uint DefaultHomeLocX
{ {
get { return m_defaultHomeLocX.Value; } get { return m_defaultHomeLocX.Value; }
} }
private uint? m_defaultHomeLocY; private uint? m_defaultHomeLocY;
public uint DefaultHomeLocY public uint DefaultHomeLocY
{ {
get { return m_defaultHomeLocY.Value; } get { return m_defaultHomeLocY.Value; }
@ -76,19 +75,22 @@ namespace OpenSim.Framework
public void loadFromConfiguration(IConfigSource config) public void loadFromConfiguration(IConfigSource config)
{ {
m_defaultHomeLocX = (uint)config.Configs["StandAlone"].GetInt("default_location_x", 1000); m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000);
m_defaultHomeLocY = (uint)config.Configs["StandAlone"].GetInt("default_location_y", 1000); m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000);
HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort);
RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort);
GridURL = config.Configs["Network"].GetString("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); GridURL =
config.Configs["Network"].GetString("grid_server_url",
"http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString());
GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null");
GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null");
UserURL = config.Configs["Network"].GetString("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); UserURL =
config.Configs["Network"].GetString("user_server_url",
"http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString());
UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More