From 67e12b95ea7b68f4904a7484d77ecfd787d16d0c Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 30 Oct 2007 09:05:31 +0000 Subject: * Optimized usings * Shortened type references * Removed redundant 'this' qualifier --- OpenSim/Framework/Communications/CAPSService.cs | 6 +- .../Framework/Communications/Cache/AssetCache.cs | 207 ++++--- .../Framework/Communications/Cache/AssetServer.cs | 24 +- .../Communications/Cache/AssetServerBase.cs | 26 +- .../Cache/AssetTransactionManager.cs | 37 +- .../Communications/Cache/AssetTransactions.cs | 199 +++---- .../Communications/Cache/CachedUserInfo.cs | 37 +- .../Communications/Cache/GridAssetClient.cs | 21 +- .../Communications/Cache/InventoryFolder.cs | 41 +- .../Communications/Cache/LibraryRootFolder.cs | 82 ++- .../Communications/Cache/SQLAssetServer.cs | 21 +- .../Communications/Cache/UserProfileCache.cs | 72 ++- .../Framework/Communications/Capabilities/Caps.cs | 136 +++-- .../Communications/Capabilities/LLSDArray.cs | 3 +- .../Capabilities/LLSDAssetUploadComplete.cs | 3 +- .../Capabilities/LLSDAssetUploadRequest.cs | 5 +- .../Capabilities/LLSDAssetUploadResponse.cs | 7 +- .../Communications/Capabilities/LLSDCapEvent.cs | 3 +- .../Communications/Capabilities/LLSDCapsDetails.cs | 12 +- .../Communications/Capabilities/LLSDEmpty.cs | 3 +- .../Communications/Capabilities/LLSDHelpers.cs | 32 +- .../Communications/Capabilities/LLSDItemUpdate.cs | 5 +- .../Communications/Capabilities/LLSDMapLayer.cs | 3 +- .../Capabilities/LLSDMapLayerResponse.cs | 3 +- .../Communications/Capabilities/LLSDMapRequest.cs | 3 +- .../Communications/Capabilities/LLSDMethod.cs | 6 +- .../Capabilities/LLSDStreamHandler.cs | 19 +- .../Communications/Capabilities/LLSDTest.cs | 3 +- .../Communications/Capabilities/LLSDType.cs | 10 +- .../Communications/CommunicationsManager.cs | 20 +- OpenSim/Framework/Communications/IGridServices.cs | 6 +- .../Communications/IInterRegionCommunications.cs | 3 +- .../Framework/Communications/IInventoryServices.cs | 6 +- .../Communications/InventoryServiceBase.cs | 19 +- OpenSim/Framework/Communications/LoginResponse.cs | 594 ++++++++------------- OpenSim/Framework/Communications/LoginService.cs | 53 +- .../Communications/Properties/AssemblyInfo.cs | 31 +- .../RestClient/GenericAsyncResult.cs | 37 +- .../Communications/RestClient/RestClient.cs | 64 ++- .../Framework/Communications/UserManagerBase.cs | 49 +- .../Configuration/HTTP/HTTPConfiguration.cs | 26 +- .../Configuration/HTTP/RemoteConfigSettings.cs | 20 +- .../Configuration/XML/XmlConfiguration.cs | 16 +- OpenSim/Framework/Console/AssemblyInfo.cs | 22 +- OpenSim/Framework/Console/ConsoleCallbacksBase.cs | 4 +- OpenSim/Framework/Console/LogBase.cs | 31 +- OpenSim/Framework/Console/MainLog.cs | 11 +- OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 17 +- OpenSim/Framework/Data.DB4o/DB4oManager.cs | 21 +- OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 24 +- .../Framework/Data.DB4o/Properties/AssemblyInfo.cs | 31 +- OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs | 4 +- OpenSim/Framework/Data.MSSQL/MSSQLManager.cs | 68 +-- .../Data.MSSQL/Properties/AssemblyInfo.cs | 31 +- OpenSim/Framework/Data.MySQL/MySQLAssetData.cs | 43 +- OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 21 +- OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 117 ++-- OpenSim/Framework/Data.MySQL/MySQLLogData.cs | 13 +- OpenSim/Framework/Data.MySQL/MySQLManager.cs | 329 ++++++------ OpenSim/Framework/Data.MySQL/MySQLUserData.cs | 52 +- .../Data.MySQL/Properties/AssemblyInfo.cs | 31 +- .../Data.SQLite/Properties/AssemblyInfo.cs | 31 +- OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs | 125 +++-- OpenSim/Framework/Data.SQLite/SQLiteBase.cs | 102 ++-- OpenSim/Framework/Data.SQLite/SQLiteGridData.cs | 2 +- .../Framework/Data.SQLite/SQLiteInventoryStore.cs | 189 +++---- OpenSim/Framework/Data.SQLite/SQLiteManager.cs | 132 ++--- OpenSim/Framework/Data.SQLite/SQLiteUserData.cs | 261 ++++----- OpenSim/Framework/Data/GridData.cs | 3 +- OpenSim/Framework/Data/ILogData.cs | 7 +- OpenSim/Framework/Data/IniConfig.cs | 22 +- OpenSim/Framework/Data/Properties/AssemblyInfo.cs | 31 +- OpenSim/Framework/Data/RegionProfileData.cs | 63 ++- OpenSim/Framework/Data/ReservationData.cs | 4 +- OpenSim/Framework/General/ACL.cs | 22 +- OpenSim/Framework/General/AgentCircuitManager.cs | 35 +- OpenSim/Framework/General/AgentCiruitData.cs | 11 +- OpenSim/Framework/General/AgentInventory.cs | 71 ++- OpenSim/Framework/General/AgentWearable.cs | 5 +- OpenSim/Framework/General/AssetBase.cs | 3 +- OpenSim/Framework/General/AssetConfig.cs | 26 +- OpenSim/Framework/General/AssetLandmark.cs | 16 +- OpenSim/Framework/General/AssetStorage.cs | 29 +- OpenSim/Framework/General/AuthenticateResponse.cs | 6 +- OpenSim/Framework/General/BlockingQueue.cs | 2 +- OpenSim/Framework/General/ClientManager.cs | 22 +- OpenSim/Framework/General/ConfigurationMember.cs | 110 ++-- OpenSim/Framework/General/ConfigurationOption.cs | 10 +- OpenSim/Framework/General/Culture.cs | 16 +- OpenSim/Framework/General/EstateSettings.cs | 428 +++++++-------- OpenSim/Framework/General/GridConfig.cs | 73 ++- OpenSim/Framework/General/IAssetProvider.cs | 8 +- OpenSim/Framework/General/IAssetServer.cs | 4 +- OpenSim/Framework/General/IClientAPI.cs | 179 ++++--- OpenSim/Framework/General/IGenericConfig.cs | 2 +- OpenSim/Framework/General/IPlugin.cs | 6 +- OpenSim/Framework/General/IRegionCommsListener.cs | 7 +- OpenSim/Framework/General/IScene.cs | 10 +- OpenSim/Framework/General/IUserData.cs | 3 +- OpenSim/Framework/General/IUserService.cs | 1 - OpenSim/Framework/General/InventoryItemBase.cs | 19 +- OpenSim/Framework/General/LandData.cs | 169 +++--- OpenSim/Framework/General/Login.cs | 4 +- OpenSim/Framework/General/MapBlockData.cs | 3 +- OpenSim/Framework/General/NeighbourInfo.cs | 2 +- OpenSim/Framework/General/NetworkServersInfo.cs | 22 +- OpenSim/Framework/General/PrimitiveBaseShape.cs | 42 +- .../Framework/General/Properties/AssemblyInfo.cs | 31 +- OpenSim/Framework/General/RegionCommsListener.cs | 16 +- OpenSim/Framework/General/RegionHandle.cs | 33 +- OpenSim/Framework/General/RegionInfo.cs | 187 +++---- OpenSim/Framework/General/Remoting.cs | 9 +- OpenSim/Framework/General/UUID.cs | 6 +- OpenSim/Framework/General/UserConfig.cs | 43 +- OpenSim/Framework/General/UserProfileData.cs | 31 +- OpenSim/Framework/General/Util.cs | 61 +-- OpenSim/Framework/Servers/BaseHttpServer.cs | 34 +- OpenSim/Framework/Servers/BaseStreamHandler.cs | 21 +- OpenSim/Framework/Servers/BinaryStreamHandler.cs | 17 +- OpenSim/Framework/Servers/CheckSumServer.cs | 4 +- OpenSim/Framework/Servers/IStreamHandler.cs | 13 +- OpenSim/Framework/Servers/RestMethod.cs | 4 +- OpenSim/Framework/Servers/RestStreamHandler.cs | 14 +- OpenSim/Framework/Servers/UDPServerBase.cs | 11 +- OpenSim/Framework/Servers/XmlRpcMethod.cs | 4 +- 125 files changed, 2840 insertions(+), 2880 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs index b60ef02..40f4006 100644 --- a/OpenSim/Framework/Communications/CAPSService.cs +++ b/OpenSim/Framework/Communications/CAPSService.cs @@ -37,17 +37,17 @@ namespace OpenSim.Framework.Communications public CAPSService(BaseHttpServer httpServer) { m_server = httpServer; - this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); + AddCapsSeedHandler("/CapsSeed/", CapsRequest); } private void AddCapsSeedHandler(string path, RestMethod restMethod) { - m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); + m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); } public string CapsRequest(string request, string path, string param) { - System.Console.WriteLine("new caps request " + request +" from path "+ path); + System.Console.WriteLine("new caps request " + request + " from path " + path); return ""; } } diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 39e2887..ca2fc35 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -29,12 +29,9 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Threading; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; using OpenSim.Framework.Console; namespace OpenSim.Framework.Communications.Cache @@ -51,18 +48,22 @@ namespace OpenSim.Framework.Communications.Cache public Dictionary Assets; public Dictionary Textures; - public List AssetRequests = new List(); //assets ready to be sent to viewers + public List AssetRequests = new List(); //assets ready to be sent to viewers public List TextureRequests = new List(); //textures ready to be sent - public Dictionary RequestedAssets = new Dictionary(); //Assets requested from the asset server - public Dictionary RequestedTextures = new Dictionary(); //Textures requested from the asset server + public Dictionary RequestedAssets = new Dictionary(); + //Assets requested from the asset server + + public Dictionary RequestedTextures = new Dictionary(); + //Textures requested from the asset server public Dictionary SendingTextures = new Dictionary(); private BlockingQueue QueueTextures = new BlockingQueue(); private Dictionary> AvatarRecievedTextures = new Dictionary>(); - private Dictionary> TimesTextureSent = new Dictionary>(); + private Dictionary> TimesTextureSent = + new Dictionary>(); public Dictionary RequestLists = new Dictionary(); @@ -76,19 +77,18 @@ namespace OpenSim.Framework.Communications.Cache /// public AssetCache(IAssetServer assetServer) { - OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache"); + MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache"); _assetServer = assetServer; _assetServer.SetReceiver(this); Assets = new Dictionary(); Textures = new Dictionary(); - this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); - this._assetCacheThread.IsBackground = true; - this._assetCacheThread.Start(); - - this.TextureSenderThread = new Thread(new ThreadStart(this.ProcessTextureSenders)); - this.TextureSenderThread.IsBackground = true; - this.TextureSenderThread.Start(); + _assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); + _assetCacheThread.IsBackground = true; + _assetCacheThread.Start(); + TextureSenderThread = new Thread(new ThreadStart(ProcessTextureSenders)); + TextureSenderThread.IsBackground = true; + TextureSenderThread.Start(); } /// @@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications.Cache { try { - this.ProcessAssetQueue(); - this.ProcessTextureQueue(); + ProcessAssetQueue(); + ProcessTextureQueue(); Thread.Sleep(500); } catch (Exception e) @@ -115,13 +115,13 @@ namespace OpenSim.Framework.Communications.Cache public AssetBase GetAsset(LLUUID assetID) { 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; } @@ -129,13 +129,13 @@ namespace OpenSim.Framework.Communications.Cache public void GetAsset(LLUUID assetID, AssetRequestCallback callback) { 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) @@ -145,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache else { NewAssetRequest req = new NewAssetRequest(assetID, callback); - if (this.RequestLists.ContainsKey(assetID)) + if (RequestLists.ContainsKey(assetID)) { lock (RequestLists) { @@ -161,7 +161,7 @@ namespace OpenSim.Framework.Communications.Cache RequestLists.Add(assetID, reqList); } } - this._assetServer.FetchAsset(assetID, false); + _assetServer.FetchAsset(assetID, false); } } @@ -171,22 +171,23 @@ namespace OpenSim.Framework.Communications.Cache AssetBase asset = GetAsset(assetID); if (asset == null) { - this._assetServer.FetchAsset(assetID, isTexture); + _assetServer.FetchAsset(assetID, isTexture); } return asset; } public void AddAsset(AssetBase asset) { - //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); + //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); if (asset.Type == 0) { //Console.WriteLine("which is a texture"); if (!Textures.ContainsKey(asset.FullID)) - { //texture + { + //texture TextureImage textur = new TextureImage(asset); Textures.Add(textur.FullID, textur); - if(!asset.Temporary) + if (!asset.Temporary) _assetServer.StoreAndCommitAsset(asset); } else @@ -219,49 +220,47 @@ namespace OpenSim.Framework.Communications.Cache /// private void ProcessTextureQueue() { - if (this.TextureRequests.Count == 0) + if (TextureRequests.Count == 0) { //no requests waiting return; } int num; - num = this.TextureRequests.Count; + num = TextureRequests.Count; AssetRequest req; for (int i = 0; i < num; i++) { - req = (AssetRequest)this.TextureRequests[i]; - if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) + req = (AssetRequest) TextureRequests[i]; + if (!SendingTextures.ContainsKey(req.ImageInfo.FullID)) { //Console.WriteLine("new texture to send"); TextureSender sender = new TextureSender(req); //sender.OnComplete += this.TextureSent; - this.SendingTextures.Add(req.ImageInfo.FullID, sender); - this.QueueTextures.Enqueue(sender); + SendingTextures.Add(req.ImageInfo.FullID, sender); + QueueTextures.Enqueue(sender); } - } - this.TextureRequests.Clear(); + TextureRequests.Clear(); } public void ProcessTextureSenders() { while (true) { - TextureSender sender = this.QueueTextures.Dequeue(); - + TextureSender sender = QueueTextures.Dequeue(); + bool finished = sender.SendTexture(); if (finished) { - this.TextureSent(sender); + TextureSent(sender); } else { // Console.WriteLine("readding texture"); - this.QueueTextures.Enqueue(sender); + QueueTextures.Enqueue(sender); } - } } @@ -271,16 +270,16 @@ namespace OpenSim.Framework.Communications.Cache /// 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); } } public void AssetReceived(AssetBase asset, bool IsTexture) { - if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server + if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server { //check if it is a texture or not //then add to the correct cache list @@ -292,48 +291,48 @@ namespace OpenSim.Framework.Communications.Cache //Console.WriteLine("asset recieved from asset server"); TextureImage image = new TextureImage(asset); - if (!this.Textures.ContainsKey(image.FullID)) + if (!Textures.ContainsKey(image.FullID)) { - this.Textures.Add(image.FullID, image); - if (this.RequestedTextures.ContainsKey(image.FullID)) + Textures.Add(image.FullID, image); + if (RequestedTextures.ContainsKey(image.FullID)) { - AssetRequest req = this.RequestedTextures[image.FullID]; + AssetRequest req = RequestedTextures[image.FullID]; req.ImageInfo = image; if (image.Data.LongLength > 600) { //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 { req.NumPackets = 1; } - this.RequestedTextures.Remove(image.FullID); - this.TextureRequests.Add(req); + RequestedTextures.Remove(image.FullID); + TextureRequests.Add(req); } } } else { AssetInfo assetInf = new AssetInfo(asset); - if (!this.Assets.ContainsKey(assetInf.FullID)) + if (!Assets.ContainsKey(assetInf.FullID)) { - this.Assets.Add(assetInf.FullID, assetInf); - if (this.RequestedAssets.ContainsKey(assetInf.FullID)) + Assets.Add(assetInf.FullID, assetInf); + if (RequestedAssets.ContainsKey(assetInf.FullID)) { - AssetRequest req = this.RequestedAssets[assetInf.FullID]; + AssetRequest req = RequestedAssets[assetInf.FullID]; req.AssetInf = assetInf; if (assetInf.Data.LongLength > 600) { //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 { req.NumPackets = 1; } - this.RequestedAssets.Remove(assetInf.FullID); - this.AssetRequests.Add(req); + RequestedAssets.Remove(assetInf.FullID); + AssetRequests.Add(req); } } } @@ -345,7 +344,7 @@ namespace OpenSim.Framework.Communications.Cache { req.Callback(asset.FullID, asset); } - + lock (RequestLists) { RequestLists.Remove(asset.FullID); @@ -373,6 +372,7 @@ namespace OpenSim.Framework.Communications.Cache } #region Assets + /// /// /// @@ -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. //Console.WriteLine("asset request " + requestID); - if (!this.Assets.ContainsKey(requestID)) + if (!Assets.ContainsKey(requestID)) { //not found asset // so request from asset server - if (!this.RequestedAssets.ContainsKey(requestID)) + if (!RequestedAssets.ContainsKey(requestID)) { AssetRequest request = new AssetRequest(); request.RequestUser = userInfo; @@ -408,13 +408,13 @@ namespace OpenSim.Framework.Communications.Cache request.TransferRequestID = transferRequest.TransferInfo.TransferID; request.AssetRequestSource = source; request.Params = transferRequest.TransferInfo.Params; - this.RequestedAssets.Add(requestID, request); - this._assetServer.FetchAsset(requestID, false); + RequestedAssets.Add(requestID, request); + _assetServer.FetchAsset(requestID, false); } return; } //it is in our cache - AssetInfo asset = this.Assets[requestID]; + AssetInfo asset = Assets[requestID]; //work out how many packets it should be sent in // and add to the AssetRequests list @@ -429,14 +429,14 @@ namespace OpenSim.Framework.Communications.Cache if (asset.Data.LongLength > 600) { //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 { req.NumPackets = 1; } - this.AssetRequests.Add(req); + AssetRequests.Add(req); } /// @@ -444,17 +444,17 @@ namespace OpenSim.Framework.Communications.Cache /// private void ProcessAssetQueue() { - if (this.AssetRequests.Count == 0) + if (AssetRequests.Count == 0) { //no requests waiting return; } int num; - if (this.AssetRequests.Count < 5) + if (AssetRequests.Count < 5) { //lower than 5 so do all of them - num = this.AssetRequests.Count; + num = AssetRequests.Count; } else { @@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Cache AssetRequest req; for (int i = 0; i < num; i++) { - req = (AssetRequest)this.AssetRequests[i]; + req = (AssetRequest) AssetRequests[i]; //Console.WriteLine("sending asset " + req.RequestAssetID); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; @@ -473,7 +473,7 @@ namespace OpenSim.Framework.Communications.Cache { Transfer.TransferInfo.Params = new byte[20]; 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); } 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.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; req.RequestUser.OutPacket(Transfer); @@ -533,19 +533,19 @@ namespace OpenSim.Framework.Communications.Cache req.RequestUser.OutPacket(TransferPacket); } } - } //remove requests that have been completed for (int i = 0; i < num; i++) { - this.AssetRequests.RemoveAt(0); + AssetRequests.RemoveAt(0); } - } + #endregion #region Textures + /// /// /// @@ -553,21 +553,21 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard) { - // 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 - if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) + if (!AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) { - this.AvatarRecievedTextures.Add(userInfo.AgentId, new List()); + AvatarRecievedTextures.Add(userInfo.AgentId, new List()); } /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) { //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); 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 AssetRequest request = new AssetRequest(); @@ -575,14 +575,14 @@ namespace OpenSim.Framework.Communications.Cache request.RequestAssetID = imageID; request.IsTextureRequest = true; request.DiscardLevel = discard; - this.RequestedTextures.Add(imageID, request); - this._assetServer.FetchAsset(imageID, true); + RequestedTextures.Add(imageID, request); + _assetServer.FetchAsset(imageID, true); } return; } - // System.Console.WriteLine("texture already in cache"); - TextureImage imag = this.Textures[imageID]; + // System.Console.WriteLine("texture already in cache"); + TextureImage imag = Textures[imageID]; AssetRequest req = new AssetRequest(); req.RequestUser = userInfo; req.RequestAssetID = imageID; @@ -594,7 +594,7 @@ namespace OpenSim.Framework.Communications.Cache { //Console.WriteLine("{0}", imag.Data.LongLength); //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"); } else @@ -603,12 +603,11 @@ namespace OpenSim.Framework.Communications.Cache } if (packetNumber != 0) { - req.PacketCounter = (int)packetNumber; + req.PacketCounter = (int) packetNumber; } - this.TextureRequests.Add(req); + TextureRequests.Add(req); } - #endregion public class AssetRequest @@ -630,7 +629,6 @@ namespace OpenSim.Framework.Communications.Cache public AssetRequest() { - } } @@ -638,7 +636,6 @@ namespace OpenSim.Framework.Communications.Cache { public AssetInfo() { - } public AssetInfo(AssetBase aBase) @@ -656,7 +653,6 @@ namespace OpenSim.Framework.Communications.Cache { public TextureImage() { - } public TextureImage(AssetBase aBase) @@ -678,7 +674,6 @@ namespace OpenSim.Framework.Communications.Cache public TextureSender(AssetRequest req) { request = req; - } public bool SendTexture() @@ -686,7 +681,8 @@ namespace OpenSim.Framework.Communications.Cache SendPacket(); 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; } @@ -707,7 +703,7 @@ namespace OpenSim.Framework.Communications.Cache im.Header.Reliable = false; im.ImageID.Packets = 1; 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.ImageID.Codec = 2; req.RequestUser.OutPacket(im); @@ -721,9 +717,9 @@ namespace OpenSim.Framework.Communications.Cache //more than one packet so split file up ImageDataPacket im = new ImageDataPacket(); im.Header.Reliable = false; - im.ImageID.Packets = (ushort)(req.NumPackets); + im.ImageID.Packets = (ushort) (req.NumPackets); 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]; Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); im.ImageID.Codec = 2; @@ -742,19 +738,18 @@ namespace OpenSim.Framework.Communications.Cache //more than one packet so split file up ImagePacketPacket im = new ImagePacketPacket(); im.Header.Reliable = false; - im.ImageID.Packet = (ushort)(req.PacketCounter); + im.ImageID.Packet = (ushort) (req.PacketCounter); 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; //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, 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.PacketCounter++; //req.ImageInfo.last_used = time; //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); } - } private void SaveAssetToFile(string filename, byte[] data) @@ -789,7 +784,5 @@ namespace OpenSim.Framework.Communications.Cache AssetID = assetID; Callback = callback; } - - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetServer.cs b/OpenSim/Framework/Communications/Cache/AssetServer.cs index c927571..fa421c7 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServer.cs @@ -25,18 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections.Generic; using System.IO; -using System.Threading; using Db4objects.Db4o; using Db4objects.Db4o.Query; using libsecondlife; -using Nini.Config; -using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Communications.Cache { @@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache yapfile = File.Exists(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) { @@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache db.Commit(); } - override public void Close() + public override void Close() { base.Close(); if (db != null) { - MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); + MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database"); db.Close(); } } - override protected void RunRequests() + protected override void RunRequests() { while (true) { byte[] idata = null; bool found = false; AssetStorage foundAsset = null; - ARequest req = this._assetRequests.Dequeue(); + ARequest req = _assetRequests.Dequeue(); IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); if (result.Count > 0) { - foundAsset = (AssetStorage)result.Next(); + foundAsset = (AssetStorage) result.Next(); found = true; } @@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache //asset.FullID = ; _receiver.AssetNotFound(req.AssetID); } - } - } - override protected void StoreAsset(AssetBase asset) + protected override void StoreAsset(AssetBase asset) { AssetStorage store = new AssetStorage(); store.Data = asset.Data; @@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache { _findID = find; } + public bool Match(AssetStorage asset) { return (asset.UUID == _findID); diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 0771a20..7109910 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs @@ -5,8 +5,6 @@ using System.Threading; using libsecondlife; using Nini.Config; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Communications.Cache { @@ -36,13 +34,12 @@ namespace OpenSim.Framework.Communications.Cache public AssetServerBase() { + MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system"); + _assetRequests = new BlockingQueue(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting asset storage system"); - this._assetRequests = new BlockingQueue(); - - this._localAssetServerThread = new Thread(RunRequests); - this._localAssetServerThread.IsBackground = true; - this._localAssetServerThread.Start(); + _localAssetServerThread = new Thread(RunRequests); + _localAssetServerThread.IsBackground = true; + _localAssetServerThread.Start(); } 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); byte[] idata = new byte[numBytes]; BinaryReader br = new BinaryReader(fStream); - idata = br.ReadBytes((int)numBytes); + idata = br.ReadBytes((int) numBytes); br.Close(); fStream.Close(); info.Data = idata; @@ -66,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache public void SetReceiver(IAssetReceiver receiver) { - this._receiver = receiver; + _receiver = receiver; } public void FetchAsset(LLUUID assetID, bool isTexture) @@ -74,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache ARequest req = new ARequest(); req.AssetID = assetID; req.IsTexture = isTexture; - this._assetRequests.Enqueue(req); + _assetRequests.Enqueue(req); } public void UpdateAsset(AssetBase asset) @@ -102,7 +99,6 @@ namespace OpenSim.Framework.Communications.Cache public void SetServerInfo(string ServerUrl, string ServerKey) { - } public virtual List GetDefaultAssets() @@ -175,8 +171,8 @@ namespace OpenSim.Framework.Communications.Cache // System.Console.WriteLine("loading asset into database"); string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); string name = source.Configs[i].GetString("name", ""); - sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); - sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); + sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0); + sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0); string fileName = source.Configs[i].GetString("fileName", ""); AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); @@ -189,4 +185,4 @@ namespace OpenSim.Framework.Communications.Cache assets.ForEach(action); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs index d622e02..55b255a 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs @@ -25,15 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; using System.Collections.Generic; -using System.Text; -using System.IO; using libsecondlife; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.Data; namespace OpenSim.Framework.Communications.Cache { @@ -41,7 +34,10 @@ namespace OpenSim.Framework.Communications.Cache { // Fields public CommunicationsManager CommsManager; - public Dictionary AgentTransactions = new Dictionary(); + + public Dictionary AgentTransactions = + new Dictionary(); + private bool m_dumpAssetsToFile; public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) @@ -53,10 +49,10 @@ namespace OpenSim.Framework.Communications.Cache // Methods public AgentAssetTransactions AddUser(LLUUID userID) { - if (!this.AgentTransactions.ContainsKey(userID)) + if (!AgentTransactions.ContainsKey(userID)) { AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); - this.AgentTransactions.Add(userID, transactions); + AgentTransactions.Add(userID, transactions); return transactions; } return null; @@ -64,27 +60,30 @@ namespace OpenSim.Framework.Communications.Cache public AgentAssetTransactions GetUserTransActions(LLUUID userID) { - if (this.AgentTransactions.ContainsKey(userID)) + if (AgentTransactions.ContainsKey(userID)) { - return this.AgentTransactions[userID]; + return AgentTransactions[userID]; } 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) { - 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); - AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); + AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); if (transactions != null) { 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) { - AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); + AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId); if (transactions != null) { transactions.HandleXfer(xferID, packetID, data); diff --git a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs index e78f4f7..6b08fc9 100644 --- a/OpenSim/Framework/Communications/Cache/AssetTransactions.cs +++ b/OpenSim/Framework/Communications/Cache/AssetTransactions.cs @@ -26,17 +26,12 @@ * */ using System; -using System.Collections; using System.Collections.Generic; -using System.Text; using System.IO; using libsecondlife; 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.Region.Capabilities; namespace OpenSim.Framework.Communications.Cache { @@ -53,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache // Methods public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) { - this.UserID = agentID; + UserID = agentID; Manager = manager; m_dumpAssetsToFile = dumpAssetsToFile; } @@ -61,24 +56,24 @@ namespace OpenSim.Framework.Communications.Cache public AssetCapsUploader RequestCapsUploader() { AssetCapsUploader uploader = new AssetCapsUploader(); - this.CapsUploaders.Add(uploader); + CapsUploaders.Add(uploader); return uploader; } public NoteCardCapsUpdate RequestNoteCardUpdater() { NoteCardCapsUpdate update = new NoteCardCapsUpdate(); - this.NotecardUpdaters.Add(update); + NotecardUpdaters.Add(update); return update; } public AssetXferUploader RequestXferUploader(LLUUID transactionID) { - if (!this.XferUploaders.ContainsKey(transactionID)) + if (!XferUploaders.ContainsKey(transactionID)) { AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); - this.XferUploaders.Add(transactionID, uploader); + XferUploaders.Add(transactionID, uploader); return uploader; } return null; @@ -86,7 +81,7 @@ namespace OpenSim.Framework.Communications.Cache 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) { @@ -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) { - if (this.XferUploaders.ContainsKey(transactionID)) + if (XferUploaders.ContainsKey(transactionID)) { return XferUploaders[transactionID].GetAssetData(); } @@ -130,15 +129,16 @@ namespace OpenSim.Framework.Communications.Cache public event UpLoadedAsset OnUpLoad; // 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; - this.m_assetDescription = assetDescription; - this.m_folderID = folderID; - this.newAssetID = assetID; - this.inventoryItemID = inventoryItem; - this.uploaderPath = path; - this.httpListener = httpServer; + m_assetName = assetName; + m_assetDescription = assetDescription; + m_folderID = folderID; + newAssetID = assetID; + inventoryItemID = inventoryItem; + uploaderPath = path; + httpListener = httpServer; m_dumpImageToFile = dumpImageToFile; } @@ -156,18 +156,18 @@ namespace OpenSim.Framework.Communications.Cache LLUUID inventoryItemID = this.inventoryItemID; string text = ""; LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); - complete.new_asset = this.newAssetID.ToStringHyphenated(); + complete.new_asset = newAssetID.ToStringHyphenated(); complete.new_inventory_item = inventoryItemID; complete.state = "complete"; text = LLSDHelpers.SerialiseLLSDReply(complete); - this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); - if (this.m_dumpImageToFile) + httpListener.RemoveStreamHandler("POST", uploaderPath); + 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; } @@ -196,90 +196,91 @@ namespace OpenSim.Framework.Communications.Cache public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) { - this.m_userTransactions = transactions; + m_userTransactions = transactions; m_dumpAssetToFile = dumpAssetToFile; } // Methods 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]; - Array.Copy(this.Asset.Data, 0, destinationArray, 0, this.Asset.Data.Length); - Array.Copy(data, 0, destinationArray, this.Asset.Data.Length, data.Length); - this.Asset.Data = destinationArray; + byte[] destinationArray = new byte[Asset.Data.Length + data.Length]; + Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length); + Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length); + Asset.Data = destinationArray; } else { byte[] buffer2 = new byte[data.Length - 4]; Array.Copy(data, 4, buffer2, 0, data.Length - 4); - this.Asset.Data = buffer2; + Asset.Data = buffer2; } ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); newPack.XferID.ID = xferID; newPack.XferID.Packet = packetID; - this.ourClient.OutPacket(newPack); + ourClient.OutPacket(newPack); 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; - this.Asset = new AssetBase(); - this.Asset.FullID = assetID; - this.Asset.InvType = type; - this.Asset.Type = type; - this.Asset.Data = data; - this.Asset.Name = "blank"; - this.Asset.Description = "empty"; - this.TransactionID = transaction; - this.m_storeLocal = storeLocal; - if (this.Asset.Data.Length > 2) + ourClient = remoteClient; + Asset = new AssetBase(); + Asset.FullID = assetID; + Asset.InvType = type; + Asset.Type = type; + Asset.Data = data; + Asset.Name = "blank"; + Asset.Description = "empty"; + TransactionID = transaction; + m_storeLocal = storeLocal; + if (Asset.Data.Length > 2) { - this.SendCompleteMessage(); + SendCompleteMessage(); } else { - this.ReqestStartXfer(); + ReqestStartXfer(); } } protected void ReqestStartXfer() { - this.UploadComplete = false; - this.XferID = Util.GetNextXferID(); + UploadComplete = false; + XferID = Util.GetNextXferID(); RequestXferPacket newPack = new RequestXferPacket(); - newPack.XferID.ID = this.XferID; - newPack.XferID.VFileType = this.Asset.Type; - newPack.XferID.VFileID = this.Asset.FullID; + newPack.XferID.ID = XferID; + newPack.XferID.VFileType = Asset.Type; + newPack.XferID.VFileID = Asset.FullID; newPack.XferID.FilePath = 0; newPack.XferID.Filename = new byte[0]; - this.ourClient.OutPacket(newPack); + ourClient.OutPacket(newPack); } protected void SendCompleteMessage() { - this.UploadComplete = true; + UploadComplete = true; AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); - newPack.AssetBlock.Type = this.Asset.Type; + newPack.AssetBlock.Type = Asset.Type; newPack.AssetBlock.Success = true; - newPack.AssetBlock.UUID = this.Asset.FullID; - this.ourClient.OutPacket(newPack); - this.m_finished = true; + newPack.AssetBlock.UUID = Asset.FullID; + ourClient.OutPacket(newPack); + m_finished = true; if (m_createItem) { DoCreateItem(); } 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); @@ -287,8 +288,10 @@ namespace OpenSim.Framework.Communications.Cache if (m_dumpAssetToFile) { 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 ); - SaveAssetToFile(filename, this.Asset.Data); + 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); + SaveAssetToFile(filename, Asset.Data); } } @@ -301,20 +304,22 @@ namespace OpenSim.Framework.Communications.Cache 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; - this.m_name = name; - this.m_description = description; + InventFolder = folderID; + m_name = name; + m_description = description; this.type = type; this.invType = invType; - this.nextPerm = nextOwnerMask; - this.Asset.Name = name; - this.Asset.Description = description; - this.Asset.Type = type; - this.Asset.InvType = invType; + nextPerm = nextOwnerMask; + Asset.Name = name; + Asset.Description = description; + Asset.Type = type; + Asset.InvType = invType; m_createItem = true; if (m_finished) { @@ -326,22 +331,23 @@ namespace OpenSim.Framework.Communications.Cache private void DoCreateItem() { //really need to fix this call, if lbsa71 saw this he would die. - this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); - CachedUserInfo userInfo = m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); + m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset); + CachedUserInfo userInfo = + m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); if (userInfo != null) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = this.ourClient.AgentId; + item.avatarID = ourClient.AgentId; item.creatorsID = ourClient.AgentId; item.inventoryID = LLUUID.Random(); item.assetID = Asset.FullID; - item.inventoryDescription = this.m_description; + item.inventoryDescription = m_description; item.inventoryName = m_name; item.assetType = type; - item.invType = this.invType; - item.parentFolderID = this.InventFolder; + item.invType = invType; + item.parentFolderID = InventFolder; item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = this.nextPerm; + item.inventoryNextPermissions = nextPerm; userInfo.AddItem(ourClient.AgentId, item); ourClient.SendInventoryItemUpdate(item); @@ -350,14 +356,13 @@ namespace OpenSim.Framework.Communications.Cache public void UpdateInventoryItem(LLUUID itemID) { - } public AssetBase GetAssetData() { if (m_finished) { - return this.Asset; + return Asset; } return null; } @@ -379,10 +384,10 @@ namespace OpenSim.Framework.Communications.Cache // Methods public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) { - this.inventoryItemID = inventoryItem; - this.uploaderPath = path; - this.httpListener = httpServer; - this.newAssetID = LLUUID.Random(); + inventoryItemID = inventoryItem; + uploaderPath = path; + httpListener = httpServer; + newAssetID = LLUUID.Random(); } private void SaveImageToFile(string filename, byte[] data) @@ -399,18 +404,18 @@ namespace OpenSim.Framework.Communications.Cache LLUUID inventoryItemID = this.inventoryItemID; string text = ""; LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); - complete.new_asset = this.newAssetID.ToStringHyphenated(); + complete.new_asset = newAssetID.ToStringHyphenated(); complete.new_inventory_item = inventoryItemID; complete.state = "complete"; text = LLSDHelpers.SerialiseLLSDReply(complete); - this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); - if (this.SaveImages) + httpListener.RemoveStreamHandler("POST", uploaderPath); + 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; } diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 2d639d6..8fbc3fd 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -26,7 +26,6 @@ * */ using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework.Communications.Cache { @@ -45,22 +44,22 @@ namespace OpenSim.Framework.Communications.Cache // Methods 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) { - 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 { - InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID); + InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID); if (folder != null) { folder.SubFolders.Add(folderInfo.folderID, folderInfo); @@ -71,18 +70,18 @@ namespace OpenSim.Framework.Communications.Cache 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 { - InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); + InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID); 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) { - if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) + if ((userID == UserProfile.UUID) && (RootFolder != null)) { - this.ItemReceive(userID, itemInfo); - this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); + ItemReceive(userID, itemInfo); + m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, 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) { bool result = false; - if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) + if ((userID == UserProfile.UUID) && (RootFolder != null)) { result = RootFolder.DeleteItem(item.inventoryID); if (result) { - this.m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); + m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); } } return result; diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 4904293..74a1ef4 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -25,19 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; +using System.Collections.Generic; using System.IO; -using System.Threading; -using System.Reflection; using System.Xml.Serialization; - using libsecondlife; - -using Nini.Config; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.Communications; namespace OpenSim.Framework.Communications.Cache { @@ -63,7 +57,6 @@ namespace OpenSim.Framework.Communications.Cache Stream s = null; try { - MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); RestClient rc = new RestClient(_assetServerUrl); @@ -77,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache if (s.Length > 0) { - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); - AssetBase asset = (AssetBase)xs.Deserialize(s); + XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); + AssetBase asset = (AssetBase) xs.Deserialize(s); _receiver.AssetReceived(asset, isTexture); } @@ -106,7 +99,7 @@ namespace OpenSim.Framework.Communications.Cache { MemoryStream s = new MemoryStream(); - XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); + XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); xs.Serialize(s, asset); RestClient rc = new RestClient(_assetServerUrl); rc.AddResourcePath("assets"); @@ -129,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache throw new Exception("The method or operation is not implemented."); } - public System.Collections.Generic.List GetDefaultAssets() + public List GetDefaultAssets() { throw new Exception("The method or operation is not implemented."); } @@ -156,4 +149,4 @@ namespace OpenSim.Framework.Communications.Cache #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index 0905af8..3495e55 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs @@ -25,14 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; using System.Collections.Generic; -using System.Text; -using System.IO; using libsecondlife; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Communications.Cache { @@ -44,17 +38,16 @@ namespace OpenSim.Framework.Communications.Cache public InventoryFolderImpl(InventoryFolderBase folderbase) { - this.agentID = folderbase.agentID; - this.folderID = folderbase.folderID; - this.name = folderbase.name; - this.parentID = folderbase.parentID; - this.type = folderbase.type; - this.version = folderbase.version; + agentID = folderbase.agentID; + folderID = folderbase.folderID; + name = folderbase.name; + parentID = folderbase.parentID; + type = folderbase.type; + version = folderbase.version; } public InventoryFolderImpl() { - } // Methods @@ -65,19 +58,19 @@ namespace OpenSim.Framework.Communications.Cache subFold.folderID = folderID; subFold.type = (short) type; subFold.parentID = this.folderID; - subFold.agentID = this.agentID; - this.SubFolders.Add(subFold.folderID, subFold); + subFold.agentID = agentID; + SubFolders.Add(subFold.folderID, subFold); return subFold; } public InventoryItemBase HasItem(LLUUID itemID) { 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); if (base2 != null) @@ -91,12 +84,12 @@ namespace OpenSim.Framework.Communications.Cache public bool DeleteItem(LLUUID itemID) { bool found = false; - if (this.Items.ContainsKey(itemID)) + if (Items.ContainsKey(itemID)) { Items.Remove(itemID); return true; } - foreach (InventoryFolderImpl folder in this.SubFolders.Values) + foreach (InventoryFolderImpl folder in SubFolders.Values) { found = folder.DeleteItem(itemID); if (found == true) @@ -111,13 +104,13 @@ namespace OpenSim.Framework.Communications.Cache public InventoryFolderImpl HasSubFolder(LLUUID folderID) { InventoryFolderImpl returnFolder = null; - if (this.SubFolders.ContainsKey(folderID)) + if (SubFolders.ContainsKey(folderID)) { - returnFolder = this.SubFolders[folderID]; + returnFolder = SubFolders[folderID]; } else { - foreach (InventoryFolderImpl folder in this.SubFolders.Values) + foreach (InventoryFolderImpl folder in SubFolders.Values) { returnFolder = folder.HasSubFolder(folderID); if (returnFolder != null) @@ -132,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache public List RequestListOfItems() { List itemList = new List(); - foreach (InventoryItemBase item in this.Items.Values) + foreach (InventoryItemBase item in Items.Values) { itemList.Add(item); } diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index 60f9b6b..765c42e 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -26,12 +26,8 @@ * */ -using System; using System.IO; -using System.Collections.Generic; -using System.Text; using libsecondlife; -using OpenSim.Framework; using Nini.Config; 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 /// once the server is fully implemented then should read the data from that /// - public class LibraryRootFolder : Cache.InventoryFolderImpl + public class LibraryRootFolder : InventoryFolderImpl { private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); - private Cache.InventoryFolderImpl m_textureFolder; + private InventoryFolderImpl m_textureFolder; public LibraryRootFolder() { - this.agentID = libOwner; - this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); - this.name = "OpenSim Library"; - this.parentID = LLUUID.Zero; - this.type = (short)-1; - this.version = (ushort)1; - - Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); + agentID = libOwner; + folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); + name = "OpenSim Library"; + parentID = LLUUID.Zero; + type = (short) -1; + version = (ushort) 1; + + InventoryFolderImpl folderInfo = new InventoryFolderImpl(); folderInfo.agentID = libOwner; folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); folderInfo.name = "Texture Library"; - folderInfo.parentID = this.folderID; + folderInfo.parentID = folderID; folderInfo.type = -1; folderInfo.version = 1; - this.SubFolders.Add(folderInfo.folderID, folderInfo); - this.m_textureFolder = folderInfo; + SubFolders.Add(folderInfo.folderID, folderInfo); + m_textureFolder = folderInfo; - this.CreateLibraryItems(); + CreateLibraryItems(); string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); if (File.Exists(filePath)) { XmlConfigSource source = new XmlConfigSource(filePath); - this.ReadItemsFromFile(source); + ReadItemsFromFile(source); } } private void CreateLibraryItems() { - InventoryItemBase item = new InventoryItemBase(); item.avatarID = libOwner; item.creatorsID = libOwner; @@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF; - this.m_textureFolder.Items.Add(item.inventoryID, item); + m_textureFolder.Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF; - this.m_textureFolder.Items.Add(item.inventoryID, item); + m_textureFolder.Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF; - this.m_textureFolder.Items.Add(item.inventoryID, item); + m_textureFolder.Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF; - this.m_textureFolder.Items.Add(item.inventoryID, item); + m_textureFolder.Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryEveryOnePermissions = 0x7FFFFFFF; item.inventoryCurrentPermissions = 0x7FFFFFFF; item.inventoryNextPermissions = 0x7FFFFFFF; - this.m_textureFolder.Items.Add(item.inventoryID, item); + m_textureFolder.Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryName = "Default Shape"; item.assetType = 13; item.invType = 18; - item.parentFolderID = this.folderID; + item.parentFolderID = folderID; item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; - this.Items.Add(item.inventoryID, item); + Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryName = "Default Skin"; item.assetType = 13; item.invType = 18; - item.parentFolderID = this.folderID; + item.parentFolderID = folderID; item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; - this.Items.Add(item.inventoryID, item); + Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryName = "Default Shirt"; item.assetType = 5; item.invType = 18; - item.parentFolderID = this.folderID; + item.parentFolderID = folderID; item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; - this.Items.Add(item.inventoryID, item); + Items.Add(item.inventoryID, item); item = new InventoryItemBase(); item.avatarID = libOwner; @@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache item.inventoryName = "Default Pants"; item.assetType = 5; item.invType = 18; - item.parentFolderID = this.folderID; + item.parentFolderID = folderID; item.inventoryCurrentPermissions = 0; item.inventoryNextPermissions = 0; - this.Items.Add(item.inventoryID, item); - + Items.Add(item.inventoryID, item); } private void ReadItemsFromFile(IConfigSource source) @@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache InventoryItemBase item = new InventoryItemBase(); item.avatarID = 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.inventoryDescription = source.Configs[i].GetString("description", ""); item.inventoryName = source.Configs[i].GetString("name", ""); item.assetType = source.Configs[i].GetInt("assetType", 0); item.invType = source.Configs[i].GetInt("inventoryType", 0); - item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); - item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); - item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); - item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); + item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); + item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); + item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); + item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); if (item.assetType == 0) { - item.parentFolderID = this.m_textureFolder.folderID; - this.m_textureFolder.Items.Add(item.inventoryID, item); + item.parentFolderID = m_textureFolder.folderID; + m_textureFolder.Items.Add(item.inventoryID, item); } else { - item.parentFolderID = this.folderID; - this.Items.Add(item.inventoryID, item); + item.parentFolderID = folderID; + Items.Add(item.inventoryID, item); } } } - } } \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 0953e19..b4f29db 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs @@ -26,14 +26,8 @@ * */ using System; -using System.IO; -using System.Threading; using System.Reflection; -using libsecondlife; -using Nini.Config; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Communications.Cache { @@ -62,11 +56,14 @@ namespace OpenSim.Framework.Communications.Cache 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.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; @@ -84,13 +81,13 @@ namespace OpenSim.Framework.Communications.Cache m_assetProviderPlugin.CommitAssets(); } - override protected void RunRequests() + protected override void RunRequests() { 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); AssetBase asset = null; lock (syncLock) @@ -105,9 +102,7 @@ namespace OpenSim.Framework.Communications.Cache { _receiver.AssetNotFound(req.AssetID); } - } - } protected override void StoreAsset(AssetBase asset) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index 8105556..fe943b0 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs @@ -25,16 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; -using System.Collections; using System.Collections.Generic; -using System.Text; -using System.IO; using libsecondlife; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; - namespace OpenSim.Framework.Communications.Cache { @@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache // Methods public UserProfileCache(CommunicationsManager parent) { - this.m_parent = parent; + m_parent = parent; } /// @@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache // Potential fix - Multithreading issue. lock (UserProfiles) { - if (!this.UserProfiles.ContainsKey(userID)) + if (!UserProfiles.ContainsKey(userID)) { - CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); - userInfo.UserProfile = this.RequestUserProfileForUser(userID); + CachedUserInfo userInfo = new CachedUserInfo(m_parent); + userInfo.UserProfile = RequestUserProfileForUser(userID); if (userInfo.UserProfile != null) { - this.RequestInventoryForUser(userID, userInfo); - this.UserProfiles.Add(userID, userInfo); + RequestInventoryForUser(userID, userInfo); + UserProfiles.Add(userID, userInfo); } else { @@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache public CachedUserInfo GetUserDetails(LLUUID userID) { - if (this.UserProfiles.ContainsKey(userID)) + if (UserProfiles.ContainsKey(userID)) { - return this.UserProfiles[userID]; + return UserProfiles[userID]; } 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) { - InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); + InventoryFolderImpl createdFolder = + info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); if (createdFolder != null) { - this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); + m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); } } 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; - if (folderID == libraryRoot.folderID ) + InventoryFolderImpl fold = null; + 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()); } - 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 (fetchItems) { - remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); + remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, + info.RootFolder.RequestListOfItems()); } } else @@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); 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"); } - 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) { remoteClient.SendInventoryItemDetails(ownerID, item); @@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache /// 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); } /// @@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache /// private UserProfileData RequestUserProfileForUser(LLUUID userID) { - return this.m_parent.UserService.GetUserProfile(userID); + return m_parent.UserService.GetUserProfile(userID); } /// diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a114b64..23dfcc6 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -28,18 +28,23 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Text; using System.IO; using libsecondlife; +using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; +using OpenSim.Framework.Console; using OpenSim.Framework.Servers; -using OpenSim.Framework; 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 void NewInventoryItem(LLUUID userID, InventoryItemBase item); + public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); public class Caps @@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities public ItemUpdatedCallback ItemUpdatedCall = null; 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; m_capsObjectPath = capsPath; @@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities /// 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; try { - httpListener.AddStreamHandler(new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); - httpListener.AddStreamHandler(new LLSDStreamhandler("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); + httpListener.AddStreamHandler( + new LLSDStreamhandler("POST", capsBase + m_mapLayerPath, + GetMapLayer)); + httpListener.AddStreamHandler( + new LLSDStreamhandler("POST", + capsBase + m_newInventory, + NewAgentInventoryRequest)); AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); @@ -103,7 +114,7 @@ namespace OpenSim.Region.Capabilities string capsBase = "/CAPS/" + m_capsObjectPath; httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); } - + /// /// /// @@ -113,8 +124,8 @@ namespace OpenSim.Region.Capabilities /// public string CapsRequest(string request, string path, string param) { - // Console.WriteLine("caps request " + request); - string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); + // Console.WriteLine("caps request " + request); + string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities()); return result; } @@ -125,9 +136,10 @@ namespace OpenSim.Region.Capabilities protected LLSDCapsDetails GetCapabilities() { 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.RequestTextureDownload = capsBaseUrl + m_requestTexture; + // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; @@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) { LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); - mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); + mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse()); return mapResponse; } @@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities } #region EventQueue (Currently not enabled) + /// /// /// @@ -184,10 +197,10 @@ namespace OpenSim.Region.Capabilities public string ProcessEventQueue(string request, string path, string param) { string res = ""; - - if (this.CapsEventQueue.Count > 0) + + if (CapsEventQueue.Count > 0) { - lock (this.CapsEventQueue) + lock (CapsEventQueue) { string item = CapsEventQueue.Dequeue(); res = item; @@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities } else { - res = this.CreateEmptyEventResponse(); + res = CreateEmptyEventResponse(); } return res; } @@ -214,8 +227,8 @@ namespace OpenSim.Region.Capabilities eventItem.events.Array.Add(new LLSDEmpty()); string res = LLSDHelpers.SerialiseLLSDReply(eventItem); eventQueueCount++; - - this.CapsEventQueue.Enqueue(res); + + CapsEventQueue.Enqueue(res); return res; } @@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities eventQueueCount++; return res; } + #endregion /// @@ -243,24 +257,27 @@ namespace OpenSim.Region.Capabilities /// 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(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); - + string capsBase = "/CAPS/" + m_capsObjectPath; LLUUID newInvItem = llsdRequest.item_id; string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); - ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); - uploader.OnUpLoad += this.ItemUpdated; + ItemUpdater uploader = + new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile); + uploader.OnUpLoad += ItemUpdated; - httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; + httpListener.AddStreamHandler( + new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); + string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + + uploaderPath; LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; - + return LLSDHelpers.SerialiseLLSDReply(uploadResponse); } @@ -272,7 +289,7 @@ namespace OpenSim.Region.Capabilities public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) { //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); - + string assetName = llsdRequest.name; string assetDes = llsdRequest.description; string capsBase = "/CAPS/" + m_capsObjectPath; @@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities LLUUID parentFolder = llsdRequest.folder_id; 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); - httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; + AssetUploader uploader = + new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, + 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(); uploadResponse.uploader = uploaderURL; uploadResponse.state = "upload"; - uploader.OnUpLoad += this.UploadCompleteHandler; + uploader.OnUpLoad += UploadCompleteHandler; return uploadResponse; } @@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities /// /// /// - 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 inType = 0; @@ -319,14 +342,14 @@ namespace OpenSim.Region.Capabilities asset.FullID = assetID; asset.Type = assType; asset.InvType = inType; - asset.Name = assetName; + asset.Name = assetName; asset.Data = data; - this.assetCache.AddAsset(asset); + assetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); item.avatarID = agentID; item.creatorsID = agentID; - item.inventoryID = inventoryItem; + item.inventoryID = inventoryItem; item.assetID = asset.FullID; item.inventoryDescription = assetDescription; item.inventoryName = assetName; @@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities { AddNewInventoryItem(agentID, item); } - } public LLUUID ItemUpdated(LLUUID itemID, byte[] data) { if (ItemUpdatedCall != null) { - return ItemUpdatedCall(this.agentID, itemID, data); + return ItemUpdatedCall(agentID, itemID, data); } return LLUUID.Zero; } @@ -359,7 +381,7 @@ namespace OpenSim.Region.Capabilities private string uploaderPath = ""; private LLUUID newAssetID; private LLUUID inventoryItemID; - private LLUUID parentFolder; + private LLUUID parentFolder; private BaseHttpServer httpListener; private bool m_dumpAssetsToFile; private string m_assetName = ""; @@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities private string m_invType = ""; 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_assetDes = description; @@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities /// public string uploaderCaps(byte[] data, string path, string param) { - LLUUID inv = this.inventoryItemID; + LLUUID inv = inventoryItemID; string res = ""; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); uploadComplete.new_asset = newAssetID.ToStringHyphenated(); @@ -399,29 +423,29 @@ namespace OpenSim.Region.Capabilities uploadComplete.state = "complete"; res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); - + 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) { OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); } - + return res; } private void SaveAssetToFile(string filename, byte[] data) { - FileStream fs = File.Create(filename); - BinaryWriter bw = new BinaryWriter(fs); - bw.Write(data); - bw.Close(); - fs.Close(); + FileStream fs = File.Create(filename); + BinaryWriter bw = new BinaryWriter(fs); + bw.Write(data); + bw.Close(); + fs.Close(); } } @@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities private BaseHttpServer httpListener; 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; @@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities /// public string uploaderCaps(byte[] data, string path, string param) { - LLUUID inv = this.inventoryItemID; + LLUUID inv = inventoryItemID; string res = ""; LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); LLUUID assetID = LLUUID.Zero; @@ -461,7 +485,7 @@ namespace OpenSim.Region.Capabilities { assetID = OnUpLoad(inv, data); } - + uploadComplete.new_asset = assetID.ToStringHyphenated(); uploadComplete.new_inventory_item = inv; uploadComplete.state = "complete"; @@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities 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; @@ -488,6 +512,4 @@ namespace OpenSim.Region.Capabilities } } } -} - - +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs index 2af5a4a..2ed7750 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDArray.cs @@ -36,7 +36,6 @@ namespace OpenSim.Region.Capabilities public LLSDArray() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs index e65e741..d054386 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs @@ -39,7 +39,6 @@ namespace OpenSim.Region.Capabilities public LLSDAssetUploadComplete() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs index 3a2fe20..7fed27a 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs @@ -26,9 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using libsecondlife; namespace OpenSim.Region.Capabilities @@ -46,4 +43,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs index c7a9ee6..3ad618d 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { [LLSDMap] @@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities public LLSDAssetUploadResponse() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs index d1894d4..06afac4 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities public LLSDCapEvent() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs index 3184792..35caa15 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs @@ -34,18 +34,14 @@ namespace OpenSim.Region.Capabilities public string MapLayer = ""; public string NewFileAgentInventory = ""; //public string EventQueueGet = ""; - // public string RequestTextureDownload = ""; - // public string ChatSessionRequest = ""; + // public string RequestTextureDownload = ""; + // public string ChatSessionRequest = ""; public string UpdateNotecardAgentInventory = ""; public string UpdateScriptAgentInventory = ""; - // public string ParcelVoiceInfoRequest = ""; + // public string ParcelVoiceInfoRequest = ""; public LLSDCapsDetails() { - } } -} - - - +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs index 0169d3c..69c525c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs @@ -32,7 +32,6 @@ namespace OpenSim.Region.Capabilities { public LLSDEmpty() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs index 8a2215f..8252a63 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Capabilities public static void SerializeLLSDType(XmlTextWriter writer, object obj) { Type myType = obj.GetType(); - LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); if (llsdattributes.Length > 0) { switch (llsdattributes[0].ObjectType) @@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities for (int i = 0; i < fields.Length; i++) { 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) { writer.WriteStartElement(String.Empty, "key", String.Empty); @@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities case "ARRAY": // LLSDArray arrayObject = obj as LLSDArray; // 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) { writer.WriteStartElement(String.Empty, "array", String.Empty); @@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities public static object DeserialiseLLSDMap(Hashtable llsd, object obj) { Type myType = obj.GetType(); - LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); + LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false); if (llsdattributes.Length > 0) { switch (llsdattributes[0].ObjectType) @@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities IDictionaryEnumerator enumerator = llsd.GetEnumerator(); while (enumerator.MoveNext()) { - FieldInfo field = myType.GetField((string)enumerator.Key); + FieldInfo field = myType.GetField((string) enumerator.Key); if (field != null) { if (enumerator.Value is Hashtable) @@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities return obj; } } - - - - - - - - - - - - - - - - - - - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs index 57fc9e8..3842058 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs @@ -26,9 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using libsecondlife; namespace OpenSim.Region.Capabilities @@ -42,4 +39,4 @@ namespace OpenSim.Region.Capabilities { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs index 6d17bff..683e479 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs @@ -40,7 +40,6 @@ namespace OpenSim.Region.Capabilities public LLSDMapLayer() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs index 7900290..1945a6c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities public LLSDMapLayerResponse() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs index 5fa08c9..935f81d 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities public LLSDMapRequest() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs index 67253ee..6bd47e1 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs @@ -26,11 +26,7 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Region.Capabilities { public delegate TResponse LLSDMethod(TRequest request); -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs index 894b276..08e9563 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs @@ -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.IO; +using System.Text; using libsecondlife; +using OpenSim.Framework.Servers; namespace OpenSim.Region.Capabilities { @@ -42,11 +40,11 @@ namespace OpenSim.Region.Capabilities private LLSDMethod m_method; public LLSDStreamhandler(string httpMethod, string path, LLSDMethod method) - : base(httpMethod, path ) + : base(httpMethod, path) { m_method = method; } - + public override byte[] Handle(string path, Stream request) { //Encoding encoding = Encoding.UTF8; @@ -55,16 +53,15 @@ namespace OpenSim.Region.Capabilities //string requestBody = streamReader.ReadToEnd(); //streamReader.Close(); - Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); + Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); TRequest llsdRequest = new TRequest(); LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); TResponse response = m_method(llsdRequest); Encoding encoding = new UTF8Encoding(false); - - return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) ); + return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs index f70fa11..c2a6054 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDTest.cs @@ -35,7 +35,6 @@ namespace OpenSim.Region.Capabilities public LLSDTest() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs index 6af7f39..a90ae03 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDType.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDType.cs @@ -37,23 +37,19 @@ namespace OpenSim.Region.Capabilities public LLSDType(string type) { myType = type; - } public string ObjectType { - get - { - return myType; - } + get { return myType; } } } [AttributeUsage(AttributeTargets.Class)] public class LLSDMap : LLSDType { - public LLSDMap() : base( "MAP" ) + public LLSDMap() : base("MAP") { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index d8d198b..77c7261 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -28,69 +28,77 @@ using System; using libsecondlife; using OpenSim.Framework.Communications.Cache; +using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; -using OpenSim.Framework; -using OpenSim.Framework.Console; namespace OpenSim.Framework.Communications { public class CommunicationsManager { protected IUserService m_userService; + public IUserService UserService { get { return m_userService; } } protected IGridServices m_gridService; + public IGridServices GridService { get { return m_gridService; } } protected IInventoryServices m_inventoryService; + public IInventoryServices InventoryService { get { return m_inventoryService; } } protected IInterRegionCommunications m_interRegion; + public IInterRegionCommunications InterRegion { get { return m_interRegion; } } protected UserProfileCache m_userProfileCache; + public UserProfileCache UserProfileCache { get { return m_userProfileCache; } } protected AssetTransactionManager m_transactionsManager; + public AssetTransactionManager TransactionsManager { get { return m_transactionsManager; } } protected AssetCache m_assetCache; + public AssetCache AssetCache { get { return m_assetCache; } } protected NetworkServersInfo m_networkServersInfo; + public NetworkServersInfo 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_assetCache = assetCache; m_userProfileCache = new UserProfileCache(this); - m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile ); + m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile); } public void doCreate(string[] cmmdParams) @@ -106,7 +114,6 @@ namespace OpenSim.Framework.Communications if (cmmdParams.Length < 2) { - firstName = MainLog.Instance.CmdPrompt("First name", "Default"); lastName = MainLog.Instance.CmdPrompt("Last name", "User"); password = MainLog.Instance.PasswdPrompt("Password"); @@ -120,7 +127,6 @@ namespace OpenSim.Framework.Communications password = cmmdParams[3]; regX = Convert.ToUInt32(cmmdParams[4]); regY = Convert.ToUInt32(cmmdParams[5]); - } AddUser(firstName, lastName, password, regX, regY); @@ -140,7 +146,7 @@ namespace OpenSim.Framework.Communications } else { - this.m_inventoryService.CreateNewUserInventory(userProf.UUID); + m_inventoryService.CreateNewUserInventory(userProf.UUID); System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); return userProf.UUID; } diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index ccbb729..ce6205f 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -27,10 +27,6 @@ */ using System.Collections.Generic; -using System.Net; -using libsecondlife; - -using OpenSim.Framework; namespace OpenSim.Framework.Communications { @@ -41,4 +37,4 @@ namespace OpenSim.Framework.Communications RegionInfo RequestNeighbourInfo(ulong regionHandle); List RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 244747d..d4fb54b 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs @@ -26,7 +26,6 @@ * */ using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework.Communications { @@ -36,4 +35,4 @@ namespace OpenSim.Framework.Communications bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index e7758c4..fc301c2 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -26,16 +26,14 @@ * */ -using System; using System.Collections.Generic; -using System.Text; using libsecondlife; using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework; namespace OpenSim.Framework.Communications { public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); + public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); public interface IInventoryServices @@ -53,4 +51,4 @@ namespace OpenSim.Framework.Communications /// List RequestFirstLevelFolders(LLUUID userID); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 05183be..effe132 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -30,10 +30,8 @@ using System; using System.Collections.Generic; using System.Reflection; using libsecondlife; -using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; -using OpenSim.Framework; namespace OpenSim.Framework.Communications { @@ -67,10 +65,10 @@ namespace OpenSim.Framework.Communications if (typeInterface != null) { IInventoryData plug = - (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); plug.Initialise(); - this.m_plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface"); + m_plugins.Add(plug.getName(), plug); + MainLog.Instance.Verbose("INVENTORY", "Added IInventoryData Interface"); } } } @@ -168,7 +166,7 @@ namespace OpenSim.Framework.Communications { foreach (InventoryFolderBase folder in inventory.Folders.Values) { - this.AddFolder(folder); + AddFolder(folder); } } @@ -176,7 +174,7 @@ namespace OpenSim.Framework.Communications { UsersInventory inven = new UsersInventory(); inven.CreateNewInventorySet(user); - this.AddNewInventorySet(inven); + AddNewInventorySet(inven); } public class UsersInventory @@ -186,7 +184,6 @@ namespace OpenSim.Framework.Communications public UsersInventory() { - } public virtual void CreateNewInventorySet(LLUUID user) @@ -231,9 +228,11 @@ 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 AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 38bc016..4d1c35a 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -34,12 +34,10 @@ using OpenSim.Framework.Console; namespace OpenSim.Framework.UserManagement { - /// /// A temp class to handle login response. /// Should make use of UserProfileManager where possible. /// - public class LoginResponse { private Hashtable loginFlagsHash; @@ -103,211 +101,222 @@ namespace OpenSim.Framework.UserManagement public LoginResponse() { - this.loginFlags = new ArrayList(); - this.globalTextures = new ArrayList(); - this.eventCategories = new ArrayList(); - this.uiConfig = new ArrayList(); - this.classifiedCategories = new ArrayList(); + loginFlags = new ArrayList(); + globalTextures = new ArrayList(); + eventCategories = new ArrayList(); + uiConfig = new ArrayList(); + classifiedCategories = new ArrayList(); - this.loginError = new Hashtable(); - this.uiConfigHash = new Hashtable(); + loginError = new Hashtable(); + uiConfigHash = new Hashtable(); - this.defaultXmlRpcResponse = new XmlRpcResponse(); - this.userProfile = new UserInfo(); - this.inventoryRoot = new ArrayList(); - this.initialOutfit = new ArrayList(); - this.agentInventory = new ArrayList(); - this.inventoryLibrary = new ArrayList(); - this.inventoryLibraryOwner = new ArrayList(); + defaultXmlRpcResponse = new XmlRpcResponse(); + userProfile = new UserInfo(); + inventoryRoot = new ArrayList(); + initialOutfit = new ArrayList(); + agentInventory = new ArrayList(); + inventoryLibrary = new ArrayList(); + inventoryLibraryOwner = new ArrayList(); - this.xmlRpcResponse = new XmlRpcResponse(); - this.defaultXmlRpcResponse = new XmlRpcResponse(); + xmlRpcResponse = new XmlRpcResponse(); + defaultXmlRpcResponse = new XmlRpcResponse(); - this.SetDefaultValues(); + SetDefaultValues(); } // LoginServer public void SetDefaultValues() { - this.DST = "N"; - this.StipendSinceLogin = "N"; - this.Gendered = "Y"; - this.EverLoggedIn = "Y"; - this.login = "false"; - this.firstname = "Test"; - this.lastname = "User"; - this.agentAccess = "M"; - this.startLocation = "last"; - this.allowFirstLife = "Y"; - - this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; - this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; - this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; - - this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; - this.ErrorReason = "key"; - this.welcomeMessage = "Welcome to OpenSim!"; - this.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() + "]}"; - this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; - this.RegionX = (uint)255232; - this.RegionY = (uint)254976; - - // Classifieds; - this.AddClassifiedCategory((Int32)1, "Shopping"); - this.AddClassifiedCategory((Int32)2, "Land Rental"); - this.AddClassifiedCategory((Int32)3, "Property Rental"); - this.AddClassifiedCategory((Int32)4, "Special Attraction"); - this.AddClassifiedCategory((Int32)5, "New Products"); - this.AddClassifiedCategory((Int32)6, "Employment"); - this.AddClassifiedCategory((Int32)7, "Wanted"); - this.AddClassifiedCategory((Int32)8, "Service"); - this.AddClassifiedCategory((Int32)9, "Personal"); - - - this.SessionID = LLUUID.Random(); - this.SecureSessionID = LLUUID.Random(); - this.AgentID = LLUUID.Random(); - - Hashtable InitialOutfitHash = new Hashtable(); - InitialOutfitHash["folder_name"] = "Nightclub Female"; - InitialOutfitHash["gender"] = "female"; - this.initialOutfit.Add(InitialOutfitHash); - - + DST = "N"; + StipendSinceLogin = "N"; + Gendered = "Y"; + EverLoggedIn = "Y"; + login = "false"; + firstname = "Test"; + lastname = "User"; + agentAccess = "M"; + startLocation = "last"; + allowFirstLife = "Y"; + + SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; + CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; + MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; + + ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; + ErrorReason = "key"; + welcomeMessage = "Welcome to OpenSim!"; + seedCapability = ""; + home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" + + userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + + userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + + userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; + lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; + RegionX = (uint) 255232; + RegionY = (uint) 254976; + + // Classifieds; + AddClassifiedCategory((Int32) 1, "Shopping"); + AddClassifiedCategory((Int32) 2, "Land Rental"); + AddClassifiedCategory((Int32) 3, "Property Rental"); + AddClassifiedCategory((Int32) 4, "Special Attraction"); + AddClassifiedCategory((Int32) 5, "New Products"); + AddClassifiedCategory((Int32) 6, "Employment"); + AddClassifiedCategory((Int32) 7, "Wanted"); + AddClassifiedCategory((Int32) 8, "Service"); + AddClassifiedCategory((Int32) 9, "Personal"); + + + SessionID = LLUUID.Random(); + SecureSessionID = LLUUID.Random(); + AgentID = LLUUID.Random(); + + Hashtable InitialOutfitHash = new Hashtable(); + InitialOutfitHash["folder_name"] = "Nightclub Female"; + InitialOutfitHash["gender"] = "female"; + initialOutfit.Add(InitialOutfitHash); } // SetDefaultValues #region Login Failure Methods + public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) { // Overwrite any default values; - this.xmlRpcResponse = new XmlRpcResponse(); + xmlRpcResponse = new XmlRpcResponse(); // Ensure Login Failed message/reason; - this.ErrorMessage = message; - this.ErrorReason = reason; - - this.loginError["reason"] = this.ErrorReason; - this.loginError["message"] = this.ErrorMessage; - this.loginError["login"] = login; - this.xmlRpcResponse.Value = this.loginError; - return (this.xmlRpcResponse); + ErrorMessage = message; + ErrorReason = reason; + + loginError["reason"] = ErrorReason; + loginError["message"] = ErrorMessage; + loginError["login"] = login; + xmlRpcResponse.Value = loginError; + return (xmlRpcResponse); } // GenerateResponse public XmlRpcResponse CreateFailedResponse() { - return (this.CreateLoginFailedResponse()); + return (CreateLoginFailedResponse()); } // CreateErrorConnectingToGridResponse() 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 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() 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 public XmlRpcResponse ToXmlRpcResponse() { try { - Hashtable responseData = new Hashtable(); - this.loginFlagsHash = new Hashtable(); - this.loginFlagsHash["daylight_savings"] = this.DST; - this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; - this.loginFlagsHash["gendered"] = this.Gendered; - this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; - this.loginFlags.Add(this.loginFlagsHash); - - responseData["first_name"] = this.Firstname; - responseData["last_name"] = this.Lastname; - responseData["agent_access"] = this.agentAccess; - - this.globalTexturesHash = new Hashtable(); - this.globalTexturesHash["sun_texture_id"] = this.SunTexture; - this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; - this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; - this.globalTextures.Add(this.globalTexturesHash); - // this.eventCategories.Add(this.eventCategoriesHash); - - this.AddToUIConfig("allow_first_life", this.allowFirstLife); - this.uiConfig.Add(this.uiConfigHash); - - responseData["sim_port"] =(Int32) this.SimPort; - responseData["sim_ip"] = this.SimAddress; - - responseData["agent_id"] = this.AgentID.ToStringHyphenated(); - responseData["session_id"] = this.SessionID.ToStringHyphenated(); - responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); - responseData["circuit_code"] = this.CircuitCode; - responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - responseData["login-flags"] = this.loginFlags; - responseData["global-textures"] = this.globalTextures; - responseData["seed_capability"] = this.seedCapability; - - responseData["event_categories"] = this.eventCategories; + loginFlagsHash = new Hashtable(); + loginFlagsHash["daylight_savings"] = DST; + loginFlagsHash["stipend_since_login"] = StipendSinceLogin; + loginFlagsHash["gendered"] = Gendered; + loginFlagsHash["ever_logged_in"] = EverLoggedIn; + loginFlags.Add(loginFlagsHash); + + responseData["first_name"] = Firstname; + responseData["last_name"] = Lastname; + responseData["agent_access"] = agentAccess; + + globalTexturesHash = new Hashtable(); + globalTexturesHash["sun_texture_id"] = SunTexture; + globalTexturesHash["cloud_texture_id"] = CloudTexture; + globalTexturesHash["moon_texture_id"] = MoonTexture; + globalTextures.Add(globalTexturesHash); + // this.eventCategories.Add(this.eventCategoriesHash); + + AddToUIConfig("allow_first_life", allowFirstLife); + uiConfig.Add(uiConfigHash); + + responseData["sim_port"] = (Int32) SimPort; + responseData["sim_ip"] = SimAddress; + + responseData["agent_id"] = AgentID.ToStringHyphenated(); + responseData["session_id"] = SessionID.ToStringHyphenated(); + responseData["secure_session_id"] = SecureSessionID.ToStringHyphenated(); + responseData["circuit_code"] = CircuitCode; + responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + responseData["login-flags"] = loginFlags; + responseData["global-textures"] = globalTextures; + responseData["seed_capability"] = seedCapability; + + responseData["event_categories"] = eventCategories; responseData["event_notifications"] = new ArrayList(); // todo - responseData["classified_categories"] = this.classifiedCategories; - responseData["ui-config"] = this.uiConfig; + responseData["classified_categories"] = classifiedCategories; + responseData["ui-config"] = uiConfig; - responseData["inventory-skeleton"] = this.agentInventory; - responseData["inventory-skel-lib"] = this.inventoryLibrary; - responseData["inventory-root"] = this.inventoryRoot; + responseData["inventory-skeleton"] = agentInventory; + responseData["inventory-skel-lib"] = inventoryLibrary; + responseData["inventory-root"] = inventoryRoot; responseData["gestures"] = new ArrayList(); // todo - responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; - responseData["initial-outfit"] = this.initialOutfit; - responseData["start_location"] = this.startLocation; - responseData["seed_capability"] = this.seedCapability; - responseData["home"] = this.home; - responseData["look_at"] = this.lookAt; - responseData["message"] = this.welcomeMessage; - responseData["region_x"] = (Int32)this.RegionX * 256; - responseData["region_y"] = (Int32)this.RegionY * 256; + responseData["inventory-lib-owner"] = inventoryLibraryOwner; + responseData["initial-outfit"] = initialOutfit; + responseData["start_location"] = startLocation; + responseData["seed_capability"] = seedCapability; + responseData["home"] = home; + responseData["look_at"] = lookAt; + responseData["message"] = welcomeMessage; + responseData["region_x"] = (Int32) RegionX*256; + responseData["region_y"] = (Int32) RegionY*256; //responseData["inventory-lib-root"] = new ArrayList(); // todo //responseData["buddy-list"] = new ArrayList(); // todo responseData["login"] = "true"; - this.xmlRpcResponse.Value = responseData; + xmlRpcResponse.Value = responseData; - return (this.xmlRpcResponse); + return (xmlRpcResponse); } catch (Exception e) { MainLog.Instance.Warn( "CLIENT", "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 public void SetEventCategories(string category, string value) { - // this.eventCategoriesHash[category] = value; + // this.eventCategoriesHash[category] = value; //TODO } // SetEventCategories public void AddToUIConfig(string itemName, string item) { - this.uiConfigHash[itemName] = item; + uiConfigHash[itemName] = item; } // SetUIConfig public void AddClassifiedCategory(Int32 ID, string categoryName) @@ -315,372 +324,193 @@ namespace OpenSim.Framework.UserManagement Hashtable hash = new Hashtable(); hash["category_name"] = categoryName; hash["category_id"] = ID; - this.classifiedCategories.Add(hash); + classifiedCategories.Add(hash); // this.classifiedCategoriesHash.Clear(); } // SetClassifiedCategory #region Properties + public string Login { - get - { - return this.login; - } - set - { - this.login = value; - } + get { return login; } + set { login = value; } } // Login public string DST { - get - { - return this.dst; - } - set - { - this.dst = value; - } + get { return dst; } + set { dst = value; } } // DST public string StipendSinceLogin { - get - { - return this.stipendSinceLogin; - } - set - { - this.stipendSinceLogin = value; - } + get { return stipendSinceLogin; } + set { stipendSinceLogin = value; } } // StipendSinceLogin public string Gendered { - get - { - return this.gendered; - } - set - { - this.gendered = value; - } + get { return gendered; } + set { gendered = value; } } // Gendered public string EverLoggedIn { - get - { - return this.everLoggedIn; - } - set - { - this.everLoggedIn = value; - } + get { return everLoggedIn; } + set { everLoggedIn = value; } } // EverLoggedIn public int SimPort { - get - { - return this.simPort; - } - set - { - this.simPort = value; - } + get { return simPort; } + set { simPort = value; } } // SimPort public string SimAddress { - get - { - return this.simAddress; - } - set - { - this.simAddress = value; - } + get { return simAddress; } + set { simAddress = value; } } // SimAddress public LLUUID AgentID { - get - { - return this.agentID; - } - set - { - this.agentID = value; - } + get { return agentID; } + set { agentID = value; } } // AgentID public LLUUID SessionID { - get - { - return this.sessionID; - } - set - { - this.sessionID = value; - } + get { return sessionID; } + set { sessionID = value; } } // SessionID public LLUUID SecureSessionID { - get - { - return this.secureSessionID; - } - set - { - this.secureSessionID = value; - } + get { return secureSessionID; } + set { secureSessionID = value; } } // SecureSessionID public Int32 CircuitCode { - get - { - return this.circuitCode; - } - set - { - this.circuitCode = value; - } + get { return circuitCode; } + set { circuitCode = value; } } // CircuitCode public uint RegionX { - get - { - return this.regionX; - } - set - { - this.regionX = value; - } + get { return regionX; } + set { regionX = value; } } // RegionX public uint RegionY { - get - { - return this.regionY; - } - set - { - this.regionY = value; - } + get { return regionY; } + set { regionY = value; } } // RegionY public string SunTexture { - get - { - return this.sunTexture; - } - set - { - this.sunTexture = value; - } + get { return sunTexture; } + set { sunTexture = value; } } // SunTexture public string CloudTexture { - get - { - return this.cloudTexture; - } - set - { - this.cloudTexture = value; - } + get { return cloudTexture; } + set { cloudTexture = value; } } // CloudTexture public string MoonTexture { - get - { - return this.moonTexture; - } - set - { - this.moonTexture = value; - } + get { return moonTexture; } + set { moonTexture = value; } } // MoonTexture public string Firstname { - get - { - return this.firstname; - } - set - { - this.firstname = value; - } + get { return firstname; } + set { firstname = value; } } // Firstname public string Lastname { - get - { - return this.lastname; - } - set - { - this.lastname = value; - } + get { return lastname; } + set { lastname = value; } } // Lastname public string AgentAccess { - get - { - return this.agentAccess; - } - set - { - this.agentAccess = value; - } + get { return agentAccess; } + set { agentAccess = value; } } public string StartLocation { - get - { - return this.startLocation; - } - set - { - this.startLocation = value; - } + get { return startLocation; } + set { startLocation = value; } } // StartLocation public string LookAt { - get - { - return this.lookAt; - } - set - { - this.lookAt = value; - } + get { return lookAt; } + set { lookAt = value; } } public string SeedCapability { - get - { - return this.seedCapability; - } - set - { - this.seedCapability = value; - } + get { return seedCapability; } + set { seedCapability = value; } } // SeedCapability public string ErrorReason { - get - { - return this.errorReason; - } - set - { - this.errorReason = value; - } + get { return errorReason; } + set { errorReason = value; } } // ErrorReason public string ErrorMessage { - get - { - return this.errorMessage; - } - set - { - this.errorMessage = value; - } + get { return errorMessage; } + set { errorMessage = value; } } // ErrorMessage public ArrayList InventoryRoot { - get - { - return this.inventoryRoot; - } - set - { - this.inventoryRoot = value; - } + get { return inventoryRoot; } + set { inventoryRoot = value; } } public ArrayList InventorySkeleton { - get - { - return this.agentInventory; - } - set - { - this.agentInventory = value; - } + get { return agentInventory; } + set { agentInventory = value; } } public ArrayList InventoryLibrary { - get - { - return this.inventoryLibrary; - } - set - { - this.inventoryLibrary = value; - } + get { return inventoryLibrary; } + set { inventoryLibrary = value; } } public ArrayList InventoryLibraryOwner { - get - { - return this.inventoryLibraryOwner; - } - set - { - this.inventoryLibraryOwner = value; - } + get { return inventoryLibraryOwner; } + set { inventoryLibraryOwner = value; } } public string Home { - get - { - return this.home; - } - set - { - this.home = value; - } + get { return home; } + set { home = value; } } public string Message { - get - { - return this.welcomeMessage; - } - set - { - this.welcomeMessage = value; - } + get { return welcomeMessage; } + set { welcomeMessage = value; } } - #endregion + #endregion public class UserInfo { @@ -691,6 +521,4 @@ namespace OpenSim.Framework.UserManagement public LLVector3 homelookat; } } -} - - +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 66b91e1..497cc5d 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -28,16 +28,10 @@ using System; using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using System.Security.Cryptography; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework.Console; -using OpenSim.Framework; -using InventoryFolder = OpenSim.Framework.InventoryFolder; - namespace OpenSim.Framework.UserManagement { public class LoginService @@ -61,12 +55,12 @@ namespace OpenSim.Framework.UserManagement /// The response to send public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) { - - MainLog.Instance.Verbose("LOGIN","Attempting login now..."); + MainLog.Instance.Verbose("LOGIN", "Attempting login now..."); 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; UserProfileData userProfile; @@ -74,9 +68,9 @@ namespace OpenSim.Framework.UserManagement if (GoodXML) { - string firstname = (string)requestData["first"]; - string lastname = (string)requestData["last"]; - string passwd = (string)requestData["passwd"]; + string firstname = (string) requestData["first"]; + string lastname = (string) requestData["last"]; + string passwd = (string) requestData["passwd"]; userProfile = GetTheUser(firstname, lastname); if (userProfile == null) @@ -110,7 +104,7 @@ namespace OpenSim.Framework.UserManagement LLUUID agentID = userProfile.UUID; // Inventory Library Section - InventoryData inventData = this.CreateInventoryData(agentID); + InventoryData inventData = CreateInventoryData(agentID); ArrayList AgentInventoryArray = inventData.InventoryArray; Hashtable InventoryRootHash = new Hashtable(); @@ -120,7 +114,7 @@ namespace OpenSim.Framework.UserManagement userProfile.rootInventoryFolderID = inventData.RootFolderID; // Circuit Code - uint circode = (uint)(Util.RandomClass.Next()); + uint circode = (uint) (Util.RandomClass.Next()); logResponse.Lastname = userProfile.surname; logResponse.Firstname = userProfile.username; @@ -129,20 +123,20 @@ namespace OpenSim.Framework.UserManagement logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); logResponse.InventoryRoot = InventoryRoot; logResponse.InventorySkeleton = AgentInventoryArray; - logResponse.InventoryLibrary = this.GetInventoryLibrary(); - logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); - logResponse.CircuitCode = (Int32)circode; + logResponse.InventoryLibrary = GetInventoryLibrary(); + logResponse.InventoryLibraryOwner = GetLibraryOwner(); + logResponse.CircuitCode = (Int32) circode; //logResponse.RegionX = 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.SimAddress = "127.0.0.1"; //overwritten //logResponse.SimPort = 0; //overwritten - logResponse.Message = this.GetMessage(); + logResponse.Message = GetMessage(); try { - this.CustomiseResponse(logResponse, userProfile); + CustomiseResponse(logResponse, userProfile); } catch (Exception e) { @@ -152,7 +146,6 @@ namespace OpenSim.Framework.UserManagement } CommitAgent(ref userProfile); return logResponse.ToXmlRpcResponse(); - } catch (Exception E) @@ -162,7 +155,6 @@ namespace OpenSim.Framework.UserManagement //} } return response; - } /// @@ -174,7 +166,7 @@ namespace OpenSim.Framework.UserManagement { } - /// + /// /// Saves a target agent to the database /// /// The users profile @@ -194,8 +186,7 @@ namespace OpenSim.Framework.UserManagement /// Authenticated? 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$ @@ -211,7 +202,7 @@ namespace OpenSim.Framework.UserManagement /// public void CreateAgent(UserProfileData profile, XmlRpcRequest request) { - this.m_userManager.CreateAgent(profile, request); + m_userManager.CreateAgent(profile, request); } /// @@ -222,7 +213,7 @@ namespace OpenSim.Framework.UserManagement /// public virtual UserProfileData GetTheUser(string firstname, string lastname) { - return this.m_userManager.GetUserProfile(firstname, lastname); + return m_userManager.GetUserProfile(firstname, lastname); } /// @@ -286,8 +277,8 @@ namespace OpenSim.Framework.UserManagement TempHash = new Hashtable(); TempHash["name"] = InvFolder.FolderName; TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.Version; - TempHash["type_default"] = (Int32)InvFolder.DefaultType; + TempHash["version"] = (Int32) InvFolder.Version; + TempHash["type_default"] = (Int32) InvFolder.DefaultType; TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); AgentInventoryArray.Add(TempHash); } @@ -307,4 +298,4 @@ namespace OpenSim.Framework.UserManagement } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs index 43fce84..a812ac9 100644 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -27,25 +27,29 @@ */ using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenGrid.Framework.Communications")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenGrid.Framework.Communications")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenGrid.Framework.Communications")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenGrid.Framework.Communications")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -56,5 +60,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs index c821fa4..72d8f65 100644 --- a/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs +++ b/OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; -using System.Text; using System.Threading; namespace OpenSim.Framework.Communications { internal class SimpleAsyncResult : IAsyncResult { - private readonly AsyncCallback m_callback; /// @@ -36,7 +33,6 @@ namespace OpenSim.Framework.Communications m_completedSynchronously = 1; } - #region IAsyncResult Members public object AsyncState @@ -45,7 +41,6 @@ namespace OpenSim.Framework.Communications } - public WaitHandle AsyncWaitHandle { get @@ -82,19 +77,18 @@ namespace OpenSim.Framework.Communications get { return Thread.VolatileRead(ref m_completed) == 1; } } - #endregion - #region class Methods + internal void SetAsCompleted(bool completedSynchronously) { m_completed = 1; - if(completedSynchronously) + if (completedSynchronously) m_completedSynchronously = 1; else m_completedSynchronously = 0; - + SignalCompletion(); } @@ -112,9 +106,9 @@ namespace OpenSim.Framework.Communications 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() @@ -125,14 +119,14 @@ namespace OpenSim.Framework.Communications // If the operation isn't done, wait for it AsyncWaitHandle.WaitOne(); AsyncWaitHandle.Close(); - m_waitHandle = null; // Allow early GC + m_waitHandle = null; // Allow early GC } // Operation is done: if an exception occured, throw it if (m_exception != null) throw m_exception; - } + } - #endregion + #endregion } internal class AsyncResult : SimpleAsyncResult @@ -140,10 +134,12 @@ namespace OpenSim.Framework.Communications private T m_result = default(T); 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) { // Save the asynchronous operation's result m_result = result; @@ -153,11 +149,10 @@ namespace OpenSim.Framework.Communications base.SetAsCompleted(completedSynchronously); } - new public T EndInvoke() + public new T EndInvoke() { - base.EndInvoke(); - return m_result; + base.EndInvoke(); + return m_result; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/RestClient/RestClient.cs b/OpenSim/Framework/Communications/RestClient/RestClient.cs index 392669f..ac3a287 100644 --- a/OpenSim/Framework/Communications/RestClient/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient/RestClient.cs @@ -1,12 +1,10 @@ using System; +using System.Collections.Generic; using System.IO; using System.Net; -using System.Web; using System.Text; -using System.Collections.Generic; using System.Threading; - -using OpenSim.Framework.Console; +using System.Web; namespace OpenSim.Framework.Communications { @@ -29,9 +27,10 @@ namespace OpenSim.Framework.Communications /// public class RestClient { + private string realuri; - string realuri; #region member variables + /// /// The base Uri of the web-service e.g. http://www.google.com /// @@ -60,7 +59,7 @@ namespace OpenSim.Framework.Communications /// /// MemoryStream representing the resultiong resource /// - Stream _resource; + private Stream _resource; /// /// WebRequest object, held as a member variable @@ -80,12 +79,12 @@ namespace OpenSim.Framework.Communications /// /// Default time out period /// - const int DefaultTimeout = 10 * 1000; // 10 seconds timeout + private const int DefaultTimeout = 10*1000; // 10 seconds timeout /// /// Default Buffer size of a block requested from the web-server /// - const int BufferSize = 4096; // Read blocks of 4 KB. + private const int BufferSize = 4096; // Read blocks of 4 KB. /// @@ -97,6 +96,7 @@ namespace OpenSim.Framework.Communications #endregion member variables #region constructors + /// /// Instantiate a new RestClient /// @@ -111,7 +111,8 @@ namespace OpenSim.Framework.Communications _lock = new object(); } - object _lock; + private object _lock; + #endregion constructors /// @@ -120,8 +121,8 @@ namespace OpenSim.Framework.Communications /// path entry public void AddResourcePath(string element) { - if(isSlashed(element)) - _pathElements.Add(element.Substring(0, element.Length-1)); + if (isSlashed(element)) + _pathElements.Add(element.Substring(0, element.Length - 1)); else _pathElements.Add(element); } @@ -178,7 +179,7 @@ namespace OpenSim.Framework.Communications /// Build a Uri based on the intial Url, path elements and parameters /// /// fully constructed Uri - Uri buildUri() + private Uri buildUri() { StringBuilder sb = new StringBuilder(); sb.Append(_url); @@ -196,7 +197,8 @@ namespace OpenSim.Framework.Communications { sb.Append("?"); firstElement = false; - } else + } + else sb.Append("&"); sb.Append(kv.Key); @@ -209,7 +211,9 @@ namespace OpenSim.Framework.Communications realuri = sb.ToString(); return new Uri(sb.ToString()); } + #region Async communications with server + /// /// Async method, invoked when a block of data has been received from the service /// @@ -218,13 +222,14 @@ namespace OpenSim.Framework.Communications { try { - Stream s = (Stream)ar.AsyncState; + Stream s = (Stream) ar.AsyncState; int read = s.EndRead(ar); if (read > 0) { _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 //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); @@ -251,12 +256,13 @@ namespace OpenSim.Framework.Communications try { // grab response - WebRequest wr = (WebRequest)ar.AsyncState; - _response = (HttpWebResponse)wr.EndGetResponse(ar); + WebRequest wr = (WebRequest) ar.AsyncState; + _response = (HttpWebResponse) wr.EndGetResponse(ar); // get response stream, and setup async reading 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 // wait until completed, or we timed out @@ -281,6 +287,7 @@ namespace OpenSim.Framework.Communications } } } + #endregion Async communications with server /// @@ -290,17 +297,17 @@ namespace OpenSim.Framework.Communications { lock (_lock) { - _request = (HttpWebRequest)WebRequest.Create(buildUri()); + _request = (HttpWebRequest) WebRequest.Create(buildUri()); _request.KeepAlive = false; _request.ContentType = "application/xml"; _request.Timeout = 200000; _asyncException = null; // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); - _response = (HttpWebResponse)_request.GetResponse(); + _response = (HttpWebResponse) _request.GetResponse(); Stream src = _response.GetResponseStream(); int length = src.Read(_readbuf, 0, BufferSize); - while(length > 0) + while (length > 0) { _resource.Write(_readbuf, 0, length); length = src.Read(_readbuf, 0, BufferSize); @@ -329,7 +336,7 @@ namespace OpenSim.Framework.Communications public Stream Request(Stream src) { - _request = (HttpWebRequest)WebRequest.Create(buildUri()); + _request = (HttpWebRequest) WebRequest.Create(buildUri()); _request.KeepAlive = false; _request.ContentType = "application/xml"; _request.Timeout = 900000; @@ -340,13 +347,13 @@ namespace OpenSim.Framework.Communications src.Seek(0, SeekOrigin.Begin); Stream dst = _request.GetRequestStream(); byte[] buf = new byte[1024]; - int length = src.Read(buf,0, 1024); + int length = src.Read(buf, 0, 1024); while (length > 0) { dst.Write(buf, 0, length); length = src.Read(buf, 0, 1024); } - _response = (HttpWebResponse)_request.GetResponse(); + _response = (HttpWebResponse) _request.GetResponse(); // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); @@ -357,8 +364,8 @@ namespace OpenSim.Framework.Communications return null; } - #region Async Invocation + public IAsyncResult BeginRequest(AsyncCallback callback, object state) { /// @@ -371,7 +378,7 @@ namespace OpenSim.Framework.Communications public Stream EndRequest(IAsyncResult asyncResult) { - AsyncResult ar = (AsyncResult)asyncResult; + AsyncResult ar = (AsyncResult) asyncResult; // Wait for operation to complete, then return result or // throw exception @@ -381,7 +388,7 @@ namespace OpenSim.Framework.Communications private void RequestHelper(Object asyncResult) { // We know that it's really an AsyncResult object - AsyncResult ar = (AsyncResult)asyncResult; + AsyncResult ar = (AsyncResult) asyncResult; try { // Perform the operation; if sucessful set the result @@ -394,6 +401,7 @@ namespace OpenSim.Framework.Communications ar.HandleException(e, false); } } + #endregion Async Invocation } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 006c8ee..cdc3baf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -33,18 +33,15 @@ using System.Reflection; using System.Security.Cryptography; using libsecondlife; using Nwc.XmlRpc; -using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Data; using OpenSim.Framework.Interfaces; - namespace OpenSim.Framework.UserManagement { public abstract class UserManagerBase : IUserService { public UserConfig _config; - Dictionary _plugins = new Dictionary(); + private Dictionary _plugins = new Dictionary(); /// /// 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) { plug.Initialise(); - this._plugins.Add(plug.getName(), plug); - MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); + _plugins.Add(plug.getName(), plug); + MainLog.Instance.Verbose("Userstorage: Added IUserData Interface"); } #region Get UserProfile + /// /// Loads a user profile from a database by UUID /// @@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement } 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) { 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 { - UserProfileData profile = plugin.Value.GetUserByName(fname,lname); + UserProfileData profile = plugin.Value.GetUserByName(fname, lname); profile.currentAgent = getUserAgent(profile.UUID); @@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement } 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,20 +168,24 @@ namespace OpenSim.Framework.UserManagement { foreach (KeyValuePair plugin in _plugins) { - try { + try + { plugin.Value.UpdateUserProfile(data); 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() + ")"); } } - + return false; } #endregion #region Get UserAgent + /// /// Loads a user agent by uuid (not called directly) /// @@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement } 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) { - 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 { - return plugin.Value.GetAgentByName(fname,lname); + return plugin.Value.GetAgentByName(fname, lname); } 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 #region CreateAgent + /// /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB /// @@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement /// The users loginrequest public void CreateAgent(UserProfileData profile, XmlRpcRequest request) { - Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable requestData = (Hashtable) request.Params[0]; UserAgentData agent = new UserAgentData(); @@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement // If user specified additional start, use that if (requestData.ContainsKey("start")) { - string startLoc = ((string)requestData["start"]).Trim(); + string startLoc = ((string) requestData["start"]).Trim(); if (!(startLoc == "last" || startLoc == "home")) { // Format: uri:Ahern&162&213&34 @@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement } catch (Exception) { - } } } @@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement // Current location agent.regionID = new LLUUID(); // Fill in later - agent.currentRegion = new LLUUID(); // Fill in later + agent.currentRegion = new LLUUID(); // Fill in later profile.currentAgent = agent; } @@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement try { plugin.Value.AddNewUserProfile(user); - } catch (Exception e) { @@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement public abstract UserProfileData SetupMasterUser(string firstName, string lastName); public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index efe6ebb..0d48683 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -26,21 +26,18 @@ * */ -using System; -using System.Collections.Generic; -using System.Net; using System.IO; +using System.Net; using System.Text; - -using OpenSim.Framework; +using OpenSim.Framework.Console; namespace OpenSim.Framework.Configuration.HTTP { public class HTTPConfiguration : IGenericConfig { - RemoteConfigSettings remoteConfigSettings; + private RemoteConfigSettings remoteConfigSettings; - XmlConfiguration xmlConfig; + private XmlConfiguration xmlConfig; private string configFileName = ""; @@ -62,8 +59,9 @@ namespace OpenSim.Framework.Configuration.HTTP StringBuilder sb = new StringBuilder(); byte[] buf = new byte[8192]; - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + HttpWebRequest request = + (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); + HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream resStream = response.GetResponseStream(); @@ -78,13 +76,14 @@ namespace OpenSim.Framework.Configuration.HTTP tempString = Encoding.ASCII.GetString(buf, 0, count); sb.Append(tempString); } - } - while (count > 0); + } while (count > 0); LoadDataFromString(sb.ToString()); } 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.LoadData(); } @@ -93,7 +92,6 @@ namespace OpenSim.Framework.Configuration.HTTP public void LoadDataFromString(string data) { xmlConfig.LoadDataFromString(data); - } public string GetAttribute(string attributeName) @@ -114,4 +112,4 @@ namespace OpenSim.Framework.Configuration.HTTP { } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs index 3ac03bb..332066c 100644 --- a/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs +++ b/OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs @@ -26,12 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - -using OpenSim.Framework; - namespace OpenSim.Framework.Configuration.HTTP { public class RemoteConfigSettings @@ -39,24 +33,30 @@ namespace OpenSim.Framework.Configuration.HTTP private ConfigurationMember configMember; public string baseConfigURL = ""; + 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.performConfigurationRetrieve(); } 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) { if (configuration_key == "base_config_url") { - baseConfigURL = (string)configuration_result; + baseConfigURL = (string) configuration_result; } return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index 52db852..152dec5 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs @@ -25,12 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.IO; using System.Xml; -using OpenSim.Framework; - namespace OpenSim.Framework.Configuration { public class XmlConfiguration : IGenericConfig @@ -56,6 +55,7 @@ namespace OpenSim.Framework.Configuration if (configNode.Name != "Config") throw new Exception("Error: Invalid .xml File. first child should be "); } + public void LoadData() { lock (this) @@ -81,7 +81,7 @@ namespace OpenSim.Framework.Configuration if (createdFile) { - this.Commit(); + Commit(); } } } @@ -93,12 +93,13 @@ namespace OpenSim.Framework.Configuration LoadDataToClass(); } + public string GetAttribute(string attributeName) { string result = null; if (configNode.Attributes[attributeName] != null) { - result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; + result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value; } return result; } @@ -107,7 +108,7 @@ namespace OpenSim.Framework.Configuration { if (configNode.Attributes[attributeName] != null) { - ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; + ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; } else { @@ -124,7 +125,7 @@ namespace OpenSim.Framework.Configuration if (!Directory.Exists(Util.configDir())) { Directory.CreateDirectory(Util.configDir()); - } + } doc.Save(fileName); } @@ -134,6 +135,5 @@ namespace OpenSim.Framework.Configuration rootNode = null; doc = null; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Console/AssemblyInfo.cs b/OpenSim/Framework/Console/AssemblyInfo.cs index 7e7c77a..bfad5b7 100644 --- a/OpenSim/Framework/Console/AssemblyInfo.cs +++ b/OpenSim/Framework/Console/AssemblyInfo.cs @@ -27,24 +27,26 @@ */ using System.Reflection; using System.Runtime.InteropServices; + // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. -[assembly: AssemblyTitle("ServerConsole")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ServerConsole")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly : AssemblyTitle("ServerConsole")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("ServerConsole")] +[assembly : AssemblyCopyright("")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // This sets the default COM visibility of types in the assembly to invisible. // If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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 // numbers with the '*' character (the default): -[assembly: AssemblyVersion("1.0.*")] +[assembly : AssemblyVersion("1.0.*")] \ No newline at end of file diff --git a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs index e079202..8eea702 100644 --- a/OpenSim/Framework/Console/ConsoleCallbacksBase.cs +++ b/OpenSim/Framework/Console/ConsoleCallbacksBase.cs @@ -26,10 +26,10 @@ * */ namespace OpenSim.Framework.Console -{ +{ public interface conscmd_callback { void RunCmd(string cmd, string[] cmdparams); void Show(string ShowWhat); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Console/LogBase.cs b/OpenSim/Framework/Console/LogBase.cs index c976e2c..6651e5d 100644 --- a/OpenSim/Framework/Console/LogBase.cs +++ b/OpenSim/Framework/Console/LogBase.cs @@ -26,10 +26,10 @@ * */ using System; +using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Net; -using System.Diagnostics; -using System.Collections.Generic; namespace OpenSim.Framework.Console { @@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console { private object m_syncRoot = new object(); - StreamWriter Log; + private StreamWriter Log; public conscmd_callback cmdparser; public string componentname; private bool m_verbose; @@ -57,7 +57,7 @@ namespace OpenSim.Framework.Console { this.componentname = componentname; this.cmdparser = cmdparser; - this.m_verbose = verbose; + m_verbose = verbose; System.Console.WriteLine("Creating new local console"); if (String.IsNullOrEmpty(LogFile)) @@ -87,8 +87,8 @@ namespace OpenSim.Framework.Console /// an ansii color private ConsoleColor DeriveColor(string input) { - int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; - return (ConsoleColor)colIdx; + int colIdx = (input.ToUpper().GetHashCode()%6) + 9; + return (ConsoleColor) colIdx; } /// @@ -236,7 +236,7 @@ namespace OpenSim.Framework.Console { 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.WriteLine(format, args); Log.Flush(); @@ -306,7 +306,7 @@ namespace OpenSim.Framework.Console public int Read() { int TempInt = System.Console.Read(); - Log.Write((char)TempInt); + Log.Write((char) TempInt); return TempInt; } @@ -359,7 +359,7 @@ namespace OpenSim.Framework.Console { // FIXME: Needs to be better abstracted Log.WriteLine(prompt); - this.Notice(prompt); + Notice(prompt); ConsoleColor oldfg = System.Console.ForegroundColor; System.Console.ForegroundColor = System.Console.BackgroundColor; 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 public string CmdPrompt(string prompt) { - this.Notice(String.Format("{0}: ", prompt)); - return this.ReadLine(); + Notice(String.Format("{0}: ", prompt)); + return ReadLine(); } // 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() { - - string tempstr = this.CmdPrompt(this.componentname + "# "); + string tempstr = CmdPrompt(componentname + "# "); MainLogRunCommand(tempstr); } @@ -436,7 +435,7 @@ namespace OpenSim.Framework.Console Array.Reverse(tempstrarray); Array.Resize(ref tempstrarray, tempstrarray.Length - 1); Array.Reverse(tempstrarray); - string[] cmdparams = (string[])tempstrarray; + string[] cmdparams = (string[]) tempstrarray; try { RunCmd(cmd, cmdparams); @@ -454,7 +453,7 @@ namespace OpenSim.Framework.Console string result = String.Empty; string stacktrace = Environment.StackTrace; - List lines = new List(stacktrace.Split(new string[] { "at " }, StringSplitOptions.None)); + List lines = new List(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None)); if (lines.Count > 4) { @@ -481,4 +480,4 @@ namespace OpenSim.Framework.Console } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Console/MainLog.cs b/OpenSim/Framework/Console/MainLog.cs index 5c1a257..adf566c 100644 --- a/OpenSim/Framework/Console/MainLog.cs +++ b/OpenSim/Framework/Console/MainLog.cs @@ -27,15 +27,14 @@ */ namespace OpenSim.Framework.Console { - public class MainLog { - + public class MainLog + { private static LogBase instance; - - public static LogBase Instance + + public static LogBase Instance { get { return instance; } set { instance = value; } } } - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index bc7225a..a96d9bd 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs @@ -34,18 +34,19 @@ namespace OpenSim.Framework.Data.DB4o /// /// A grid server storage mechanism employing the DB4o database system /// - class DB4oGridData : IGridData + internal class DB4oGridData : IGridData { /// /// The database manager object /// - DB4oGridManager manager; + private DB4oGridManager manager; /// /// Called when the plugin is first loaded (as constructors are not called) /// - public void Initialise() { - manager = new DB4oGridManager("gridserver.yap"); + public void Initialise() + { + manager = new DB4oGridManager("gridserver.yap"); } /// @@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o if (manager.simProfiles.ContainsKey(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); } /// @@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o /// The location the region is logging into (unused in Db4o) /// The shared secret /// Authenticated? - public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { + public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) + { if (manager.simProfiles[uuid].regionRecvKey == key) return true; return false; @@ -160,4 +163,4 @@ namespace OpenSim.Framework.Data.DB4o return null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 9e8a03f..033413a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs @@ -29,23 +29,23 @@ using System; using System.Collections.Generic; using Db4objects.Db4o; using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework.Data.DB4o { /// /// A Database manager for Db4o /// - class DB4oGridManager + internal class DB4oGridManager { /// /// A list of the current regions connected (in-memory cache) /// public Dictionary simProfiles = new Dictionary(); + /// /// Database File Name /// - string dbfl; + private string dbfl; /// /// Creates a new grid storage manager @@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o dbfl = db4odb; IObjectContainer database; database = Db4oFactory.OpenFile(dbfl); - IObjectSet result = database.Get(typeof(RegionProfileData)); + IObjectSet result = database.Get(typeof (RegionProfileData)); // Loads the file into the in-memory cache foreach (RegionProfileData row in result) { @@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o return false; } } - - } /// /// A manager for the DB4o database (user profiles) /// - class DB4oUserManager + internal class DB4oUserManager { /// /// A list of the user profiles (in memory cache) /// public Dictionary userProfiles = new Dictionary(); + /// /// Database filename /// - string dbfl; + private string dbfl; /// /// Initialises a new DB manager @@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o IObjectContainer database; database = Db4oFactory.OpenFile(dbfl); // Load to cache - IObjectSet result = database.Get(typeof(UserProfileData)); + IObjectSet result = database.Get(typeof (UserProfileData)); foreach (UserProfileData row in result) { if (userProfiles.ContainsKey(row.UUID)) @@ -144,7 +143,7 @@ namespace OpenSim.Framework.Data.DB4o /// The profile to update /// true on success, false on fail to persist to db public bool UpdateRecord(UserProfileData record) - { + { if (userProfiles.ContainsKey(record.UUID)) { userProfiles[record.UUID] = record; @@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index b00fd02..c7113bf 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs @@ -28,8 +28,6 @@ using System; using System.IO; using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework; namespace OpenSim.Framework.Data.DB4o { @@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o /// /// The database manager /// - DB4oUserManager manager; + private DB4oUserManager manager; /// /// Artificial constructor called upon plugin load /// public void Initialise() { - manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); + manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap")); } /// @@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o /// A user profile public UserProfileData GetUserByUUID(LLUUID uuid) { - if(manager.userProfiles.ContainsKey(uuid)) + if (manager.userProfiles.ContainsKey(uuid)) return manager.userProfiles[uuid]; return null; } @@ -95,7 +93,7 @@ namespace OpenSim.Framework.Data.DB4o /// The users account ID /// A matching users profile public UserAgentData GetAgentByUUID(LLUUID uuid) - { + { try { return GetUserByUUID(uuid).currentAgent; @@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o { try { - return GetUserByName(fname,lname).currentAgent; + return GetUserByName(fname, lname).currentAgent; } catch (Exception) { @@ -149,7 +147,7 @@ namespace OpenSim.Framework.Data.DB4o Console.WriteLine(e.ToString()); } } - + /// /// Creates a new user profile /// @@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o /// True on success, false on error public bool UpdateUserProfile(UserProfileData user) { - try { + try + { return manager.UpdateRecord(user); - } catch (Exception e) { + } + catch (Exception e) + { Console.WriteLine(e.ToString()); return false; } } - /// /// Creates a new user agent @@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs index 52d09fa..6183b6e 100644 --- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -29,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs index e628882..1946790 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs @@ -185,10 +185,10 @@ namespace OpenSim.Framework.Data.MSSQL byte[] hash = HashProvider.ComputeHash(stream); return false; } + public ReservationData GetReservationAtPoint(uint x, uint y) { return null; } } - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs index 77d29f7..c0b2edf 100644 --- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs +++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs @@ -36,12 +36,12 @@ namespace OpenSim.Framework.Data.MSSQL /// /// A management class for the MS SQL Storage Engine /// - class MSSqlManager + internal class MSSqlManager { /// /// The database connection object /// - IDbConnection dbcon; + private IDbConnection dbcon; /// /// Initialises and creates a new Sql connection and maintains it. @@ -55,7 +55,8 @@ namespace OpenSim.Framework.Data.MSSQL { 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.Open(); @@ -83,14 +84,14 @@ namespace OpenSim.Framework.Data.MSSQL /// A Sql DB Command public IDbCommand Query(string sql, Dictionary parameters) { - SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); + SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand(); dbcommand.CommandText = sql; foreach (KeyValuePair param in parameters) { dbcommand.Parameters.AddWithValue(param.Key, param.Value); } - return (IDbCommand)dbcommand; + return (IDbCommand) dbcommand; } /// @@ -105,42 +106,42 @@ namespace OpenSim.Framework.Data.MSSQL if (reader.Read()) { // Region Main - regionprofile.regionHandle = (ulong)reader["regionHandle"]; - regionprofile.regionName = (string)reader["regionName"]; - regionprofile.UUID = new LLUUID((string)reader["uuid"]); + regionprofile.regionHandle = (ulong) reader["regionHandle"]; + regionprofile.regionName = (string) reader["regionName"]; + regionprofile.UUID = new LLUUID((string) reader["uuid"]); // Secrets - regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; - regionprofile.regionSecret = (string)reader["regionSecret"]; - regionprofile.regionSendKey = (string)reader["regionSendKey"]; + regionprofile.regionRecvKey = (string) reader["regionRecvKey"]; + regionprofile.regionSecret = (string) reader["regionSecret"]; + regionprofile.regionSendKey = (string) reader["regionSendKey"]; // 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.serverIP = (string)reader["serverIP"]; - regionprofile.serverPort = (uint)reader["serverPort"]; - regionprofile.serverURI = (string)reader["serverURI"]; + regionprofile.serverIP = (string) reader["serverIP"]; + regionprofile.serverPort = (uint) reader["serverPort"]; + regionprofile.serverURI = (string) reader["serverURI"]; // Location - regionprofile.regionLocX = (uint)((int)reader["locX"]); - regionprofile.regionLocY = (uint)((int)reader["locY"]); - regionprofile.regionLocZ = (uint)((int)reader["locZ"]); + regionprofile.regionLocX = (uint) ((int) reader["locX"]); + regionprofile.regionLocY = (uint) ((int) reader["locY"]); + regionprofile.regionLocZ = (uint) ((int) reader["locZ"]); // Neighbours - 0 = No Override - regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; - regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; - regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; - regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; + regionprofile.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"]; + regionprofile.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"]; + regionprofile.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"]; + regionprofile.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"]; // Assets - regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; - regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; - regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + regionprofile.regionAssetURI = (string) reader["regionAssetURI"]; + regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; + regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"]; // Userserver - regionprofile.regionUserURI = (string)reader["regionUserURI"]; - regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; - regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; + regionprofile.regionUserURI = (string) reader["regionUserURI"]; + regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"]; + regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"]; } else { @@ -156,12 +157,15 @@ namespace OpenSim.Framework.Data.MSSQL /// Successful? public bool insertRow(RegionProfileData profile) { - string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; - sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; + string sql = + "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 += "(@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);"; Dictionary parameters = new Dictionary(); @@ -208,4 +212,4 @@ namespace OpenSim.Framework.Data.MSSQL return returnval; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs index eeac06c..6846ecf 100644 --- a/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -29,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs index bf895c0..055cd92 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLAssetData.cs @@ -28,18 +28,17 @@ using System; using System.Collections.Generic; -using MySql.Data.MySqlClient; - +using System.Data; using libsecondlife; +using MySql.Data.MySqlClient; using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework.Data.MySQL { - class MySQLAssetData : IAssetProvider + internal class MySQLAssetData : IAssetProvider { - MySQLManager _dbConnection; + private MySQLManager _dbConnection; + #region IAssetProvider Members private void UpgradeAssetsTable(string oldVersion) @@ -58,14 +57,12 @@ namespace OpenSim.Framework.Data.MySQL /// private void TestTables() { - Dictionary tableList = new Dictionary(); tableList["assets"] = null; _dbConnection.GetTableVersion(tableList); UpgradeAssetsTable(tableList["assets"]); - } public AssetBase FetchAsset(LLUUID assetID) @@ -73,21 +70,24 @@ namespace OpenSim.Framework.Data.MySQL AssetBase asset = null; 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); p.Value = assetID.GetBytes(); - using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) + using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (dbReader.Read()) { asset = new AssetBase(); - asset.Data = (byte[])dbReader["data"]; - asset.Description = (string)dbReader["description"]; + asset.Data = (byte[]) dbReader["data"]; + asset.Description = (string) dbReader["description"]; asset.FullID = assetID; - asset.InvType = (sbyte)dbReader["invType"]; - asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; - asset.Name = (string)dbReader["name"]; - asset.Type = (sbyte)dbReader["assetType"]; + asset.InvType = (sbyte) dbReader["invType"]; + asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false; + asset.Name = (string) dbReader["name"]; + asset.Type = (sbyte) dbReader["assetType"]; } } } @@ -96,8 +96,11 @@ namespace OpenSim.Framework.Data.MySQL public void CreateAsset(AssetBase asset) { - MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + - "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); + MySqlCommand cmd = + 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); p.Value = asset.FullID.GetBytes(); cmd.Parameters.AddWithValue("?name", asset.Name); @@ -148,7 +151,7 @@ namespace OpenSim.Framework.Data.MySQL public string Version { - get { return _dbConnection.getVersion(); } + get { return _dbConnection.getVersion(); } } public string Name @@ -158,4 +161,4 @@ namespace OpenSim.Framework.Data.MySQL #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 9876ab1..fdfc61c 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs @@ -25,13 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using System.Data; using System.Security.Cryptography; using System.Text; using libsecondlife; - using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MySQL @@ -59,7 +59,9 @@ namespace OpenSim.Framework.Data.MySQL string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); - database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + database = + new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, + settingPort); } /// @@ -108,7 +110,10 @@ namespace OpenSim.Framework.Data.MySQL param["?xmax"] = xmax.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(); RegionProfileData row; @@ -123,7 +128,6 @@ namespace OpenSim.Framework.Data.MySQL result.Dispose(); return rows.ToArray(); - } } catch (Exception e) @@ -266,7 +270,10 @@ namespace OpenSim.Framework.Data.MySQL Dictionary param = new Dictionary(); param["?x"] = x.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(); ReservationData row = database.readReservationRow(reader); @@ -284,6 +291,4 @@ namespace OpenSim.Framework.Data.MySQL } } } - - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index ded584e..f303a6b 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs @@ -26,13 +26,10 @@ * */ using System; -using System.IO; -using System.Data; using System.Collections.Generic; using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework.Console; using MySql.Data.MySqlClient; +using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MySQL { @@ -59,7 +56,9 @@ namespace OpenSim.Framework.Data.MySQL string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 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); } @@ -99,7 +98,6 @@ namespace OpenSim.Framework.Data.MySQL private void TestTables(MySqlConnection conn) { - Dictionary tableList = new Dictionary(); tableList["inventoryfolders"] = null; @@ -110,6 +108,7 @@ namespace OpenSim.Framework.Data.MySQL UpgradeFoldersTable(tableList["inventoryfolders"]); UpgradeItemsTable(tableList["inventoryitems"]); } + #endregion /// @@ -151,11 +150,13 @@ namespace OpenSim.Framework.Data.MySQL { List items = new List(); - 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()); MySqlDataReader reader = result.ExecuteReader(); - while(reader.Read()) + while (reader.Read()) items.Add(readInventoryItem(reader)); reader.Close(); @@ -183,13 +184,16 @@ namespace OpenSim.Framework.Data.MySQL { 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("?zero", LLUUID.Zero.ToStringHyphenated()); MySqlDataReader reader = result.ExecuteReader(); List items = new List(); - while(reader.Read()) + while (reader.Read()) items.Add(readInventoryFolder(reader)); @@ -218,17 +222,21 @@ namespace OpenSim.Framework.Data.MySQL { 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("?zero", LLUUID.Zero.ToStringHyphenated()); MySqlDataReader reader = result.ExecuteReader(); List items = new List(); - while(reader.Read()) + while (reader.Read()) 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(); result.Dispose(); @@ -254,13 +262,15 @@ namespace OpenSim.Framework.Data.MySQL { 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()); MySqlDataReader reader = result.ExecuteReader(); List items = new List(); - - while(reader.Read()) + + while (reader.Read()) items.Add(readInventoryFolder(reader)); reader.Close(); @@ -288,19 +298,19 @@ namespace OpenSim.Framework.Data.MySQL { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string)reader["inventoryID"]); - item.assetID = new LLUUID((string)reader["assetID"]); - item.assetType = (int)reader["assetType"]; - item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); - item.avatarID = new LLUUID((string)reader["avatarID"]); - item.inventoryName = (string)reader["inventoryName"]; - item.inventoryDescription = (string)reader["inventoryDescription"]; - item.inventoryNextPermissions = (uint)reader["inventoryNextPermissions"]; - item.inventoryCurrentPermissions = (uint)reader["inventoryCurrentPermissions"]; - item.invType = (int)reader["invType"]; - item.creatorsID = new LLUUID((string)reader["creatorID"]); - item.inventoryBasePermissions = (uint)reader["inventoryBasePermissions"]; - item.inventoryEveryOnePermissions = (uint)reader["inventoryEveryOnePermissions"]; + item.inventoryID = new LLUUID((string) reader["inventoryID"]); + item.assetID = new LLUUID((string) reader["assetID"]); + item.assetType = (int) reader["assetType"]; + item.parentFolderID = new LLUUID((string) reader["parentFolderID"]); + item.avatarID = new LLUUID((string) reader["avatarID"]); + item.inventoryName = (string) reader["inventoryName"]; + item.inventoryDescription = (string) reader["inventoryDescription"]; + item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"]; + item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"]; + item.invType = (int) reader["invType"]; + item.creatorsID = new LLUUID((string) reader["creatorID"]); + item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"]; + item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; return item; } catch (MySqlException e) @@ -324,12 +334,13 @@ namespace OpenSim.Framework.Data.MySQL { Dictionary param = new Dictionary(); - 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()); MySqlDataReader reader = result.ExecuteReader(); InventoryItemBase item = null; - if(reader.Read()) + if (reader.Read()) item = readInventoryItem(reader); reader.Close(); @@ -356,12 +367,12 @@ namespace OpenSim.Framework.Data.MySQL try { InventoryFolderBase folder = new InventoryFolderBase(); - folder.agentID = new LLUUID((string)reader["agentID"]); - folder.parentID = new LLUUID((string)reader["parentFolderID"]); - folder.folderID = new LLUUID((string)reader["folderID"]); - folder.name = (string)reader["folderName"]; - folder.type = (short)reader["type"]; - folder.version = (ushort)((int)reader["version"]); + folder.agentID = new LLUUID((string) reader["agentID"]); + folder.parentID = new LLUUID((string) reader["parentFolderID"]); + folder.folderID = new LLUUID((string) reader["folderID"]); + folder.name = (string) reader["folderName"]; + folder.type = (short) reader["type"]; + folder.version = (ushort) ((int) reader["version"]); return folder; } catch (Exception e) @@ -384,7 +395,8 @@ namespace OpenSim.Framework.Data.MySQL { 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()); MySqlDataReader reader = result.ExecuteReader(); @@ -410,8 +422,10 @@ namespace OpenSim.Framework.Data.MySQL /// The inventory 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 "; - sql += "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; + string sql = + "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 { @@ -424,7 +438,8 @@ namespace OpenSim.Framework.Data.MySQL result.Parameters.AddWithValue("?inventoryName", item.inventoryName); result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); 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("?creatorID", item.creatorsID.ToStringHyphenated()); result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); @@ -455,7 +470,8 @@ namespace OpenSim.Framework.Data.MySQL { 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.ExecuteNonQuery(); } @@ -472,7 +488,8 @@ namespace OpenSim.Framework.Data.MySQL /// Folder to create 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)"; MySqlCommand cmd = new MySqlCommand(sql, database.Connection); @@ -480,9 +497,9 @@ namespace OpenSim.Framework.Data.MySQL cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated()); cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); 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); - + try { cmd.ExecuteNonQuery(); @@ -515,7 +532,7 @@ namespace OpenSim.Framework.Data.MySQL foreach (InventoryFolderBase f in subfolderList) folders.Add(f); } - + /// /// Returns all child folders in the hierarchy from the parent folder and down /// @@ -536,7 +553,8 @@ namespace OpenSim.Framework.Data.MySQL { 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.ExecuteNonQuery(); } @@ -551,7 +569,8 @@ namespace OpenSim.Framework.Data.MySQL { 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.ExecuteNonQuery(); } @@ -586,4 +605,4 @@ namespace OpenSim.Framework.Data.MySQL } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs index bfb4b48..e8775a1 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLLogData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLLogData.cs @@ -25,14 +25,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using System; - namespace OpenSim.Framework.Data.MySQL { /// /// An interface to the log database for MySQL /// - class MySQLLogData : ILogData + internal class MySQLLogData : ILogData { /// /// The database manager @@ -52,7 +50,9 @@ namespace OpenSim.Framework.Data.MySQL string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); - database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + database = + new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, + settingPort); } /// @@ -64,7 +64,8 @@ namespace OpenSim.Framework.Data.MySQL /// The arguments passed to the method /// How critical is this? /// The message to log - 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 { @@ -102,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs index 8fcf68b..778da06 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs @@ -25,16 +25,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; -using System.IO; +using System.Collections.Generic; using System.Data; +using System.IO; using System.Reflection; -using System.Collections.Generic; using libsecondlife; - using MySql.Data.MySqlClient; - -using OpenSim.Framework; using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MySQL @@ -42,16 +40,17 @@ namespace OpenSim.Framework.Data.MySQL /// /// A MySQL Database manager /// - class MySQLManager + internal class MySQLManager { /// /// The database connection object /// - MySqlConnection dbcon; + private MySqlConnection dbcon; + /// /// Connection string for ADO.net /// - string connectionString; + private string connectionString; /// /// Initialises and creates a new MySQL connection and maintains it. @@ -61,11 +60,13 @@ namespace OpenSim.Framework.Data.MySQL /// The username logging into the database /// The password for the user logging in /// Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'. - 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 { - 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.Open(); @@ -123,15 +124,17 @@ namespace OpenSim.Framework.Data.MySQL /// A string containing the DB provider public string getVersion() { - System.Reflection.Module module = this.GetType().Module; + Module module = GetType().Module; string dllName = module.Assembly.ManifestModule.Name; 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); } - + /// /// Extract a named string resource from the embedded resources /// @@ -139,7 +142,7 @@ namespace OpenSim.Framework.Data.MySQL /// string contained within the embedded resource private string getResourceString(string name) { - Assembly assem = this.GetType().Assembly; + Assembly assem = GetType().Assembly; string[] names = assem.GetManifestResourceNames(); foreach (string s in names) @@ -173,7 +176,10 @@ namespace OpenSim.Framework.Data.MySQL { 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); using (MySqlDataReader tables = tablesCmd.ExecuteReader()) { @@ -181,9 +187,9 @@ namespace OpenSim.Framework.Data.MySQL { try { - string tableName = (string)tables["TABLE_NAME"]; - string comment = (string)tables["TABLE_COMMENT"]; - if(tableList.ContainsKey(tableName)) + string tableName = (string) tables["TABLE_NAME"]; + string comment = (string) tables["TABLE_COMMENT"]; + if (tableList.ContainsKey(tableName)) tableList[tableName] = comment; } catch (Exception e) @@ -198,7 +204,7 @@ namespace OpenSim.Framework.Data.MySQL // at some time this code should be cleaned up - + /// /// Runs a query with protection against SQL Injection by using parameterised input. /// @@ -209,14 +215,14 @@ namespace OpenSim.Framework.Data.MySQL { try { - MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); + MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); dbcommand.CommandText = sql; foreach (KeyValuePair param in parameters) { dbcommand.Parameters.AddWithValue(param.Key, param.Value); } - return (IDbCommand)dbcommand; + return (IDbCommand) dbcommand; } catch { @@ -227,7 +233,9 @@ namespace OpenSim.Framework.Data.MySQL { dbcon.Close(); } - catch { } + catch + { + } // Try reopen it try @@ -243,14 +251,14 @@ namespace OpenSim.Framework.Data.MySQL // Run the query again try { - MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); + MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand(); dbcommand.CommandText = sql; foreach (KeyValuePair param in parameters) { dbcommand.Parameters.AddWithValue(param.Key, param.Value); } - return (IDbCommand)dbcommand; + return (IDbCommand) dbcommand; } catch (Exception e) { @@ -275,20 +283,20 @@ namespace OpenSim.Framework.Data.MySQL { // Region Main retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); - retval.regionName = (string)reader["regionName"]; - retval.UUID = new LLUUID((string)reader["uuid"]); + retval.regionName = (string) reader["regionName"]; + retval.UUID = new LLUUID((string) reader["uuid"]); // Secrets - retval.regionRecvKey = (string)reader["regionRecvKey"]; - retval.regionSecret = (string)reader["regionSecret"]; - retval.regionSendKey = (string)reader["regionSendKey"]; + retval.regionRecvKey = (string) reader["regionRecvKey"]; + retval.regionSecret = (string) reader["regionSecret"]; + retval.regionSendKey = (string) reader["regionSendKey"]; // 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.serverIP = (string)reader["serverIP"]; - retval.serverPort = (uint)reader["serverPort"]; - retval.serverURI = (string)reader["serverURI"]; + retval.serverIP = (string) reader["serverIP"]; + retval.serverPort = (uint) reader["serverPort"]; + retval.serverURI = (string) reader["serverURI"]; retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); @@ -304,14 +312,14 @@ namespace OpenSim.Framework.Data.MySQL retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); // Assets - retval.regionAssetURI = (string)reader["regionAssetURI"]; - retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; - retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + retval.regionAssetURI = (string) reader["regionAssetURI"]; + retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; + retval.regionAssetSendKey = (string) reader["regionAssetSendKey"]; // Userserver - retval.regionUserURI = (string)reader["regionUserURI"]; - retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; - retval.regionUserSendKey = (string)reader["regionUserSendKey"]; + retval.regionUserURI = (string) reader["regionUserURI"]; + retval.regionUserRecvKey = (string) reader["regionUserRecvKey"]; + retval.regionUserSendKey = (string) reader["regionUserSendKey"]; // World Map Addition string tempRegionMap = reader["regionMapTexture"].ToString(); @@ -341,17 +349,16 @@ namespace OpenSim.Framework.Data.MySQL ReservationData retval = new ReservationData(); if (reader.Read()) { - retval.gridRecvKey = (string)reader["gridRecvKey"]; - retval.gridSendKey = (string)reader["gridSendKey"]; - retval.reservationCompany = (string)reader["resCompany"]; + retval.gridRecvKey = (string) reader["gridRecvKey"]; + retval.gridSendKey = (string) reader["gridSendKey"]; + retval.reservationCompany = (string) reader["resCompany"]; retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); retval.reservationMinX = Convert.ToInt32(reader["resXMin"].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.userUUID = new LLUUID((string)reader["userUUID"]); - + retval.userUUID = new LLUUID((string) reader["userUUID"]); } else { @@ -359,6 +366,7 @@ namespace OpenSim.Framework.Data.MySQL } return retval; } + /// /// Reads an agent row from a database reader /// @@ -371,12 +379,12 @@ namespace OpenSim.Framework.Data.MySQL if (reader.Read()) { // Agent IDs - retval.UUID = new LLUUID((string)reader["UUID"]); - retval.sessionID = new LLUUID((string)reader["sessionID"]); - retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); + retval.UUID = new LLUUID((string) reader["UUID"]); + retval.sessionID = new LLUUID((string) reader["sessionID"]); + retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]); // Agent Who? - retval.agentIP = (string)reader["agentIP"]; + retval.agentIP = (string) reader["agentIP"]; retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); @@ -385,9 +393,9 @@ namespace OpenSim.Framework.Data.MySQL retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); // Current position - retval.currentRegion = (string)reader["currentRegion"]; + retval.currentRegion = (string) reader["currentRegion"]; retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); - LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); + LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos); } else { @@ -407,12 +415,12 @@ namespace OpenSim.Framework.Data.MySQL if (reader.Read()) { - retval.UUID = new LLUUID((string)reader["UUID"]); - retval.username = (string)reader["username"]; - retval.surname = (string)reader["lastname"]; + retval.UUID = new LLUUID((string) reader["UUID"]); + retval.username = (string) reader["username"]; + retval.surname = (string) reader["lastname"]; - retval.passwordHash = (string)reader["passwordHash"]; - retval.passwordSalt = (string)reader["passwordSalt"]; + retval.passwordHash = (string) reader["passwordHash"]; + retval.passwordSalt = (string) reader["passwordSalt"]; retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); retval.homeLocation = new LLVector3( @@ -427,18 +435,17 @@ namespace OpenSim.Framework.Data.MySQL retval.created = Convert.ToInt32(reader["created"].ToString()); retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); - retval.userInventoryURI = (string)reader["userInventoryURI"]; - retval.userAssetURI = (string)reader["userAssetURI"]; + retval.userInventoryURI = (string) reader["userInventoryURI"]; + retval.userAssetURI = (string) reader["userAssetURI"]; retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); - retval.profileAboutText = (string)reader["profileAboutText"]; - retval.profileFirstText = (string)reader["profileFirstText"]; - - retval.profileImage = new LLUUID((string)reader["profileImage"]); - retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]); + retval.profileAboutText = (string) reader["profileAboutText"]; + retval.profileFirstText = (string) reader["profileFirstText"]; + retval.profileImage = new LLUUID((string) reader["profileImage"]); + retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]); } else { @@ -448,7 +455,6 @@ namespace OpenSim.Framework.Data.MySQL } - /// /// Inserts a new row into the log database /// @@ -459,7 +465,8 @@ namespace OpenSim.Framework.Data.MySQL /// How critical is this? /// Extra message info /// Saved successfully? - 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 "; sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; @@ -493,89 +500,97 @@ namespace OpenSim.Framework.Data.MySQL } - /// - /// Creates a new user and inserts it into the database - /// - /// User ID - /// First part of the login - /// Second part of the login - /// A salted hash of the users password - /// The salt used for the password hash - /// A regionHandle of the users home region - /// Home region position vector - /// Home region position vector - /// Home region position vector - /// Home region 'look at' vector - /// Home region 'look at' vector - /// Home region 'look at' vector - /// Account created (unix timestamp) - /// Last login (unix timestamp) - /// Users inventory URI - /// Users asset URI - /// I can do mask - /// I want to do mask - /// Profile text - /// Firstlife text - /// UUID for profile image - /// UUID for firstlife image - /// Success? - public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, - float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, - libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) - { - string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; - sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; - sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; - sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; - - sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; - sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; - sql += "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; - sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; - - Dictionary parameters = new Dictionary(); - parameters["?UUID"] = uuid.ToStringHyphenated(); - parameters["?username"] = username.ToString(); - parameters["?lastname"] = lastname.ToString(); - parameters["?passwordHash"] = passwordHash.ToString(); - parameters["?passwordSalt"] = passwordSalt.ToString(); - parameters["?homeRegion"] = homeRegion.ToString(); - parameters["?homeLocationX"] = homeLocX.ToString(); - parameters["?homeLocationY"] = homeLocY.ToString(); - parameters["?homeLocationZ"] = homeLocZ.ToString(); - parameters["?homeLookAtX"] = homeLookAtX.ToString(); - parameters["?homeLookAtY"] = homeLookAtY.ToString(); - parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); - parameters["?created"] = created.ToString(); - parameters["?lastLogin"] = lastlogin.ToString(); - parameters["?userInventoryURI"] = ""; - parameters["?userAssetURI"] = ""; - parameters["?profileCanDoMask"] = "0"; - parameters["?profileWantDoMask"] = "0"; - parameters["?profileAboutText"] = ""; - parameters["?profileFirstText"] = ""; - parameters["?profileImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); - parameters["?profileFirstImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); - - bool returnval = false; - - try - { - IDbCommand result = Query(sql, parameters); - - if (result.ExecuteNonQuery() == 1) - returnval = true; - - result.Dispose(); - } - catch (Exception e) - { - MainLog.Instance.Error(e.ToString()); - return false; - } - - return returnval; - } + /// + /// Creates a new user and inserts it into the database + /// + /// User ID + /// First part of the login + /// Second part of the login + /// A salted hash of the users password + /// The salt used for the password hash + /// A regionHandle of the users home region + /// Home region position vector + /// Home region position vector + /// Home region position vector + /// Home region 'look at' vector + /// Home region 'look at' vector + /// Home region 'look at' vector + /// Account created (unix timestamp) + /// Last login (unix timestamp) + /// Users inventory URI + /// Users asset URI + /// I can do mask + /// I want to do mask + /// Profile text + /// Firstlife text + /// UUID for profile image + /// UUID for firstlife image + /// Success? + public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash, + string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, + 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`, "; + sql += + "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; + sql += + "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; + sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; + + sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; + sql += + "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; + sql += + "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; + sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; + + Dictionary parameters = new Dictionary(); + parameters["?UUID"] = uuid.ToStringHyphenated(); + parameters["?username"] = username.ToString(); + parameters["?lastname"] = lastname.ToString(); + parameters["?passwordHash"] = passwordHash.ToString(); + parameters["?passwordSalt"] = passwordSalt.ToString(); + parameters["?homeRegion"] = homeRegion.ToString(); + parameters["?homeLocationX"] = homeLocX.ToString(); + parameters["?homeLocationY"] = homeLocY.ToString(); + parameters["?homeLocationZ"] = homeLocZ.ToString(); + parameters["?homeLookAtX"] = homeLookAtX.ToString(); + parameters["?homeLookAtY"] = homeLookAtY.ToString(); + parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); + parameters["?created"] = created.ToString(); + parameters["?lastLogin"] = lastlogin.ToString(); + parameters["?userInventoryURI"] = ""; + parameters["?userAssetURI"] = ""; + parameters["?profileCanDoMask"] = "0"; + parameters["?profileWantDoMask"] = "0"; + parameters["?profileAboutText"] = ""; + parameters["?profileFirstText"] = ""; + parameters["?profileImage"] = LLUUID.Zero.ToStringHyphenated(); + parameters["?profileFirstImage"] = LLUUID.Zero.ToStringHyphenated(); + + bool returnval = false; + + try + { + IDbCommand result = Query(sql, parameters); + + if (result.ExecuteNonQuery() == 1) + returnval = true; + + result.Dispose(); + } + catch (Exception e) + { + MainLog.Instance.Error(e.ToString()); + return false; + } + + return returnval; + } /// @@ -585,13 +600,18 @@ namespace OpenSim.Framework.Data.MySQL /// Success? public bool insertRegion(RegionProfileData regiondata) { - string sql = "REPLACE INTO regions (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, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; + string sql = + "REPLACE INTO regions (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, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; sql += "(?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, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; + sql += + "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; + sql += + "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; Dictionary parameters = new Dictionary(); @@ -626,7 +646,6 @@ namespace OpenSim.Framework.Data.MySQL try { - IDbCommand result = Query(sql, parameters); //Console.WriteLine(result.CommandText); @@ -646,4 +665,4 @@ namespace OpenSim.Framework.Data.MySQL return returnval; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs index 27c9cf6..8846650 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLUserData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLUserData.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Data; using libsecondlife; -using OpenSim.Framework; using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.MySQL @@ -37,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL /// /// A database interface class to a user profile storage system /// - class MySQLUserData : IUserData + internal class MySQLUserData : IUserData { /// /// Database manager for MySQL @@ -59,7 +58,9 @@ namespace OpenSim.Framework.Data.MySQL string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); - database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); + database = + new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, + settingPort); } /// @@ -88,11 +89,12 @@ namespace OpenSim.Framework.Data.MySQL param["?first"] = user; 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(); UserProfileData row = database.readUserRow(reader); - + reader.Close(); result.Dispose(); @@ -201,21 +203,25 @@ namespace OpenSim.Framework.Data.MySQL /// The user profile to create public void AddNewUserProfile(UserProfileData user) { - try - { - 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, - 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) - { - database.Reconnect(); - MainLog.Instance.Error(e.ToString()); - } - + try + { + 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, + 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) + { + database.Reconnect(); + MainLog.Instance.Error(e.ToString()); + } } /// @@ -226,8 +232,8 @@ namespace OpenSim.Framework.Data.MySQL { // Do nothing. } - - + + public bool UpdateUserProfile(UserProfileData user) { return true; @@ -277,4 +283,4 @@ namespace OpenSim.Framework.Data.MySQL return "0.1"; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs index 46c0ae0..7024bfa 100644 --- a/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -29,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs index 75bb53d..6693c98 100644 --- a/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -29,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs index a85ab4d..4187078 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs @@ -26,15 +26,11 @@ * */ using System; -using System.IO; -using libsecondlife; -using OpenSim.Framework; using System.Data; -using System.Data.SqlTypes; +using System.Reflection; +using libsecondlife; using Mono.Data.SqliteClient; using OpenSim.Framework.Console; -using OpenSim.Framework; -using OpenSim.Framework.Interfaces; namespace OpenSim.Framework.Data.SQLite { @@ -46,11 +42,11 @@ namespace OpenSim.Framework.Data.SQLite /// /// The database manager /// - /// /// Artificial constructor called upon plugin load /// private const string assetSelect = "select * from assets"; + private DataSet ds; private SqliteDataAdapter da; @@ -58,13 +54,14 @@ namespace OpenSim.Framework.Data.SQLite { SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3"); TestTables(conn); - + ds = new DataSet(); da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); - lock (ds) { + lock (ds) + { ds.Tables.Add(createAssetsTable()); - + setupAssetCommands(da, conn); try { @@ -75,11 +72,11 @@ namespace OpenSim.Framework.Data.SQLite MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); } } - + return; } - public AssetBase FetchAsset(LLUUID uuid) + public AssetBase FetchAsset(LLUUID uuid) { AssetBase asset = new AssetBase(); DataRow row = ds.Tables["assets"].Rows.Find(uuid); @@ -92,27 +89,28 @@ namespace OpenSim.Framework.Data.SQLite return null; } } - - public void CreateAsset(AssetBase asset) + + public void CreateAsset(AssetBase asset) { // no difference for now UpdateAsset(asset); } - - public void UpdateAsset(AssetBase asset) + + public void UpdateAsset(AssetBase asset) { LogAssetLoad(asset); DataTable assets = ds.Tables["assets"]; - lock(ds) { + lock (ds) + { DataRow row = assets.Rows.Find(asset.FullID); - if (row == null) + if (row == null) { row = assets.NewRow(); fillAssetRow(row, asset); assets.Rows.Add(row); } - else + else { fillAssetRow(row, asset); } @@ -124,9 +122,10 @@ namespace OpenSim.Framework.Data.SQLite string temporary = asset.Temporary ? "Temporary" : "Stored"; string local = asset.Local ? "Local" : "Remote"; - MainLog.Instance.Verbose("ASSETSTORAGE", - 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) ); + MainLog.Instance.Verbose("ASSETSTORAGE", + 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)); } public bool ExistsAsset(LLUUID uuid) @@ -137,23 +136,26 @@ namespace OpenSim.Framework.Data.SQLite public void DeleteAsset(LLUUID uuid) { - lock (ds) { + lock (ds) + { DataRow row = ds.Tables["assets"].Rows.Find(uuid); - if (row != null) { + if (row != null) + { row.Delete(); } } } - + public void CommitAssets() // force a sync to the database { MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); - lock (ds) { + lock (ds) + { da.Update(ds, "assets"); ds.AcceptChanges(); } } - + /*********************************************************************** * * Database Definition Functions @@ -161,24 +163,24 @@ namespace OpenSim.Framework.Data.SQLite * This should be db agnostic as we define them in ADO.NET terms * **********************************************************************/ - + private DataTable createAssetsTable() { DataTable assets = new DataTable("assets"); - createCol(assets, "UUID", typeof(System.String)); - createCol(assets, "Name", typeof(System.String)); - createCol(assets, "Description", typeof(System.String)); - createCol(assets, "Type", typeof(System.Int32)); - createCol(assets, "InvType", typeof(System.Int32)); - createCol(assets, "Local", typeof(System.Boolean)); - createCol(assets, "Temporary", typeof(System.Boolean)); - createCol(assets, "Data", typeof(System.Byte[])); + createCol(assets, "UUID", typeof (String)); + createCol(assets, "Name", typeof (String)); + createCol(assets, "Description", typeof (String)); + createCol(assets, "Type", typeof (Int32)); + createCol(assets, "InvType", typeof (Int32)); + createCol(assets, "Local", typeof (Boolean)); + createCol(assets, "Temporary", typeof (Boolean)); + createCol(assets, "Data", typeof (Byte[])); // Add in contraints - assets.PrimaryKey = new DataColumn[] { assets.Columns["UUID"] }; + assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]}; return assets; } - + /*********************************************************************** * * Convert between ADO.NET <=> OpenSim Objects @@ -193,19 +195,19 @@ namespace OpenSim.Framework.Data.SQLite // interesting has to be done to actually get these values // back out. Not enough time to figure it out yet. AssetBase asset = new AssetBase(); - - asset.FullID = new LLUUID((String)row["UUID"]); - asset.Name = (String)row["Name"]; - asset.Description = (String)row["Description"]; + + asset.FullID = new LLUUID((String) row["UUID"]); + asset.Name = (String) row["Name"]; + asset.Description = (String) row["Description"]; asset.Type = Convert.ToSByte(row["Type"]); asset.InvType = Convert.ToSByte(row["InvType"]); asset.Local = Convert.ToBoolean(row["Local"]); asset.Temporary = Convert.ToBoolean(row["Temporary"]); - asset.Data = (byte[])row["Data"]; + asset.Data = (byte[]) row["Data"]; return asset; } - + private void fillAssetRow(DataRow row, AssetBase asset) { row["UUID"] = asset.FullID; @@ -225,8 +227,10 @@ namespace OpenSim.Framework.Data.SQLite row["Data"] = asset.Data; // ADO.NET doesn't handle NULL very well - foreach (DataColumn col in ds.Tables["assets"].Columns) { - if (row[col] == null) { + foreach (DataColumn col in ds.Tables["assets"].Columns) + { + if (row[col] == null) + { row[col] = ""; } } @@ -250,18 +254,18 @@ namespace OpenSim.Framework.Data.SQLite da.UpdateCommand.Connection = conn; 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; da.DeleteCommand = delete; } - + private void InitDB(SqliteConnection conn) { string createAssets = defineTable(createAssetsTable()); SqliteCommand pcmd = new SqliteCommand(createAssets, conn); conn.Open(); pcmd.ExecuteNonQuery(); - conn.Close(); + conn.Close(); } private bool TestTables(SqliteConnection conn) @@ -269,9 +273,12 @@ namespace OpenSim.Framework.Data.SQLite SqliteCommand cmd = new SqliteCommand(assetSelect, conn); SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); DataSet tmpDS = new DataSet(); - try { + try + { pDa.Fill(tmpDS, "assets"); - } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { + } + catch (SqliteSyntaxException) + { MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); InitDB(conn); } @@ -279,14 +286,18 @@ namespace OpenSim.Framework.Data.SQLite } #region IPlugin interface - public string Version { + + public string Version + { get { - System.Reflection.Module module = this.GetType().Module; + Module module = GetType().Module; string dllName = module.Assembly.ManifestModule.Name; 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", ""); } - public string Name { + public string Name + { get { return "SQLite Asset storage engine"; } } + #endregion } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs index 4f237fd..157b4e6 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteBase.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteBase.cs @@ -26,13 +26,8 @@ * */ using System; -using System.IO; -using libsecondlife; -using OpenSim.Framework; using System.Data; -using System.Data.SqlTypes; using Mono.Data.SqliteClient; -using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite { @@ -48,8 +43,8 @@ namespace OpenSim.Framework.Data.SQLite * This should be db agnostic as we define them in ADO.NET terms * **********************************************************************/ - - 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); dt.Columns.Add(col); @@ -77,7 +72,8 @@ namespace OpenSim.Framework.Data.SQLite * generate these strings instead of typing them out. */ 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]; cols[i] = col.ColumnName; } @@ -92,7 +88,7 @@ namespace OpenSim.Framework.Data.SQLite // this provides the binding for all our parameters, so // much less code than it used to be - foreach (DataColumn col in dt.Columns) + foreach (DataColumn col in dt.Columns) { cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); } @@ -106,7 +102,8 @@ namespace OpenSim.Framework.Data.SQLite foreach (DataColumn col in dt.Columns) { if (subsql.Length > 0) - { // a map function would rock so much here + { + // a map function would rock so much here subsql += ", "; } subsql += col.ColumnName + "= :" + col.ColumnName; @@ -118,7 +115,7 @@ namespace OpenSim.Framework.Data.SQLite // this provides the binding for all our parameters, so // much less code than it used to be - foreach (DataColumn col in dt.Columns) + foreach (DataColumn col in dt.Columns) { cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); } @@ -133,11 +130,12 @@ namespace OpenSim.Framework.Data.SQLite foreach (DataColumn col in dt.Columns) { if (subsql.Length > 0) - { // a map function would rock so much here + { + // a map function would rock so much here subsql += ",\n"; } subsql += col.ColumnName + " " + sqliteType(col.DataType); - if(col == dt.PrimaryKey[0]) + if (col == dt.PrimaryKey[0]) { subsql += " primary key"; } @@ -167,7 +165,7 @@ namespace OpenSim.Framework.Data.SQLite /// for us. /// ///a built sqlite parameter - protected static SqliteParameter createSqliteParameter(string name, System.Type type) + protected static SqliteParameter createSqliteParameter(string name, Type type) { SqliteParameter param = new SqliteParameter(); param.ParameterName = ":" + name; @@ -182,53 +180,87 @@ namespace OpenSim.Framework.Data.SQLite * Type conversion functions * **********************************************************************/ - + protected static DbType dbtypeFromType(Type type) { - if (type == typeof(System.String)) { + if (type == typeof (String)) + { return DbType.String; - } else if (type == typeof(System.Int32)) { + } + else if (type == typeof (Int32)) + { return DbType.Int32; - } else if (type == typeof(System.UInt32)) { + } + else if (type == typeof (UInt32)) + { return DbType.UInt32; - } else if (type == typeof(System.Int64)) { + } + else if (type == typeof (Int64)) + { return DbType.Int64; - } else if (type == typeof(System.UInt64)) { + } + else if (type == typeof (UInt64)) + { return DbType.UInt64; - } else if (type == typeof(System.Double)) { + } + else if (type == typeof (Double)) + { return DbType.Double; - } else if (type == typeof(System.Boolean)) { + } + else if (type == typeof (Boolean)) + { return DbType.Boolean; - } else if (type == typeof(System.Byte[])) { + } + else if (type == typeof (Byte[])) + { return DbType.Binary; - } else { + } + else + { return DbType.String; } } - + // this is something we'll need to implement for each db // slightly differently. protected static string sqliteType(Type type) { - if (type == typeof(System.String)) { + if (type == typeof (String)) + { return "varchar(255)"; - } else if (type == typeof(System.Int32)) { + } + else if (type == typeof (Int32)) + { return "integer"; - } else if (type == typeof(System.UInt32)) { + } + else if (type == typeof (UInt32)) + { return "integer"; - } else if (type == typeof(System.Int64)) { + } + else if (type == typeof (Int64)) + { return "varchar(255)"; - } else if (type == typeof(System.UInt64)) { + } + else if (type == typeof (UInt64)) + { return "varchar(255)"; - } else if (type == typeof(System.Double)) { + } + else if (type == typeof (Double)) + { return "float"; - } else if (type == typeof(System.Boolean)) { + } + else if (type == typeof (Boolean)) + { return "integer"; - } else if (type == typeof(System.Byte[])) { + } + else if (type == typeof (Byte[])) + { return "blob"; - } else { + } + else + { return "string"; } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs index 2fc80b4..8f3e8aa 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteGridData.cs @@ -192,4 +192,4 @@ namespace OpenSim.Framework.Data.SQLite return null; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs index 82a8434..5e95878 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs @@ -28,22 +28,14 @@ using System; using System.Collections.Generic; -using System.Text; +using System.Data; using System.Reflection; - -using OpenSim.Framework.Console; -using OpenSim.Framework; -using OpenSim.Framework; using libsecondlife; - -using System.Data; -using System.Data.SqlTypes; - using Mono.Data.SqliteClient; +using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite { - public class SQLiteInventoryStore : SQLiteBase, IInventoryData { private const string invItemsSelect = "select * from inventoryitems"; @@ -96,14 +88,14 @@ namespace OpenSim.Framework.Data.SQLite public InventoryItemBase buildItem(DataRow row) { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string)row["UUID"]); - item.assetID = new LLUUID((string)row["assetID"]); + item.inventoryID = new LLUUID((string) row["UUID"]); + item.assetID = new LLUUID((string) row["assetID"]); item.assetType = Convert.ToInt32(row["assetType"]); item.invType = Convert.ToInt32(row["invType"]); - item.parentFolderID = new LLUUID((string)row["parentFolderID"]); - item.avatarID = new LLUUID((string)row["avatarID"]); - item.creatorsID = new LLUUID((string)row["creatorsID"]); - item.inventoryName =(string) row["inventoryName"]; + item.parentFolderID = new LLUUID((string) row["parentFolderID"]); + item.avatarID = new LLUUID((string) row["avatarID"]); + item.creatorsID = new LLUUID((string) row["creatorsID"]); + item.inventoryName = (string) row["inventoryName"]; item.inventoryDescription = (string) row["inventoryDescription"]; item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); @@ -147,7 +139,7 @@ namespace OpenSim.Framework.Data.SQLite fillFolderRow(inventoryRow, folder); } - this.invFoldersDa.Update(ds, "inventoryfolders"); + invFoldersDa.Update(ds, "inventoryfolders"); } private void addItem(InventoryItemBase item) @@ -165,7 +157,7 @@ namespace OpenSim.Framework.Data.SQLite { fillItemRow(inventoryRow, item); } - this.invItemsDa.Update(ds, "inventoryitems"); + invItemsDa.Update(ds, "inventoryitems"); } public void Shutdown() @@ -195,12 +187,14 @@ namespace OpenSim.Framework.Data.SQLite /// A string containing the plugin version public string getVersion() { - System.Reflection.Module module = this.GetType().Module; + Module module = GetType().Module; string dllName = module.Assembly.ManifestModule.Name; 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); } /// @@ -306,7 +300,7 @@ namespace OpenSim.Framework.Data.SQLite List folders = new List(); getInventoryFolders(ref folders, parentID); - for(int i=0; iA class containing folder information public InventoryFolderBase getInventoryFolder(LLUUID folder) { - - // TODO: Deep voodoo here. If you enable this code then - // multi region breaks. No idea why, but I figured it was - // better to leave multi region at this point. It does mean - // that you don't get to see system textures why creating - // clothes and the like. :( - - DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); - if (row != null) { + // TODO: Deep voodoo here. If you enable this code then + // multi region breaks. No idea why, but I figured it was + // better to leave multi region at this point. It does mean + // that you don't get to see system textures why creating + // clothes and the like. :( + + DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); + if (row != null) + { return buildFolder(row); - } else { + } + else + { return null; - } + } } /// @@ -355,7 +354,7 @@ namespace OpenSim.Framework.Data.SQLite /// The item to be created public void addInventoryItem(InventoryItemBase item) { - this.addItem(item); + addItem(item); } /// @@ -364,7 +363,7 @@ namespace OpenSim.Framework.Data.SQLite /// The updated item public void updateInventoryItem(InventoryItemBase item) { - this.addItem(item); + addItem(item); } /// @@ -376,12 +375,12 @@ namespace OpenSim.Framework.Data.SQLite DataTable inventoryItemTable = ds.Tables["inventoryitems"]; DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID); - if (inventoryRow != null) - { - inventoryRow.Delete(); - } + if (inventoryRow != null) + { + inventoryRow.Delete(); + } - this.invItemsDa.Update(ds, "inventoryitems"); + invItemsDa.Update(ds, "inventoryitems"); } @@ -394,7 +393,7 @@ namespace OpenSim.Framework.Data.SQLite { List items = getInventoryInFolder(folderId); - foreach(InventoryItemBase i in items) + foreach (InventoryItemBase i in items) deleteInventoryItem(i.inventoryID); } @@ -404,7 +403,7 @@ namespace OpenSim.Framework.Data.SQLite /// The inventory folder public void addInventoryFolder(InventoryFolderBase folder) { - this.addFolder(folder); + addFolder(folder); } /// @@ -413,7 +412,7 @@ namespace OpenSim.Framework.Data.SQLite /// The inventory folder public void updateInventoryFolder(InventoryFolderBase folder) { - this.addFolder(folder); + addFolder(folder); } @@ -427,7 +426,7 @@ namespace OpenSim.Framework.Data.SQLite public void deleteInventoryFolder(LLUUID folderID) { List subFolders = getFolderHierarchy(folderID); - + DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; DataRow inventoryRow; @@ -450,7 +449,7 @@ namespace OpenSim.Framework.Data.SQLite inventoryRow.Delete(); } - this.invFoldersDa.Update(ds, "inventoryfolders"); + invFoldersDa.Update(ds, "inventoryfolders"); } /*********************************************************************** @@ -458,43 +457,43 @@ namespace OpenSim.Framework.Data.SQLite * Data Table definitions * **********************************************************************/ - + private static DataTable createInventoryItemsTable() { DataTable inv = new DataTable("inventoryitems"); - - createCol(inv, "UUID", typeof(System.String)); //inventoryID - createCol(inv, "assetID", typeof(System.String)); - createCol(inv, "assetType", typeof(System.Int32)); - createCol(inv, "invType", typeof(System.Int32)); - createCol(inv, "parentFolderID", typeof(System.String)); - createCol(inv, "avatarID", typeof(System.String)); - createCol(inv, "creatorsID", typeof(System.String)); - - createCol(inv, "inventoryName", typeof(System.String)); - createCol(inv, "inventoryDescription", typeof(System.String)); + + createCol(inv, "UUID", typeof (String)); //inventoryID + createCol(inv, "assetID", typeof (String)); + createCol(inv, "assetType", typeof (Int32)); + createCol(inv, "invType", typeof (Int32)); + createCol(inv, "parentFolderID", typeof (String)); + createCol(inv, "avatarID", typeof (String)); + createCol(inv, "creatorsID", typeof (String)); + + createCol(inv, "inventoryName", typeof (String)); + createCol(inv, "inventoryDescription", typeof (String)); // permissions - createCol(inv, "inventoryNextPermissions", typeof(System.Int32)); - createCol(inv, "inventoryCurrentPermissions", typeof(System.Int32)); - createCol(inv, "inventoryBasePermissions", typeof(System.Int32)); - createCol(inv, "inventoryEveryOnePermissions", typeof(System.Int32)); - - inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; + createCol(inv, "inventoryNextPermissions", typeof (Int32)); + createCol(inv, "inventoryCurrentPermissions", typeof (Int32)); + createCol(inv, "inventoryBasePermissions", typeof (Int32)); + createCol(inv, "inventoryEveryOnePermissions", typeof (Int32)); + + inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]}; return inv; } - + private DataTable createInventoryFoldersTable() { DataTable fol = new DataTable("inventoryfolders"); - - createCol(fol, "UUID", typeof(System.String)); //folderID - createCol(fol, "name", typeof(System.String)); - createCol(fol, "agentID", typeof(System.String)); - createCol(fol, "parentID", typeof(System.String)); - createCol(fol, "type", typeof(System.Int32)); - createCol(fol, "version", typeof(System.Int32)); - - fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; + + createCol(fol, "UUID", typeof (String)); //folderID + createCol(fol, "name", typeof (String)); + createCol(fol, "agentID", typeof (String)); + createCol(fol, "parentID", typeof (String)); + createCol(fol, "type", typeof (Int32)); + createCol(fol, "version", typeof (Int32)); + + fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]}; return fol; } @@ -507,7 +506,7 @@ namespace OpenSim.Framework.Data.SQLite da.UpdateCommand.Connection = conn; 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; da.DeleteCommand = delete; } @@ -521,7 +520,7 @@ namespace OpenSim.Framework.Data.SQLite da.UpdateCommand.Connection = conn; 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; da.DeleteCommand = delete; } @@ -529,10 +528,10 @@ namespace OpenSim.Framework.Data.SQLite private InventoryFolderBase buildFolder(DataRow row) { InventoryFolderBase folder = new InventoryFolderBase(); - folder.folderID = new LLUUID((string)row["UUID"]); - folder.name = (string)row["name"]; - folder.agentID = new LLUUID((string)row["agentID"]); - folder.parentID = new LLUUID((string)row["parentID"]); + folder.folderID = new LLUUID((string) row["UUID"]); + folder.name = (string) row["name"]; + folder.agentID = new LLUUID((string) row["agentID"]); + folder.parentID = new LLUUID((string) row["parentID"]); folder.type = Convert.ToInt16(row["type"]); folder.version = Convert.ToUInt16(row["version"]); return folder; @@ -554,17 +553,18 @@ namespace OpenSim.Framework.Data.SQLite * Test and Initialization code * **********************************************************************/ + private void InitDB(SqliteConnection conn) { string createInventoryItems = defineTable(createInventoryItemsTable()); string createInventoryFolders = defineTable(createInventoryFoldersTable()); - + SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); conn.Open(); pcmd.ExecuteNonQuery(); scmd.ExecuteNonQuery(); - conn.Close(); + conn.Close(); } private bool TestTables(SqliteConnection conn) @@ -575,10 +575,13 @@ namespace OpenSim.Framework.Data.SQLite SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd); DataSet tmpDS = new DataSet(); - try { + try + { pDa.Fill(tmpDS, "inventoryitems"); sDa.Fill(tmpDS, "inventoryfolders"); - } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { + } + catch (SqliteSyntaxException) + { MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); InitDB(conn); } @@ -586,14 +589,18 @@ namespace OpenSim.Framework.Data.SQLite pDa.Fill(tmpDS, "inventoryitems"); sDa.Fill(tmpDS, "inventoryfolders"); - foreach (DataColumn col in createInventoryItemsTable().Columns) { - if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName) ) { + foreach (DataColumn col in createInventoryItemsTable().Columns) + { + if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) + { MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); return false; } } - foreach (DataColumn col in createInventoryFoldersTable().Columns) { - if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName) ) { + foreach (DataColumn col in createInventoryFoldersTable().Columns) + { + if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName)) + { MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); return false; } @@ -601,8 +608,4 @@ namespace OpenSim.Framework.Data.SQLite return true; } } -} - - - - +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs index 5954fba..e102da3 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteManager.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteManager.cs @@ -30,13 +30,14 @@ using System.Collections.Generic; using System.Data; using System.Data.SQLite; using libsecondlife; +using Mono.Data.SqliteClient; using OpenSim.Framework.Console; namespace OpenSim.Framework.Data.SQLite { - class SQLiteManager : SQLiteBase + internal class SQLiteManager : SQLiteBase { - IDbConnection dbcon; + private IDbConnection dbcon; /// /// Initialises and creates a new SQLite connection and maintains it. @@ -78,15 +79,15 @@ namespace OpenSim.Framework.Data.SQLite /// A SQLite DB Command public IDbCommand Query(string sql, Dictionary parameters) { - SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); + SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand(); dbcommand.CommandText = sql; foreach (KeyValuePair param in parameters) { - SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); + SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value); dbcommand.Parameters.Add(paramx); } - return (IDbCommand)dbcommand; + return (IDbCommand) dbcommand; } private bool TestTables(SQLiteConnection conn) @@ -98,7 +99,7 @@ namespace OpenSim.Framework.Data.SQLite { pDa.Fill(tmpDS, "regions"); } - catch (Mono.Data.SqliteClient.SqliteSyntaxException) + catch (SqliteSyntaxException) { MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); InitDB(conn); @@ -110,39 +111,39 @@ namespace OpenSim.Framework.Data.SQLite { DataTable regions = new DataTable("regions"); - createCol(regions, "regionHandle", typeof(ulong)); - createCol(regions, "regionName", typeof(System.String)); - createCol(regions, "uuid", typeof(System.String)); - - createCol(regions, "regionRecvKey", typeof(System.String)); - createCol(regions, "regionSecret", typeof(System.String)); - createCol(regions, "regionSendKey", typeof(System.String)); - - createCol(regions, "regionDataURI", typeof(System.String)); - createCol(regions, "serverIP", typeof(System.String)); - createCol(regions, "serverPort", typeof(System.String)); - createCol(regions, "serverURI", typeof(System.String)); - - - createCol(regions, "locX", typeof( uint)); - createCol(regions, "locY", typeof( uint)); - createCol(regions, "locZ", typeof( uint)); - - createCol(regions, "eastOverrideHandle", typeof( ulong )); - createCol(regions, "westOverrideHandle", typeof( ulong )); - createCol(regions, "southOverrideHandle", typeof( ulong )); - createCol(regions, "northOverrideHandle", typeof( ulong )); - - createCol(regions, "regionAssetURI", typeof(System.String)); - createCol(regions, "regionAssetRecvKey", typeof(System.String)); - createCol(regions, "regionAssetSendKey", typeof(System.String)); - - createCol(regions, "regionUserURI", typeof(System.String)); - createCol(regions, "regionUserRecvKey", typeof(System.String)); - createCol(regions, "regionUserSendKey", typeof(System.String)); + createCol(regions, "regionHandle", typeof (ulong)); + createCol(regions, "regionName", typeof (String)); + createCol(regions, "uuid", typeof (String)); + + createCol(regions, "regionRecvKey", typeof (String)); + createCol(regions, "regionSecret", typeof (String)); + createCol(regions, "regionSendKey", typeof (String)); + + createCol(regions, "regionDataURI", typeof (String)); + createCol(regions, "serverIP", typeof (String)); + createCol(regions, "serverPort", typeof (String)); + createCol(regions, "serverURI", typeof (String)); + + + createCol(regions, "locX", typeof (uint)); + createCol(regions, "locY", typeof (uint)); + createCol(regions, "locZ", typeof (uint)); + + createCol(regions, "eastOverrideHandle", typeof (ulong)); + createCol(regions, "westOverrideHandle", typeof (ulong)); + createCol(regions, "southOverrideHandle", typeof (ulong)); + createCol(regions, "northOverrideHandle", typeof (ulong)); + + createCol(regions, "regionAssetURI", typeof (String)); + createCol(regions, "regionAssetRecvKey", typeof (String)); + createCol(regions, "regionAssetSendKey", typeof (String)); + + createCol(regions, "regionUserURI", typeof (String)); + createCol(regions, "regionUserRecvKey", typeof (String)); + createCol(regions, "regionUserSendKey", typeof (String)); // Add in contraints - regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; + regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]}; return regions; } @@ -168,42 +169,42 @@ namespace OpenSim.Framework.Data.SQLite if (reader.Read()) { // Region Main - retval.regionHandle = (ulong)reader["regionHandle"]; - retval.regionName = (string)reader["regionName"]; - retval.UUID = new LLUUID((string)reader["uuid"]); + retval.regionHandle = (ulong) reader["regionHandle"]; + retval.regionName = (string) reader["regionName"]; + retval.UUID = new LLUUID((string) reader["uuid"]); // Secrets - retval.regionRecvKey = (string)reader["regionRecvKey"]; - retval.regionSecret = (string)reader["regionSecret"]; - retval.regionSendKey = (string)reader["regionSendKey"]; + retval.regionRecvKey = (string) reader["regionRecvKey"]; + retval.regionSecret = (string) reader["regionSecret"]; + retval.regionSendKey = (string) reader["regionSendKey"]; // 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.serverIP = (string)reader["serverIP"]; - retval.serverPort = (uint)reader["serverPort"]; - retval.serverURI = (string)reader["serverURI"]; + retval.serverIP = (string) reader["serverIP"]; + retval.serverPort = (uint) reader["serverPort"]; + retval.serverURI = (string) reader["serverURI"]; // Location - retval.regionLocX = (uint)((int)reader["locX"]); - retval.regionLocY = (uint)((int)reader["locY"]); - retval.regionLocZ = (uint)((int)reader["locZ"]); + retval.regionLocX = (uint) ((int) reader["locX"]); + retval.regionLocY = (uint) ((int) reader["locY"]); + retval.regionLocZ = (uint) ((int) reader["locZ"]); // Neighbours - 0 = No Override - retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; - retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; - retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; - retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; + retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"]; + retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"]; + retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"]; + retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"]; // Assets - retval.regionAssetURI = (string)reader["regionAssetURI"]; - retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; - retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; + retval.regionAssetURI = (string) reader["regionAssetURI"]; + retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"]; + retval.regionAssetSendKey = (string) reader["regionAssetSendKey"]; // Userserver - retval.regionUserURI = (string)reader["regionUserURI"]; - retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; - retval.regionUserSendKey = (string)reader["regionUserSendKey"]; + retval.regionUserURI = (string) reader["regionUserURI"]; + retval.regionUserRecvKey = (string) reader["regionUserRecvKey"]; + retval.regionUserSendKey = (string) reader["regionUserSendKey"]; } else { @@ -219,12 +220,15 @@ namespace OpenSim.Framework.Data.SQLite /// Success? public bool insertRow(RegionProfileData profile) { - string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; - sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; + string sql = + "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 += "(@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);"; Dictionary parameters = new Dictionary(); @@ -271,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite return returnval; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs index 37a8be5..d7a6b39 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteUserData.cs @@ -26,12 +26,8 @@ * */ using System; -using System.IO; -using libsecondlife; -using OpenSim.Framework; -using OpenSim.Framework; using System.Data; -using System.Data.SqlTypes; +using libsecondlife; using Mono.Data.SqliteClient; using OpenSim.Framework.Console; @@ -45,30 +41,31 @@ namespace OpenSim.Framework.Data.SQLite /// /// The database manager /// - /// /// Artificial constructor called upon plugin load /// private const string userSelect = "select * from users"; + private DataSet ds; private SqliteDataAdapter da; - + public void Initialise() { SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); TestTables(conn); - + ds = new DataSet(); da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); - lock (ds) { + lock (ds) + { ds.Tables.Add(createUsersTable()); ds.Tables.Add(createUserAgentsTable()); - + setupUserCommands(da, conn); da.Fill(ds.Tables["users"]); } - + return; } @@ -79,16 +76,21 @@ namespace OpenSim.Framework.Data.SQLite /// A user profile public UserProfileData GetUserByUUID(LLUUID uuid) { - lock (ds) { + lock (ds) + { DataRow row = ds.Tables["users"].Rows.Find(uuid); - if(row != null) { + if (row != null) + { UserProfileData user = buildUserProfile(row); row = ds.Tables["useragents"].Rows.Find(uuid); - if(row != null) { + if (row != null) + { user.currentAgent = buildUserAgent(row); } return user; - } else { + } + else + { return null; } } @@ -113,16 +115,21 @@ namespace OpenSim.Framework.Data.SQLite public UserProfileData GetUserByName(string fname, string lname) { string select = "surname = '" + lname + "' and username = '" + fname + "'"; - lock (ds) { + lock (ds) + { DataRow[] rows = ds.Tables["users"].Select(select); - if(rows.Length > 0) { + if (rows.Length > 0) + { UserProfileData user = buildUserProfile(rows[0]); DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID); - if(row != null) { + if (row != null) + { user.currentAgent = buildUserAgent(row); } return user; - } else { + } + else + { return null; } } @@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data.SQLite /// The users account ID /// A matching users profile public UserAgentData GetAgentByUUID(LLUUID uuid) - { + { try { return GetUserByUUID(uuid).currentAgent; @@ -165,7 +172,7 @@ namespace OpenSim.Framework.Data.SQLite { try { - return GetUserByName(fname,lname).currentAgent; + return GetUserByName(fname, lname).currentAgent; } catch (Exception) { @@ -180,8 +187,9 @@ namespace OpenSim.Framework.Data.SQLite public void AddNewUserProfile(UserProfileData user) { DataTable users = ds.Tables["users"]; - lock (ds) { - DataRow row = users.Rows.Find(user.UUID); + lock (ds) + { + DataRow row = users.Rows.Find(user.UUID); if (row == null) { row = users.NewRow(); @@ -192,10 +200,11 @@ namespace OpenSim.Framework.Data.SQLite { fillUserRow(row, user); } - - if(user.currentAgent != null) { + + if (user.currentAgent != null) + { DataTable ua = ds.Tables["useragents"]; - row = ua.Rows.Find(user.UUID); + row = ua.Rows.Find(user.UUID); if (row == null) { row = ua.NewRow(); @@ -207,12 +216,13 @@ namespace OpenSim.Framework.Data.SQLite 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 da.Update(ds, "users"); } } - + /// /// Creates a new user profile /// @@ -220,10 +230,13 @@ namespace OpenSim.Framework.Data.SQLite /// True on success, false on error public bool UpdateUserProfile(UserProfileData user) { - try { + try + { AddNewUserProfile(user); return true; - } catch (Exception) { + } + catch (Exception) + { return false; } } @@ -279,51 +292,51 @@ namespace OpenSim.Framework.Data.SQLite { return "0.1"; } - + /*********************************************************************** * * DataTable creation * **********************************************************************/ - /*********************************************************************** + /*********************************************************************** * * Database Definition Functions * * This should be db agnostic as we define them in ADO.NET terms * **********************************************************************/ - + private DataTable createUsersTable() { DataTable users = new DataTable("users"); - createCol(users, "UUID", typeof(System.String)); - createCol(users, "username", typeof(System.String)); - createCol(users, "surname", typeof(System.String)); - createCol(users, "passwordHash", typeof(System.String)); - createCol(users, "passwordSalt", typeof(System.String)); - - createCol(users, "homeRegionX", typeof(System.Int32)); - createCol(users, "homeRegionY", typeof(System.Int32)); - createCol(users, "homeLocationX", typeof(System.Double)); - createCol(users, "homeLocationY", typeof(System.Double)); - createCol(users, "homeLocationZ", typeof(System.Double)); - createCol(users, "homeLookAtX", typeof(System.Double)); - createCol(users, "homeLookAtY", typeof(System.Double)); - createCol(users, "homeLookAtZ", typeof(System.Double)); - createCol(users, "created", typeof(System.Int32)); - createCol(users, "lastLogin", typeof(System.Int32)); - createCol(users, "rootInventoryFolderID", typeof(System.String)); - createCol(users, "userInventoryURI", typeof(System.String)); - createCol(users, "userAssetURI", typeof(System.String)); - createCol(users, "profileCanDoMask", typeof(System.Int32)); - createCol(users, "profileWantDoMask", typeof(System.Int32)); - createCol(users, "profileAboutText", typeof(System.String)); - createCol(users, "profileFirstText", typeof(System.String)); - createCol(users, "profileImage", typeof(System.String)); - createCol(users, "profileFirstImage", typeof(System.String)); + createCol(users, "UUID", typeof (String)); + createCol(users, "username", typeof (String)); + createCol(users, "surname", typeof (String)); + createCol(users, "passwordHash", typeof (String)); + createCol(users, "passwordSalt", typeof (String)); + + createCol(users, "homeRegionX", typeof (Int32)); + createCol(users, "homeRegionY", typeof (Int32)); + createCol(users, "homeLocationX", typeof (Double)); + createCol(users, "homeLocationY", typeof (Double)); + createCol(users, "homeLocationZ", typeof (Double)); + createCol(users, "homeLookAtX", typeof (Double)); + createCol(users, "homeLookAtY", typeof (Double)); + createCol(users, "homeLookAtZ", typeof (Double)); + createCol(users, "created", typeof (Int32)); + createCol(users, "lastLogin", typeof (Int32)); + createCol(users, "rootInventoryFolderID", typeof (String)); + createCol(users, "userInventoryURI", typeof (String)); + createCol(users, "userAssetURI", typeof (String)); + createCol(users, "profileCanDoMask", typeof (Int32)); + createCol(users, "profileWantDoMask", typeof (Int32)); + createCol(users, "profileAboutText", typeof (String)); + createCol(users, "profileFirstText", typeof (String)); + createCol(users, "profileImage", typeof (String)); + createCol(users, "profileFirstImage", typeof (String)); // Add in contraints - users.PrimaryKey = new DataColumn[] { users.Columns["UUID"] }; + users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]}; return users; } @@ -331,27 +344,27 @@ namespace OpenSim.Framework.Data.SQLite { DataTable ua = new DataTable("useragents"); // this is the UUID of the user - createCol(ua, "UUID", typeof(System.String)); - createCol(ua, "agentIP", typeof(System.String)); - createCol(ua, "agentPort", typeof(System.Int32)); - createCol(ua, "agentOnline", typeof(System.Boolean)); - createCol(ua, "sessionID", typeof(System.String)); - createCol(ua, "secureSessionID", typeof(System.String)); - createCol(ua, "regionID", typeof(System.String)); - createCol(ua, "loginTime", typeof(System.Int32)); - createCol(ua, "logoutTime", typeof(System.Int32)); - createCol(ua, "currentRegion", typeof(System.String)); - createCol(ua, "currentHandle", typeof(System.Int32)); + createCol(ua, "UUID", typeof (String)); + createCol(ua, "agentIP", typeof (String)); + createCol(ua, "agentPort", typeof (Int32)); + createCol(ua, "agentOnline", typeof (Boolean)); + createCol(ua, "sessionID", typeof (String)); + createCol(ua, "secureSessionID", typeof (String)); + createCol(ua, "regionID", typeof (String)); + createCol(ua, "loginTime", typeof (Int32)); + createCol(ua, "logoutTime", typeof (Int32)); + createCol(ua, "currentRegion", typeof (String)); + createCol(ua, "currentHandle", typeof (Int32)); // vectors - createCol(ua, "currentPosX", typeof(System.Double)); - createCol(ua, "currentPosY", typeof(System.Double)); - createCol(ua, "currentPosZ", typeof(System.Double)); + createCol(ua, "currentPosX", typeof (Double)); + createCol(ua, "currentPosY", typeof (Double)); + createCol(ua, "currentPosZ", typeof (Double)); // constraints - ua.PrimaryKey = new DataColumn[] { ua.Columns["UUID"] }; + ua.PrimaryKey = new DataColumn[] {ua.Columns["UUID"]}; return ua; } - + /*********************************************************************** * * Convert between ADO.NET <=> OpenSim Objects @@ -366,35 +379,35 @@ namespace OpenSim.Framework.Data.SQLite // interesting has to be done to actually get these values // back out. Not enough time to figure it out yet. UserProfileData user = new UserProfileData(); - user.UUID = new LLUUID((String)row["UUID"]); - user.username = (String)row["username"]; - user.surname = (String)row["surname"]; - user.passwordHash = (String)row["passwordHash"]; - user.passwordSalt = (String)row["passwordSalt"]; + user.UUID = new LLUUID((String) row["UUID"]); + user.username = (String) row["username"]; + user.surname = (String) row["surname"]; + user.passwordHash = (String) row["passwordHash"]; + user.passwordSalt = (String) row["passwordSalt"]; user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); user.homeLocation = new LLVector3( - Convert.ToSingle(row["homeLocationX"]), - Convert.ToSingle(row["homeLocationY"]), - Convert.ToSingle(row["homeLocationZ"]) - ); + Convert.ToSingle(row["homeLocationX"]), + Convert.ToSingle(row["homeLocationY"]), + Convert.ToSingle(row["homeLocationZ"]) + ); user.homeLookAt = new LLVector3( - Convert.ToSingle(row["homeLookAtX"]), - Convert.ToSingle(row["homeLookAtY"]), - Convert.ToSingle(row["homeLookAtZ"]) - ); + Convert.ToSingle(row["homeLookAtX"]), + Convert.ToSingle(row["homeLookAtY"]), + Convert.ToSingle(row["homeLookAtZ"]) + ); user.created = Convert.ToInt32(row["created"]); user.lastLogin = Convert.ToInt32(row["lastLogin"]); - user.rootInventoryFolderID = new LLUUID((String)row["rootInventoryFolderID"]); - user.userInventoryURI = (String)row["userInventoryURI"]; - user.userAssetURI = (String)row["userAssetURI"]; + user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]); + user.userInventoryURI = (String) row["userInventoryURI"]; + user.userAssetURI = (String) row["userAssetURI"]; user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); - user.profileAboutText = (String)row["profileAboutText"]; - user.profileFirstText = (String)row["profileFirstText"]; - user.profileImage = new LLUUID((String)row["profileImage"]); - user.profileFirstImage = new LLUUID((String)row["profileFirstImage"]); + user.profileAboutText = (String) row["profileAboutText"]; + user.profileFirstText = (String) row["profileFirstText"]; + user.profileImage = new LLUUID((String) row["profileImage"]); + user.profileFirstImage = new LLUUID((String) row["profileFirstImage"]); return user; } @@ -405,8 +418,8 @@ namespace OpenSim.Framework.Data.SQLite row["surname"] = user.surname; row["passwordHash"] = user.passwordHash; row["passwordSalt"] = user.passwordSalt; - - + + row["homeRegionX"] = user.homeRegionX; row["homeRegionY"] = user.homeRegionY; row["homeLocationX"] = user.homeLocation.X; @@ -427,10 +440,12 @@ namespace OpenSim.Framework.Data.SQLite row["profileFirstText"] = user.profileFirstText; row["profileImage"] = user.profileImage; row["profileFirstImage"] = user.profileFirstImage; - + // ADO.NET doesn't handle NULL very well - foreach (DataColumn col in ds.Tables["users"].Columns) { - if (row[col] == null) { + foreach (DataColumn col in ds.Tables["users"].Columns) + { + if (row[col] == null) + { row[col] = ""; } } @@ -439,33 +454,33 @@ namespace OpenSim.Framework.Data.SQLite private UserAgentData buildUserAgent(DataRow row) { UserAgentData ua = new UserAgentData(); - - ua.UUID = new LLUUID((String)row["UUID"]); - ua.agentIP = (String)row["agentIP"]; + + ua.UUID = new LLUUID((String) row["UUID"]); + ua.agentIP = (String) row["agentIP"]; ua.agentPort = Convert.ToUInt32(row["agentPort"]); ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); - ua.sessionID = new LLUUID((String)row["sessionID"]); - ua.secureSessionID = new LLUUID((String)row["secureSessionID"]); - ua.regionID = new LLUUID((String)row["regionID"]); + ua.sessionID = new LLUUID((String) row["sessionID"]); + ua.secureSessionID = new LLUUID((String) row["secureSessionID"]); + ua.regionID = new LLUUID((String) row["regionID"]); ua.loginTime = Convert.ToInt32(row["loginTime"]); 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.currentPos = new LLVector3( - Convert.ToSingle(row["currentPosX"]), - Convert.ToSingle(row["currentPosY"]), - Convert.ToSingle(row["currentPosZ"]) - ); + Convert.ToSingle(row["currentPosX"]), + Convert.ToSingle(row["currentPosY"]), + Convert.ToSingle(row["currentPosZ"]) + ); return ua; } private void fillUserAgentRow(DataRow row, UserAgentData ua) { row["UUID"] = ua.UUID; - row["agentIP"] = ua.agentIP; - row["agentPort"] = ua.agentPort; - row["agentOnline"] = ua.agentOnline; - row["sessionID"] = ua.sessionID; + row["agentIP"] = ua.agentIP; + row["agentPort"] = ua.agentPort; + row["agentOnline"] = ua.agentOnline; + row["sessionID"] = ua.sessionID; row["secureSessionID"] = ua.secureSessionID; row["regionID"] = ua.regionID; row["loginTime"] = ua.loginTime; @@ -496,18 +511,18 @@ namespace OpenSim.Framework.Data.SQLite da.UpdateCommand.Connection = conn; 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; da.DeleteCommand = delete; } - + private void InitDB(SqliteConnection conn) { string createUsers = defineTable(createUsersTable()); SqliteCommand pcmd = new SqliteCommand(createUsers, conn); conn.Open(); pcmd.ExecuteNonQuery(); - conn.Close(); + conn.Close(); } private bool TestTables(SqliteConnection conn) @@ -515,14 +530,16 @@ namespace OpenSim.Framework.Data.SQLite SqliteCommand cmd = new SqliteCommand(userSelect, conn); SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); DataSet tmpDS = new DataSet(); - try { + try + { pDa.Fill(tmpDS, "users"); - } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { + } + catch (SqliteSyntaxException) + { MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); InitDB(conn); } return true; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/GridData.cs b/OpenSim/Framework/Data/GridData.cs index 2a5b8f6..b3b6ed7 100644 --- a/OpenSim/Framework/Data/GridData.cs +++ b/OpenSim/Framework/Data/GridData.cs @@ -106,6 +106,5 @@ namespace OpenSim.Framework.Data DataResponse AddProfile(RegionProfileData profile); ReservationData GetReservationAtPoint(uint x, uint y); - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/ILogData.cs b/OpenSim/Framework/Data/ILogData.cs index b222a28..373d8e1 100644 --- a/OpenSim/Framework/Data/ILogData.cs +++ b/OpenSim/Framework/Data/ILogData.cs @@ -63,7 +63,9 @@ namespace OpenSim.Framework.Data /// 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); + /// /// Initialises the interface /// @@ -86,5 +88,4 @@ namespace OpenSim.Framework.Data /// A string containing the plugin version string getVersion(); } - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/IniConfig.cs b/OpenSim/Framework/Data/IniConfig.cs index f0f63b4..048b491 100644 --- a/OpenSim/Framework/Data/IniConfig.cs +++ b/OpenSim/Framework/Data/IniConfig.cs @@ -27,6 +27,7 @@ */ using System.IO; using System.Text.RegularExpressions; + /* Taken from public code listing at by Alex Pinsker http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html @@ -52,7 +53,8 @@ namespace OpenSim.Framework.Data RegexOptions.Compiled | RegexOptions.CultureInvariant); } - static private Regex _iniKeyValuePatternRegex; + + private static Regex _iniKeyValuePatternRegex; public IniFile(string iniFileName) { @@ -62,7 +64,7 @@ namespace OpenSim.Framework.Data public string ParseFileReadValue(string key) { using (StreamReader reader = - new StreamReader(_iniFileName)) + new StreamReader(_iniFileName)) { do { @@ -72,18 +74,16 @@ namespace OpenSim.Framework.Data if (match.Success) { string currentKey = - match.Groups["Key"].Value as string; + match.Groups["Key"].Value as string; if (currentKey != null && - currentKey.Trim().CompareTo(key) == 0) + currentKey.Trim().CompareTo(key) == 0) { string value = - match.Groups["Value"].Value as string; + match.Groups["Value"].Value as string; return value; } } - - } - while (reader.Peek() != -1); + } while (reader.Peek() != -1); } return null; } @@ -91,6 +91,8 @@ namespace OpenSim.Framework.Data public string IniFileName { get { return _iniFileName; } - } private string _iniFileName; + } + + private string _iniFileName; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs index 556d589..51050d1 100644 --- a/OpenSim/Framework/Data/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.Data")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.Framework.Data")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.Framework.Data")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.Framework.Data")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // 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: // @@ -29,5 +33,6 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // 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")] \ No newline at end of file diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs index 5e5dac6..ab8771a 100644 --- a/OpenSim/Framework/Data/RegionProfileData.cs +++ b/OpenSim/Framework/Data/RegionProfileData.cs @@ -25,11 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; -using Nwc.XmlRpc; using System; using System.Collections; +using libsecondlife; +using Nwc.XmlRpc; namespace OpenSim.Framework.Data { @@ -57,6 +57,7 @@ namespace OpenSim.Framework.Data /// Coordinates of the region /// public uint regionLocX; + public uint regionLocY; public uint regionLocZ; // Reserved (round-robin, layers, etc) @@ -65,6 +66,7 @@ namespace OpenSim.Framework.Data /// /// Not very secure, needs improvement. public string regionSendKey = ""; + public string regionRecvKey = ""; public string regionSecret = ""; @@ -77,6 +79,7 @@ namespace OpenSim.Framework.Data /// Information about the server that the region is currently hosted on /// public string serverIP = ""; + public uint serverPort; public string serverURI = ""; @@ -88,6 +91,7 @@ namespace OpenSim.Framework.Data /// Set of optional overrides. Can be used to create non-eulicidean spaces. /// public ulong regionNorthOverrideHandle; + public ulong regionSouthOverrideHandle; public ulong regionEastOverrideHandle; public ulong regionWestOverrideHandle; @@ -102,6 +106,7 @@ namespace OpenSim.Framework.Data /// Region Asset Details /// public string regionAssetURI = ""; + public string regionAssetSendKey = ""; public string regionAssetRecvKey = ""; @@ -109,6 +114,7 @@ namespace OpenSim.Framework.Data /// Region Userserver Details /// public string regionUserURI = ""; + public string regionUserSendKey = ""; public string regionUserRecvKey = ""; @@ -124,7 +130,8 @@ namespace OpenSim.Framework.Data /// /// /// - 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(); requestData["region_uuid"] = region_uuid.UUID.ToString(); @@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); - Hashtable responseData = (Hashtable)GridResp.Value; + Hashtable responseData = (Hashtable) GridResp.Value; if (responseData.ContainsKey("error")) { @@ -142,21 +149,23 @@ namespace OpenSim.Framework.Data } RegionProfileData simData = new RegionProfileData(); - simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); - simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); - simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); - simData.serverIP = (string)responseData["sim_ip"]; - simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); - simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); - simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); + simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); + simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); + simData.serverIP = (string) responseData["sim_ip"]; + simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); + simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); + simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; - simData.UUID = new LLUUID((string)responseData["region_UUID"]); - simData.regionName = (string)responseData["region_name"]; + simData.UUID = new LLUUID((string) responseData["region_UUID"]); + 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(); requestData["region_handle"] = region_handle.ToString(); @@ -166,7 +175,7 @@ namespace OpenSim.Framework.Data XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); - Hashtable responseData = (Hashtable)GridResp.Value; + Hashtable responseData = (Hashtable) GridResp.Value; if (responseData.ContainsKey("error")) { @@ -174,19 +183,19 @@ namespace OpenSim.Framework.Data } RegionProfileData simData = new RegionProfileData(); - simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); - simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); - simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); - simData.serverIP = (string)responseData["sim_ip"]; - simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); - simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); - simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); + simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); + simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); + simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); + simData.serverIP = (string) responseData["sim_ip"]; + simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); + simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); + simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; - simData.UUID = new LLUUID((string)responseData["region_UUID"]); - simData.regionName = (string)responseData["region_name"]; + simData.UUID = new LLUUID((string) responseData["region_UUID"]); + simData.regionName = (string) responseData["region_name"]; - return simData; + return simData; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Data/ReservationData.cs b/OpenSim/Framework/Data/ReservationData.cs index 1e606ee..06adf04 100644 --- a/OpenSim/Framework/Data/ReservationData.cs +++ b/OpenSim/Framework/Data/ReservationData.cs @@ -36,7 +36,7 @@ namespace OpenSim.Framework.Data public int reservationMinY = 0; public int reservationMaxX = 65536; public int reservationMaxY = 65536; - + public string reservationName = ""; public string reservationCompany = ""; public bool status = true; @@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data public string gridSendKey = ""; public string gridRecvKey = ""; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/ACL.cs b/OpenSim/Framework/General/ACL.cs index 348f0ae..0e9df19 100644 --- a/OpenSim/Framework/General/ACL.cs +++ b/OpenSim/Framework/General/ACL.cs @@ -27,7 +27,6 @@ */ using System; using System.Collections.Generic; -using System.Text; namespace OpenSim.Framework { @@ -37,15 +36,15 @@ namespace OpenSim.Framework // permissions rather than just the first. Deny permissions will // override all others. - #region ACL Core Class + /// /// Access Control List Engine /// public class ACL { - Dictionary Roles = new Dictionary(); - Dictionary Resources = new Dictionary(); + private Dictionary Roles = new Dictionary(); + private Dictionary Resources = new Dictionary(); public ACL AddRole(Role role) { @@ -114,9 +113,11 @@ namespace OpenSim.Framework return this; } } + #endregion #region Exceptions + /// /// Thrown when an ACL attempts to add a duplicate role. /// @@ -139,6 +140,7 @@ namespace OpenSim.Framework return "This ACL already contains a role called '" + m_role.Name + "'."; } } + #endregion #region Roles and Resources @@ -146,7 +148,12 @@ namespace OpenSim.Framework /// /// Does this Role have permission to access a specified Resource? /// - public enum Permission { Deny, None, Allow }; + public enum Permission + { + Deny, + None, + Allow + } ; /// /// A role class, for use with Users or Groups @@ -227,7 +234,7 @@ namespace OpenSim.Framework #region Tests - class ACLTester + internal class ACLTester { public ACLTester() { @@ -249,9 +256,8 @@ namespace OpenSim.Framework acl.GrantPermission("Guests", "CanBuild"); acl.HasPermission("JoeGuest", "CanBuild"); - } } #endregion -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentCircuitManager.cs b/OpenSim/Framework/General/AgentCircuitManager.cs index 578cc67..3658feb 100644 --- a/OpenSim/Framework/General/AgentCircuitManager.cs +++ b/OpenSim/Framework/General/AgentCircuitManager.cs @@ -27,8 +27,6 @@ */ using System.Collections.Generic; using libsecondlife; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework { @@ -38,15 +36,14 @@ namespace OpenSim.Framework public AgentCircuitManager() { - } public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) { AgentCircuitData validcircuit = null; - if (this.AgentCircuits.ContainsKey(circuitcode)) + if (AgentCircuits.ContainsKey(circuitcode)) { - validcircuit = this.AgentCircuits[circuitcode]; + validcircuit = AgentCircuits[circuitcode]; } AuthenticateResponse user = new AuthenticateResponse(); if (validcircuit == null) @@ -79,50 +76,50 @@ namespace OpenSim.Framework 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 { - this.AgentCircuits.Add(circuitCode, agentData); + AgentCircuits.Add(circuitCode, agentData); } } public LLVector3 GetPosition(uint circuitCode) { LLVector3 vec = new LLVector3(); - if (this.AgentCircuits.ContainsKey(circuitCode)) + if (AgentCircuits.ContainsKey(circuitCode)) { - vec = this.AgentCircuits[circuitCode].startpos; + vec = AgentCircuits[circuitCode].startpos; } return vec; } 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; - this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; - this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; - // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); + AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname; + AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname; + AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos; + // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); } } 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) { - if (this.AgentCircuits.ContainsKey(circuitcode)) + if (AgentCircuits.ContainsKey(circuitcode)) { - return this.AgentCircuits[circuitcode].child; + return AgentCircuits[circuitcode].child; } return false; } diff --git a/OpenSim/Framework/General/AgentCiruitData.cs b/OpenSim/Framework/General/AgentCiruitData.cs index 0924d36..95cac60 100644 --- a/OpenSim/Framework/General/AgentCiruitData.cs +++ b/OpenSim/Framework/General/AgentCiruitData.cs @@ -25,15 +25,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; using System; +using libsecondlife; namespace OpenSim.Framework { [Serializable] public class AgentCircuitData { - public AgentCircuitData() { } + public AgentCircuitData() + { + } + public LLUUID AgentID; public LLUUID SessionID; public LLUUID SecureSessionID; @@ -44,6 +47,6 @@ namespace OpenSim.Framework public bool child; public LLUUID InventoryFolder; public LLUUID BaseFolder; - public string CapsPath = ""; + public string CapsPath = ""; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentInventory.cs b/OpenSim/Framework/General/AgentInventory.cs index cf110cb..7a1174a 100644 --- a/OpenSim/Framework/General/AgentInventory.cs +++ b/OpenSim/Framework/General/AgentInventory.cs @@ -28,8 +28,6 @@ using System.Collections.Generic; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Framework; - namespace OpenSim.Framework { @@ -39,7 +37,7 @@ namespace OpenSim.Framework public Dictionary InventoryFolders; public Dictionary InventoryItems; public InventoryFolder InventoryRoot; - public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server + public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server public LLUUID AgentID; public AvatarWearable[] Wearables; @@ -47,12 +45,12 @@ namespace OpenSim.Framework { InventoryFolders = new Dictionary(); InventoryItems = new Dictionary(); - this.Initialise(); + Initialise(); } public virtual void Initialise() { - Wearables = new AvatarWearable[13]; + Wearables = new AvatarWearable[13]; for (int i = 0; i < 13; i++) { Wearables[i] = new AvatarWearable(); @@ -63,27 +61,27 @@ namespace OpenSim.Framework { InventoryFolder Folder = new InventoryFolder(); Folder.FolderID = folderID; - Folder.OwnerID = this.AgentID; + Folder.OwnerID = AgentID; Folder.DefaultType = type; - this.InventoryFolders.Add(Folder.FolderID, Folder); + InventoryFolders.Add(Folder.FolderID, Folder); return (true); } public void CreateRootFolder(LLUUID newAgentID, bool createTextures) { - this.AgentID = newAgentID; + AgentID = newAgentID; InventoryRoot = new InventoryFolder(); InventoryRoot.FolderID = LLUUID.Random(); InventoryRoot.ParentID = new LLUUID(); InventoryRoot.Version = 1; InventoryRoot.DefaultType = 8; - InventoryRoot.OwnerID = this.AgentID; + InventoryRoot.OwnerID = AgentID; InventoryRoot.FolderName = "My Inventory"; InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); - InventoryRoot.OwnerID = this.AgentID; + InventoryRoot.OwnerID = AgentID; 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(); Folder.FolderID = folderID; - Folder.OwnerID = this.AgentID; + Folder.OwnerID = AgentID; Folder.DefaultType = type; Folder.FolderName = folderName; - this.InventoryFolders.Add(Folder.FolderID, Folder); + InventoryFolders.Add(Folder.FolderID, Folder); return (true); } 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"); InventoryFolder Folder = new InventoryFolder(); Folder.FolderID = folderID; - Folder.OwnerID = this.AgentID; + Folder.OwnerID = AgentID; Folder.DefaultType = type; Folder.FolderName = folderName; Folder.ParentID = parentID; - this.InventoryFolders.Add(Folder.FolderID, Folder); + InventoryFolders.Add(Folder.FolderID, Folder); } return (true); } public bool HasFolder(LLUUID folderID) { - if (this.InventoryFolders.ContainsKey(folderID)) + if (InventoryFolders.ContainsKey(folderID)) { return true; } @@ -125,7 +123,7 @@ namespace OpenSim.Framework public LLUUID GetFolderID(string folderName) { - foreach (InventoryFolder inv in this.InventoryFolders.Values) + foreach (InventoryFolder inv in InventoryFolders.Values) { if (inv.FolderName == folderName) { @@ -137,11 +135,12 @@ namespace OpenSim.Framework 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; - 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 } return true; @@ -150,10 +149,10 @@ namespace OpenSim.Framework public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) { 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)); - InventoryItem Item = this.InventoryItems[itemID]; + System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name)); + InventoryItem Item = InventoryItems[itemID]; Item.Name = Util.FieldToString(packet.Name); System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); //TODO need to update the rest of the info @@ -163,7 +162,7 @@ namespace OpenSim.Framework public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) { - if (this.InventoryFolders.ContainsKey(folderID)) + if (InventoryFolders.ContainsKey(folderID)) { LLUUID NewItemID = LLUUID.Random(); @@ -176,7 +175,7 @@ namespace OpenSim.Framework Item.Name = asset.Name; Item.Description = asset.Description; Item.InvType = asset.InvType; - this.InventoryItems.Add(Item.ItemID, Item); + InventoryItems.Add(Item.ItemID, Item); InventoryFolder Folder = InventoryFolders[Item.FolderID]; Folder.Items.Add(Item); return (Item.ItemID); @@ -190,10 +189,10 @@ namespace OpenSim.Framework public bool DeleteFromInventory(LLUUID itemID) { bool res = false; - if (this.InventoryItems.ContainsKey(itemID)) + if (InventoryItems.ContainsKey(itemID)) { - InventoryItem item = this.InventoryItems[itemID]; - this.InventoryItems.Remove(itemID); + InventoryItem item = InventoryItems[itemID]; + InventoryItems.Remove(itemID); foreach (InventoryFolder fold in InventoryFolders.Values) { if (fold.Items.Contains(item)) @@ -203,7 +202,6 @@ namespace OpenSim.Framework } } res = true; - } return res; } @@ -225,7 +223,6 @@ namespace OpenSim.Framework Items = new List(); //Subfolders = new List(); } - } public class InventoryItem @@ -237,12 +234,12 @@ namespace OpenSim.Framework public LLUUID CreatorID; public sbyte InvType; public sbyte Type; - public string Name =""; + public string Name = ""; public string Description; public InventoryItem() { - this.CreatorID = LLUUID.Zero; + CreatorID = LLUUID.Zero; } public string ExportString() @@ -251,11 +248,11 @@ namespace OpenSim.Framework string result = ""; result += "\tinv_object\t0\n\t{\n"; result += "\t\tobj_id\t%s\n"; - result += "\t\tparent_id\t"+ ItemID.ToString() +"\n"; - result += "\t\ttype\t"+ typ +"\n"; - result += "\t\tname\t" + Name+"|\n"; + result += "\t\tparent_id\t" + ItemID.ToString() + "\n"; + result += "\t\ttype\t" + typ + "\n"; + result += "\t\tname\t" + Name + "|\n"; result += "\t}\n"; return result; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AgentWearable.cs b/OpenSim/Framework/General/AgentWearable.cs index af8a630..c2d4db3 100644 --- a/OpenSim/Framework/General/AgentWearable.cs +++ b/OpenSim/Framework/General/AgentWearable.cs @@ -36,10 +36,9 @@ namespace OpenSim.Framework public AvatarWearable() { - } - public AvatarWearable( LLUUID itemId, LLUUID assetId ) + public AvatarWearable(LLUUID itemId, LLUUID assetId) { AssetID = assetId; ItemID = itemId; @@ -69,4 +68,4 @@ namespace OpenSim.Framework } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetBase.cs b/OpenSim/Framework/General/AssetBase.cs index 9c69eb8..f0367f0 100644 --- a/OpenSim/Framework/General/AssetBase.cs +++ b/OpenSim/Framework/General/AssetBase.cs @@ -44,7 +44,6 @@ namespace OpenSim.Framework public AssetBase() { - } public AssetBase(LLUUID assetId, string name) @@ -53,4 +52,4 @@ namespace OpenSim.Framework Name = name; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetConfig.cs b/OpenSim/Framework/General/AssetConfig.cs index 457369d..81cf899 100644 --- a/OpenSim/Framework/General/AssetConfig.cs +++ b/OpenSim/Framework/General/AssetConfig.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework { /// @@ -48,18 +44,22 @@ namespace OpenSim.Framework public AssetConfig(string description, string filename) { - configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } public void loadConfigurationOptions() { - 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("default_startup_message", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Startup Message", "Welcome to OGS", false); - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), 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); } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -67,17 +67,17 @@ namespace OpenSim.Framework switch (configuration_key) { case "default_startup_message": - this.DefaultStartupMsg = (string)configuration_result; + DefaultStartupMsg = (string) configuration_result; break; case "database_provider": - this.DatabaseProvider = (string)configuration_result; + DatabaseProvider = (string) configuration_result; break; case "http_port": - HttpPort = (uint)configuration_result; + HttpPort = (uint) configuration_result; break; } return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetLandmark.cs b/OpenSim/Framework/General/AssetLandmark.cs index 9f05531..a62a85b 100644 --- a/OpenSim/Framework/General/AssetLandmark.cs +++ b/OpenSim/Framework/General/AssetLandmark.cs @@ -38,22 +38,22 @@ namespace OpenSim.Framework public AssetLandmark(AssetBase a) { - this.Data = a.Data; - this.FullID = a.FullID; - this.Type = a.Type; - this.InvType = a.InvType; - this.Name = a.Name; - this.Description = a.Description; + Data = a.Data; + FullID = a.FullID; + Type = a.Type; + InvType = a.InvType; + Name = a.Name; + Description = a.Description; InternData(); } private void InternData() { - string temp = Encoding.UTF8.GetString(Data).Trim(); + string temp = Encoding.UTF8.GetString(Data).Trim(); string[] parts = temp.Split('\n'); int.TryParse(parts[0].Substring(17, 1), out Version); LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AssetStorage.cs b/OpenSim/Framework/General/AssetStorage.cs index e3193ed..b39ceeb 100644 --- a/OpenSim/Framework/General/AssetStorage.cs +++ b/OpenSim/Framework/General/AssetStorage.cs @@ -29,19 +29,20 @@ using libsecondlife; namespace OpenSim.Framework { - public class AssetStorage - { + public class AssetStorage + { + public AssetStorage() + { + } - public AssetStorage() { - } + public AssetStorage(LLUUID assetUUID) + { + UUID = assetUUID; + } - public AssetStorage(LLUUID assetUUID) { - UUID=assetUUID; - } - - public byte[] Data; - public sbyte Type; - public string Name; - public LLUUID UUID; - } -} + public byte[] Data; + public sbyte Type; + public string Name; + public LLUUID UUID; + } +} \ No newline at end of file diff --git a/OpenSim/Framework/General/AuthenticateResponse.cs b/OpenSim/Framework/General/AuthenticateResponse.cs index 25bb0dd..0bf356e 100644 --- a/OpenSim/Framework/General/AuthenticateResponse.cs +++ b/OpenSim/Framework/General/AuthenticateResponse.cs @@ -25,8 +25,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using OpenSim.Framework; - namespace OpenSim.Framework { public class AuthenticateResponse @@ -36,8 +34,6 @@ namespace OpenSim.Framework public AuthenticateResponse() { - } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/BlockingQueue.cs b/OpenSim/Framework/General/BlockingQueue.cs index 2d59db4..006fbc8 100644 --- a/OpenSim/Framework/General/BlockingQueue.cs +++ b/OpenSim/Framework/General/BlockingQueue.cs @@ -55,4 +55,4 @@ namespace OpenSim.Framework } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/ClientManager.cs b/OpenSim/Framework/General/ClientManager.cs index c3b3d94..e34c051 100644 --- a/OpenSim/Framework/General/ClientManager.cs +++ b/OpenSim/Framework/General/ClientManager.cs @@ -26,16 +26,14 @@ * */ -using System; using System.Collections.Generic; -using System.Text; -using libsecondlife.Packets; -using OpenSim.Framework.Interfaces; using libsecondlife; +using libsecondlife.Packets; namespace OpenSim.Framework { public delegate void ForEachClientDelegate(IClientAPI client); + public class ClientManager { private Dictionary m_clients; @@ -63,7 +61,7 @@ namespace OpenSim.Framework m_clients.Add(id, client); } - public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet) + public void InPacket(uint circuitCode, Packet packet) { IClientAPI client; @@ -83,10 +81,10 @@ namespace OpenSim.Framework } } - public void CloseAllCircuits( LLUUID agentId ) + public void CloseAllCircuits(LLUUID agentId) { uint[] circuits = GetAllCircuits(agentId); - foreach (uint circuit in circuits ) + foreach (uint circuit in circuits) { IClientAPI client; if (m_clients.TryGetValue(circuit, out client)) @@ -94,7 +92,7 @@ namespace OpenSim.Framework Remove(circuit); client.Close(); } - } + } } private uint[] GetAllCircuits(LLUUID agentId) @@ -103,16 +101,16 @@ namespace OpenSim.Framework foreach (KeyValuePair pair in m_clients) { - if( pair.Value.AgentId == agentId ) + if (pair.Value.AgentId == agentId) { - circuits.Add( pair.Key ); + circuits.Add(pair.Key); } } return circuits.ToArray(); } - + public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) { ViewerEffectPacket packet = new ViewerEffectPacket(); @@ -134,4 +132,4 @@ namespace OpenSim.Framework return m_clients.TryGetValue(circuitId, out user); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/ConfigurationMember.cs b/OpenSim/Framework/General/ConfigurationMember.cs index c71982a..5883d73 100644 --- a/OpenSim/Framework/General/ConfigurationMember.cs +++ b/OpenSim/Framework/General/ConfigurationMember.cs @@ -27,22 +27,19 @@ */ using System; -using System.Reflection; -using System.Collections; using System.Collections.Generic; -using System.Text; +using System.Globalization; using System.Net; - +using System.Reflection; using libsecondlife; - using OpenSim.Framework.Console; -using System.Globalization; namespace OpenSim.Framework { public class ConfigurationMember { public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); + public delegate void ConfigurationOptionsLoad(); private List configurationOptions = new List(); @@ -53,22 +50,26 @@ namespace OpenSim.Framework private ConfigurationOptionResult resultFunction; private IGenericConfig configurationPlugin = null; + /// /// This is the default configuration DLL loaded /// 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; - this.configurationDescription = configuration_description; - this.loadFunction = load_function; - this.resultFunction = result_function; + configurationFilename = configuration_filename; + configurationDescription = configuration_description; + loadFunction = load_function; + resultFunction = result_function; } public void setConfigurationFilename(string filename) { configurationFilename = filename; } + public void setConfigurationDescription(string desc) { configurationDescription = desc; @@ -83,7 +84,11 @@ namespace OpenSim.Framework { 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(); configOption.configurationKey = configuration_key; @@ -92,7 +97,8 @@ namespace OpenSim.Framework configOption.configurationType = configuration_type; 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)) { @@ -101,32 +107,37 @@ namespace OpenSim.Framework } 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() { - configurationPlugin = this.LoadConfigDll(configurationPluginFilename); + configurationPlugin = LoadConfigDll(configurationPluginFilename); 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; } - 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; } 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; } @@ -157,7 +168,6 @@ namespace OpenSim.Framework bool ignoreNextFromConfig = false; while (convertSuccess == false) { - string console_result = ""; string attribute = null; if (useFile) @@ -180,16 +190,20 @@ namespace OpenSim.Framework } else { - if (configurationDescription.Trim() != "") { - console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); + console_result = + MainLog.Instance.CmdPrompt( + configurationDescription + ": " + configOption.configurationQuestion, + configOption.configurationDefault); } else { - console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); + console_result = + MainLog.Instance.CmdPrompt(configOption.configurationQuestion, + configOption.configurationDefault); } - } + } } else { @@ -252,7 +266,6 @@ namespace OpenSim.Framework { convertSuccess = true; return_result = intResult; - } errorMessage = "a signed 32 bit integer (int)"; break; @@ -307,7 +320,6 @@ namespace OpenSim.Framework { convertSuccess = true; return_result = uintResult; - } errorMessage = "an unsigned 32 bit integer (uint)"; break; @@ -322,7 +334,9 @@ namespace OpenSim.Framework break; case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: 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; return_result = floatResult; @@ -331,7 +345,9 @@ namespace OpenSim.Framework break; case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: 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; 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; ignoreNextFromConfig = true; } @@ -359,19 +376,27 @@ namespace OpenSim.Framework { 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; } 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; } } } } - if(useFile) + if (useFile) { configurationPlugin.Commit(); configurationPlugin.Close(); @@ -393,7 +418,8 @@ namespace OpenSim.Framework 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) { - this.configurationPlugin.LoadData(); - this.configurationPlugin.SetAttribute(configuration_key, configuration_value); - this.configurationPlugin.Commit(); - this.configurationPlugin.Close(); + configurationPlugin.LoadData(); + configurationPlugin.SetAttribute(configuration_key, configuration_value); + configurationPlugin.Commit(); + configurationPlugin.Close(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/ConfigurationOption.cs b/OpenSim/Framework/General/ConfigurationOption.cs index 792e697..5a8fd08 100644 --- a/OpenSim/Framework/General/ConfigurationOption.cs +++ b/OpenSim/Framework/General/ConfigurationOption.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework { public class ConfigurationOption @@ -40,7 +36,7 @@ namespace OpenSim.Framework TYPE_STRING_NOT_EMPTY, TYPE_UINT16, TYPE_UINT32, - TYPE_UINT64, + TYPE_UINT64, TYPE_INT16, TYPE_INT32, TYPE_INT64, @@ -52,7 +48,7 @@ namespace OpenSim.Framework TYPE_LLVECTOR3, TYPE_FLOAT, TYPE_DOUBLE - }; + } ; public string configurationKey = ""; public string configurationQuestion = ""; @@ -61,4 +57,4 @@ namespace OpenSim.Framework public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; public bool configurationUseDefaultNoPrompt = false; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/Culture.cs b/OpenSim/Framework/General/Culture.cs index 54eae7c..f8cadfe 100644 --- a/OpenSim/Framework/General/Culture.cs +++ b/OpenSim/Framework/General/Culture.cs @@ -27,31 +27,23 @@ */ using System; -using System.Collections.Generic; using System.Globalization; -using System.Text; using System.Threading; namespace OpenSim.Framework { public class Culture { - private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true); + private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true); public static NumberFormatInfo NumberFormatInfo { - get - { - return m_cultureInfo.NumberFormat; - } + get { return m_cultureInfo.NumberFormat; } } public static IFormatProvider FormatProvider { - get - { - return m_cultureInfo; - } + get { return m_cultureInfo; } } public static void SetCurrentCulture() @@ -59,4 +51,4 @@ namespace OpenSim.Framework Thread.CurrentThread.CurrentCulture = m_cultureInfo; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/EstateSettings.cs b/OpenSim/Framework/General/EstateSettings.cs index 3e99424..c70b6ca 100644 --- a/OpenSim/Framework/General/EstateSettings.cs +++ b/OpenSim/Framework/General/EstateSettings.cs @@ -25,24 +25,20 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +using System; using System.IO; using libsecondlife; -using OpenSim.Framework; -using System.Globalization; namespace OpenSim.Framework { public class EstateSettings { - //Settings to this island private float m_billableFactor; + public float billableFactor { - get - { - return m_billableFactor; - } + get { return m_billableFactor; } set { m_billableFactor = value; @@ -52,12 +48,10 @@ namespace OpenSim.Framework private uint m_estateID; + public uint estateID { - get - { - return m_estateID; - } + get { return m_estateID; } set { m_estateID = value; @@ -67,12 +61,10 @@ namespace OpenSim.Framework private uint m_parentEstateID; + public uint parentEstateID { - get - { - return m_parentEstateID; - } + get { return m_parentEstateID; } set { m_parentEstateID = value; @@ -81,12 +73,10 @@ namespace OpenSim.Framework } private byte m_maxAgents; + public byte maxAgents { - get - { - return m_maxAgents; - } + get { return m_maxAgents; } set { m_maxAgents = value; @@ -95,12 +85,10 @@ namespace OpenSim.Framework } private float m_objectBonusFactor; + public float objectBonusFactor { - get - { - return m_objectBonusFactor; - } + get { return m_objectBonusFactor; } set { m_objectBonusFactor = value; @@ -109,12 +97,10 @@ namespace OpenSim.Framework } private int m_redirectGridX; + public int redirectGridX { - get - { - return m_redirectGridX; - } + get { return m_redirectGridX; } set { m_redirectGridX = value; @@ -123,12 +109,10 @@ namespace OpenSim.Framework } private int m_redirectGridY; + public int redirectGridY { - get - { - return m_redirectGridY; - } + get { return m_redirectGridY; } set { m_redirectGridY = value; @@ -137,12 +121,10 @@ namespace OpenSim.Framework } private Simulator.RegionFlags m_regionFlags; + public Simulator.RegionFlags regionFlags { - get - { - return m_regionFlags; - } + get { return m_regionFlags; } set { m_regionFlags = value; @@ -152,12 +134,10 @@ namespace OpenSim.Framework private Simulator.SimAccess m_simAccess; + public Simulator.SimAccess simAccess { - get - { - return m_simAccess; - } + get { return m_simAccess; } set { m_simAccess = value; @@ -166,12 +146,10 @@ namespace OpenSim.Framework } private float m_sunHour; + public float sunHour { - get - { - return m_sunHour; - } + get { return m_sunHour; } set { m_sunHour = value; @@ -180,12 +158,10 @@ namespace OpenSim.Framework } private float m_terrainRaiseLimit; + public float terrainRaiseLimit { - get - { - return m_terrainRaiseLimit; - } + get { return m_terrainRaiseLimit; } set { m_terrainRaiseLimit = value; @@ -194,12 +170,10 @@ namespace OpenSim.Framework } private float m_terrainLowerLimit; + public float terrainLowerLimit { - get - { - return m_terrainLowerLimit; - } + get { return m_terrainLowerLimit; } set { m_terrainLowerLimit = value; @@ -208,12 +182,10 @@ namespace OpenSim.Framework } private bool m_useFixedSun; + public bool useFixedSun { - get - { - return m_useFixedSun; - } + get { return m_useFixedSun; } set { m_useFixedSun = value; @@ -223,12 +195,10 @@ namespace OpenSim.Framework private int m_pricePerMeter; + public int pricePerMeter { - get - { - return m_pricePerMeter; - } + get { return m_pricePerMeter; } set { m_pricePerMeter = value; @@ -238,12 +208,10 @@ namespace OpenSim.Framework private ushort m_regionWaterHeight; + public ushort regionWaterHeight { - get - { - return m_regionWaterHeight; - } + get { return m_regionWaterHeight; } set { m_regionWaterHeight = value; @@ -253,12 +221,10 @@ namespace OpenSim.Framework private bool m_regionAllowTerraform; + public bool regionAllowTerraform { - get - { - return m_regionAllowTerraform; - } + get { return m_regionAllowTerraform; } set { m_regionAllowTerraform = value; @@ -266,16 +232,14 @@ namespace OpenSim.Framework } } - + // Region Information // Low resolution 'base' textures. No longer used. private LLUUID m_terrainBase0; + public LLUUID terrainBase0 { - get - { - return m_terrainBase0; - } + get { return m_terrainBase0; } set { m_terrainBase0 = value; @@ -284,12 +248,10 @@ namespace OpenSim.Framework } private LLUUID m_terrainBase1; + public LLUUID terrainBase1 { - get - { - return m_terrainBase1; - } + get { return m_terrainBase1; } set { m_terrainBase1 = value; @@ -298,12 +260,10 @@ namespace OpenSim.Framework } private LLUUID m_terrainBase2; + public LLUUID terrainBase2 { - get - { - return m_terrainBase2; - } + get { return m_terrainBase2; } set { m_terrainBase2 = value; @@ -312,12 +272,10 @@ namespace OpenSim.Framework } private LLUUID m_terrainBase3; + public LLUUID terrainBase3 { - get - { - return m_terrainBase3; - } + get { return m_terrainBase3; } set { m_terrainBase3 = value; @@ -328,53 +286,46 @@ namespace OpenSim.Framework // Higher resolution terrain textures private LLUUID m_terrainDetail0; + public LLUUID terrainDetail0 { - get - { - return m_terrainDetail0; - } + get { return m_terrainDetail0; } set { - m_terrainDetail0 = value; configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); } } private LLUUID m_terrainDetail1; + public LLUUID terrainDetail1 { - get - { - return m_terrainDetail1; - } + get { return m_terrainDetail1; } set { m_terrainDetail1 = value; configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); } } + private LLUUID m_terrainDetail2; + public LLUUID terrainDetail2 { - get - { - return m_terrainDetail2; - } + get { return m_terrainDetail2; } set { m_terrainDetail2 = value; configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); } } + private LLUUID m_terrainDetail3; + public LLUUID terrainDetail3 { - get - { - return m_terrainDetail3; - } + get { return m_terrainDetail3; } set { m_terrainDetail3 = value; @@ -384,12 +335,10 @@ namespace OpenSim.Framework // First quad - each point is bilinearly interpolated at each meter of terrain private float m_terrainStartHeight0; + public float terrainStartHeight0 { - get - { - return m_terrainStartHeight0; - } + get { return m_terrainStartHeight0; } set { m_terrainStartHeight0 = value; @@ -399,12 +348,10 @@ namespace OpenSim.Framework private float m_terrainStartHeight1; + public float terrainStartHeight1 { - get - { - return m_terrainStartHeight1; - } + get { return m_terrainStartHeight1; } set { m_terrainStartHeight1 = value; @@ -413,12 +360,10 @@ namespace OpenSim.Framework } private float m_terrainStartHeight2; + public float terrainStartHeight2 { - get - { - return m_terrainStartHeight2; - } + get { return m_terrainStartHeight2; } set { m_terrainStartHeight2 = value; @@ -427,28 +372,25 @@ namespace OpenSim.Framework } private float m_terrainStartHeight3; + public float terrainStartHeight3 { - get - { - return m_terrainStartHeight3; - } + get { return m_terrainStartHeight3; } set { m_terrainStartHeight3 = value; configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); } } + // Second quad - also bilinearly interpolated. // Terrain texturing is done that: // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] private float m_terrainHeightRange0; + public float terrainHeightRange0 { - get - { - return m_terrainHeightRange0; - } + get { return m_terrainHeightRange0; } set { m_terrainHeightRange0 = value; @@ -457,12 +399,10 @@ namespace OpenSim.Framework } private float m_terrainHeightRange1; + public float terrainHeightRange1 { - get - { - return m_terrainHeightRange1; - } + get { return m_terrainHeightRange1; } set { m_terrainHeightRange1 = value; @@ -471,12 +411,10 @@ namespace OpenSim.Framework } private float m_terrainHeightRange2; + public float terrainHeightRange2 { - get - { - return m_terrainHeightRange2; - } + get { return m_terrainHeightRange2; } set { m_terrainHeightRange2 = value; @@ -485,26 +423,23 @@ namespace OpenSim.Framework } private float m_terrainHeightRange3; + public float terrainHeightRange3 { - get - { - return m_terrainHeightRange3; - } + get { return m_terrainHeightRange3; } set { m_terrainHeightRange3 = value; configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); } } + // Terrain Default (Must be in F32 Format!) private string m_terrainFile; + public string terrainFile { - get - { - return m_terrainFile; - } + get { return m_terrainFile; } set { m_terrainFile = value; @@ -513,12 +448,10 @@ namespace OpenSim.Framework } private double m_terrainMultiplier; + public double terrainMultiplier { - get - { - return m_terrainMultiplier; - } + get { return m_terrainMultiplier; } set { m_terrainMultiplier = value; @@ -527,12 +460,10 @@ namespace OpenSim.Framework } private float m_waterHeight; + public float waterHeight { - get - { - return m_waterHeight; - } + get { return m_waterHeight; } set { m_waterHeight = value; @@ -541,73 +472,112 @@ namespace OpenSim.Framework } private LLUUID m_terrainImageID; + public LLUUID terrainImageID { - get - { - return m_terrainImageID; - } + get { return m_terrainImageID; } set { m_terrainImageID = value; configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); } } + private ConfigurationMember configMember; + public EstateSettings() { // Temporary hack to prevent multiple loadings. 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(); } } public void loadConfigurationOptions() { - configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "","0.0",true); - configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "","0",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("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); - configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); - configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); - configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", true); - configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", 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_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "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_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "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_1", 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_1", 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_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); + configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", + "0.0", true); + configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", + 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("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", + "0", true); + configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", + "0", true); + configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", + "0", true); + configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", + true); + configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", + 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_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", + "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_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "", "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_1", + 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_1", + 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_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) @@ -615,123 +585,123 @@ namespace OpenSim.Framework switch (configuration_key) { case "billable_factor": - this.m_billableFactor = (float)configuration_result; + m_billableFactor = (float) configuration_result; break; case "estate_id": - this.m_estateID = (uint)configuration_result; + m_estateID = (uint) configuration_result; break; case "parent_estate_id": - this.m_parentEstateID = (uint)configuration_result; + m_parentEstateID = (uint) configuration_result; break; case "max_agents": - this.m_maxAgents = (byte)configuration_result; + m_maxAgents = (byte) configuration_result; break; case "object_bonus_factor": - this.m_objectBonusFactor = (float)configuration_result; + m_objectBonusFactor = (float) configuration_result; break; case "redirect_grid_x": - this.m_redirectGridX = (int)configuration_result; + m_redirectGridX = (int) configuration_result; break; case "redirect_grid_y": - this.m_redirectGridY = (int)configuration_result; + m_redirectGridY = (int) configuration_result; break; case "region_flags": - this.m_regionFlags = (Simulator.RegionFlags)((uint)configuration_result); + m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result); break; case "sim_access": - this.m_simAccess = (Simulator.SimAccess)((byte)configuration_result); + m_simAccess = (Simulator.SimAccess) ((byte) configuration_result); break; case "sun_hour": - this.m_sunHour = (float)configuration_result; + m_sunHour = (float) configuration_result; break; case "terrain_raise_limit": - this.m_terrainRaiseLimit = (float)configuration_result; + m_terrainRaiseLimit = (float) configuration_result; break; case "terrain_lower_limit": - this.m_terrainLowerLimit = (float)configuration_result; + m_terrainLowerLimit = (float) configuration_result; break; case "use_fixed_sun": - this.m_useFixedSun = (bool)configuration_result; + m_useFixedSun = (bool) configuration_result; break; case "price_per_meter": - this.m_pricePerMeter = System.Convert.ToInt32(configuration_result); + m_pricePerMeter = Convert.ToInt32(configuration_result); break; case "region_water_height": - this.m_regionWaterHeight = (ushort)configuration_result; + m_regionWaterHeight = (ushort) configuration_result; break; case "region_allow_terraform": - this.m_regionAllowTerraform = (bool)configuration_result; + m_regionAllowTerraform = (bool) configuration_result; break; case "terrain_base_0": - this.m_terrainBase0 = (LLUUID)configuration_result; + m_terrainBase0 = (LLUUID) configuration_result; break; case "terrain_base_1": - this.m_terrainBase1 = (LLUUID)configuration_result; + m_terrainBase1 = (LLUUID) configuration_result; break; case "terrain_base_2": - this.m_terrainBase2 = (LLUUID)configuration_result; + m_terrainBase2 = (LLUUID) configuration_result; break; case "terrain_base_3": - this.m_terrainBase3 = (LLUUID)configuration_result; + m_terrainBase3 = (LLUUID) configuration_result; break; case "terrain_detail_0": - this.m_terrainDetail0 = (LLUUID)configuration_result; + m_terrainDetail0 = (LLUUID) configuration_result; break; case "terrain_detail_1": - this.m_terrainDetail1 = (LLUUID)configuration_result; + m_terrainDetail1 = (LLUUID) configuration_result; break; case "terrain_detail_2": - this.m_terrainDetail2 = (LLUUID)configuration_result; + m_terrainDetail2 = (LLUUID) configuration_result; break; case "terrain_detail_3": - this.m_terrainDetail3 = (LLUUID)configuration_result; + m_terrainDetail3 = (LLUUID) configuration_result; break; case "terrain_start_height_0": - this.m_terrainStartHeight0 = (float)configuration_result; + m_terrainStartHeight0 = (float) configuration_result; break; case "terrain_start_height_1": - this.m_terrainStartHeight1 = (float)configuration_result; + m_terrainStartHeight1 = (float) configuration_result; break; case "terrain_start_height_2": - this.m_terrainStartHeight2 = (float)configuration_result; + m_terrainStartHeight2 = (float) configuration_result; break; case "terrain_start_height_3": - this.m_terrainStartHeight3 = (float)configuration_result; + m_terrainStartHeight3 = (float) configuration_result; break; case "terrain_height_range_0": - this.m_terrainHeightRange0 = (float)configuration_result; + m_terrainHeightRange0 = (float) configuration_result; break; case "terrain_height_range_1": - this.m_terrainHeightRange1 = (float)configuration_result; + m_terrainHeightRange1 = (float) configuration_result; break; case "terrain_height_range_2": - this.m_terrainHeightRange2 = (float)configuration_result; + m_terrainHeightRange2 = (float) configuration_result; break; case "terrain_height_range_3": - this.m_terrainHeightRange3 = (float)configuration_result; + m_terrainHeightRange3 = (float) configuration_result; break; case "terrain_file": - this.m_terrainFile = (string)configuration_result; + m_terrainFile = (string) configuration_result; break; case "terrain_multiplier": - this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result); + m_terrainMultiplier = Convert.ToDouble(configuration_result); break; case "water_height": double tmpVal = (double) configuration_result; - this.m_waterHeight = (float) tmpVal; + m_waterHeight = (float) tmpVal; break; case "terrain_image_id": - this.m_terrainImageID = (LLUUID)configuration_result; + m_terrainImageID = (LLUUID) configuration_result; break; } return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/GridConfig.cs b/OpenSim/Framework/General/GridConfig.cs index 64ce3b1..66d6c3a 100644 --- a/OpenSim/Framework/General/GridConfig.cs +++ b/OpenSim/Framework/General/GridConfig.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework { public class GridConfig @@ -50,30 +46,49 @@ namespace OpenSim.Framework public static uint DefaultHttpPort = 8001; public uint HttpPort = DefaultHttpPort; - + private ConfigurationMember configMember; + public GridConfig(string description, string filename) { - configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } public void loadConfigurationOptions() { - configMember.addConfigurationOption("grid_owner", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "OGS Grid Owner", "OGS development team", 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("grid_owner", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "OGS Grid Owner", "OGS development team", 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("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("default_user_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "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_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("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to a simulator", "null", 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) @@ -81,41 +96,41 @@ namespace OpenSim.Framework switch (configuration_key) { case "grid_owner": - this.GridOwner = (string)configuration_result; + GridOwner = (string) configuration_result; break; case "default_asset_server": - this.DefaultAssetServer = (string)configuration_result; + DefaultAssetServer = (string) configuration_result; break; case "asset_send_key": - this.AssetSendKey = (string)configuration_result; + AssetSendKey = (string) configuration_result; break; case "asset_recv_key": - this.AssetRecvKey = (string)configuration_result; + AssetRecvKey = (string) configuration_result; break; case "default_user_server": - this.DefaultUserServer = (string)configuration_result; + DefaultUserServer = (string) configuration_result; break; case "user_send_key": - this.UserSendKey = (string)configuration_result; + UserSendKey = (string) configuration_result; break; case "user_recv_key": - this.UserRecvKey = (string)configuration_result; + UserRecvKey = (string) configuration_result; break; case "sim_send_key": - this.SimSendKey = (string)configuration_result; + SimSendKey = (string) configuration_result; break; case "sim_recv_key": - this.SimRecvKey = (string)configuration_result; + SimRecvKey = (string) configuration_result; break; case "database_provider": - this.DatabaseProvider = (string)configuration_result; + DatabaseProvider = (string) configuration_result; break; case "http_port": - HttpPort = (uint)configuration_result; + HttpPort = (uint) configuration_result; break; } return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IAssetProvider.cs b/OpenSim/Framework/General/IAssetProvider.cs index 42dbf1f..f452822 100644 --- a/OpenSim/Framework/General/IAssetProvider.cs +++ b/OpenSim/Framework/General/IAssetProvider.cs @@ -26,15 +26,11 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework; using libsecondlife; namespace OpenSim.Framework { - public interface IAssetProvider : IPlugin + public interface IAssetProvider : IPlugin { AssetBase FetchAsset(LLUUID uuid); void CreateAsset(AssetBase asset); @@ -42,4 +38,4 @@ namespace OpenSim.Framework bool ExistsAsset(LLUUID uuid); void CommitAssets(); // force a sync to the database } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IAssetServer.cs b/OpenSim/Framework/General/IAssetServer.cs index ae86c8c..f4cb533 100644 --- a/OpenSim/Framework/General/IAssetServer.cs +++ b/OpenSim/Framework/General/IAssetServer.cs @@ -28,14 +28,12 @@ using System; using System.Collections.Generic; using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework { /// /// Description of IAssetServer. /// - public interface IAssetServer { void SetReceiver(IAssetReceiver receiver); @@ -68,4 +66,4 @@ namespace OpenSim.Framework public LLUUID AssetID; public bool IsTexture; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IClientAPI.cs b/OpenSim/Framework/General/IClientAPI.cs index 8c81eae..c7ec514 100644 --- a/OpenSim/Framework/General/IClientAPI.cs +++ b/OpenSim/Framework/General/IClientAPI.cs @@ -30,31 +30,28 @@ using System.Collections.Generic; using System.Net; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Framework; namespace OpenSim.Framework { // Base Args Interface public interface IEventArgs { - IScene Scene - { - get; - set; - } + IScene Scene { get; set; } - IClientAPI Sender - { - get; - set; - } + IClientAPI Sender { get; set; } } public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); 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 + } ; /// /// ChatFromViewer Arguments @@ -163,68 +160,127 @@ namespace OpenSim.Framework 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 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 StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); + public delegate void LinkObjects(uint parent, List children); + 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 RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); public delegate void GenericCall(IClientAPI remoteClient); + 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 GenericCall5(IClientAPI remoteClient, bool status); + public delegate void GenericCall6(LLUUID uid); + public delegate void GenericCall7(uint localID, string message); public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); + public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); + public delegate void ObjectSelect(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 UpdatePrimTexture(uint localID, byte[] texture, 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 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 StatusChange(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 AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); + public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); + 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 ParcelJoinRequest(int west, int south, int east, int north, 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 ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); + public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, 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 CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); - 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 CreateInventoryFolder( + IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); + + 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 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 UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, 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 RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); + public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); public interface IClientAPI @@ -298,37 +354,17 @@ namespace OpenSim.Framework event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; event EstateOwnerMessageRequest OnEstateOwnerMessage; - LLVector3 StartPos - { - get; - set; - } + LLVector3 StartPos { get; set; } - LLUUID AgentId - { - get; - } + LLUUID AgentId { get; } - LLUUID SessionId - { - get; - } + LLUUID SessionId { get; } - string FirstName - { - get; - } + string FirstName { get; } - string LastName - { - get; - } + string LastName { get; } - uint CircuitCode - { - get; - set; - } + uint CircuitCode { get; set; } void OutPacket(Packet newPack); void SendWearables(AvatarWearable[] wearables); @@ -339,28 +375,46 @@ namespace OpenSim.Framework void SendRegionHandshake(RegionInfo regionInfo); 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 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(int px, int py, float[] map); void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); - void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint ); + void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); 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 mapBlocks); 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 SendTeleportLocationStart(); 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 SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); + void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, + LLVector3 Pos, byte[] textureEntry, uint parentID); + + void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, + LLVector3 velocity, LLQuaternion rotation); + void SendCoarseLocationUpdate(List CoarseLocations); 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 items); void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); void SendInventoryItemUpdate(InventoryItemBase Item); @@ -375,10 +429,13 @@ namespace OpenSim.Framework void SendAlertMessage(string message); void SendAgentAlertMessage(string message, bool modal); 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 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 InPacket(Packet NewPack); void Close(); @@ -387,4 +444,4 @@ namespace OpenSim.Framework event Action OnConnectionClosed; void SendLogoutPacket(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IGenericConfig.cs b/OpenSim/Framework/General/IGenericConfig.cs index 8d45d47..0c9ee1e 100644 --- a/OpenSim/Framework/General/IGenericConfig.cs +++ b/OpenSim/Framework/General/IGenericConfig.cs @@ -37,4 +37,4 @@ namespace OpenSim.Framework void Commit(); void Close(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IPlugin.cs b/OpenSim/Framework/General/IPlugin.cs index 6926ef4..cc835da 100644 --- a/OpenSim/Framework/General/IPlugin.cs +++ b/OpenSim/Framework/General/IPlugin.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework { /// @@ -54,4 +50,4 @@ namespace OpenSim.Framework /// void Initialise(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IRegionCommsListener.cs b/OpenSim/Framework/General/IRegionCommsListener.cs index 9ac9988..1a24469 100644 --- a/OpenSim/Framework/General/IRegionCommsListener.cs +++ b/OpenSim/Framework/General/IRegionCommsListener.cs @@ -27,14 +27,15 @@ */ using System.Collections.Generic; using libsecondlife; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; namespace OpenSim.Framework { public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); + public delegate void UpdateNeighbours(List neighbours); + public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); + public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); public interface IRegionCommsListener @@ -45,4 +46,4 @@ namespace OpenSim.Framework event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; event UpdateNeighbours OnNeighboursUpdate; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IScene.cs b/OpenSim/Framework/General/IScene.cs index 9f03a04..cf5ee93 100644 --- a/OpenSim/Framework/General/IScene.cs +++ b/OpenSim/Framework/General/IScene.cs @@ -26,7 +26,6 @@ * */ using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework { @@ -34,14 +33,11 @@ namespace OpenSim.Framework { void AddNewClient(IClientAPI client, bool child); void RemoveClient(LLUUID agentID); - + RegionInfo RegionInfo { get; } object SyncRoot { get; } uint NextLocalId { get; } - ClientManager ClientManager - { - get; - } + ClientManager ClientManager { get; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IUserData.cs b/OpenSim/Framework/General/IUserData.cs index e1e9c99..b955ef1 100644 --- a/OpenSim/Framework/General/IUserData.cs +++ b/OpenSim/Framework/General/IUserData.cs @@ -26,7 +26,6 @@ * */ using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework { @@ -132,4 +131,4 @@ namespace OpenSim.Framework /// void Initialise(); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/IUserService.cs b/OpenSim/Framework/General/IUserService.cs index 400c12b..bf1c7e8 100644 --- a/OpenSim/Framework/General/IUserService.cs +++ b/OpenSim/Framework/General/IUserService.cs @@ -26,7 +26,6 @@ * */ using libsecondlife; -using OpenSim.Framework; namespace OpenSim.Framework.Interfaces { diff --git a/OpenSim/Framework/General/InventoryItemBase.cs b/OpenSim/Framework/General/InventoryItemBase.cs index 27124d9..45700ae 100644 --- a/OpenSim/Framework/General/InventoryItemBase.cs +++ b/OpenSim/Framework/General/InventoryItemBase.cs @@ -39,50 +39,62 @@ namespace OpenSim.Framework /// A UUID containing the ID for the inventory item itself /// public LLUUID inventoryID; + /// /// The UUID of the associated asset on the asset server /// public LLUUID assetID; + /// /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) /// public int assetType; + /// /// The type of inventory item. (Can be slightly different to the asset type /// public int invType; + /// /// The folder this item is contained in /// public LLUUID parentFolderID; + /// /// The owner of this inventory item /// public LLUUID avatarID; + /// /// The creator of this item /// public LLUUID creatorsID; + /// /// The name of the inventory item (must be less than 64 characters) /// public string inventoryName; + /// /// The description of the inventory item (must be less than 64 characters) /// public string inventoryDescription; + /// /// A mask containing the permissions for the next owner (cannot be enforced) /// public uint inventoryNextPermissions; + /// /// A mask containing permissions for the current owner (cannot be enforced) /// public uint inventoryCurrentPermissions; + /// /// /// public uint inventoryBasePermissions; + /// /// /// @@ -98,22 +110,27 @@ namespace OpenSim.Framework /// The name of the folder (64 characters or less) /// public string name; + /// /// The agent who's inventory this is contained by /// public LLUUID agentID; + /// /// The folder this folder is contained in /// public LLUUID parentID; + /// /// The UUID for this folder /// public LLUUID folderID; + /// /// Tyep of Items normally stored in this folder /// public short type; + /// /// /// @@ -225,4 +242,4 @@ namespace OpenSim.Framework /// The id of the folder void deleteInventoryFolder(LLUUID folder); } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/LandData.cs b/OpenSim/Framework/General/LandData.cs index 414b613..cab71a9 100644 --- a/OpenSim/Framework/General/LandData.cs +++ b/OpenSim/Framework/General/LandData.cs @@ -29,92 +29,95 @@ using libsecondlife; namespace OpenSim.Framework { - - public class LandData - { - public byte[] landBitmapByteArray = new byte[512]; - public string landName = "Your Parcel"; - public string landDesc = ""; - public LLUUID ownerID = new LLUUID(); - public bool isGroupOwned = false; - public LLVector3 AABBMin = new LLVector3(); - public LLVector3 AABBMax = new LLVector3(); - public int area = 0; - public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned - public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID - public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category - public int claimDate = 0; //Unemplemented - public int claimPrice = 0; //Unemplemented - public LLUUID groupID = new LLUUID(); //Unemplemented - public int groupPrims = 0; - public int otherPrims = 0; - public int ownerPrims = 0; - public int selectedPrims = 0; - public int simwidePrims = 0; - public int simwideArea = 0; - public int salePrice = 0; //Unemeplemented. Parcels price. - 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 byte landingType = 0; - public byte mediaAutoScale = 0; - public LLUUID mediaID = LLUUID.Zero; - public int localID = 0; - public LLUUID globalID = new LLUUID(); + public class LandData + { + public byte[] landBitmapByteArray = new byte[512]; + public string landName = "Your Parcel"; + public string landDesc = ""; + public LLUUID ownerID = new LLUUID(); + public bool isGroupOwned = false; + public LLVector3 AABBMin = new LLVector3(); + public LLVector3 AABBMax = new LLVector3(); + public int area = 0; + public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned + public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID + public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category + public int claimDate = 0; //Unemplemented + public int claimPrice = 0; //Unemplemented + public LLUUID groupID = new LLUUID(); //Unemplemented + public int groupPrims = 0; + public int otherPrims = 0; + public int ownerPrims = 0; + public int selectedPrims = 0; + public int simwidePrims = 0; + public int simwideArea = 0; + public int salePrice = 0; //Unemeplemented. Parcels price. + 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 byte landingType = 0; + public byte mediaAutoScale = 0; + public LLUUID mediaID = LLUUID.Zero; + public int localID = 0; + public LLUUID globalID = new LLUUID(); - public string mediaURL = ""; - public string musicURL = ""; - public float passHours = 0; - public int passPrice = 0; - public LLUUID snapshotID = LLUUID.Zero; - public LLVector3 userLocation = new LLVector3(); - public LLVector3 userLookAt = new LLVector3(); + public string mediaURL = ""; + public string musicURL = ""; + public float passHours = 0; + public int passPrice = 0; + public LLUUID snapshotID = LLUUID.Zero; + public LLVector3 userLocation = new LLVector3(); + public LLVector3 userLookAt = new LLVector3(); - public LandData() - { - globalID = LLUUID.Random(); - } + public LandData() + { + globalID = LLUUID.Random(); + } - public LandData Copy() - { - LandData landData = new LandData(); + public LandData Copy() + { + LandData landData = new LandData(); - landData.AABBMax = this.AABBMax; - landData.AABBMin = this.AABBMin; - landData.area = this.area; - landData.auctionID = this.auctionID; - landData.authBuyerID = this.authBuyerID; - landData.category = this.category; - landData.claimDate = this.claimDate; - landData.claimPrice = this.claimPrice; - landData.globalID = this.globalID; - landData.groupID = this.groupID; - landData.groupPrims = this.groupPrims; - landData.otherPrims = this.otherPrims; - landData.ownerPrims = this.ownerPrims; - landData.selectedPrims = this.selectedPrims; - landData.isGroupOwned = this.isGroupOwned; - landData.localID = this.localID; - landData.landingType = this.landingType; - landData.mediaAutoScale = this.mediaAutoScale; - landData.mediaID = this.mediaID; - landData.mediaURL = this.mediaURL; - landData.musicURL = this.musicURL; - landData.ownerID = this.ownerID; - landData.landBitmapByteArray = (byte[])this.landBitmapByteArray.Clone(); - landData.landDesc = this.landDesc; - landData.landFlags = this.landFlags; - landData.landName = this.landName; - landData.landStatus = this.landStatus; - landData.passHours = this.passHours; - landData.passPrice = this.passPrice; - landData.salePrice = this.salePrice; - landData.snapshotID = this.snapshotID; - landData.userLocation = this.userLocation; - landData.userLookAt = this.userLookAt; + landData.AABBMax = AABBMax; + landData.AABBMin = AABBMin; + landData.area = area; + landData.auctionID = auctionID; + landData.authBuyerID = authBuyerID; + landData.category = category; + landData.claimDate = claimDate; + landData.claimPrice = claimPrice; + landData.globalID = globalID; + landData.groupID = groupID; + landData.groupPrims = groupPrims; + landData.otherPrims = otherPrims; + landData.ownerPrims = ownerPrims; + landData.selectedPrims = selectedPrims; + landData.isGroupOwned = isGroupOwned; + landData.localID = localID; + landData.landingType = landingType; + landData.mediaAutoScale = mediaAutoScale; + landData.mediaID = mediaID; + landData.mediaURL = mediaURL; + landData.musicURL = musicURL; + landData.ownerID = ownerID; + landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone(); + landData.landDesc = landDesc; + landData.landFlags = landFlags; + landData.landName = landName; + landData.landStatus = landStatus; + landData.passHours = passHours; + landData.passPrice = passPrice; + landData.salePrice = salePrice; + landData.snapshotID = snapshotID; + landData.userLocation = userLocation; + landData.userLookAt = userLookAt; - return landData; - - } + return landData; } - -} + } +} \ No newline at end of file diff --git a/OpenSim/Framework/General/Login.cs b/OpenSim/Framework/General/Login.cs index a55fd57..d9a5ab2 100644 --- a/OpenSim/Framework/General/Login.cs +++ b/OpenSim/Framework/General/Login.cs @@ -39,7 +39,7 @@ namespace OpenSim.Framework public LLUUID InventoryFolder; public LLUUID BaseFolder; public uint CircuitCode; - public string CapsPath =""; + public string CapsPath = ""; public LLVector3 StartPos; public Login() @@ -47,4 +47,4 @@ namespace OpenSim.Framework StartPos = new LLVector3(128, 128, 70); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/MapBlockData.cs b/OpenSim/Framework/General/MapBlockData.cs index eafd65d..d794015 100644 --- a/OpenSim/Framework/General/MapBlockData.cs +++ b/OpenSim/Framework/General/MapBlockData.cs @@ -45,7 +45,6 @@ namespace OpenSim.Framework public MapBlockData() { - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/NeighbourInfo.cs b/OpenSim/Framework/General/NeighbourInfo.cs index 771b844..457f7d0 100644 --- a/OpenSim/Framework/General/NeighbourInfo.cs +++ b/OpenSim/Framework/General/NeighbourInfo.cs @@ -39,4 +39,4 @@ namespace OpenSim.Framework public string sim_ip; public uint sim_port; } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/NetworkServersInfo.cs b/OpenSim/Framework/General/NetworkServersInfo.cs index 358e496..98d489e 100644 --- a/OpenSim/Framework/General/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/NetworkServersInfo.cs @@ -25,12 +25,9 @@ * 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; + namespace OpenSim.Framework { public class NetworkServersInfo @@ -63,12 +60,14 @@ namespace OpenSim.Framework } private uint? m_defaultHomeLocX; + public uint DefaultHomeLocX { get { return m_defaultHomeLocX.Value; } } private uint? m_defaultHomeLocY; + public uint DefaultHomeLocY { get { return m_defaultHomeLocY.Value; } @@ -76,19 +75,22 @@ namespace OpenSim.Framework public void loadFromConfiguration(IConfigSource config) { - m_defaultHomeLocX = (uint)config.Configs["StandAlone"].GetInt("default_location_x", 1000); - m_defaultHomeLocY = (uint)config.Configs["StandAlone"].GetInt("default_location_y", 1000); + m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000); + m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000); HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); 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"); 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"); UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); - } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/PrimitiveBaseShape.cs b/OpenSim/Framework/General/PrimitiveBaseShape.cs index 1799fb8..2123ecb 100644 --- a/OpenSim/Framework/General/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/PrimitiveBaseShape.cs @@ -28,7 +28,6 @@ using System.Xml.Serialization; using libsecondlife; -using libsecondlife.Packets; namespace OpenSim.Framework { @@ -93,47 +92,39 @@ namespace OpenSim.Framework public ProfileShape ProfileShape { - get - { - return (ProfileShape)(ProfileCurve & 0xf); - } + get { return (ProfileShape) (ProfileCurve & 0xf); } set { - byte oldValueMasked = (byte)(ProfileCurve & 0xf0); - ProfileCurve = (byte)(oldValueMasked | (byte)value); + byte oldValueMasked = (byte) (ProfileCurve & 0xf0); + ProfileCurve = (byte) (oldValueMasked | (byte) value); } } [XmlIgnore] public HollowShape HollowShape { - get - { - return (HollowShape)(ProfileHollow & 0xf0); - } + get { return (HollowShape) (ProfileHollow & 0xf0); } set { - byte oldValueMasked = (byte)(ProfileHollow & 0xf0); - ProfileHollow = (byte)(oldValueMasked | (byte)value); + byte oldValueMasked = (byte) (ProfileHollow & 0xf0); + ProfileHollow = (byte) (oldValueMasked | (byte) value); } } public LLVector3 PrimScale { - get - { - return this.Scale; - } + get { return Scale; } } static PrimitiveBaseShape() { - m_defaultTextureEntry = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); + m_defaultTextureEntry = + new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); } public PrimitiveBaseShape() { - PCode = (byte)PCodeEnum.Primitive; + PCode = (byte) PCodeEnum.Primitive; ExtraParams = new byte[1]; TextureEntry = m_defaultTextureEntry; } @@ -141,12 +132,11 @@ namespace OpenSim.Framework //void returns need to change of course public virtual void GetMesh() { - } public PrimitiveBaseShape Copy() { - return (PrimitiveBaseShape)this.MemberwiseClone(); + return (PrimitiveBaseShape) MemberwiseClone(); } } @@ -155,7 +145,6 @@ namespace OpenSim.Framework public GenericShape() : base() { - } } @@ -164,7 +153,7 @@ namespace OpenSim.Framework public BoxShape() : base() { - PathCurve = (byte)Extrusion.Straight; + PathCurve = (byte) Extrusion.Straight; ProfileShape = ProfileShape.Square; PathScaleX = 100; PathScaleY = 100; @@ -193,12 +182,13 @@ namespace OpenSim.Framework } } } + public class CylinderShape : PrimitiveBaseShape { public CylinderShape() : base() { - PathCurve = (byte)Extrusion.Straight; + PathCurve = (byte) Extrusion.Straight; ProfileShape = ProfileShape.Circle; PathScaleX = 100; PathScaleY = 100; @@ -218,7 +208,7 @@ namespace OpenSim.Framework private void SetRadius(float radius) { - Scale.X = Scale.Y = radius * 2f; + Scale.X = Scale.Y = radius*2f; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/Properties/AssemblyInfo.cs b/OpenSim/Framework/General/Properties/AssemblyInfo.cs index 655cffc..b3206a7 100644 --- a/OpenSim/Framework/General/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/General/Properties/AssemblyInfo.cs @@ -1,24 +1,28 @@ -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; + // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.FrameWork")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("OpenSim.FrameWork")] -[assembly: AssemblyCopyright("Copyright © 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] + +[assembly : AssemblyTitle("OpenSim.FrameWork")] +[assembly : AssemblyDescription("")] +[assembly : AssemblyConfiguration("")] +[assembly : AssemblyCompany("")] +[assembly : AssemblyProduct("OpenSim.FrameWork")] +[assembly : AssemblyCopyright("Copyright © 2007")] +[assembly : AssemblyTrademark("")] +[assembly : AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] + +[assembly : ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] + +[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] // Version information for an assembly consists of the following four values: // @@ -27,5 +31,6 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly : AssemblyVersion("1.0.0.0")] +[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionCommsListener.cs b/OpenSim/Framework/General/RegionCommsListener.cs index caa4af7..ee0d503 100644 --- a/OpenSim/Framework/General/RegionCommsListener.cs +++ b/OpenSim/Framework/General/RegionCommsListener.cs @@ -25,15 +25,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -using libsecondlife; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; using System.Collections.Generic; +using libsecondlife; namespace OpenSim.Framework { - public class RegionCommsListener :IRegionCommsListener + public class RegionCommsListener : IRegionCommsListener { public event ExpectUserDelegate OnExpectUser; public event GenericCall2 OnExpectChildAgent; @@ -46,11 +44,10 @@ namespace OpenSim.Framework /// /// /// - public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) + public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) { - if(OnExpectUser != null) + if (OnExpectUser != null) { - OnExpectUser(regionHandle, agent); return true; } @@ -58,7 +55,8 @@ namespace OpenSim.Framework return false; } - public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) + public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, + bool isFlying) { if (OnAvatarCrossingIntoRegion != null) { @@ -111,4 +109,4 @@ namespace OpenSim.Framework return false; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionHandle.cs b/OpenSim/Framework/General/RegionHandle.cs index d800e57..807a17c 100644 --- a/OpenSim/Framework/General/RegionHandle.cs +++ b/OpenSim/Framework/General/RegionHandle.cs @@ -28,13 +28,14 @@ using System; using System.Net; +using System.Net.Sockets; namespace OpenSim.Framework { /// /// A class for manipulating RegionHandle coordinates /// - class RegionHandle + internal class RegionHandle { private UInt64 handle; @@ -48,28 +49,28 @@ namespace OpenSim.Framework { IPAddress addr = IPAddress.Parse(ip); - if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) + if (addr.AddressFamily != AddressFamily.InterNetwork) throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); // Split the IP address in half - short a = (short)((baseHandle << 16) & 0xFFFF); - short b = (short)((baseHandle << 0) & 0xFFFF); + short a = (short) ((baseHandle << 16) & 0xFFFF); + short b = (short) ((baseHandle << 0) & 0xFFFF); // Raise the bounds a little - uint nx = (uint)x; - uint ny = (uint)y; + uint nx = (uint) x; + uint ny = (uint) y; // Multiply grid coords to get region coords nx *= 256; ny *= 256; // Stuff the IP address in too - nx = (uint)a << 16; - ny = (uint)b << 16; + nx = (uint) a << 16; + ny = (uint) b << 16; - handle = ((UInt64)nx << 32) | (uint)ny; + handle = ((UInt64) nx << 32) | (uint) ny; } /// @@ -79,7 +80,7 @@ namespace OpenSim.Framework /// Grid Y Coordinate public RegionHandle(uint x, uint y) { - handle = ((x * 256) << 32) | (y * 256); + handle = ((x*256) << 32) | (y*256); } /// @@ -118,10 +119,10 @@ namespace OpenSim.Framework /// Grid Server IP Address public IPAddress getGridIP() { - uint a = (uint)((handle >> 16) & 0xFFFF); - uint b = (uint)((handle >> 48) & 0xFFFF); + uint a = (uint) ((handle >> 16) & 0xFFFF); + uint b = (uint) ((handle >> 48) & 0xFFFF); - return new IPAddress((long)(a << 16) | (long)b); + return new IPAddress((long) (a << 16) | (long) b); } /// @@ -130,7 +131,7 @@ namespace OpenSim.Framework /// X Coordinate public uint getGridX() { - uint x = (uint)((handle >> 32) & 0xFFFF); + uint x = (uint) ((handle >> 32) & 0xFFFF); return x; } @@ -141,9 +142,9 @@ namespace OpenSim.Framework /// Y Coordinate public uint getGridY() { - uint y = (uint)((handle >> 0) & 0xFFFF); + uint y = (uint) ((handle >> 0) & 0xFFFF); return y; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/RegionInfo.cs b/OpenSim/Framework/General/RegionInfo.cs index 32f0c76..c14afd2 100644 --- a/OpenSim/Framework/General/RegionInfo.cs +++ b/OpenSim/Framework/General/RegionInfo.cs @@ -26,14 +26,10 @@ * */ using System; -using System.Globalization; using System.Net; using System.Net.Sockets; -using Nini.Config; using libsecondlife; -using OpenSim.Framework.Console; -using OpenSim.Framework.Interfaces; -using OpenSim.Framework; +using Nini.Config; namespace OpenSim.Framework { @@ -45,7 +41,6 @@ namespace OpenSim.Framework public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) { - m_regionLocX = regionLocX; m_regionLocY = regionLocY; @@ -55,7 +50,6 @@ namespace OpenSim.Framework public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) { - m_regionLocX = regionLocX; m_regionLocY = regionLocY; @@ -67,16 +61,11 @@ namespace OpenSim.Framework public LLUUID RegionID = new LLUUID(); private uint m_remotingPort; + public uint RemotingPort { - get - { - return m_remotingPort; - } - set - { - m_remotingPort = value; - } + get { return m_remotingPort; } + set { m_remotingPort = value; } } public string RemotingAddress; @@ -109,76 +98,49 @@ namespace OpenSim.Framework ia = Adr; break; } - } return new IPEndPoint(ia, m_internalEndPoint.Port); } - set - { - m_externalHostName = value.ToString(); - } + set { m_externalHostName = value.ToString(); } } protected string m_externalHostName; + public string ExternalHostName { - get - { - return m_externalHostName; - } - set - { - m_externalHostName = value; - } + get { return m_externalHostName; } + set { m_externalHostName = value; } } protected IPEndPoint m_internalEndPoint; + public IPEndPoint InternalEndPoint { - get - { - return m_internalEndPoint; - } - set - { - m_internalEndPoint = value; - } + get { return m_internalEndPoint; } + set { m_internalEndPoint = value; } } protected uint? m_regionLocX; + public uint RegionLocX { - get - { - return m_regionLocX.Value; - } - set - { - m_regionLocX = value; - } + get { return m_regionLocX.Value; } + set { m_regionLocX = value; } } protected uint? m_regionLocY; + public uint RegionLocY { - get - { - return m_regionLocY.Value; - } - set - { - m_regionLocY = value; - } + get { return m_regionLocY.Value; } + set { m_regionLocY = value; } } public ulong RegionHandle { - get - { - return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); - } + get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } } } @@ -196,80 +158,81 @@ namespace OpenSim.Framework // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. private static EstateSettings m_estateSettings; + public EstateSettings EstateSettings { get { - if( m_estateSettings == null ) + if (m_estateSettings == null) { m_estateSettings = new EstateSettings(); } return m_estateSettings; } - } public ConfigurationMember configMember; + public RegionInfo(string description, string filename) { - configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : base(regionLocX, regionLocY, internalEndPoint, externalUri) { - - } public RegionInfo() { - } //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source) { - this.LoadFromNiniSource(source, "RegionInfo"); + LoadFromNiniSource(source, "RegionInfo"); } //not in use, should swap to nini though. public void LoadFromNiniSource(IConfigSource source, string sectionName) { string errorMessage = ""; - this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); - this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); - this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); - this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); - this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); + RegionID = + new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); + RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); + m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); + m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); + DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); IPAddress ipAddressResult; if (IPAddress.TryParse(ipAddress, out ipAddressResult)) { - this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); + m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); } else { errorMessage = "needs an IP Address (IPAddress)"; } - this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); + m_internalEndPoint.Port = + source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); if (externalHost != "SYSTEMIP") { - this.m_externalHostName = externalHost; + m_externalHostName = externalHost; } else { - this.m_externalHostName = Util.GetLocalHost().ToString(); + m_externalHostName = Util.GetLocalHost().ToString(); } - this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); - this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); - this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); + MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); + MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); + MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); if (errorMessage != "") { @@ -279,17 +242,36 @@ namespace OpenSim.Framework public void loadConfigurationOptions() { - configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); - configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); - configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); - configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); - configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); - configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); - configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); - configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); - configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); - configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); - configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); + configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, + "UUID of Region (Default is recommended, random UUID)", + LLUUID.Random().ToString(), true); + configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Region Name", "OpenSim Test", false); + configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (X Axis)", "1000", false); + configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, + "Grid Location (Y Axis)", "1000", false); + configMember.addConfigurationOption("datastore", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Filename for local storage", "OpenSim.db", false); + configMember.addConfigurationOption("internal_ip_address", + ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, + "Internal IP Address for incoming UDP client connections", "0.0.0.0", + false); + configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Internal IP Port for incoming UDP client connections", + NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); + configMember.addConfigurationOption("external_host_name", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "External Host Name", "127.0.0.1", false); + configMember.addConfigurationOption("master_avatar_first", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "First Name of Master Avatar", "Test", false); + configMember.addConfigurationOption("master_avatar_last", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Last Name of Master Avatar", "User", false); + configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "(Sandbox Mode Only)Password for Master Avatar account", "test", false); } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -297,51 +279,50 @@ namespace OpenSim.Framework switch (configuration_key) { case "sim_UUID": - this.RegionID = (LLUUID)configuration_result; + RegionID = (LLUUID) configuration_result; break; case "sim_name": - this.RegionName = (string)configuration_result; + RegionName = (string) configuration_result; break; case "sim_location_x": - this.m_regionLocX = (uint)configuration_result; + m_regionLocX = (uint) configuration_result; break; case "sim_location_y": - this.m_regionLocY = (uint)configuration_result; + m_regionLocY = (uint) configuration_result; break; case "datastore": - this.DataStore = (string)configuration_result; + DataStore = (string) configuration_result; break; case "internal_ip_address": - IPAddress address = (IPAddress)configuration_result; - this.m_internalEndPoint = new IPEndPoint(address, 0); + IPAddress address = (IPAddress) configuration_result; + m_internalEndPoint = new IPEndPoint(address, 0); break; case "internal_ip_port": - this.m_internalEndPoint.Port = (int)configuration_result; + m_internalEndPoint.Port = (int) configuration_result; break; case "external_host_name": - if ((string)configuration_result != "SYSTEMIP") + if ((string) configuration_result != "SYSTEMIP") { - this.m_externalHostName = (string)configuration_result; + m_externalHostName = (string) configuration_result; } else { - this.m_externalHostName = Util.GetLocalHost().ToString(); + m_externalHostName = Util.GetLocalHost().ToString(); } break; case "master_avatar_first": - this.MasterAvatarFirstName = (string)configuration_result; + MasterAvatarFirstName = (string) configuration_result; break; case "master_avatar_last": - this.MasterAvatarLastName = (string)configuration_result; + MasterAvatarLastName = (string) configuration_result; break; case "master_avatar_pass": - string tempMD5Passwd = (string)configuration_result; - this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); + string tempMD5Passwd = (string) configuration_result; + MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); break; } return true; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/Remoting.cs b/OpenSim/Framework/General/Remoting.cs index 330c078..667ae69 100644 --- a/OpenSim/Framework/General/Remoting.cs +++ b/OpenSim/Framework/General/Remoting.cs @@ -41,7 +41,7 @@ namespace OpenSim.Framework /// When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[]. /// Both hosts should be performing these operations for this to be effective. /// - class RemoteDigest + internal class RemoteDigest { private byte[] currentHash; private byte[] secret; @@ -58,7 +58,7 @@ namespace OpenSim.Framework public RemoteDigest(string sharedSecret, byte[] salt, string challenge) { SHA512 = new SHA512Managed(); - Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt); + Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt); secret = RFC2898.GetBytes(512); ASCIIEncoding ASCII = new ASCIIEncoding(); @@ -108,7 +108,7 @@ namespace OpenSim.Framework byte[] bytes = new byte[64]; RNG.GetBytes(bytes); - StringBuilder sb = new StringBuilder(bytes.Length * 2); + StringBuilder sb = new StringBuilder(bytes.Length*2); foreach (byte b in bytes) { sb.AppendFormat("{0:x2}", b); @@ -130,6 +130,5 @@ namespace OpenSim.Framework Buffer.BlockCopy(b, 0, c, a.Length, b.Length); return c; } - } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/UUID.cs b/OpenSim/Framework/General/UUID.cs index 4327f40..f27cd6c 100644 --- a/OpenSim/Framework/General/UUID.cs +++ b/OpenSim/Framework/General/UUID.cs @@ -31,7 +31,7 @@ using libsecondlife; namespace OpenSim.Framework { - class UUID + internal class UUID { public LLUUID llUUID; @@ -73,7 +73,7 @@ namespace OpenSim.Framework n = BitConverter.GetBytes(fourth); n.CopyTo(uuid, 12); - llUUID = new LLUUID(uuid,0); + llUUID = new LLUUID(uuid, 0); } public override string ToString() @@ -152,4 +152,4 @@ namespace OpenSim.Framework return !a.Equals(b); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/UserConfig.cs b/OpenSim/Framework/General/UserConfig.cs index 3d79fc9..9abe61f 100644 --- a/OpenSim/Framework/General/UserConfig.cs +++ b/OpenSim/Framework/General/UserConfig.cs @@ -26,10 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; - namespace OpenSim.Framework { /// @@ -51,21 +47,30 @@ namespace OpenSim.Framework public UserConfig(string description, string filename) { - configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); + configMember = + new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); configMember.performConfigurationRetrieve(); } public void loadConfigurationOptions() { - configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); - - configMember.addConfigurationOption("default_grid_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Grid Server URI", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); - configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null", false); - configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null", false); - configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + configMember.addConfigurationOption("default_startup_message", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Startup Message", "Welcome to OGS", false); - configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); + configMember.addConfigurationOption("default_grid_server", + ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, + "Default Grid Server URI", + "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); + configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to send to grid server", "null", false); + configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Key to expect from grid server", "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); } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -73,26 +78,26 @@ namespace OpenSim.Framework switch (configuration_key) { case "default_startup_message": - this.DefaultStartupMsg = (string)configuration_result; + DefaultStartupMsg = (string) configuration_result; break; case "default_grid_server": - this.GridServerURL = (string)configuration_result; + GridServerURL = (string) configuration_result; break; case "grid_send_key": - this.GridSendKey = (string)configuration_result; + GridSendKey = (string) configuration_result; break; case "grid_recv_key": - this.GridRecvKey = (string)configuration_result; + GridRecvKey = (string) configuration_result; break; case "database_provider": - this.DatabaseProvider = (string)configuration_result; + DatabaseProvider = (string) configuration_result; break; case "http_port": - HttpPort = (uint)configuration_result; + HttpPort = (uint) configuration_result; break; } return true; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/General/UserProfileData.cs b/OpenSim/Framework/General/UserProfileData.cs index 444d811..ed70246 100644 --- a/OpenSim/Framework/General/UserProfileData.cs +++ b/OpenSim/Framework/General/UserProfileData.cs @@ -44,6 +44,7 @@ namespace OpenSim.Framework /// The first component of a users account name /// public string username; + /// /// The second component of a users account name /// @@ -54,6 +55,7 @@ namespace OpenSim.Framework /// /// This is double MD5'd because the client sends an unsalted MD5 to the loginserver public string passwordHash; + /// /// The salt used for the users hash, should be 32 bytes or longer /// @@ -64,18 +66,22 @@ namespace OpenSim.Framework /// public ulong homeRegion { - get { return Helpers.UIntsToLong((homeRegionX * 256), (homeRegionY * 256)); } - set { - homeRegionX = (uint)(value >> 40); - homeRegionY = (((uint)(value)) >> 8); + get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); } + set + { + homeRegionX = (uint) (value >> 40); + homeRegionY = (((uint) (value)) >> 8); } } + public uint homeRegionX; public uint homeRegionY; + /// /// The coordinates inside the region of the home location /// public LLVector3 homeLocation; + /// /// Where the user will be looking when they rez. /// @@ -85,6 +91,7 @@ namespace OpenSim.Framework /// A UNIX Timestamp (seconds since epoch) for the users creation /// public int created; + /// /// A UNIX Timestamp for the users last login date / time /// @@ -96,6 +103,7 @@ namespace OpenSim.Framework /// A URI to the users inventory server, used for foreigners and large grids /// public string userInventoryURI = String.Empty; + /// /// A URI to the users asset server, used for foreigners and large grids. /// @@ -105,6 +113,7 @@ namespace OpenSim.Framework /// A uint mask containing the "I can do" fields of the users profile /// public uint profileCanDoMask; + /// /// A uint mask containing the "I want to do" part of the users profile /// @@ -114,6 +123,7 @@ namespace OpenSim.Framework /// The about text listed in a users profile. /// public string profileAboutText = String.Empty; + /// /// The first life about text listed in a users profile /// @@ -123,10 +133,12 @@ namespace OpenSim.Framework /// The profile image for an avatar stored on the asset server /// public LLUUID profileImage; + /// /// The profile image for the users first life tab /// public LLUUID profileFirstImage; + /// /// The users last registered agent (filled in on the user server) /// @@ -142,47 +154,58 @@ namespace OpenSim.Framework /// The UUID of the users avatar (not the agent!) /// public LLUUID UUID; + /// /// The IP address of the user /// public string agentIP = String.Empty; + /// /// The port of the user /// public uint agentPort; + /// /// Is the user online? /// public bool agentOnline; + /// /// The session ID for the user (also the agent ID) /// public LLUUID sessionID; + /// /// The "secure" session ID for the user /// /// Not very secure. Dont rely on it for anything more than Linden Lab does. public LLUUID secureSessionID; + /// /// The region the user logged into initially /// public LLUUID regionID; + /// /// A unix timestamp from when the user logged in /// public int loginTime; + /// /// When this agent expired and logged out, 0 if still online /// public int logoutTime; + /// /// Current region the user is logged into /// public LLUUID currentRegion; + /// /// Region handle of the current region the user is in /// public ulong currentHandle; + /// /// The position of the user within the region /// diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index e3b156d..c731561 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs @@ -25,14 +25,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; +using System.Data; using System.IO; -using System.Security.Cryptography; using System.Net; +using System.Net.Sockets; +using System.Security.Cryptography; using System.Text; using libsecondlife; - using Nini.Config; namespace OpenSim.Framework @@ -52,16 +54,13 @@ namespace OpenSim.Framework public static Random RandomClass { - get - { - return randomClass; - } + get { return randomClass; } } public static uint GetNextXferID() { uint id = 0; - lock(XferLock) + lock (XferLock) { id = nextXferID; nextXferID++; @@ -71,25 +70,24 @@ namespace OpenSim.Framework public Util() { - } public static string GetFileName(string file) { // Return just the filename on UNIX platforms // TODO: this should be customisable with a prefix, but that's something to do later. - if (System.Environment.OSVersion.Platform == PlatformID.Unix) + if (Environment.OSVersion.Platform == PlatformID.Unix) { return file; } // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData - if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) + if (Environment.OSVersion.Platform == PlatformID.Win32NT) { - if (!System.IO.Directory.Exists("%APPDATA%\\OpenSim\\")) + if (!Directory.Exists("%APPDATA%\\OpenSim\\")) { - System.IO.Directory.CreateDirectory("%APPDATA%\\OpenSim"); + Directory.CreateDirectory("%APPDATA%\\OpenSim"); } return "%APPDATA%\\OpenSim\\" + file; @@ -103,23 +101,23 @@ namespace OpenSim.Framework public static bool IsEnvironmentSupported(ref string reason) { // Must have .NET 2.0 (Generics / libsl) - if (System.Environment.Version.Major < 2) + if (Environment.Version.Major < 2) { reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; return false; } // Windows 95/98/ME are unsupported - if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows && - System.Environment.OSVersion.Platform != PlatformID.Win32NT) + if (Environment.OSVersion.Platform == PlatformID.Win32Windows && + Environment.OSVersion.Platform != PlatformID.Win32NT) { reason = "Windows 95/98/ME will not run OpenSim"; return false; } // Windows 2000 / Pre-SP2 XP - if (System.Environment.OSVersion.Version.Major == 5 && ( - System.Environment.OSVersion.Version.Minor == 0)) + if (Environment.OSVersion.Version.Major == 5 && ( + Environment.OSVersion.Version.Minor == 0)) { reason = "Please update to Windows XP Service Pack 2 or Server2003"; return false; @@ -131,7 +129,7 @@ namespace OpenSim.Framework public static int UnixTimeSinceEpoch() { TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); - int timestamp = (int)t.TotalSeconds; + int timestamp = (int) t.TotalSeconds; return timestamp; } @@ -155,10 +153,10 @@ namespace OpenSim.Framework public static int fast_distance2d(int x, int y) { - x = System.Math.Abs(x); - y = System.Math.Abs(y); + x = Math.Abs(x); + y = Math.Abs(y); - int min = System.Math.Min(x, y); + int min = Math.Min(x, y); return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); } @@ -233,7 +231,7 @@ namespace OpenSim.Framework for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) { if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) - output.Append((char)bytes[i + j]); + output.Append((char) bytes[i + j]); else output.Append("."); } @@ -250,7 +248,6 @@ namespace OpenSim.Framework /// An IP address, or null public static IPAddress GetHostFromDNS(string dnsAddress) { - // Is it already a valid IP? No need to look it up. IPAddress ipa; if (IPAddress.TryParse(dnsAddress, out ipa)) @@ -261,7 +258,7 @@ namespace OpenSim.Framework foreach (IPAddress host in hosts) { - if (host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + if (host.AddressFamily == AddressFamily.InterNetwork) { return host; } @@ -281,7 +278,7 @@ namespace OpenSim.Framework foreach (IPAddress host in hosts) { - if (!IPAddress.IsLoopback(host) && host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) { return host; } @@ -302,7 +299,7 @@ namespace OpenSim.Framework string temp; // string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); // temp = Path.Combine(personal,".OpenSim"); - temp="."; + temp = "."; return temp; } @@ -349,9 +346,9 @@ namespace OpenSim.Framework } // Nini (config) related Methods - public static IConfigSource ConvertDataRowToXMLConfig(System.Data.DataRow row, string fileName) + public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) { - if(!File.Exists(fileName)) + if (!File.Exists(fileName)) { //create new file } @@ -362,13 +359,13 @@ namespace OpenSim.Framework return config; } - public static void AddDataRowToConfig(IConfigSource config, System.Data.DataRow row) + public static void AddDataRowToConfig(IConfigSource config, DataRow row) { - config.Configs.Add((string)row[0]); + config.Configs.Add((string) row[0]); for (int i = 0; i < row.Table.Columns.Count; i++) { - config.Configs[(string)row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); + config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); } } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 179a651..52d2a2c 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -31,11 +31,10 @@ using System.Collections.Generic; using System.IO; using System.Net; using System.Text; -using System.Text.RegularExpressions; using System.Threading; +using System.Xml; using Nwc.XmlRpc; using OpenSim.Framework.Console; -using System.Xml; namespace OpenSim.Framework.Servers { @@ -50,7 +49,7 @@ namespace OpenSim.Framework.Servers public int Port { - get { return m_port; } + get { return m_port; } } public BaseHttpServer(int port) @@ -58,11 +57,11 @@ namespace OpenSim.Framework.Servers m_port = port; } - public void AddStreamHandler( IStreamHandler handler) + public void AddStreamHandler(IStreamHandler handler) { string httpMethod = handler.HttpMethod; string path = handler.Path; - + string handlerKey = GetHandlerKey(httpMethod, path); m_streamHandlers.Add(handlerKey, handler); } @@ -74,9 +73,9 @@ namespace OpenSim.Framework.Servers public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) { - if (!this.m_rpcHandlers.ContainsKey(method)) + if (!m_rpcHandlers.ContainsKey(method)) { - this.m_rpcHandlers.Add(method, handler); + m_rpcHandlers.Add(method, handler); return true; } @@ -87,7 +86,7 @@ namespace OpenSim.Framework.Servers public virtual void HandleRequest(Object stateinfo) { - HttpListenerContext context = (HttpListenerContext)stateinfo; + HttpListenerContext context = (HttpListenerContext) stateinfo; HttpListenerRequest request = context.Request; HttpListenerResponse response = context.Response; @@ -96,11 +95,11 @@ namespace OpenSim.Framework.Servers response.SendChunked = false; string path = request.RawUrl; - string handlerKey = GetHandlerKey( request.HttpMethod, path ); + string handlerKey = GetHandlerKey(request.HttpMethod, path); IStreamHandler streamHandler; - if (TryGetStreamHandler( handlerKey, out streamHandler)) + if (TryGetStreamHandler(handlerKey, out streamHandler)) { byte[] buffer = streamHandler.Handle(path, request.InputStream); request.InputStream.Close(); @@ -159,11 +158,11 @@ namespace OpenSim.Framework.Servers try { - xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); + xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody); } - catch ( XmlException e ) - { - responseString = String.Format( "XmlException:\n{0}",e.Message ); + catch (XmlException e) + { + responseString = String.Format("XmlException:\n{0}", e.Message); } if (xmlRprcRequest != null) @@ -173,7 +172,7 @@ namespace OpenSim.Framework.Servers XmlRpcResponse xmlRpcResponse; XmlRpcMethod method; - if (this.m_rpcHandlers.TryGetValue(methodName, out method)) + if (m_rpcHandlers.TryGetValue(methodName, out method)) { xmlRpcResponse = method(xmlRprcRequest); } @@ -181,7 +180,8 @@ namespace OpenSim.Framework.Servers { xmlRpcResponse = new XmlRpcResponse(); Hashtable unknownMethodError = new Hashtable(); - unknownMethodError["reason"] = "XmlRequest"; ; + unknownMethodError["reason"] = "XmlRequest"; + ; unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; unknownMethodError["login"] = "false"; xmlRpcResponse.Value = unknownMethodError; @@ -249,4 +249,4 @@ namespace OpenSim.Framework.Servers m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs index 4b609c3..cd99183 100644 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs @@ -26,37 +26,36 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using System.IO; namespace OpenSim.Framework.Servers { public abstract class BaseStreamHandler : IStreamHandler { - virtual public string ContentType + public virtual string ContentType { get { return "application/xml"; } } private string m_httpMethod; - virtual public string HttpMethod + + public virtual string HttpMethod { get { return m_httpMethod; } } private string m_path; - virtual public string Path + + public virtual string Path { get { return m_path; } } - - protected string GetParam( string path ) + + protected string GetParam(string path) { - return path.Substring( m_path.Length ); + return path.Substring(m_path.Length); } - + public abstract byte[] Handle(string path, Stream request); protected BaseStreamHandler(string httpMethod, string path) @@ -65,4 +64,4 @@ namespace OpenSim.Framework.Servers m_path = path; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index 4cc6fc7..65fa3c9 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs @@ -26,10 +26,8 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using System.IO; +using System.Text; namespace OpenSim.Framework.Servers { @@ -37,14 +35,14 @@ namespace OpenSim.Framework.Servers public class BinaryStreamHandler : BaseStreamHandler { - BinaryMethod m_method; + private BinaryMethod m_method; - override public byte[] Handle(string path, Stream request) + public override byte[] Handle(string path, Stream request) { byte[] data = ReadFully(request); string param = GetParam(path); string responseString = m_method(data, path, param); - + return Encoding.UTF8.GetBytes(responseString); } @@ -67,11 +65,10 @@ namespace OpenSim.Framework.Servers { return ms.ToArray(); } - + ms.Write(buffer, 0, read); } - } + } } } - -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs index 62e5ea0..ef4c0ee 100644 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ b/OpenSim/Framework/Servers/CheckSumServer.cs @@ -26,7 +26,8 @@ * */ namespace OpenSim.Framework.Servers -{/* +{ + /* public class CheckSumServer : UDPServerBase { //protected ConsoleBase m_log; @@ -123,5 +124,4 @@ namespace OpenSim.Framework.Servers } * } */ - } \ No newline at end of file diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index d97b37f..d674172 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs @@ -26,9 +26,6 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using System.IO; namespace OpenSim.Framework.Servers @@ -36,15 +33,15 @@ namespace OpenSim.Framework.Servers public interface IStreamHandler { // Handle request stream, return byte array - byte[] Handle(string path, Stream request ); - + byte[] Handle(string path, Stream request); + // Return response content type string ContentType { get; } - + // Return required http method - string HttpMethod { get;} + string HttpMethod { get; } // Return path string Path { get; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index 80c6451..83f9e71 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs @@ -27,5 +27,5 @@ */ namespace OpenSim.Framework.Servers { - public delegate string RestMethod( string request, string path, string param ); -} + public delegate string RestMethod(string request, string path, string param); +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 1b1876e..0450387 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs @@ -26,18 +26,16 @@ * */ -using System; -using System.Collections.Generic; -using System.Text; using System.IO; +using System.Text; namespace OpenSim.Framework.Servers { public class RestStreamHandler : BaseStreamHandler { - RestMethod m_restMethod; + private RestMethod m_restMethod; - override public byte[] Handle(string path, Stream request ) + public override byte[] Handle(string path, Stream request) { Encoding encoding = Encoding.UTF8; StreamReader streamReader = new StreamReader(request, encoding); @@ -46,14 +44,14 @@ namespace OpenSim.Framework.Servers streamReader.Close(); string param = GetParam(path); - string responseString = m_restMethod(requestBody, path, param ); + string responseString = m_restMethod(requestBody, path, param); return Encoding.UTF8.GetBytes(responseString); } - public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) + public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path) { m_restMethod = restMethod; } } -} +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/UDPServerBase.cs b/OpenSim/Framework/Servers/UDPServerBase.cs index 8fc32ff..017168f 100644 --- a/OpenSim/Framework/Servers/UDPServerBase.cs +++ b/OpenSim/Framework/Servers/UDPServerBase.cs @@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers protected virtual void OnReceivedData(IAsyncResult result) { ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - epSender = (EndPoint)ipeSender; + epSender = (EndPoint) ipeSender; Packet packet = null; int numBytes = Server.EndReceiveFrom(result, ref epSender); int packetEnd = numBytes - 1; @@ -67,21 +67,18 @@ namespace OpenSim.Framework.Servers public virtual void ServerListener() { - ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server.Bind(ServerIncoming); ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); - epSender = (EndPoint)ipeSender; - ReceivedData = new AsyncCallback(this.OnReceivedData); + epSender = (EndPoint) ipeSender; + ReceivedData = new AsyncCallback(OnReceivedData); Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); } public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) { - } } -} - +} \ No newline at end of file diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs index ef14cf6..c3817ca 100644 --- a/OpenSim/Framework/Servers/XmlRpcMethod.cs +++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs @@ -29,5 +29,5 @@ using Nwc.XmlRpc; namespace OpenSim.Framework.Servers { - public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); -} + public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); +} \ No newline at end of file -- cgit v1.1