aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/CAPSService.cs6
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs207
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServer.cs24
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetServerBase.cs26
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactionManager.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetTransactions.cs199
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs37
-rw-r--r--OpenSim/Framework/Communications/Cache/GridAssetClient.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolder.cs41
-rw-r--r--OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs82
-rw-r--r--OpenSim/Framework/Communications/Cache/SQLAssetServer.cs21
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCache.cs72
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs136
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDArray.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadComplete.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadRequest.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDAssetUploadResponse.cs7
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapEvent.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs12
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDEmpty.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs32
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDItemUpdate.cs5
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayer.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapLayerResponse.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMapRequest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDMethod.cs6
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDStreamHandler.cs19
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDTest.cs3
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDType.cs10
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs20
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs6
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs3
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs6
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs19
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs594
-rw-r--r--OpenSim/Framework/Communications/LoginService.cs53
-rw-r--r--OpenSim/Framework/Communications/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Communications/RestClient/GenericAsyncResult.cs37
-rw-r--r--OpenSim/Framework/Communications/RestClient/RestClient.cs64
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs49
-rw-r--r--OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs26
-rw-r--r--OpenSim/Framework/Configuration/HTTP/RemoteConfigSettings.cs20
-rw-r--r--OpenSim/Framework/Configuration/XML/XmlConfiguration.cs16
-rw-r--r--OpenSim/Framework/Console/AssemblyInfo.cs22
-rw-r--r--OpenSim/Framework/Console/ConsoleCallbacksBase.cs4
-rw-r--r--OpenSim/Framework/Console/LogBase.cs31
-rw-r--r--OpenSim/Framework/Console/MainLog.cs11
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oGridData.cs17
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oManager.cs21
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs24
-rw-r--r--OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs4
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs68
-rw-r--r--OpenSim/Framework/Data.MSSQL/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLAssetData.cs43
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLGridData.cs21
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs117
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLLogData.cs13
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLManager.cs329
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLUserData.cs52
-rw-r--r--OpenSim/Framework/Data.MySQL/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Data.SQLite/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteAssetData.cs125
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteBase.cs102
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteGridData.cs2
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs189
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteManager.cs132
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteUserData.cs261
-rw-r--r--OpenSim/Framework/Data/GridData.cs3
-rw-r--r--OpenSim/Framework/Data/ILogData.cs7
-rw-r--r--OpenSim/Framework/Data/IniConfig.cs22
-rw-r--r--OpenSim/Framework/Data/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs63
-rw-r--r--OpenSim/Framework/Data/ReservationData.cs4
-rw-r--r--OpenSim/Framework/General/ACL.cs22
-rw-r--r--OpenSim/Framework/General/AgentCircuitManager.cs35
-rw-r--r--OpenSim/Framework/General/AgentCiruitData.cs11
-rw-r--r--OpenSim/Framework/General/AgentInventory.cs71
-rw-r--r--OpenSim/Framework/General/AgentWearable.cs5
-rw-r--r--OpenSim/Framework/General/AssetBase.cs3
-rw-r--r--OpenSim/Framework/General/AssetConfig.cs26
-rw-r--r--OpenSim/Framework/General/AssetLandmark.cs16
-rw-r--r--OpenSim/Framework/General/AssetStorage.cs29
-rw-r--r--OpenSim/Framework/General/AuthenticateResponse.cs6
-rw-r--r--OpenSim/Framework/General/BlockingQueue.cs2
-rw-r--r--OpenSim/Framework/General/ClientManager.cs22
-rw-r--r--OpenSim/Framework/General/ConfigurationMember.cs110
-rw-r--r--OpenSim/Framework/General/ConfigurationOption.cs10
-rw-r--r--OpenSim/Framework/General/Culture.cs16
-rw-r--r--OpenSim/Framework/General/EstateSettings.cs428
-rw-r--r--OpenSim/Framework/General/GridConfig.cs73
-rw-r--r--OpenSim/Framework/General/IAssetProvider.cs8
-rw-r--r--OpenSim/Framework/General/IAssetServer.cs4
-rw-r--r--OpenSim/Framework/General/IClientAPI.cs179
-rw-r--r--OpenSim/Framework/General/IGenericConfig.cs2
-rw-r--r--OpenSim/Framework/General/IPlugin.cs6
-rw-r--r--OpenSim/Framework/General/IRegionCommsListener.cs7
-rw-r--r--OpenSim/Framework/General/IScene.cs10
-rw-r--r--OpenSim/Framework/General/IUserData.cs3
-rw-r--r--OpenSim/Framework/General/IUserService.cs1
-rw-r--r--OpenSim/Framework/General/InventoryItemBase.cs19
-rw-r--r--OpenSim/Framework/General/LandData.cs169
-rw-r--r--OpenSim/Framework/General/Login.cs4
-rw-r--r--OpenSim/Framework/General/MapBlockData.cs3
-rw-r--r--OpenSim/Framework/General/NeighbourInfo.cs2
-rw-r--r--OpenSim/Framework/General/NetworkServersInfo.cs22
-rw-r--r--OpenSim/Framework/General/PrimitiveBaseShape.cs42
-rw-r--r--OpenSim/Framework/General/Properties/AssemblyInfo.cs31
-rw-r--r--OpenSim/Framework/General/RegionCommsListener.cs16
-rw-r--r--OpenSim/Framework/General/RegionHandle.cs33
-rw-r--r--OpenSim/Framework/General/RegionInfo.cs187
-rw-r--r--OpenSim/Framework/General/Remoting.cs9
-rw-r--r--OpenSim/Framework/General/UUID.cs6
-rw-r--r--OpenSim/Framework/General/UserConfig.cs43
-rw-r--r--OpenSim/Framework/General/UserProfileData.cs31
-rw-r--r--OpenSim/Framework/General/Util.cs61
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs34
-rw-r--r--OpenSim/Framework/Servers/BaseStreamHandler.cs21
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs17
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs4
-rw-r--r--OpenSim/Framework/Servers/IStreamHandler.cs13
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs4
-rw-r--r--OpenSim/Framework/Servers/RestStreamHandler.cs14
-rw-r--r--OpenSim/Framework/Servers/UDPServerBase.cs11
-rw-r--r--OpenSim/Framework/Servers/XmlRpcMethod.cs4
125 files changed, 2840 insertions, 2880 deletions
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
37 public CAPSService(BaseHttpServer httpServer) 37 public CAPSService(BaseHttpServer httpServer)
38 { 38 {
39 m_server = httpServer; 39 m_server = httpServer;
40 this.AddCapsSeedHandler("/CapsSeed/", CapsRequest); 40 AddCapsSeedHandler("/CapsSeed/", CapsRequest);
41 } 41 }
42 42
43 private void AddCapsSeedHandler(string path, RestMethod restMethod) 43 private void AddCapsSeedHandler(string path, RestMethod restMethod)
44 { 44 {
45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod)); 45 m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
46 } 46 }
47 47
48 public string CapsRequest(string request, string path, string param) 48 public string CapsRequest(string request, string path, string param)
49 { 49 {
50 System.Console.WriteLine("new caps request " + request +" from path "+ path); 50 System.Console.WriteLine("new caps request " + request + " from path " + path);
51 return ""; 51 return "";
52 } 52 }
53 } 53 }
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 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection;
33using System.Threading; 32using System.Threading;
34using libsecondlife; 33using libsecondlife;
35using libsecondlife.Packets; 34using libsecondlife.Packets;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework;
38using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
39 36
40namespace OpenSim.Framework.Communications.Cache 37namespace OpenSim.Framework.Communications.Cache
@@ -51,18 +48,22 @@ namespace OpenSim.Framework.Communications.Cache
51 public Dictionary<LLUUID, AssetInfo> Assets; 48 public Dictionary<LLUUID, AssetInfo> Assets;
52 public Dictionary<LLUUID, TextureImage> Textures; 49 public Dictionary<LLUUID, TextureImage> Textures;
53 50
54 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers 51 public List<AssetRequest> AssetRequests = new List<AssetRequest>(); //assets ready to be sent to viewers
55 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent 52 public List<AssetRequest> TextureRequests = new List<AssetRequest>(); //textures ready to be sent
56 53
57 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server 54 public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>();
58 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server 55 //Assets requested from the asset server
56
57 public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>();
58 //Textures requested from the asset server
59 59
60 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>(); 60 public Dictionary<LLUUID, TextureSender> SendingTextures = new Dictionary<LLUUID, TextureSender>();
61 private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>(); 61 private BlockingQueue<TextureSender> QueueTextures = new BlockingQueue<TextureSender>();
62 62
63 private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>(); 63 private Dictionary<LLUUID, List<LLUUID>> AvatarRecievedTextures = new Dictionary<LLUUID, List<LLUUID>>();
64 64
65 private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent = new Dictionary<LLUUID, Dictionary<LLUUID, int>>(); 65 private Dictionary<LLUUID, Dictionary<LLUUID, int>> TimesTextureSent =
66 new Dictionary<LLUUID, Dictionary<LLUUID, int>>();
66 67
67 public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>(); 68 public Dictionary<LLUUID, AssetRequestsList> RequestLists = new Dictionary<LLUUID, AssetRequestsList>();
68 69
@@ -76,19 +77,18 @@ namespace OpenSim.Framework.Communications.Cache
76 /// </summary> 77 /// </summary>
77 public AssetCache(IAssetServer assetServer) 78 public AssetCache(IAssetServer assetServer)
78 { 79 {
79 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSTORAGE","Creating Asset cache"); 80 MainLog.Instance.Verbose("ASSETSTORAGE", "Creating Asset cache");
80 _assetServer = assetServer; 81 _assetServer = assetServer;
81 _assetServer.SetReceiver(this); 82 _assetServer.SetReceiver(this);
82 Assets = new Dictionary<LLUUID, AssetInfo>(); 83 Assets = new Dictionary<LLUUID, AssetInfo>();
83 Textures = new Dictionary<LLUUID, TextureImage>(); 84 Textures = new Dictionary<LLUUID, TextureImage>();
84 this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager)); 85 _assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
85 this._assetCacheThread.IsBackground = true; 86 _assetCacheThread.IsBackground = true;
86 this._assetCacheThread.Start(); 87 _assetCacheThread.Start();
87
88 this.TextureSenderThread = new Thread(new ThreadStart(this.ProcessTextureSenders));
89 this.TextureSenderThread.IsBackground = true;
90 this.TextureSenderThread.Start();
91 88
89 TextureSenderThread = new Thread(new ThreadStart(ProcessTextureSenders));
90 TextureSenderThread.IsBackground = true;
91 TextureSenderThread.Start();
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Communications.Cache
100 { 100 {
101 try 101 try
102 { 102 {
103 this.ProcessAssetQueue(); 103 ProcessAssetQueue();
104 this.ProcessTextureQueue(); 104 ProcessTextureQueue();
105 Thread.Sleep(500); 105 Thread.Sleep(500);
106 } 106 }
107 catch (Exception e) 107 catch (Exception e)
@@ -115,13 +115,13 @@ namespace OpenSim.Framework.Communications.Cache
115 public AssetBase GetAsset(LLUUID assetID) 115 public AssetBase GetAsset(LLUUID assetID)
116 { 116 {
117 AssetBase asset = null; 117 AssetBase asset = null;
118 if (this.Textures.ContainsKey(assetID)) 118 if (Textures.ContainsKey(assetID))
119 { 119 {
120 asset = this.Textures[assetID]; 120 asset = Textures[assetID];
121 } 121 }
122 else if (this.Assets.ContainsKey(assetID)) 122 else if (Assets.ContainsKey(assetID))
123 { 123 {
124 asset = this.Assets[assetID]; 124 asset = Assets[assetID];
125 } 125 }
126 return asset; 126 return asset;
127 } 127 }
@@ -129,13 +129,13 @@ namespace OpenSim.Framework.Communications.Cache
129 public void GetAsset(LLUUID assetID, AssetRequestCallback callback) 129 public void GetAsset(LLUUID assetID, AssetRequestCallback callback)
130 { 130 {
131 AssetBase asset = null; 131 AssetBase asset = null;
132 if (this.Textures.ContainsKey(assetID)) 132 if (Textures.ContainsKey(assetID))
133 { 133 {
134 asset = this.Textures[assetID]; 134 asset = Textures[assetID];
135 } 135 }
136 else if (this.Assets.ContainsKey(assetID)) 136 else if (Assets.ContainsKey(assetID))
137 { 137 {
138 asset = this.Assets[assetID]; 138 asset = Assets[assetID];
139 } 139 }
140 140
141 if (asset != null) 141 if (asset != null)
@@ -145,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
145 else 145 else
146 { 146 {
147 NewAssetRequest req = new NewAssetRequest(assetID, callback); 147 NewAssetRequest req = new NewAssetRequest(assetID, callback);
148 if (this.RequestLists.ContainsKey(assetID)) 148 if (RequestLists.ContainsKey(assetID))
149 { 149 {
150 lock (RequestLists) 150 lock (RequestLists)
151 { 151 {
@@ -161,7 +161,7 @@ namespace OpenSim.Framework.Communications.Cache
161 RequestLists.Add(assetID, reqList); 161 RequestLists.Add(assetID, reqList);
162 } 162 }
163 } 163 }
164 this._assetServer.FetchAsset(assetID, false); 164 _assetServer.FetchAsset(assetID, false);
165 } 165 }
166 } 166 }
167 167
@@ -171,22 +171,23 @@ namespace OpenSim.Framework.Communications.Cache
171 AssetBase asset = GetAsset(assetID); 171 AssetBase asset = GetAsset(assetID);
172 if (asset == null) 172 if (asset == null)
173 { 173 {
174 this._assetServer.FetchAsset(assetID, isTexture); 174 _assetServer.FetchAsset(assetID, isTexture);
175 } 175 }
176 return asset; 176 return asset;
177 } 177 }
178 178
179 public void AddAsset(AssetBase asset) 179 public void AddAsset(AssetBase asset)
180 { 180 {
181 //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); 181 //System.Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated());
182 if (asset.Type == 0) 182 if (asset.Type == 0)
183 { 183 {
184 //Console.WriteLine("which is a texture"); 184 //Console.WriteLine("which is a texture");
185 if (!Textures.ContainsKey(asset.FullID)) 185 if (!Textures.ContainsKey(asset.FullID))
186 { //texture 186 {
187 //texture
187 TextureImage textur = new TextureImage(asset); 188 TextureImage textur = new TextureImage(asset);
188 Textures.Add(textur.FullID, textur); 189 Textures.Add(textur.FullID, textur);
189 if(!asset.Temporary) 190 if (!asset.Temporary)
190 _assetServer.StoreAndCommitAsset(asset); 191 _assetServer.StoreAndCommitAsset(asset);
191 } 192 }
192 else 193 else
@@ -219,49 +220,47 @@ namespace OpenSim.Framework.Communications.Cache
219 /// </summary> 220 /// </summary>
220 private void ProcessTextureQueue() 221 private void ProcessTextureQueue()
221 { 222 {
222 if (this.TextureRequests.Count == 0) 223 if (TextureRequests.Count == 0)
223 { 224 {
224 //no requests waiting 225 //no requests waiting
225 return; 226 return;
226 } 227 }
227 int num; 228 int num;
228 num = this.TextureRequests.Count; 229 num = TextureRequests.Count;
229 230
230 AssetRequest req; 231 AssetRequest req;
231 for (int i = 0; i < num; i++) 232 for (int i = 0; i < num; i++)
232 { 233 {
233 req = (AssetRequest)this.TextureRequests[i]; 234 req = (AssetRequest) TextureRequests[i];
234 if (!this.SendingTextures.ContainsKey(req.ImageInfo.FullID)) 235 if (!SendingTextures.ContainsKey(req.ImageInfo.FullID))
235 { 236 {
236 //Console.WriteLine("new texture to send"); 237 //Console.WriteLine("new texture to send");
237 TextureSender sender = new TextureSender(req); 238 TextureSender sender = new TextureSender(req);
238 //sender.OnComplete += this.TextureSent; 239 //sender.OnComplete += this.TextureSent;
239 this.SendingTextures.Add(req.ImageInfo.FullID, sender); 240 SendingTextures.Add(req.ImageInfo.FullID, sender);
240 this.QueueTextures.Enqueue(sender); 241 QueueTextures.Enqueue(sender);
241 } 242 }
242
243 } 243 }
244 244
245 this.TextureRequests.Clear(); 245 TextureRequests.Clear();
246 } 246 }
247 247
248 public void ProcessTextureSenders() 248 public void ProcessTextureSenders()
249 { 249 {
250 while (true) 250 while (true)
251 { 251 {
252 TextureSender sender = this.QueueTextures.Dequeue(); 252 TextureSender sender = QueueTextures.Dequeue();
253 253
254 bool finished = sender.SendTexture(); 254 bool finished = sender.SendTexture();
255 if (finished) 255 if (finished)
256 { 256 {
257 this.TextureSent(sender); 257 TextureSent(sender);
258 } 258 }
259 else 259 else
260 { 260 {
261 // Console.WriteLine("readding texture"); 261 // Console.WriteLine("readding texture");
262 this.QueueTextures.Enqueue(sender); 262 QueueTextures.Enqueue(sender);
263 } 263 }
264
265 } 264 }
266 } 265 }
267 266
@@ -271,16 +270,16 @@ namespace OpenSim.Framework.Communications.Cache
271 /// <param name="sender"></param> 270 /// <param name="sender"></param>
272 public void TextureSent(TextureSender sender) 271 public void TextureSent(TextureSender sender)
273 { 272 {
274 if (this.SendingTextures.ContainsKey(sender.request.ImageInfo.FullID)) 273 if (SendingTextures.ContainsKey(sender.request.ImageInfo.FullID))
275 { 274 {
276 this.SendingTextures.Remove(sender.request.ImageInfo.FullID); 275 SendingTextures.Remove(sender.request.ImageInfo.FullID);
277 // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID); 276 // this.AvatarRecievedTextures[sender.request.RequestUser.AgentId].Add(sender.request.ImageInfo.FullID);
278 } 277 }
279 } 278 }
280 279
281 public void AssetReceived(AssetBase asset, bool IsTexture) 280 public void AssetReceived(AssetBase asset, bool IsTexture)
282 { 281 {
283 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server 282 if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
284 { 283 {
285 //check if it is a texture or not 284 //check if it is a texture or not
286 //then add to the correct cache list 285 //then add to the correct cache list
@@ -292,48 +291,48 @@ namespace OpenSim.Framework.Communications.Cache
292 //Console.WriteLine("asset recieved from asset server"); 291 //Console.WriteLine("asset recieved from asset server");
293 292
294 TextureImage image = new TextureImage(asset); 293 TextureImage image = new TextureImage(asset);
295 if (!this.Textures.ContainsKey(image.FullID)) 294 if (!Textures.ContainsKey(image.FullID))
296 { 295 {
297 this.Textures.Add(image.FullID, image); 296 Textures.Add(image.FullID, image);
298 if (this.RequestedTextures.ContainsKey(image.FullID)) 297 if (RequestedTextures.ContainsKey(image.FullID))
299 { 298 {
300 AssetRequest req = this.RequestedTextures[image.FullID]; 299 AssetRequest req = RequestedTextures[image.FullID];
301 req.ImageInfo = image; 300 req.ImageInfo = image;
302 if (image.Data.LongLength > 600) 301 if (image.Data.LongLength > 600)
303 { 302 {
304 //over 600 bytes so split up file 303 //over 600 bytes so split up file
305 req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000; 304 req.NumPackets = 1 + (int) (image.Data.Length - 600)/1000;
306 } 305 }
307 else 306 else
308 { 307 {
309 req.NumPackets = 1; 308 req.NumPackets = 1;
310 } 309 }
311 this.RequestedTextures.Remove(image.FullID); 310 RequestedTextures.Remove(image.FullID);
312 this.TextureRequests.Add(req); 311 TextureRequests.Add(req);
313 } 312 }
314 } 313 }
315 } 314 }
316 else 315 else
317 { 316 {
318 AssetInfo assetInf = new AssetInfo(asset); 317 AssetInfo assetInf = new AssetInfo(asset);
319 if (!this.Assets.ContainsKey(assetInf.FullID)) 318 if (!Assets.ContainsKey(assetInf.FullID))
320 { 319 {
321 this.Assets.Add(assetInf.FullID, assetInf); 320 Assets.Add(assetInf.FullID, assetInf);
322 if (this.RequestedAssets.ContainsKey(assetInf.FullID)) 321 if (RequestedAssets.ContainsKey(assetInf.FullID))
323 { 322 {
324 AssetRequest req = this.RequestedAssets[assetInf.FullID]; 323 AssetRequest req = RequestedAssets[assetInf.FullID];
325 req.AssetInf = assetInf; 324 req.AssetInf = assetInf;
326 if (assetInf.Data.LongLength > 600) 325 if (assetInf.Data.LongLength > 600)
327 { 326 {
328 //over 600 bytes so split up file 327 //over 600 bytes so split up file
329 req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; 328 req.NumPackets = 1 + (int) (assetInf.Data.Length - 600 + 999)/1000;
330 } 329 }
331 else 330 else
332 { 331 {
333 req.NumPackets = 1; 332 req.NumPackets = 1;
334 } 333 }
335 this.RequestedAssets.Remove(assetInf.FullID); 334 RequestedAssets.Remove(assetInf.FullID);
336 this.AssetRequests.Add(req); 335 AssetRequests.Add(req);
337 } 336 }
338 } 337 }
339 } 338 }
@@ -345,7 +344,7 @@ namespace OpenSim.Framework.Communications.Cache
345 { 344 {
346 req.Callback(asset.FullID, asset); 345 req.Callback(asset.FullID, asset);
347 } 346 }
348 347
349 lock (RequestLists) 348 lock (RequestLists)
350 { 349 {
351 RequestLists.Remove(asset.FullID); 350 RequestLists.Remove(asset.FullID);
@@ -373,6 +372,7 @@ namespace OpenSim.Framework.Communications.Cache
373 } 372 }
374 373
375 #region Assets 374 #region Assets
375
376 /// <summary> 376 /// <summary>
377 /// 377 ///
378 /// </summary> 378 /// </summary>
@@ -396,11 +396,11 @@ namespace OpenSim.Framework.Communications.Cache
396 } 396 }
397 //check to see if asset is in local cache, if not we need to request it from asset server. 397 //check to see if asset is in local cache, if not we need to request it from asset server.
398 //Console.WriteLine("asset request " + requestID); 398 //Console.WriteLine("asset request " + requestID);
399 if (!this.Assets.ContainsKey(requestID)) 399 if (!Assets.ContainsKey(requestID))
400 { 400 {
401 //not found asset 401 //not found asset
402 // so request from asset server 402 // so request from asset server
403 if (!this.RequestedAssets.ContainsKey(requestID)) 403 if (!RequestedAssets.ContainsKey(requestID))
404 { 404 {
405 AssetRequest request = new AssetRequest(); 405 AssetRequest request = new AssetRequest();
406 request.RequestUser = userInfo; 406 request.RequestUser = userInfo;
@@ -408,13 +408,13 @@ namespace OpenSim.Framework.Communications.Cache
408 request.TransferRequestID = transferRequest.TransferInfo.TransferID; 408 request.TransferRequestID = transferRequest.TransferInfo.TransferID;
409 request.AssetRequestSource = source; 409 request.AssetRequestSource = source;
410 request.Params = transferRequest.TransferInfo.Params; 410 request.Params = transferRequest.TransferInfo.Params;
411 this.RequestedAssets.Add(requestID, request); 411 RequestedAssets.Add(requestID, request);
412 this._assetServer.FetchAsset(requestID, false); 412 _assetServer.FetchAsset(requestID, false);
413 } 413 }
414 return; 414 return;
415 } 415 }
416 //it is in our cache 416 //it is in our cache
417 AssetInfo asset = this.Assets[requestID]; 417 AssetInfo asset = Assets[requestID];
418 418
419 //work out how many packets it should be sent in 419 //work out how many packets it should be sent in
420 // and add to the AssetRequests list 420 // and add to the AssetRequests list
@@ -429,14 +429,14 @@ namespace OpenSim.Framework.Communications.Cache
429 if (asset.Data.LongLength > 600) 429 if (asset.Data.LongLength > 600)
430 { 430 {
431 //over 600 bytes so split up file 431 //over 600 bytes so split up file
432 req.NumPackets = 1 + (int)(asset.Data.Length - 600 + 999) / 1000; 432 req.NumPackets = 1 + (int) (asset.Data.Length - 600 + 999)/1000;
433 } 433 }
434 else 434 else
435 { 435 {
436 req.NumPackets = 1; 436 req.NumPackets = 1;
437 } 437 }
438 438
439 this.AssetRequests.Add(req); 439 AssetRequests.Add(req);
440 } 440 }
441 441
442 /// <summary> 442 /// <summary>
@@ -444,17 +444,17 @@ namespace OpenSim.Framework.Communications.Cache
444 /// </summary> 444 /// </summary>
445 private void ProcessAssetQueue() 445 private void ProcessAssetQueue()
446 { 446 {
447 if (this.AssetRequests.Count == 0) 447 if (AssetRequests.Count == 0)
448 { 448 {
449 //no requests waiting 449 //no requests waiting
450 return; 450 return;
451 } 451 }
452 int num; 452 int num;
453 453
454 if (this.AssetRequests.Count < 5) 454 if (AssetRequests.Count < 5)
455 { 455 {
456 //lower than 5 so do all of them 456 //lower than 5 so do all of them
457 num = this.AssetRequests.Count; 457 num = AssetRequests.Count;
458 } 458 }
459 else 459 else
460 { 460 {
@@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Cache
463 AssetRequest req; 463 AssetRequest req;
464 for (int i = 0; i < num; i++) 464 for (int i = 0; i < num; i++)
465 { 465 {
466 req = (AssetRequest)this.AssetRequests[i]; 466 req = (AssetRequest) AssetRequests[i];
467 //Console.WriteLine("sending asset " + req.RequestAssetID); 467 //Console.WriteLine("sending asset " + req.RequestAssetID);
468 TransferInfoPacket Transfer = new TransferInfoPacket(); 468 TransferInfoPacket Transfer = new TransferInfoPacket();
469 Transfer.TransferInfo.ChannelType = 2; 469 Transfer.TransferInfo.ChannelType = 2;
@@ -473,7 +473,7 @@ namespace OpenSim.Framework.Communications.Cache
473 { 473 {
474 Transfer.TransferInfo.Params = new byte[20]; 474 Transfer.TransferInfo.Params = new byte[20];
475 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 475 Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
476 int assType = (int)req.AssetInf.Type; 476 int assType = (int) req.AssetInf.Type;
477 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); 477 Array.Copy(Helpers.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
478 } 478 }
479 else if (req.AssetRequestSource == 3) 479 else if (req.AssetRequestSource == 3)
@@ -483,7 +483,7 @@ namespace OpenSim.Framework.Communications.Cache
483 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); 483 //Array.Copy(req.RequestUser.AgentId.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
484 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16); 484 //Array.Copy(req.RequestUser.SessionId.GetBytes(), 0, Transfer.TransferInfo.Params, 16, 16);
485 } 485 }
486 Transfer.TransferInfo.Size = (int)req.AssetInf.Data.Length; 486 Transfer.TransferInfo.Size = (int) req.AssetInf.Data.Length;
487 Transfer.TransferInfo.TransferID = req.TransferRequestID; 487 Transfer.TransferInfo.TransferID = req.TransferRequestID;
488 req.RequestUser.OutPacket(Transfer); 488 req.RequestUser.OutPacket(Transfer);
489 489
@@ -533,19 +533,19 @@ namespace OpenSim.Framework.Communications.Cache
533 req.RequestUser.OutPacket(TransferPacket); 533 req.RequestUser.OutPacket(TransferPacket);
534 } 534 }
535 } 535 }
536
537 } 536 }
538 537
539 //remove requests that have been completed 538 //remove requests that have been completed
540 for (int i = 0; i < num; i++) 539 for (int i = 0; i < num; i++)
541 { 540 {
542 this.AssetRequests.RemoveAt(0); 541 AssetRequests.RemoveAt(0);
543 } 542 }
544
545 } 543 }
544
546 #endregion 545 #endregion
547 546
548 #region Textures 547 #region Textures
548
549 /// <summary> 549 /// <summary>
550 /// 550 ///
551 /// </summary> 551 /// </summary>
@@ -553,21 +553,21 @@ namespace OpenSim.Framework.Communications.Cache
553 /// <param name="imageID"></param> 553 /// <param name="imageID"></param>
554 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard) 554 public void AddTextureRequest(IClientAPI userInfo, LLUUID imageID, uint packetNumber, int discard)
555 { 555 {
556 // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber); 556 // System.Console.WriteLine("texture request for " + imageID.ToStringHyphenated() + " packetnumber= " + packetNumber);
557 //check to see if texture is in local cache, if not request from asset server 557 //check to see if texture is in local cache, if not request from asset server
558 if (!this.AvatarRecievedTextures.ContainsKey(userInfo.AgentId)) 558 if (!AvatarRecievedTextures.ContainsKey(userInfo.AgentId))
559 { 559 {
560 this.AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>()); 560 AvatarRecievedTextures.Add(userInfo.AgentId, new List<LLUUID>());
561 } 561 }
562 /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID)) 562 /* if(this.AvatarRecievedTextures[userInfo.AgentId].Contains(imageID))
563 { 563 {
564 //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them"); 564 //Console.WriteLine(userInfo.AgentId +" is requesting a image( "+ imageID+" that has already been sent to them");
565 return; 565 return;
566 }*/ 566 }*/
567 567
568 if (!this.Textures.ContainsKey(imageID)) 568 if (!Textures.ContainsKey(imageID))
569 { 569 {
570 if (!this.RequestedTextures.ContainsKey(imageID)) 570 if (!RequestedTextures.ContainsKey(imageID))
571 { 571 {
572 //not is cache so request from asset server 572 //not is cache so request from asset server
573 AssetRequest request = new AssetRequest(); 573 AssetRequest request = new AssetRequest();
@@ -575,14 +575,14 @@ namespace OpenSim.Framework.Communications.Cache
575 request.RequestAssetID = imageID; 575 request.RequestAssetID = imageID;
576 request.IsTextureRequest = true; 576 request.IsTextureRequest = true;
577 request.DiscardLevel = discard; 577 request.DiscardLevel = discard;
578 this.RequestedTextures.Add(imageID, request); 578 RequestedTextures.Add(imageID, request);
579 this._assetServer.FetchAsset(imageID, true); 579 _assetServer.FetchAsset(imageID, true);
580 } 580 }
581 return; 581 return;
582 } 582 }
583 583
584 // System.Console.WriteLine("texture already in cache"); 584 // System.Console.WriteLine("texture already in cache");
585 TextureImage imag = this.Textures[imageID]; 585 TextureImage imag = Textures[imageID];
586 AssetRequest req = new AssetRequest(); 586 AssetRequest req = new AssetRequest();
587 req.RequestUser = userInfo; 587 req.RequestUser = userInfo;
588 req.RequestAssetID = imageID; 588 req.RequestAssetID = imageID;
@@ -594,7 +594,7 @@ namespace OpenSim.Framework.Communications.Cache
594 { 594 {
595 //Console.WriteLine("{0}", imag.Data.LongLength); 595 //Console.WriteLine("{0}", imag.Data.LongLength);
596 //over 600 bytes so split up file 596 //over 600 bytes so split up file
597 req.NumPackets = 2 + (int)(imag.Data.Length - 601) / 1000; 597 req.NumPackets = 2 + (int) (imag.Data.Length - 601)/1000;
598 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets"); 598 //Console.WriteLine("texture is " + imag.Data.Length + " which we will send in " +req.NumPackets +" packets");
599 } 599 }
600 else 600 else
@@ -603,12 +603,11 @@ namespace OpenSim.Framework.Communications.Cache
603 } 603 }
604 if (packetNumber != 0) 604 if (packetNumber != 0)
605 { 605 {
606 req.PacketCounter = (int)packetNumber; 606 req.PacketCounter = (int) packetNumber;
607 } 607 }
608 this.TextureRequests.Add(req); 608 TextureRequests.Add(req);
609 } 609 }
610 610
611
612 #endregion 611 #endregion
613 612
614 public class AssetRequest 613 public class AssetRequest
@@ -630,7 +629,6 @@ namespace OpenSim.Framework.Communications.Cache
630 629
631 public AssetRequest() 630 public AssetRequest()
632 { 631 {
633
634 } 632 }
635 } 633 }
636 634
@@ -638,7 +636,6 @@ namespace OpenSim.Framework.Communications.Cache
638 { 636 {
639 public AssetInfo() 637 public AssetInfo()
640 { 638 {
641
642 } 639 }
643 640
644 public AssetInfo(AssetBase aBase) 641 public AssetInfo(AssetBase aBase)
@@ -656,7 +653,6 @@ namespace OpenSim.Framework.Communications.Cache
656 { 653 {
657 public TextureImage() 654 public TextureImage()
658 { 655 {
659
660 } 656 }
661 657
662 public TextureImage(AssetBase aBase) 658 public TextureImage(AssetBase aBase)
@@ -678,7 +674,6 @@ namespace OpenSim.Framework.Communications.Cache
678 public TextureSender(AssetRequest req) 674 public TextureSender(AssetRequest req)
679 { 675 {
680 request = req; 676 request = req;
681
682 } 677 }
683 678
684 public bool SendTexture() 679 public bool SendTexture()
@@ -686,7 +681,8 @@ namespace OpenSim.Framework.Communications.Cache
686 SendPacket(); 681 SendPacket();
687 counter++; 682 counter++;
688 683
689 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) | (request.DiscardLevel == -1)) 684 if ((request.PacketCounter >= request.NumPackets) | counter > 100 | (request.NumPackets == 1) |
685 (request.DiscardLevel == -1))
690 { 686 {
691 return true; 687 return true;
692 } 688 }
@@ -707,7 +703,7 @@ namespace OpenSim.Framework.Communications.Cache
707 im.Header.Reliable = false; 703 im.Header.Reliable = false;
708 im.ImageID.Packets = 1; 704 im.ImageID.Packets = 1;
709 im.ImageID.ID = req.ImageInfo.FullID; 705 im.ImageID.ID = req.ImageInfo.FullID;
710 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 706 im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
711 im.ImageData.Data = req.ImageInfo.Data; 707 im.ImageData.Data = req.ImageInfo.Data;
712 im.ImageID.Codec = 2; 708 im.ImageID.Codec = 2;
713 req.RequestUser.OutPacket(im); 709 req.RequestUser.OutPacket(im);
@@ -721,9 +717,9 @@ namespace OpenSim.Framework.Communications.Cache
721 //more than one packet so split file up 717 //more than one packet so split file up
722 ImageDataPacket im = new ImageDataPacket(); 718 ImageDataPacket im = new ImageDataPacket();
723 im.Header.Reliable = false; 719 im.Header.Reliable = false;
724 im.ImageID.Packets = (ushort)(req.NumPackets); 720 im.ImageID.Packets = (ushort) (req.NumPackets);
725 im.ImageID.ID = req.ImageInfo.FullID; 721 im.ImageID.ID = req.ImageInfo.FullID;
726 im.ImageID.Size = (uint)req.ImageInfo.Data.Length; 722 im.ImageID.Size = (uint) req.ImageInfo.Data.Length;
727 im.ImageData.Data = new byte[600]; 723 im.ImageData.Data = new byte[600];
728 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600); 724 Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
729 im.ImageID.Codec = 2; 725 im.ImageID.Codec = 2;
@@ -742,19 +738,18 @@ namespace OpenSim.Framework.Communications.Cache
742 //more than one packet so split file up 738 //more than one packet so split file up
743 ImagePacketPacket im = new ImagePacketPacket(); 739 ImagePacketPacket im = new ImagePacketPacket();
744 im.Header.Reliable = false; 740 im.Header.Reliable = false;
745 im.ImageID.Packet = (ushort)(req.PacketCounter); 741 im.ImageID.Packet = (ushort) (req.PacketCounter);
746 im.ImageID.ID = req.ImageInfo.FullID; 742 im.ImageID.ID = req.ImageInfo.FullID;
747 int size = req.ImageInfo.Data.Length - 600 - (1000 * (req.PacketCounter - 1)); 743 int size = req.ImageInfo.Data.Length - 600 - (1000*(req.PacketCounter - 1));
748 if (size > 1000) size = 1000; 744 if (size > 1000) size = 1000;
749 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size); 745 //Console.WriteLine("length= {0} counter= {1} size= {2}",req.ImageInfo.Data.Length, req.PacketCounter, size);
750 im.ImageData.Data = new byte[size]; 746 im.ImageData.Data = new byte[size];
751 Array.Copy(req.ImageInfo.Data, 600 + (1000 * (req.PacketCounter - 1)), im.ImageData.Data, 0, size); 747 Array.Copy(req.ImageInfo.Data, 600 + (1000*(req.PacketCounter - 1)), im.ImageData.Data, 0, size);
752 req.RequestUser.OutPacket(im); 748 req.RequestUser.OutPacket(im);
753 req.PacketCounter++; 749 req.PacketCounter++;
754 //req.ImageInfo.last_used = time; 750 //req.ImageInfo.last_used = time;
755 //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID); 751 //System.Console.WriteLine("sent a packet of texture: "+req.ImageInfo.FullID);
756 } 752 }
757
758 } 753 }
759 754
760 private void SaveAssetToFile(string filename, byte[] data) 755 private void SaveAssetToFile(string filename, byte[] data)
@@ -789,7 +784,5 @@ namespace OpenSim.Framework.Communications.Cache
789 AssetID = assetID; 784 AssetID = assetID;
790 Callback = callback; 785 Callback = callback;
791 } 786 }
792
793
794 } 787 }
795} 788} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections.Generic;
30using System.IO; 28using System.IO;
31using System.Threading;
32using Db4objects.Db4o; 29using Db4objects.Db4o;
33using Db4objects.Db4o.Query; 30using Db4objects.Db4o.Query;
34using libsecondlife; 31using libsecondlife;
35using Nini.Config;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40 33
41namespace OpenSim.Framework.Communications.Cache 34namespace OpenSim.Framework.Communications.Cache
42{ 35{
@@ -50,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache
50 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap")); 43 yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
51 44
52 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap")); 45 db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
53 MainLog.Instance.Verbose("ASSETS","Db4 Asset database creation"); 46 MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation");
54 47
55 if (!yapfile) 48 if (!yapfile)
56 { 49 {
@@ -68,29 +61,29 @@ namespace OpenSim.Framework.Communications.Cache
68 db.Commit(); 61 db.Commit();
69 } 62 }
70 63
71 override public void Close() 64 public override void Close()
72 { 65 {
73 base.Close(); 66 base.Close();
74 67
75 if (db != null) 68 if (db != null)
76 { 69 {
77 MainLog.Instance.Verbose("ASSETSERVER","Closing local asset server database"); 70 MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database");
78 db.Close(); 71 db.Close();
79 } 72 }
80 } 73 }
81 74
82 override protected void RunRequests() 75 protected override void RunRequests()
83 { 76 {
84 while (true) 77 while (true)
85 { 78 {
86 byte[] idata = null; 79 byte[] idata = null;
87 bool found = false; 80 bool found = false;
88 AssetStorage foundAsset = null; 81 AssetStorage foundAsset = null;
89 ARequest req = this._assetRequests.Dequeue(); 82 ARequest req = _assetRequests.Dequeue();
90 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID)); 83 IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
91 if (result.Count > 0) 84 if (result.Count > 0)
92 { 85 {
93 foundAsset = (AssetStorage)result.Next(); 86 foundAsset = (AssetStorage) result.Next();
94 found = true; 87 found = true;
95 } 88 }
96 89
@@ -110,12 +103,10 @@ namespace OpenSim.Framework.Communications.Cache
110 //asset.FullID = ; 103 //asset.FullID = ;
111 _receiver.AssetNotFound(req.AssetID); 104 _receiver.AssetNotFound(req.AssetID);
112 } 105 }
113
114 } 106 }
115
116 } 107 }
117 108
118 override protected void StoreAsset(AssetBase asset) 109 protected override void StoreAsset(AssetBase asset)
119 { 110 {
120 AssetStorage store = new AssetStorage(); 111 AssetStorage store = new AssetStorage();
121 store.Data = asset.Data; 112 store.Data = asset.Data;
@@ -148,6 +139,7 @@ namespace OpenSim.Framework.Communications.Cache
148 { 139 {
149 _findID = find; 140 _findID = find;
150 } 141 }
142
151 public bool Match(AssetStorage asset) 143 public bool Match(AssetStorage asset)
152 { 144 {
153 return (asset.UUID == _findID); 145 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;
5using libsecondlife; 5using libsecondlife;
6using Nini.Config; 6using Nini.Config;
7using OpenSim.Framework.Console; 7using OpenSim.Framework.Console;
8using OpenSim.Framework.Interfaces;
9using OpenSim.Framework;
10 8
11namespace OpenSim.Framework.Communications.Cache 9namespace OpenSim.Framework.Communications.Cache
12{ 10{
@@ -36,13 +34,12 @@ namespace OpenSim.Framework.Communications.Cache
36 34
37 public AssetServerBase() 35 public AssetServerBase()
38 { 36 {
37 MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system");
38 _assetRequests = new BlockingQueue<ARequest>();
39 39
40 OpenSim.Framework.Console.MainLog.Instance.Verbose("ASSETSERVER","Starting asset storage system"); 40 _localAssetServerThread = new Thread(RunRequests);
41 this._assetRequests = new BlockingQueue<ARequest>(); 41 _localAssetServerThread.IsBackground = true;
42 42 _localAssetServerThread.Start();
43 this._localAssetServerThread = new Thread(RunRequests);
44 this._localAssetServerThread.IsBackground = true;
45 this._localAssetServerThread.Start();
46 } 43 }
47 44
48 public void LoadAsset(AssetBase info, bool image, string filename) 45 public void LoadAsset(AssetBase info, bool image, string filename)
@@ -57,7 +54,7 @@ namespace OpenSim.Framework.Communications.Cache
57 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read); 54 FileStream fStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
58 byte[] idata = new byte[numBytes]; 55 byte[] idata = new byte[numBytes];
59 BinaryReader br = new BinaryReader(fStream); 56 BinaryReader br = new BinaryReader(fStream);
60 idata = br.ReadBytes((int)numBytes); 57 idata = br.ReadBytes((int) numBytes);
61 br.Close(); 58 br.Close();
62 fStream.Close(); 59 fStream.Close();
63 info.Data = idata; 60 info.Data = idata;
@@ -66,7 +63,7 @@ namespace OpenSim.Framework.Communications.Cache
66 63
67 public void SetReceiver(IAssetReceiver receiver) 64 public void SetReceiver(IAssetReceiver receiver)
68 { 65 {
69 this._receiver = receiver; 66 _receiver = receiver;
70 } 67 }
71 68
72 public void FetchAsset(LLUUID assetID, bool isTexture) 69 public void FetchAsset(LLUUID assetID, bool isTexture)
@@ -74,7 +71,7 @@ namespace OpenSim.Framework.Communications.Cache
74 ARequest req = new ARequest(); 71 ARequest req = new ARequest();
75 req.AssetID = assetID; 72 req.AssetID = assetID;
76 req.IsTexture = isTexture; 73 req.IsTexture = isTexture;
77 this._assetRequests.Enqueue(req); 74 _assetRequests.Enqueue(req);
78 } 75 }
79 76
80 public void UpdateAsset(AssetBase asset) 77 public void UpdateAsset(AssetBase asset)
@@ -102,7 +99,6 @@ namespace OpenSim.Framework.Communications.Cache
102 99
103 public void SetServerInfo(string ServerUrl, string ServerKey) 100 public void SetServerInfo(string ServerUrl, string ServerKey)
104 { 101 {
105
106 } 102 }
107 103
108 public virtual List<AssetBase> GetDefaultAssets() 104 public virtual List<AssetBase> GetDefaultAssets()
@@ -175,8 +171,8 @@ namespace OpenSim.Framework.Communications.Cache
175 // System.Console.WriteLine("loading asset into database"); 171 // System.Console.WriteLine("loading asset into database");
176 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()); 172 string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated());
177 string name = source.Configs[i].GetString("name", ""); 173 string name = source.Configs[i].GetString("name", "");
178 sbyte type = (sbyte)source.Configs[i].GetInt("assetType", 0); 174 sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
179 sbyte invType = (sbyte)source.Configs[i].GetInt("inventoryType", 0); 175 sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
180 string fileName = source.Configs[i].GetString("fileName", ""); 176 string fileName = source.Configs[i].GetString("fileName", "");
181 177
182 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false); 178 AssetBase newAsset = CreateAsset(assetIdStr, name, fileName, false);
@@ -189,4 +185,4 @@ namespace OpenSim.Framework.Communications.Cache
189 assets.ForEach(action); 185 assets.ForEach(action);
190 } 186 }
191 } 187 }
192} 188} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36using OpenSim.Framework.Data;
37 30
38namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
39{ 32{
@@ -41,7 +34,10 @@ namespace OpenSim.Framework.Communications.Cache
41 { 34 {
42 // Fields 35 // Fields
43 public CommunicationsManager CommsManager; 36 public CommunicationsManager CommsManager;
44 public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>(); 37
38 public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
39 new Dictionary<LLUUID, AgentAssetTransactions>();
40
45 private bool m_dumpAssetsToFile; 41 private bool m_dumpAssetsToFile;
46 42
47 public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile) 43 public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
@@ -53,10 +49,10 @@ namespace OpenSim.Framework.Communications.Cache
53 // Methods 49 // Methods
54 public AgentAssetTransactions AddUser(LLUUID userID) 50 public AgentAssetTransactions AddUser(LLUUID userID)
55 { 51 {
56 if (!this.AgentTransactions.ContainsKey(userID)) 52 if (!AgentTransactions.ContainsKey(userID))
57 { 53 {
58 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile); 54 AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
59 this.AgentTransactions.Add(userID, transactions); 55 AgentTransactions.Add(userID, transactions);
60 return transactions; 56 return transactions;
61 } 57 }
62 return null; 58 return null;
@@ -64,27 +60,30 @@ namespace OpenSim.Framework.Communications.Cache
64 60
65 public AgentAssetTransactions GetUserTransActions(LLUUID userID) 61 public AgentAssetTransactions GetUserTransActions(LLUUID userID)
66 { 62 {
67 if (this.AgentTransactions.ContainsKey(userID)) 63 if (AgentTransactions.ContainsKey(userID))
68 { 64 {
69 return this.AgentTransactions[userID]; 65 return AgentTransactions[userID];
70 } 66 }
71 return null; 67 return null;
72 } 68 }
73 69
74 public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 70 public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
71 uint callbackID, string description, string name, sbyte invType,
72 sbyte type, byte wearableType, uint nextOwnerMask)
75 { 73 {
76 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 74 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
77 if (transactions != null) 75 if (transactions != null)
78 { 76 {
79 transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 77 transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
78 name, invType, type, wearableType, nextOwnerMask);
80 } 79 }
81
82 } 80 }
83 81
84 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) 82 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
83 byte[] data, bool storeLocal)
85 { 84 {
86 // Console.WriteLine("asset upload of " + assetID); 85 // Console.WriteLine("asset upload of " + assetID);
87 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 86 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
88 if (transactions != null) 87 if (transactions != null)
89 { 88 {
90 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction); 89 AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
@@ -97,7 +96,7 @@ namespace OpenSim.Framework.Communications.Cache
97 96
98 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) 97 public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
99 { 98 {
100 AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); 99 AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
101 if (transactions != null) 100 if (transactions != null)
102 { 101 {
103 transactions.HandleXfer(xferID, packetID, data); 102 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using System.IO; 30using System.IO;
33using libsecondlife; 31using libsecondlife;
34using libsecondlife.Packets; 32using libsecondlife.Packets;
35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Framework.Interfaces;
37using OpenSim.Framework;
38using OpenSim.Region.Capabilities;
39using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
34using OpenSim.Region.Capabilities;
40 35
41namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
42{ 37{
@@ -53,7 +48,7 @@ namespace OpenSim.Framework.Communications.Cache
53 // Methods 48 // Methods
54 public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile) 49 public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile)
55 { 50 {
56 this.UserID = agentID; 51 UserID = agentID;
57 Manager = manager; 52 Manager = manager;
58 m_dumpAssetsToFile = dumpAssetsToFile; 53 m_dumpAssetsToFile = dumpAssetsToFile;
59 } 54 }
@@ -61,24 +56,24 @@ namespace OpenSim.Framework.Communications.Cache
61 public AssetCapsUploader RequestCapsUploader() 56 public AssetCapsUploader RequestCapsUploader()
62 { 57 {
63 AssetCapsUploader uploader = new AssetCapsUploader(); 58 AssetCapsUploader uploader = new AssetCapsUploader();
64 this.CapsUploaders.Add(uploader); 59 CapsUploaders.Add(uploader);
65 return uploader; 60 return uploader;
66 } 61 }
67 62
68 public NoteCardCapsUpdate RequestNoteCardUpdater() 63 public NoteCardCapsUpdate RequestNoteCardUpdater()
69 { 64 {
70 NoteCardCapsUpdate update = new NoteCardCapsUpdate(); 65 NoteCardCapsUpdate update = new NoteCardCapsUpdate();
71 this.NotecardUpdaters.Add(update); 66 NotecardUpdaters.Add(update);
72 return update; 67 return update;
73 } 68 }
74 69
75 public AssetXferUploader RequestXferUploader(LLUUID transactionID) 70 public AssetXferUploader RequestXferUploader(LLUUID transactionID)
76 { 71 {
77 if (!this.XferUploaders.ContainsKey(transactionID)) 72 if (!XferUploaders.ContainsKey(transactionID))
78 { 73 {
79 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile); 74 AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
80 75
81 this.XferUploaders.Add(transactionID, uploader); 76 XferUploaders.Add(transactionID, uploader);
82 return uploader; 77 return uploader;
83 } 78 }
84 return null; 79 return null;
@@ -86,7 +81,7 @@ namespace OpenSim.Framework.Communications.Cache
86 81
87 public void HandleXfer(ulong xferID, uint packetID, byte[] data) 82 public void HandleXfer(ulong xferID, uint packetID, byte[] data)
88 { 83 {
89 foreach (AssetXferUploader uploader in this.XferUploaders.Values) 84 foreach (AssetXferUploader uploader in XferUploaders.Values)
90 { 85 {
91 if (uploader.XferID == xferID) 86 if (uploader.XferID == xferID)
92 { 87 {
@@ -96,17 +91,21 @@ namespace OpenSim.Framework.Communications.Cache
96 } 91 }
97 } 92 }
98 93
99 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 94 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
95 uint callbackID, string description, string name, sbyte invType,
96 sbyte type, byte wearableType, uint nextOwnerMask)
100 { 97 {
101 if (this.XferUploaders.ContainsKey(transactionID)) 98 if (XferUploaders.ContainsKey(transactionID))
102 { 99 {
103 this.XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description, name, invType, type, wearableType, nextOwnerMask); 100 XferUploaders[transactionID].RequestCreateInventoryItem(remoteClient, transactionID, folderID,
101 callbackID, description, name, invType, type,
102 wearableType, nextOwnerMask);
104 } 103 }
105 } 104 }
106 105
107 public AssetBase GetTransactionAsset(LLUUID transactionID) 106 public AssetBase GetTransactionAsset(LLUUID transactionID)
108 { 107 {
109 if (this.XferUploaders.ContainsKey(transactionID)) 108 if (XferUploaders.ContainsKey(transactionID))
110 { 109 {
111 return XferUploaders[transactionID].GetAssetData(); 110 return XferUploaders[transactionID].GetAssetData();
112 } 111 }
@@ -130,15 +129,16 @@ namespace OpenSim.Framework.Communications.Cache
130 public event UpLoadedAsset OnUpLoad; 129 public event UpLoadedAsset OnUpLoad;
131 130
132 // Methods 131 // Methods
133 public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile) 132 public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem,
133 LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile)
134 { 134 {
135 this.m_assetName = assetName; 135 m_assetName = assetName;
136 this.m_assetDescription = assetDescription; 136 m_assetDescription = assetDescription;
137 this.m_folderID = folderID; 137 m_folderID = folderID;
138 this.newAssetID = assetID; 138 newAssetID = assetID;
139 this.inventoryItemID = inventoryItem; 139 inventoryItemID = inventoryItem;
140 this.uploaderPath = path; 140 uploaderPath = path;
141 this.httpListener = httpServer; 141 httpListener = httpServer;
142 m_dumpImageToFile = dumpImageToFile; 142 m_dumpImageToFile = dumpImageToFile;
143 } 143 }
144 144
@@ -156,18 +156,18 @@ namespace OpenSim.Framework.Communications.Cache
156 LLUUID inventoryItemID = this.inventoryItemID; 156 LLUUID inventoryItemID = this.inventoryItemID;
157 string text = ""; 157 string text = "";
158 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); 158 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
159 complete.new_asset = this.newAssetID.ToStringHyphenated(); 159 complete.new_asset = newAssetID.ToStringHyphenated();
160 complete.new_inventory_item = inventoryItemID; 160 complete.new_inventory_item = inventoryItemID;
161 complete.state = "complete"; 161 complete.state = "complete";
162 text = LLSDHelpers.SerialiseLLSDReply(complete); 162 text = LLSDHelpers.SerialiseLLSDReply(complete);
163 this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); 163 httpListener.RemoveStreamHandler("POST", uploaderPath);
164 if (this.m_dumpImageToFile) 164 if (m_dumpImageToFile)
165 { 165 {
166 this.SaveImageToFile(this.m_assetName + ".jp2", data); 166 SaveImageToFile(m_assetName + ".jp2", data);
167 } 167 }
168 if (this.OnUpLoad != null) 168 if (OnUpLoad != null)
169 { 169 {
170 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , ""); 170 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
171 } 171 }
172 return text; 172 return text;
173 } 173 }
@@ -196,90 +196,91 @@ namespace OpenSim.Framework.Communications.Cache
196 196
197 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile) 197 public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
198 { 198 {
199 this.m_userTransactions = transactions; 199 m_userTransactions = transactions;
200 m_dumpAssetToFile = dumpAssetToFile; 200 m_dumpAssetToFile = dumpAssetToFile;
201 } 201 }
202 202
203 // Methods 203 // Methods
204 public void HandleXferPacket(ulong xferID, uint packetID, byte[] data) 204 public void HandleXferPacket(ulong xferID, uint packetID, byte[] data)
205 { 205 {
206 if (this.XferID == xferID) 206 if (XferID == xferID)
207 { 207 {
208 if (this.Asset.Data.Length > 1) 208 if (Asset.Data.Length > 1)
209 { 209 {
210 byte[] destinationArray = new byte[this.Asset.Data.Length + data.Length]; 210 byte[] destinationArray = new byte[Asset.Data.Length + data.Length];
211 Array.Copy(this.Asset.Data, 0, destinationArray, 0, this.Asset.Data.Length); 211 Array.Copy(Asset.Data, 0, destinationArray, 0, Asset.Data.Length);
212 Array.Copy(data, 0, destinationArray, this.Asset.Data.Length, data.Length); 212 Array.Copy(data, 0, destinationArray, Asset.Data.Length, data.Length);
213 this.Asset.Data = destinationArray; 213 Asset.Data = destinationArray;
214 } 214 }
215 else 215 else
216 { 216 {
217 byte[] buffer2 = new byte[data.Length - 4]; 217 byte[] buffer2 = new byte[data.Length - 4];
218 Array.Copy(data, 4, buffer2, 0, data.Length - 4); 218 Array.Copy(data, 4, buffer2, 0, data.Length - 4);
219 this.Asset.Data = buffer2; 219 Asset.Data = buffer2;
220 } 220 }
221 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket(); 221 ConfirmXferPacketPacket newPack = new ConfirmXferPacketPacket();
222 newPack.XferID.ID = xferID; 222 newPack.XferID.ID = xferID;
223 newPack.XferID.Packet = packetID; 223 newPack.XferID.Packet = packetID;
224 this.ourClient.OutPacket(newPack); 224 ourClient.OutPacket(newPack);
225 if ((packetID & 0x80000000) != 0) 225 if ((packetID & 0x80000000) != 0)
226 { 226 {
227 this.SendCompleteMessage(); 227 SendCompleteMessage();
228 } 228 }
229 } 229 }
230 } 230 }
231 231
232 public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) 232 public void Initialise(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data,
233 bool storeLocal)
233 { 234 {
234 this.ourClient = remoteClient; 235 ourClient = remoteClient;
235 this.Asset = new AssetBase(); 236 Asset = new AssetBase();
236 this.Asset.FullID = assetID; 237 Asset.FullID = assetID;
237 this.Asset.InvType = type; 238 Asset.InvType = type;
238 this.Asset.Type = type; 239 Asset.Type = type;
239 this.Asset.Data = data; 240 Asset.Data = data;
240 this.Asset.Name = "blank"; 241 Asset.Name = "blank";
241 this.Asset.Description = "empty"; 242 Asset.Description = "empty";
242 this.TransactionID = transaction; 243 TransactionID = transaction;
243 this.m_storeLocal = storeLocal; 244 m_storeLocal = storeLocal;
244 if (this.Asset.Data.Length > 2) 245 if (Asset.Data.Length > 2)
245 { 246 {
246 this.SendCompleteMessage(); 247 SendCompleteMessage();
247 } 248 }
248 else 249 else
249 { 250 {
250 this.ReqestStartXfer(); 251 ReqestStartXfer();
251 } 252 }
252 } 253 }
253 254
254 protected void ReqestStartXfer() 255 protected void ReqestStartXfer()
255 { 256 {
256 this.UploadComplete = false; 257 UploadComplete = false;
257 this.XferID = Util.GetNextXferID(); 258 XferID = Util.GetNextXferID();
258 RequestXferPacket newPack = new RequestXferPacket(); 259 RequestXferPacket newPack = new RequestXferPacket();
259 newPack.XferID.ID = this.XferID; 260 newPack.XferID.ID = XferID;
260 newPack.XferID.VFileType = this.Asset.Type; 261 newPack.XferID.VFileType = Asset.Type;
261 newPack.XferID.VFileID = this.Asset.FullID; 262 newPack.XferID.VFileID = Asset.FullID;
262 newPack.XferID.FilePath = 0; 263 newPack.XferID.FilePath = 0;
263 newPack.XferID.Filename = new byte[0]; 264 newPack.XferID.Filename = new byte[0];
264 this.ourClient.OutPacket(newPack); 265 ourClient.OutPacket(newPack);
265 } 266 }
266 267
267 protected void SendCompleteMessage() 268 protected void SendCompleteMessage()
268 { 269 {
269 this.UploadComplete = true; 270 UploadComplete = true;
270 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket(); 271 AssetUploadCompletePacket newPack = new AssetUploadCompletePacket();
271 newPack.AssetBlock.Type = this.Asset.Type; 272 newPack.AssetBlock.Type = Asset.Type;
272 newPack.AssetBlock.Success = true; 273 newPack.AssetBlock.Success = true;
273 newPack.AssetBlock.UUID = this.Asset.FullID; 274 newPack.AssetBlock.UUID = Asset.FullID;
274 this.ourClient.OutPacket(newPack); 275 ourClient.OutPacket(newPack);
275 this.m_finished = true; 276 m_finished = true;
276 if (m_createItem) 277 if (m_createItem)
277 { 278 {
278 DoCreateItem(); 279 DoCreateItem();
279 } 280 }
280 else if (m_storeLocal) 281 else if (m_storeLocal)
281 { 282 {
282 this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); 283 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
283 } 284 }
284 285
285 // Console.WriteLine("upload complete "+ this.TransactionID); 286 // Console.WriteLine("upload complete "+ this.TransactionID);
@@ -287,8 +288,10 @@ namespace OpenSim.Framework.Communications.Cache
287 if (m_dumpAssetToFile) 288 if (m_dumpAssetToFile)
288 { 289 {
289 DateTime now = DateTime.Now; 290 DateTime now = DateTime.Now;
290 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 ); 291 string filename =
291 SaveAssetToFile(filename, this.Asset.Data); 292 String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}", now.Year, now.Month, now.Day,
293 now.Hour, now.Minute, now.Second, Asset.Name, Asset.Type);
294 SaveAssetToFile(filename, Asset.Data);
292 } 295 }
293 } 296 }
294 297
@@ -301,20 +304,22 @@ namespace OpenSim.Framework.Communications.Cache
301 fs.Close(); 304 fs.Close();
302 } 305 }
303 306
304 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask) 307 public void RequestCreateInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
308 uint callbackID, string description, string name, sbyte invType,
309 sbyte type, byte wearableType, uint nextOwnerMask)
305 { 310 {
306 if (this.TransactionID == transactionID) 311 if (TransactionID == transactionID)
307 { 312 {
308 this.InventFolder = folderID; 313 InventFolder = folderID;
309 this.m_name = name; 314 m_name = name;
310 this.m_description = description; 315 m_description = description;
311 this.type = type; 316 this.type = type;
312 this.invType = invType; 317 this.invType = invType;
313 this.nextPerm = nextOwnerMask; 318 nextPerm = nextOwnerMask;
314 this.Asset.Name = name; 319 Asset.Name = name;
315 this.Asset.Description = description; 320 Asset.Description = description;
316 this.Asset.Type = type; 321 Asset.Type = type;
317 this.Asset.InvType = invType; 322 Asset.InvType = invType;
318 m_createItem = true; 323 m_createItem = true;
319 if (m_finished) 324 if (m_finished)
320 { 325 {
@@ -326,22 +331,23 @@ namespace OpenSim.Framework.Communications.Cache
326 private void DoCreateItem() 331 private void DoCreateItem()
327 { 332 {
328 //really need to fix this call, if lbsa71 saw this he would die. 333 //really need to fix this call, if lbsa71 saw this he would die.
329 this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); 334 m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(Asset);
330 CachedUserInfo userInfo = m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId); 335 CachedUserInfo userInfo =
336 m_userTransactions.Manager.CommsManager.UserProfileCache.GetUserDetails(ourClient.AgentId);
331 if (userInfo != null) 337 if (userInfo != null)
332 { 338 {
333 InventoryItemBase item = new InventoryItemBase(); 339 InventoryItemBase item = new InventoryItemBase();
334 item.avatarID = this.ourClient.AgentId; 340 item.avatarID = ourClient.AgentId;
335 item.creatorsID = ourClient.AgentId; 341 item.creatorsID = ourClient.AgentId;
336 item.inventoryID = LLUUID.Random(); 342 item.inventoryID = LLUUID.Random();
337 item.assetID = Asset.FullID; 343 item.assetID = Asset.FullID;
338 item.inventoryDescription = this.m_description; 344 item.inventoryDescription = m_description;
339 item.inventoryName = m_name; 345 item.inventoryName = m_name;
340 item.assetType = type; 346 item.assetType = type;
341 item.invType = this.invType; 347 item.invType = invType;
342 item.parentFolderID = this.InventFolder; 348 item.parentFolderID = InventFolder;
343 item.inventoryCurrentPermissions = 2147483647; 349 item.inventoryCurrentPermissions = 2147483647;
344 item.inventoryNextPermissions = this.nextPerm; 350 item.inventoryNextPermissions = nextPerm;
345 351
346 userInfo.AddItem(ourClient.AgentId, item); 352 userInfo.AddItem(ourClient.AgentId, item);
347 ourClient.SendInventoryItemUpdate(item); 353 ourClient.SendInventoryItemUpdate(item);
@@ -350,14 +356,13 @@ namespace OpenSim.Framework.Communications.Cache
350 356
351 public void UpdateInventoryItem(LLUUID itemID) 357 public void UpdateInventoryItem(LLUUID itemID)
352 { 358 {
353
354 } 359 }
355 360
356 public AssetBase GetAssetData() 361 public AssetBase GetAssetData()
357 { 362 {
358 if (m_finished) 363 if (m_finished)
359 { 364 {
360 return this.Asset; 365 return Asset;
361 } 366 }
362 return null; 367 return null;
363 } 368 }
@@ -379,10 +384,10 @@ namespace OpenSim.Framework.Communications.Cache
379 // Methods 384 // Methods
380 public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer) 385 public void Initialise(LLUUID inventoryItem, string path, BaseHttpServer httpServer)
381 { 386 {
382 this.inventoryItemID = inventoryItem; 387 inventoryItemID = inventoryItem;
383 this.uploaderPath = path; 388 uploaderPath = path;
384 this.httpListener = httpServer; 389 httpListener = httpServer;
385 this.newAssetID = LLUUID.Random(); 390 newAssetID = LLUUID.Random();
386 } 391 }
387 392
388 private void SaveImageToFile(string filename, byte[] data) 393 private void SaveImageToFile(string filename, byte[] data)
@@ -399,18 +404,18 @@ namespace OpenSim.Framework.Communications.Cache
399 LLUUID inventoryItemID = this.inventoryItemID; 404 LLUUID inventoryItemID = this.inventoryItemID;
400 string text = ""; 405 string text = "";
401 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete(); 406 LLSDAssetUploadComplete complete = new LLSDAssetUploadComplete();
402 complete.new_asset = this.newAssetID.ToStringHyphenated(); 407 complete.new_asset = newAssetID.ToStringHyphenated();
403 complete.new_inventory_item = inventoryItemID; 408 complete.new_inventory_item = inventoryItemID;
404 complete.state = "complete"; 409 complete.state = "complete";
405 text = LLSDHelpers.SerialiseLLSDReply(complete); 410 text = LLSDHelpers.SerialiseLLSDReply(complete);
406 this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); 411 httpListener.RemoveStreamHandler("POST", uploaderPath);
407 if (this.SaveImages) 412 if (SaveImages)
408 { 413 {
409 this.SaveImageToFile(this.m_assetName + "notecard.txt", data); 414 SaveImageToFile(m_assetName + "notecard.txt", data);
410 } 415 }
411 if (this.OnUpLoad != null) 416 if (OnUpLoad != null)
412 { 417 {
413 this.OnUpLoad(this.m_assetName, "description", this.newAssetID, inventoryItemID, LLUUID.Zero, data, "" , "" ); 418 OnUpLoad(m_assetName, "description", newAssetID, inventoryItemID, LLUUID.Zero, data, "", "");
414 } 419 }
415 return text; 420 return text;
416 } 421 }
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 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework.Communications.Cache 30namespace OpenSim.Framework.Communications.Cache
32{ 31{
@@ -45,22 +44,22 @@ namespace OpenSim.Framework.Communications.Cache
45 // Methods 44 // Methods
46 public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) 45 public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
47 { 46 {
48 if (userID == this.UserProfile.UUID) 47 if (userID == UserProfile.UUID)
49 { 48 {
50 if (this.RootFolder == null) 49 if (RootFolder == null)
51 { 50 {
52 if (folderInfo.parentID == LLUUID.Zero) 51 if (folderInfo.parentID == LLUUID.Zero)
53 { 52 {
54 this.RootFolder = folderInfo; 53 RootFolder = folderInfo;
55 } 54 }
56 } 55 }
57 else if (this.RootFolder.folderID == folderInfo.parentID) 56 else if (RootFolder.folderID == folderInfo.parentID)
58 { 57 {
59 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); 58 RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
60 } 59 }
61 else 60 else
62 { 61 {
63 InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID); 62 InventoryFolderImpl folder = RootFolder.HasSubFolder(folderInfo.parentID);
64 if (folder != null) 63 if (folder != null)
65 { 64 {
66 folder.SubFolders.Add(folderInfo.folderID, folderInfo); 65 folder.SubFolders.Add(folderInfo.folderID, folderInfo);
@@ -71,18 +70,18 @@ namespace OpenSim.Framework.Communications.Cache
71 70
72 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 71 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
73 { 72 {
74 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 73 if ((userID == UserProfile.UUID) && (RootFolder != null))
75 { 74 {
76 if (itemInfo.parentFolderID == this.RootFolder.folderID) 75 if (itemInfo.parentFolderID == RootFolder.folderID)
77 { 76 {
78 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); 77 RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
79 } 78 }
80 else 79 else
81 { 80 {
82 InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); 81 InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID);
83 if (folder != null) 82 if (folder != null)
84 { 83 {
85 folder.Items.Add(itemInfo.inventoryID, itemInfo); 84 folder.Items.Add(itemInfo.inventoryID, itemInfo);
86 } 85 }
87 } 86 }
88 } 87 }
@@ -90,30 +89,30 @@ namespace OpenSim.Framework.Communications.Cache
90 89
91 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 90 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
92 { 91 {
93 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 92 if ((userID == UserProfile.UUID) && (RootFolder != null))
94 { 93 {
95 this.ItemReceive(userID, itemInfo); 94 ItemReceive(userID, itemInfo);
96 this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 95 m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
97 } 96 }
98 } 97 }
99 98
100 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo) 99 public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
101 { 100 {
102 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 101 if ((userID == UserProfile.UUID) && (RootFolder != null))
103 { 102 {
104 this.m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 103 m_parentCommsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
105 } 104 }
106 } 105 }
107 106
108 public bool DeleteItem(LLUUID userID, InventoryItemBase item) 107 public bool DeleteItem(LLUUID userID, InventoryItemBase item)
109 { 108 {
110 bool result = false; 109 bool result = false;
111 if ((userID == this.UserProfile.UUID) && (this.RootFolder != null)) 110 if ((userID == UserProfile.UUID) && (RootFolder != null))
112 { 111 {
113 result = RootFolder.DeleteItem(item.inventoryID); 112 result = RootFolder.DeleteItem(item.inventoryID);
114 if (result) 113 if (result)
115 { 114 {
116 this.m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); 115 m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item);
117 } 116 }
118 } 117 }
119 return result; 118 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
30using System.Collections.Generic;
29using System.IO; 31using System.IO;
30using System.Threading;
31using System.Reflection;
32using System.Xml.Serialization; 32using System.Xml.Serialization;
33
34using libsecondlife; 33using libsecondlife;
35
36using Nini.Config;
37using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
38using OpenSim.Framework.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41 35
42namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
43{ 37{
@@ -63,7 +57,6 @@ namespace OpenSim.Framework.Communications.Cache
63 Stream s = null; 57 Stream s = null;
64 try 58 try
65 { 59 {
66
67 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString()); 60 MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
68 61
69 RestClient rc = new RestClient(_assetServerUrl); 62 RestClient rc = new RestClient(_assetServerUrl);
@@ -77,8 +70,8 @@ namespace OpenSim.Framework.Communications.Cache
77 70
78 if (s.Length > 0) 71 if (s.Length > 0)
79 { 72 {
80 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 73 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
81 AssetBase asset = (AssetBase)xs.Deserialize(s); 74 AssetBase asset = (AssetBase) xs.Deserialize(s);
82 75
83 _receiver.AssetReceived(asset, isTexture); 76 _receiver.AssetReceived(asset, isTexture);
84 } 77 }
@@ -106,7 +99,7 @@ namespace OpenSim.Framework.Communications.Cache
106 { 99 {
107 MemoryStream s = new MemoryStream(); 100 MemoryStream s = new MemoryStream();
108 101
109 XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); 102 XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
110 xs.Serialize(s, asset); 103 xs.Serialize(s, asset);
111 RestClient rc = new RestClient(_assetServerUrl); 104 RestClient rc = new RestClient(_assetServerUrl);
112 rc.AddResourcePath("assets"); 105 rc.AddResourcePath("assets");
@@ -129,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache
129 throw new Exception("The method or operation is not implemented."); 122 throw new Exception("The method or operation is not implemented.");
130 } 123 }
131 124
132 public System.Collections.Generic.List<AssetBase> GetDefaultAssets() 125 public List<AssetBase> GetDefaultAssets()
133 { 126 {
134 throw new Exception("The method or operation is not implemented."); 127 throw new Exception("The method or operation is not implemented.");
135 } 128 }
@@ -156,4 +149,4 @@ namespace OpenSim.Framework.Communications.Cache
156 149
157 #endregion 150 #endregion
158 } 151 }
159} 152} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Interfaces;
35using OpenSim.Framework;
36 30
37namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
38{ 32{
@@ -44,17 +38,16 @@ namespace OpenSim.Framework.Communications.Cache
44 38
45 public InventoryFolderImpl(InventoryFolderBase folderbase) 39 public InventoryFolderImpl(InventoryFolderBase folderbase)
46 { 40 {
47 this.agentID = folderbase.agentID; 41 agentID = folderbase.agentID;
48 this.folderID = folderbase.folderID; 42 folderID = folderbase.folderID;
49 this.name = folderbase.name; 43 name = folderbase.name;
50 this.parentID = folderbase.parentID; 44 parentID = folderbase.parentID;
51 this.type = folderbase.type; 45 type = folderbase.type;
52 this.version = folderbase.version; 46 version = folderbase.version;
53 } 47 }
54 48
55 public InventoryFolderImpl() 49 public InventoryFolderImpl()
56 { 50 {
57
58 } 51 }
59 52
60 // Methods 53 // Methods
@@ -65,19 +58,19 @@ namespace OpenSim.Framework.Communications.Cache
65 subFold.folderID = folderID; 58 subFold.folderID = folderID;
66 subFold.type = (short) type; 59 subFold.type = (short) type;
67 subFold.parentID = this.folderID; 60 subFold.parentID = this.folderID;
68 subFold.agentID = this.agentID; 61 subFold.agentID = agentID;
69 this.SubFolders.Add(subFold.folderID, subFold); 62 SubFolders.Add(subFold.folderID, subFold);
70 return subFold; 63 return subFold;
71 } 64 }
72 65
73 public InventoryItemBase HasItem(LLUUID itemID) 66 public InventoryItemBase HasItem(LLUUID itemID)
74 { 67 {
75 InventoryItemBase base2 = null; 68 InventoryItemBase base2 = null;
76 if (this.Items.ContainsKey(itemID)) 69 if (Items.ContainsKey(itemID))
77 { 70 {
78 return this.Items[itemID]; 71 return Items[itemID];
79 } 72 }
80 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 73 foreach (InventoryFolderImpl folder in SubFolders.Values)
81 { 74 {
82 base2 = folder.HasItem(itemID); 75 base2 = folder.HasItem(itemID);
83 if (base2 != null) 76 if (base2 != null)
@@ -91,12 +84,12 @@ namespace OpenSim.Framework.Communications.Cache
91 public bool DeleteItem(LLUUID itemID) 84 public bool DeleteItem(LLUUID itemID)
92 { 85 {
93 bool found = false; 86 bool found = false;
94 if (this.Items.ContainsKey(itemID)) 87 if (Items.ContainsKey(itemID))
95 { 88 {
96 Items.Remove(itemID); 89 Items.Remove(itemID);
97 return true; 90 return true;
98 } 91 }
99 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 92 foreach (InventoryFolderImpl folder in SubFolders.Values)
100 { 93 {
101 found = folder.DeleteItem(itemID); 94 found = folder.DeleteItem(itemID);
102 if (found == true) 95 if (found == true)
@@ -111,13 +104,13 @@ namespace OpenSim.Framework.Communications.Cache
111 public InventoryFolderImpl HasSubFolder(LLUUID folderID) 104 public InventoryFolderImpl HasSubFolder(LLUUID folderID)
112 { 105 {
113 InventoryFolderImpl returnFolder = null; 106 InventoryFolderImpl returnFolder = null;
114 if (this.SubFolders.ContainsKey(folderID)) 107 if (SubFolders.ContainsKey(folderID))
115 { 108 {
116 returnFolder = this.SubFolders[folderID]; 109 returnFolder = SubFolders[folderID];
117 } 110 }
118 else 111 else
119 { 112 {
120 foreach (InventoryFolderImpl folder in this.SubFolders.Values) 113 foreach (InventoryFolderImpl folder in SubFolders.Values)
121 { 114 {
122 returnFolder = folder.HasSubFolder(folderID); 115 returnFolder = folder.HasSubFolder(folderID);
123 if (returnFolder != null) 116 if (returnFolder != null)
@@ -132,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
132 public List<InventoryItemBase> RequestListOfItems() 125 public List<InventoryItemBase> RequestListOfItems()
133 { 126 {
134 List<InventoryItemBase> itemList = new List<InventoryItemBase>(); 127 List<InventoryItemBase> itemList = new List<InventoryItemBase>();
135 foreach (InventoryItemBase item in this.Items.Values) 128 foreach (InventoryItemBase item in Items.Values)
136 { 129 {
137 itemList.Add(item); 130 itemList.Add(item);
138 } 131 }
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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.IO; 29using System.IO;
31using System.Collections.Generic;
32using System.Text;
33using libsecondlife; 30using libsecondlife;
34using OpenSim.Framework;
35using Nini.Config; 31using Nini.Config;
36 32
37namespace OpenSim.Framework.Communications.Cache 33namespace OpenSim.Framework.Communications.Cache
@@ -40,43 +36,42 @@ namespace OpenSim.Framework.Communications.Cache
40 /// Basically a hack to give us a Inventory library while we don't have a inventory server 36 /// Basically a hack to give us a Inventory library while we don't have a inventory server
41 /// once the server is fully implemented then should read the data from that 37 /// once the server is fully implemented then should read the data from that
42 /// </summary> 38 /// </summary>
43 public class LibraryRootFolder : Cache.InventoryFolderImpl 39 public class LibraryRootFolder : InventoryFolderImpl
44 { 40 {
45 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); 41 private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
46 private Cache.InventoryFolderImpl m_textureFolder; 42 private InventoryFolderImpl m_textureFolder;
47 43
48 public LibraryRootFolder() 44 public LibraryRootFolder()
49 { 45 {
50 this.agentID = libOwner; 46 agentID = libOwner;
51 this.folderID = new LLUUID("00000112-000f-0000-0000-000100bba000"); 47 folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
52 this.name = "OpenSim Library"; 48 name = "OpenSim Library";
53 this.parentID = LLUUID.Zero; 49 parentID = LLUUID.Zero;
54 this.type = (short)-1; 50 type = (short) -1;
55 this.version = (ushort)1; 51 version = (ushort) 1;
56 52
57 Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl(); 53 InventoryFolderImpl folderInfo = new InventoryFolderImpl();
58 folderInfo.agentID = libOwner; 54 folderInfo.agentID = libOwner;
59 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); 55 folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001");
60 folderInfo.name = "Texture Library"; 56 folderInfo.name = "Texture Library";
61 folderInfo.parentID = this.folderID; 57 folderInfo.parentID = folderID;
62 folderInfo.type = -1; 58 folderInfo.type = -1;
63 folderInfo.version = 1; 59 folderInfo.version = 1;
64 this.SubFolders.Add(folderInfo.folderID, folderInfo); 60 SubFolders.Add(folderInfo.folderID, folderInfo);
65 this.m_textureFolder = folderInfo; 61 m_textureFolder = folderInfo;
66 62
67 this.CreateLibraryItems(); 63 CreateLibraryItems();
68 64
69 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml"); 65 string filePath = Path.Combine(Util.configDir(), "OpenSimLibrary.xml");
70 if (File.Exists(filePath)) 66 if (File.Exists(filePath))
71 { 67 {
72 XmlConfigSource source = new XmlConfigSource(filePath); 68 XmlConfigSource source = new XmlConfigSource(filePath);
73 this.ReadItemsFromFile(source); 69 ReadItemsFromFile(source);
74 } 70 }
75 } 71 }
76 72
77 private void CreateLibraryItems() 73 private void CreateLibraryItems()
78 { 74 {
79
80 InventoryItemBase item = new InventoryItemBase(); 75 InventoryItemBase item = new InventoryItemBase();
81 item.avatarID = libOwner; 76 item.avatarID = libOwner;
82 item.creatorsID = libOwner; 77 item.creatorsID = libOwner;
@@ -90,7 +85,7 @@ namespace OpenSim.Framework.Communications.Cache
90 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 85 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
91 item.inventoryCurrentPermissions = 0x7FFFFFFF; 86 item.inventoryCurrentPermissions = 0x7FFFFFFF;
92 item.inventoryNextPermissions = 0x7FFFFFFF; 87 item.inventoryNextPermissions = 0x7FFFFFFF;
93 this.m_textureFolder.Items.Add(item.inventoryID, item); 88 m_textureFolder.Items.Add(item.inventoryID, item);
94 89
95 item = new InventoryItemBase(); 90 item = new InventoryItemBase();
96 item.avatarID = libOwner; 91 item.avatarID = libOwner;
@@ -105,7 +100,7 @@ namespace OpenSim.Framework.Communications.Cache
105 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 100 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
106 item.inventoryCurrentPermissions = 0x7FFFFFFF; 101 item.inventoryCurrentPermissions = 0x7FFFFFFF;
107 item.inventoryNextPermissions = 0x7FFFFFFF; 102 item.inventoryNextPermissions = 0x7FFFFFFF;
108 this.m_textureFolder.Items.Add(item.inventoryID, item); 103 m_textureFolder.Items.Add(item.inventoryID, item);
109 104
110 item = new InventoryItemBase(); 105 item = new InventoryItemBase();
111 item.avatarID = libOwner; 106 item.avatarID = libOwner;
@@ -120,7 +115,7 @@ namespace OpenSim.Framework.Communications.Cache
120 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 115 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
121 item.inventoryCurrentPermissions = 0x7FFFFFFF; 116 item.inventoryCurrentPermissions = 0x7FFFFFFF;
122 item.inventoryNextPermissions = 0x7FFFFFFF; 117 item.inventoryNextPermissions = 0x7FFFFFFF;
123 this.m_textureFolder.Items.Add(item.inventoryID, item); 118 m_textureFolder.Items.Add(item.inventoryID, item);
124 119
125 item = new InventoryItemBase(); 120 item = new InventoryItemBase();
126 item.avatarID = libOwner; 121 item.avatarID = libOwner;
@@ -135,7 +130,7 @@ namespace OpenSim.Framework.Communications.Cache
135 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 130 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
136 item.inventoryCurrentPermissions = 0x7FFFFFFF; 131 item.inventoryCurrentPermissions = 0x7FFFFFFF;
137 item.inventoryNextPermissions = 0x7FFFFFFF; 132 item.inventoryNextPermissions = 0x7FFFFFFF;
138 this.m_textureFolder.Items.Add(item.inventoryID, item); 133 m_textureFolder.Items.Add(item.inventoryID, item);
139 134
140 item = new InventoryItemBase(); 135 item = new InventoryItemBase();
141 item.avatarID = libOwner; 136 item.avatarID = libOwner;
@@ -150,7 +145,7 @@ namespace OpenSim.Framework.Communications.Cache
150 item.inventoryEveryOnePermissions = 0x7FFFFFFF; 145 item.inventoryEveryOnePermissions = 0x7FFFFFFF;
151 item.inventoryCurrentPermissions = 0x7FFFFFFF; 146 item.inventoryCurrentPermissions = 0x7FFFFFFF;
152 item.inventoryNextPermissions = 0x7FFFFFFF; 147 item.inventoryNextPermissions = 0x7FFFFFFF;
153 this.m_textureFolder.Items.Add(item.inventoryID, item); 148 m_textureFolder.Items.Add(item.inventoryID, item);
154 149
155 item = new InventoryItemBase(); 150 item = new InventoryItemBase();
156 item.avatarID = libOwner; 151 item.avatarID = libOwner;
@@ -161,10 +156,10 @@ namespace OpenSim.Framework.Communications.Cache
161 item.inventoryName = "Default Shape"; 156 item.inventoryName = "Default Shape";
162 item.assetType = 13; 157 item.assetType = 13;
163 item.invType = 18; 158 item.invType = 18;
164 item.parentFolderID = this.folderID; 159 item.parentFolderID = folderID;
165 item.inventoryCurrentPermissions = 0; 160 item.inventoryCurrentPermissions = 0;
166 item.inventoryNextPermissions = 0; 161 item.inventoryNextPermissions = 0;
167 this.Items.Add(item.inventoryID, item); 162 Items.Add(item.inventoryID, item);
168 163
169 item = new InventoryItemBase(); 164 item = new InventoryItemBase();
170 item.avatarID = libOwner; 165 item.avatarID = libOwner;
@@ -175,10 +170,10 @@ namespace OpenSim.Framework.Communications.Cache
175 item.inventoryName = "Default Skin"; 170 item.inventoryName = "Default Skin";
176 item.assetType = 13; 171 item.assetType = 13;
177 item.invType = 18; 172 item.invType = 18;
178 item.parentFolderID = this.folderID; 173 item.parentFolderID = folderID;
179 item.inventoryCurrentPermissions = 0; 174 item.inventoryCurrentPermissions = 0;
180 item.inventoryNextPermissions = 0; 175 item.inventoryNextPermissions = 0;
181 this.Items.Add(item.inventoryID, item); 176 Items.Add(item.inventoryID, item);
182 177
183 item = new InventoryItemBase(); 178 item = new InventoryItemBase();
184 item.avatarID = libOwner; 179 item.avatarID = libOwner;
@@ -189,10 +184,10 @@ namespace OpenSim.Framework.Communications.Cache
189 item.inventoryName = "Default Shirt"; 184 item.inventoryName = "Default Shirt";
190 item.assetType = 5; 185 item.assetType = 5;
191 item.invType = 18; 186 item.invType = 18;
192 item.parentFolderID = this.folderID; 187 item.parentFolderID = folderID;
193 item.inventoryCurrentPermissions = 0; 188 item.inventoryCurrentPermissions = 0;
194 item.inventoryNextPermissions = 0; 189 item.inventoryNextPermissions = 0;
195 this.Items.Add(item.inventoryID, item); 190 Items.Add(item.inventoryID, item);
196 191
197 item = new InventoryItemBase(); 192 item = new InventoryItemBase();
198 item.avatarID = libOwner; 193 item.avatarID = libOwner;
@@ -203,11 +198,10 @@ namespace OpenSim.Framework.Communications.Cache
203 item.inventoryName = "Default Pants"; 198 item.inventoryName = "Default Pants";
204 item.assetType = 5; 199 item.assetType = 5;
205 item.invType = 18; 200 item.invType = 18;
206 item.parentFolderID = this.folderID; 201 item.parentFolderID = folderID;
207 item.inventoryCurrentPermissions = 0; 202 item.inventoryCurrentPermissions = 0;
208 item.inventoryNextPermissions = 0; 203 item.inventoryNextPermissions = 0;
209 this.Items.Add(item.inventoryID, item); 204 Items.Add(item.inventoryID, item);
210
211 } 205 }
212 206
213 private void ReadItemsFromFile(IConfigSource source) 207 private void ReadItemsFromFile(IConfigSource source)
@@ -217,28 +211,28 @@ namespace OpenSim.Framework.Communications.Cache
217 InventoryItemBase item = new InventoryItemBase(); 211 InventoryItemBase item = new InventoryItemBase();
218 item.avatarID = libOwner; 212 item.avatarID = libOwner;
219 item.creatorsID = libOwner; 213 item.creatorsID = libOwner;
220 item.inventoryID = new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated())); 214 item.inventoryID =
215 new LLUUID(source.Configs[i].GetString("inventoryID", LLUUID.Random().ToStringHyphenated()));
221 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated())); 216 item.assetID = new LLUUID(source.Configs[i].GetString("assetID", LLUUID.Random().ToStringHyphenated()));
222 item.inventoryDescription = source.Configs[i].GetString("description", ""); 217 item.inventoryDescription = source.Configs[i].GetString("description", "");
223 item.inventoryName = source.Configs[i].GetString("name", ""); 218 item.inventoryName = source.Configs[i].GetString("name", "");
224 item.assetType = source.Configs[i].GetInt("assetType", 0); 219 item.assetType = source.Configs[i].GetInt("assetType", 0);
225 item.invType = source.Configs[i].GetInt("inventoryType", 0); 220 item.invType = source.Configs[i].GetInt("inventoryType", 0);
226 item.inventoryCurrentPermissions = (uint)source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF); 221 item.inventoryCurrentPermissions = (uint) source.Configs[i].GetLong("currentPermissions", 0x7FFFFFFF);
227 item.inventoryNextPermissions = (uint)source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF); 222 item.inventoryNextPermissions = (uint) source.Configs[i].GetLong("nextPermissions", 0x7FFFFFFF);
228 item.inventoryEveryOnePermissions = (uint)source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF); 223 item.inventoryEveryOnePermissions = (uint) source.Configs[i].GetLong("everyonePermissions", 0x7FFFFFFF);
229 item.inventoryBasePermissions = (uint)source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF); 224 item.inventoryBasePermissions = (uint) source.Configs[i].GetLong("basePermissions", 0x7FFFFFFF);
230 if (item.assetType == 0) 225 if (item.assetType == 0)
231 { 226 {
232 item.parentFolderID = this.m_textureFolder.folderID; 227 item.parentFolderID = m_textureFolder.folderID;
233 this.m_textureFolder.Items.Add(item.inventoryID, item); 228 m_textureFolder.Items.Add(item.inventoryID, item);
234 } 229 }
235 else 230 else
236 { 231 {
237 item.parentFolderID = this.folderID; 232 item.parentFolderID = folderID;
238 this.Items.Add(item.inventoryID, item); 233 Items.Add(item.inventoryID, item);
239 } 234 }
240 } 235 }
241 } 236 }
242
243 } 237 }
244} \ No newline at end of file 238} \ 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Threading;
31using System.Reflection; 29using System.Reflection;
32using libsecondlife;
33using Nini.Config;
34using OpenSim.Framework.Console; 30using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37 31
38namespace OpenSim.Framework.Communications.Cache 32namespace OpenSim.Framework.Communications.Cache
39{ 33{
@@ -62,11 +56,14 @@ namespace OpenSim.Framework.Communications.Cache
62 56
63 if (typeInterface != null) 57 if (typeInterface != null)
64 { 58 {
65 IAssetProvider plug = (IAssetProvider)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 59 IAssetProvider plug =
60 (IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
66 m_assetProviderPlugin = plug; 61 m_assetProviderPlugin = plug;
67 m_assetProviderPlugin.Initialise(); 62 m_assetProviderPlugin.Initialise();
68 63
69 MainLog.Instance.Verbose("AssetStorage","Added " + m_assetProviderPlugin.Name + " " + m_assetProviderPlugin.Version); 64 MainLog.Instance.Verbose("AssetStorage",
65 "Added " + m_assetProviderPlugin.Name + " " +
66 m_assetProviderPlugin.Version);
70 } 67 }
71 68
72 typeInterface = null; 69 typeInterface = null;
@@ -84,13 +81,13 @@ namespace OpenSim.Framework.Communications.Cache
84 m_assetProviderPlugin.CommitAssets(); 81 m_assetProviderPlugin.CommitAssets();
85 } 82 }
86 83
87 override protected void RunRequests() 84 protected override void RunRequests()
88 { 85 {
89 while (true) 86 while (true)
90 { 87 {
91 ARequest req = this._assetRequests.Dequeue(); 88 ARequest req = _assetRequests.Dequeue();
92 89
93 //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID); 90 //MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
94 91
95 AssetBase asset = null; 92 AssetBase asset = null;
96 lock (syncLock) 93 lock (syncLock)
@@ -105,9 +102,7 @@ namespace OpenSim.Framework.Communications.Cache
105 { 102 {
106 _receiver.AssetNotFound(req.AssetID); 103 _receiver.AssetNotFound(req.AssetID);
107 } 104 }
108
109 } 105 }
110
111 } 106 }
112 107
113 protected override void StoreAsset(AssetBase asset) 108 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Text;
32using System.IO;
33using libsecondlife; 29using libsecondlife;
34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37
38 30
39namespace OpenSim.Framework.Communications.Cache 31namespace OpenSim.Framework.Communications.Cache
40{ 32{
@@ -49,7 +41,7 @@ namespace OpenSim.Framework.Communications.Cache
49 // Methods 41 // Methods
50 public UserProfileCache(CommunicationsManager parent) 42 public UserProfileCache(CommunicationsManager parent)
51 { 43 {
52 this.m_parent = parent; 44 m_parent = parent;
53 } 45 }
54 46
55 /// <summary> 47 /// <summary>
@@ -62,14 +54,14 @@ namespace OpenSim.Framework.Communications.Cache
62 // Potential fix - Multithreading issue. 54 // Potential fix - Multithreading issue.
63 lock (UserProfiles) 55 lock (UserProfiles)
64 { 56 {
65 if (!this.UserProfiles.ContainsKey(userID)) 57 if (!UserProfiles.ContainsKey(userID))
66 { 58 {
67 CachedUserInfo userInfo = new CachedUserInfo(this.m_parent); 59 CachedUserInfo userInfo = new CachedUserInfo(m_parent);
68 userInfo.UserProfile = this.RequestUserProfileForUser(userID); 60 userInfo.UserProfile = RequestUserProfileForUser(userID);
69 if (userInfo.UserProfile != null) 61 if (userInfo.UserProfile != null)
70 { 62 {
71 this.RequestInventoryForUser(userID, userInfo); 63 RequestInventoryForUser(userID, userInfo);
72 this.UserProfiles.Add(userID, userInfo); 64 UserProfiles.Add(userID, userInfo);
73 } 65 }
74 else 66 else
75 { 67 {
@@ -91,26 +83,28 @@ namespace OpenSim.Framework.Communications.Cache
91 83
92 public CachedUserInfo GetUserDetails(LLUUID userID) 84 public CachedUserInfo GetUserDetails(LLUUID userID)
93 { 85 {
94 if (this.UserProfiles.ContainsKey(userID)) 86 if (UserProfiles.ContainsKey(userID))
95 { 87 {
96 return this.UserProfiles[userID]; 88 return UserProfiles[userID];
97 } 89 }
98 return null; 90 return null;
99 } 91 }
100 92
101 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID) 93 public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
94 string folderName, LLUUID parentID)
102 { 95 {
103 if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 96 if (UserProfiles.ContainsKey(remoteClient.AgentId))
104 { 97 {
105 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 98 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
106 { 99 {
107 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 100 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
108 if (info.RootFolder.folderID == parentID) 101 if (info.RootFolder.folderID == parentID)
109 { 102 {
110 InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); 103 InventoryFolderImpl createdFolder =
104 info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
111 if (createdFolder != null) 105 if (createdFolder != null)
112 { 106 {
113 this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); 107 m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
114 } 108 }
115 } 109 }
116 else 110 else
@@ -125,27 +119,30 @@ namespace OpenSim.Framework.Communications.Cache
125 } 119 }
126 } 120 }
127 121
128 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) 122 public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
123 bool fetchFolders, bool fetchItems, int sortOrder)
129 { 124 {
130 InventoryFolderImpl fold = null; 125 InventoryFolderImpl fold = null;
131 if (folderID == libraryRoot.folderID ) 126 if (folderID == libraryRoot.folderID)
132 { 127 {
133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); 128 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID,
129 libraryRoot.RequestListOfItems());
134 } 130 }
135 else if (( fold = libraryRoot.HasSubFolder(folderID)) != null) 131 else if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
136 { 132 {
137 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); 133 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
138 } 134 }
139 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 135 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
140 { 136 {
141 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 137 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
142 { 138 {
143 CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; 139 CachedUserInfo info = UserProfiles[remoteClient.AgentId];
144 if (info.RootFolder.folderID == folderID) 140 if (info.RootFolder.folderID == folderID)
145 { 141 {
146 if (fetchItems) 142 if (fetchItems)
147 { 143 {
148 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, info.RootFolder.RequestListOfItems()); 144 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
145 info.RootFolder.RequestListOfItems());
149 } 146 }
150 } 147 }
151 else 148 else
@@ -153,7 +150,8 @@ namespace OpenSim.Framework.Communications.Cache
153 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID); 150 InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID);
154 if ((folder != null) && fetchItems) 151 if ((folder != null) && fetchItems)
155 { 152 {
156 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); 153 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID,
154 folder.RequestListOfItems());
157 } 155 }
158 } 156 }
159 } 157 }
@@ -166,11 +164,11 @@ namespace OpenSim.Framework.Communications.Cache
166 { 164 {
167 //Console.WriteLine("request info for library item"); 165 //Console.WriteLine("request info for library item");
168 } 166 }
169 else if (this.UserProfiles.ContainsKey(remoteClient.AgentId)) 167 else if (UserProfiles.ContainsKey(remoteClient.AgentId))
170 { 168 {
171 if (this.UserProfiles[remoteClient.AgentId].RootFolder != null) 169 if (UserProfiles[remoteClient.AgentId].RootFolder != null)
172 { 170 {
173 InventoryItemBase item = this.UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID); 171 InventoryItemBase item = UserProfiles[remoteClient.AgentId].RootFolder.HasItem(itemID);
174 if (item != null) 172 if (item != null)
175 { 173 {
176 remoteClient.SendInventoryItemDetails(ownerID, item); 174 remoteClient.SendInventoryItemDetails(ownerID, item);
@@ -185,7 +183,7 @@ namespace OpenSim.Framework.Communications.Cache
185 /// <param name="userID"></param> 183 /// <param name="userID"></param>
186 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) 184 private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
187 { 185 {
188 this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); 186 m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
189 } 187 }
190 188
191 /// <summary> 189 /// <summary>
@@ -194,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache
194 /// <param name="userID"></param> 192 /// <param name="userID"></param>
195 private UserProfileData RequestUserProfileForUser(LLUUID userID) 193 private UserProfileData RequestUserProfileForUser(LLUUID userID)
196 { 194 {
197 return this.m_parent.UserService.GetUserProfile(userID); 195 return m_parent.UserService.GetUserProfile(userID);
198 } 196 }
199 197
200 /// <summary> 198 /// <summary>
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 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text;
32using System.IO; 31using System.IO;
33using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
36using OpenSim.Framework;
37 37
38namespace OpenSim.Region.Capabilities 38namespace OpenSim.Region.Capabilities
39{ 39{
40 public delegate void UpLoadedAsset(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType); 40 public delegate void UpLoadedAsset(
41 string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data,
42 string inventoryType, string assetType);
43
41 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data); 44 public delegate LLUUID UpdateItem(LLUUID itemID, byte[] data);
45
42 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item); 46 public delegate void NewInventoryItem(LLUUID userID, InventoryItemBase item);
47
43 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data); 48 public delegate LLUUID ItemUpdatedCallback(LLUUID userID, LLUUID itemID, byte[] data);
44 49
45 public class Caps 50 public class Caps
@@ -62,7 +67,8 @@ namespace OpenSim.Region.Capabilities
62 public ItemUpdatedCallback ItemUpdatedCall = null; 67 public ItemUpdatedCallback ItemUpdatedCall = null;
63 private bool m_dumpAssetsToFile; 68 private bool m_dumpAssetsToFile;
64 69
65 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile) 70 public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath,
71 LLUUID agent, bool dumpAssetsToFile)
66 { 72 {
67 assetCache = assetCach; 73 assetCache = assetCach;
68 m_capsObjectPath = capsPath; 74 m_capsObjectPath = capsPath;
@@ -78,12 +84,17 @@ namespace OpenSim.Region.Capabilities
78 /// </summary> 84 /// </summary>
79 public void RegisterHandlers() 85 public void RegisterHandlers()
80 { 86 {
81 OpenSim.Framework.Console.MainLog.Instance.Verbose("CAPS","Registering CAPS handlers"); 87 MainLog.Instance.Verbose("CAPS", "Registering CAPS handlers");
82 string capsBase = "/CAPS/" + m_capsObjectPath; 88 string capsBase = "/CAPS/" + m_capsObjectPath;
83 try 89 try
84 { 90 {
85 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, this.GetMapLayer)); 91 httpListener.AddStreamHandler(
86 httpListener.AddStreamHandler(new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", capsBase + m_newInventory, this.NewAgentInventoryRequest)); 92 new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath,
93 GetMapLayer));
94 httpListener.AddStreamHandler(
95 new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
96 capsBase + m_newInventory,
97 NewAgentInventoryRequest));
87 98
88 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); 99 AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest);
89 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture); 100 //AddLegacyCapsHandler(httpListener, m_requestTexture , RequestTexture);
@@ -103,7 +114,7 @@ namespace OpenSim.Region.Capabilities
103 string capsBase = "/CAPS/" + m_capsObjectPath; 114 string capsBase = "/CAPS/" + m_capsObjectPath;
104 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); 115 httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod));
105 } 116 }
106 117
107 /// <summary> 118 /// <summary>
108 /// 119 ///
109 /// </summary> 120 /// </summary>
@@ -113,8 +124,8 @@ namespace OpenSim.Region.Capabilities
113 /// <returns></returns> 124 /// <returns></returns>
114 public string CapsRequest(string request, string path, string param) 125 public string CapsRequest(string request, string path, string param)
115 { 126 {
116 // Console.WriteLine("caps request " + request); 127 // Console.WriteLine("caps request " + request);
117 string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); 128 string result = LLSDHelpers.SerialiseLLSDReply(GetCapabilities());
118 return result; 129 return result;
119 } 130 }
120 131
@@ -125,9 +136,10 @@ namespace OpenSim.Region.Capabilities
125 protected LLSDCapsDetails GetCapabilities() 136 protected LLSDCapsDetails GetCapabilities()
126 { 137 {
127 LLSDCapsDetails caps = new LLSDCapsDetails(); 138 LLSDCapsDetails caps = new LLSDCapsDetails();
128 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; 139 string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" +
140 m_capsObjectPath;
129 caps.MapLayer = capsBaseUrl + m_mapLayerPath; 141 caps.MapLayer = capsBaseUrl + m_mapLayerPath;
130 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; 142 // caps.RequestTextureDownload = capsBaseUrl + m_requestTexture;
131 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; 143 caps.NewFileAgentInventory = capsBaseUrl + m_newInventory;
132 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 144 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
133 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; 145 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
@@ -142,7 +154,7 @@ namespace OpenSim.Region.Capabilities
142 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) 154 public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq)
143 { 155 {
144 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 156 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
145 mapResponse.LayerData.Array.Add(this.GetLLSDMapLayerResponse()); 157 mapResponse.LayerData.Array.Add(GetLLSDMapLayerResponse());
146 return mapResponse; 158 return mapResponse;
147 } 159 }
148 160
@@ -174,6 +186,7 @@ namespace OpenSim.Region.Capabilities
174 } 186 }
175 187
176 #region EventQueue (Currently not enabled) 188 #region EventQueue (Currently not enabled)
189
177 /// <summary> 190 /// <summary>
178 /// 191 ///
179 /// </summary> 192 /// </summary>
@@ -184,10 +197,10 @@ namespace OpenSim.Region.Capabilities
184 public string ProcessEventQueue(string request, string path, string param) 197 public string ProcessEventQueue(string request, string path, string param)
185 { 198 {
186 string res = ""; 199 string res = "";
187 200
188 if (this.CapsEventQueue.Count > 0) 201 if (CapsEventQueue.Count > 0)
189 { 202 {
190 lock (this.CapsEventQueue) 203 lock (CapsEventQueue)
191 { 204 {
192 string item = CapsEventQueue.Dequeue(); 205 string item = CapsEventQueue.Dequeue();
193 res = item; 206 res = item;
@@ -195,7 +208,7 @@ namespace OpenSim.Region.Capabilities
195 } 208 }
196 else 209 else
197 { 210 {
198 res = this.CreateEmptyEventResponse(); 211 res = CreateEmptyEventResponse();
199 } 212 }
200 return res; 213 return res;
201 } 214 }
@@ -214,8 +227,8 @@ namespace OpenSim.Region.Capabilities
214 eventItem.events.Array.Add(new LLSDEmpty()); 227 eventItem.events.Array.Add(new LLSDEmpty());
215 string res = LLSDHelpers.SerialiseLLSDReply(eventItem); 228 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
216 eventQueueCount++; 229 eventQueueCount++;
217 230
218 this.CapsEventQueue.Enqueue(res); 231 CapsEventQueue.Enqueue(res);
219 return res; 232 return res;
220 } 233 }
221 234
@@ -232,6 +245,7 @@ namespace OpenSim.Region.Capabilities
232 eventQueueCount++; 245 eventQueueCount++;
233 return res; 246 return res;
234 } 247 }
248
235 #endregion 249 #endregion
236 250
237 /// <summary> 251 /// <summary>
@@ -243,24 +257,27 @@ namespace OpenSim.Region.Capabilities
243 /// <returns></returns> 257 /// <returns></returns>
244 public string NoteCardAgentInventory(string request, string path, string param) 258 public string NoteCardAgentInventory(string request, string path, string param)
245 { 259 {
246 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request)); 260 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
247 LLSDItemUpdate llsdRequest = new LLSDItemUpdate(); 261 LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
248 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 262 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
249 263
250 string capsBase = "/CAPS/" + m_capsObjectPath; 264 string capsBase = "/CAPS/" + m_capsObjectPath;
251 LLUUID newInvItem = llsdRequest.item_id; 265 LLUUID newInvItem = llsdRequest.item_id;
252 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 266 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
253 267
254 ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile ); 268 ItemUpdater uploader =
255 uploader.OnUpLoad += this.ItemUpdated; 269 new ItemUpdater(newInvItem, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
270 uploader.OnUpLoad += ItemUpdated;
256 271
257 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 272 httpListener.AddStreamHandler(
258 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 273 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
274 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
275 uploaderPath;
259 276
260 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 277 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
261 uploadResponse.uploader = uploaderURL; 278 uploadResponse.uploader = uploaderURL;
262 uploadResponse.state = "upload"; 279 uploadResponse.state = "upload";
263 280
264 return LLSDHelpers.SerialiseLLSDReply(uploadResponse); 281 return LLSDHelpers.SerialiseLLSDReply(uploadResponse);
265 } 282 }
266 283
@@ -272,7 +289,7 @@ namespace OpenSim.Region.Capabilities
272 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) 289 public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
273 { 290 {
274 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type); 291 //Console.WriteLine("asset upload request via CAPS" + llsdRequest.inventory_type +" , "+ llsdRequest.asset_type);
275 292
276 string assetName = llsdRequest.name; 293 string assetName = llsdRequest.name;
277 string assetDes = llsdRequest.description; 294 string assetDes = llsdRequest.description;
278 string capsBase = "/CAPS/" + m_capsObjectPath; 295 string capsBase = "/CAPS/" + m_capsObjectPath;
@@ -281,14 +298,18 @@ namespace OpenSim.Region.Capabilities
281 LLUUID parentFolder = llsdRequest.folder_id; 298 LLUUID parentFolder = llsdRequest.folder_id;
282 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 299 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
283 300
284 AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile); 301 AssetUploader uploader =
285 httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); 302 new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type,
286 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; 303 llsdRequest.asset_type, capsBase + uploaderPath, httpListener, m_dumpAssetsToFile);
304 httpListener.AddStreamHandler(
305 new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
306 string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase +
307 uploaderPath;
287 308
288 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse(); 309 LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
289 uploadResponse.uploader = uploaderURL; 310 uploadResponse.uploader = uploaderURL;
290 uploadResponse.state = "upload"; 311 uploadResponse.state = "upload";
291 uploader.OnUpLoad += this.UploadCompleteHandler; 312 uploader.OnUpLoad += UploadCompleteHandler;
292 return uploadResponse; 313 return uploadResponse;
293 } 314 }
294 315
@@ -298,7 +319,9 @@ namespace OpenSim.Region.Capabilities
298 /// <param name="assetID"></param> 319 /// <param name="assetID"></param>
299 /// <param name="inventoryItem"></param> 320 /// <param name="inventoryItem"></param>
300 /// <param name="data"></param> 321 /// <param name="data"></param>
301 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType, string assetType) 322 public void UploadCompleteHandler(string assetName, string assetDescription, LLUUID assetID,
323 LLUUID inventoryItem, LLUUID parentFolder, byte[] data, string inventoryType,
324 string assetType)
302 { 325 {
303 sbyte assType = 0; 326 sbyte assType = 0;
304 sbyte inType = 0; 327 sbyte inType = 0;
@@ -319,14 +342,14 @@ namespace OpenSim.Region.Capabilities
319 asset.FullID = assetID; 342 asset.FullID = assetID;
320 asset.Type = assType; 343 asset.Type = assType;
321 asset.InvType = inType; 344 asset.InvType = inType;
322 asset.Name = assetName; 345 asset.Name = assetName;
323 asset.Data = data; 346 asset.Data = data;
324 this.assetCache.AddAsset(asset); 347 assetCache.AddAsset(asset);
325 348
326 InventoryItemBase item = new InventoryItemBase(); 349 InventoryItemBase item = new InventoryItemBase();
327 item.avatarID = agentID; 350 item.avatarID = agentID;
328 item.creatorsID = agentID; 351 item.creatorsID = agentID;
329 item.inventoryID = inventoryItem; 352 item.inventoryID = inventoryItem;
330 item.assetID = asset.FullID; 353 item.assetID = asset.FullID;
331 item.inventoryDescription = assetDescription; 354 item.inventoryDescription = assetDescription;
332 item.inventoryName = assetName; 355 item.inventoryName = assetName;
@@ -340,14 +363,13 @@ namespace OpenSim.Region.Capabilities
340 { 363 {
341 AddNewInventoryItem(agentID, item); 364 AddNewInventoryItem(agentID, item);
342 } 365 }
343
344 } 366 }
345 367
346 public LLUUID ItemUpdated(LLUUID itemID, byte[] data) 368 public LLUUID ItemUpdated(LLUUID itemID, byte[] data)
347 { 369 {
348 if (ItemUpdatedCall != null) 370 if (ItemUpdatedCall != null)
349 { 371 {
350 return ItemUpdatedCall(this.agentID, itemID, data); 372 return ItemUpdatedCall(agentID, itemID, data);
351 } 373 }
352 return LLUUID.Zero; 374 return LLUUID.Zero;
353 } 375 }
@@ -359,7 +381,7 @@ namespace OpenSim.Region.Capabilities
359 private string uploaderPath = ""; 381 private string uploaderPath = "";
360 private LLUUID newAssetID; 382 private LLUUID newAssetID;
361 private LLUUID inventoryItemID; 383 private LLUUID inventoryItemID;
362 private LLUUID parentFolder; 384 private LLUUID parentFolder;
363 private BaseHttpServer httpListener; 385 private BaseHttpServer httpListener;
364 private bool m_dumpAssetsToFile; 386 private bool m_dumpAssetsToFile;
365 private string m_assetName = ""; 387 private string m_assetName = "";
@@ -368,7 +390,9 @@ namespace OpenSim.Region.Capabilities
368 private string m_invType = ""; 390 private string m_invType = "";
369 private string m_assetType = ""; 391 private string m_assetType = "";
370 392
371 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile) 393 public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem,
394 LLUUID parentFolderID, string invType, string assetType, string path,
395 BaseHttpServer httpServer, bool dumpAssetsToFile)
372 { 396 {
373 m_assetName = assetName; 397 m_assetName = assetName;
374 m_assetDes = description; 398 m_assetDes = description;
@@ -391,7 +415,7 @@ namespace OpenSim.Region.Capabilities
391 /// <returns></returns> 415 /// <returns></returns>
392 public string uploaderCaps(byte[] data, string path, string param) 416 public string uploaderCaps(byte[] data, string path, string param)
393 { 417 {
394 LLUUID inv = this.inventoryItemID; 418 LLUUID inv = inventoryItemID;
395 string res = ""; 419 string res = "";
396 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 420 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
397 uploadComplete.new_asset = newAssetID.ToStringHyphenated(); 421 uploadComplete.new_asset = newAssetID.ToStringHyphenated();
@@ -399,29 +423,29 @@ namespace OpenSim.Region.Capabilities
399 uploadComplete.state = "complete"; 423 uploadComplete.state = "complete";
400 424
401 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); 425 res = LLSDHelpers.SerialiseLLSDReply(uploadComplete);
402 426
403 httpListener.RemoveStreamHandler("POST", uploaderPath); 427 httpListener.RemoveStreamHandler("POST", uploaderPath);
404 428
405 if (this.m_dumpAssetsToFile) 429 if (m_dumpAssetsToFile)
406 { 430 {
407 this.SaveAssetToFile(m_assetName + ".jp2", data); 431 SaveAssetToFile(m_assetName + ".jp2", data);
408 } 432 }
409 433
410 if (OnUpLoad != null) 434 if (OnUpLoad != null)
411 { 435 {
412 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); 436 OnUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType);
413 } 437 }
414 438
415 return res; 439 return res;
416 } 440 }
417 441
418 private void SaveAssetToFile(string filename, byte[] data) 442 private void SaveAssetToFile(string filename, byte[] data)
419 { 443 {
420 FileStream fs = File.Create(filename); 444 FileStream fs = File.Create(filename);
421 BinaryWriter bw = new BinaryWriter(fs); 445 BinaryWriter bw = new BinaryWriter(fs);
422 bw.Write(data); 446 bw.Write(data);
423 bw.Close(); 447 bw.Close();
424 fs.Close(); 448 fs.Close();
425 } 449 }
426 } 450 }
427 451
@@ -434,7 +458,7 @@ namespace OpenSim.Region.Capabilities
434 private BaseHttpServer httpListener; 458 private BaseHttpServer httpListener;
435 private bool m_dumpAssetToFile; 459 private bool m_dumpAssetToFile;
436 460
437 public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile) 461 public ItemUpdater(LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile)
438 { 462 {
439 m_dumpAssetToFile = dumpAssetToFile; 463 m_dumpAssetToFile = dumpAssetToFile;
440 464
@@ -452,7 +476,7 @@ namespace OpenSim.Region.Capabilities
452 /// <returns></returns> 476 /// <returns></returns>
453 public string uploaderCaps(byte[] data, string path, string param) 477 public string uploaderCaps(byte[] data, string path, string param)
454 { 478 {
455 LLUUID inv = this.inventoryItemID; 479 LLUUID inv = inventoryItemID;
456 string res = ""; 480 string res = "";
457 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete(); 481 LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();
458 LLUUID assetID = LLUUID.Zero; 482 LLUUID assetID = LLUUID.Zero;
@@ -461,7 +485,7 @@ namespace OpenSim.Region.Capabilities
461 { 485 {
462 assetID = OnUpLoad(inv, data); 486 assetID = OnUpLoad(inv, data);
463 } 487 }
464 488
465 uploadComplete.new_asset = assetID.ToStringHyphenated(); 489 uploadComplete.new_asset = assetID.ToStringHyphenated();
466 uploadComplete.new_inventory_item = inv; 490 uploadComplete.new_inventory_item = inv;
467 uploadComplete.state = "complete"; 491 uploadComplete.state = "complete";
@@ -470,9 +494,9 @@ namespace OpenSim.Region.Capabilities
470 494
471 httpListener.RemoveStreamHandler("POST", uploaderPath); 495 httpListener.RemoveStreamHandler("POST", uploaderPath);
472 496
473 if (this.m_dumpAssetToFile) 497 if (m_dumpAssetToFile)
474 { 498 {
475 this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data); 499 SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
476 } 500 }
477 501
478 return res; 502 return res;
@@ -488,6 +512,4 @@ namespace OpenSim.Region.Capabilities
488 } 512 }
489 } 513 }
490 } 514 }
491} 515} \ No newline at end of file
492
493
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
36 36
37 public LLSDArray() 37 public LLSDArray()
38 { 38 {
39
40 } 39 }
41 } 40 }
42} 41} \ 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
39 39
40 public LLSDAssetUploadComplete() 40 public LLSDAssetUploadComplete()
41 { 41 {
42
43 } 42 }
44 } 43 }
45} 44} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -46,4 +43,4 @@ namespace OpenSim.Region.Capabilities
46 { 43 {
47 } 44 }
48 } 45 }
49} 46} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 [LLSDMap] 31 [LLSDMap]
@@ -40,7 +36,6 @@ namespace OpenSim.Region.Capabilities
40 36
41 public LLSDAssetUploadResponse() 37 public LLSDAssetUploadResponse()
42 { 38 {
43
44 } 39 }
45 } 40 }
46} 41} \ 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
35 35
36 public LLSDCapEvent() 36 public LLSDCapEvent()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ 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
34 public string MapLayer = ""; 34 public string MapLayer = "";
35 public string NewFileAgentInventory = ""; 35 public string NewFileAgentInventory = "";
36 //public string EventQueueGet = ""; 36 //public string EventQueueGet = "";
37 // public string RequestTextureDownload = ""; 37 // public string RequestTextureDownload = "";
38 // public string ChatSessionRequest = ""; 38 // public string ChatSessionRequest = "";
39 public string UpdateNotecardAgentInventory = ""; 39 public string UpdateNotecardAgentInventory = "";
40 public string UpdateScriptAgentInventory = ""; 40 public string UpdateScriptAgentInventory = "";
41 // public string ParcelVoiceInfoRequest = ""; 41 // public string ParcelVoiceInfoRequest = "";
42 42
43 public LLSDCapsDetails() 43 public LLSDCapsDetails()
44 { 44 {
45
46 } 45 }
47 } 46 }
48} 47} \ No newline at end of file
49
50
51
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
32 { 32 {
33 public LLSDEmpty() 33 public LLSDEmpty()
34 { 34 {
35
36 } 35 }
37 } 36 }
38} 37} \ 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
51 public static void SerializeLLSDType(XmlTextWriter writer, object obj) 51 public static void SerializeLLSDType(XmlTextWriter writer, object obj)
52 { 52 {
53 Type myType = obj.GetType(); 53 Type myType = obj.GetType();
54 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 54 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
55 if (llsdattributes.Length > 0) 55 if (llsdattributes.Length > 0)
56 { 56 {
57 switch (llsdattributes[0].ObjectType) 57 switch (llsdattributes[0].ObjectType)
@@ -62,7 +62,8 @@ namespace OpenSim.Region.Capabilities
62 for (int i = 0; i < fields.Length; i++) 62 for (int i = 0; i < fields.Length; i++)
63 { 63 {
64 object fieldValue = fields[i].GetValue(obj); 64 object fieldValue = fields[i].GetValue(obj);
65 LLSDType[] fieldAttributes = (LLSDType[])fieldValue.GetType().GetCustomAttributes(typeof(LLSDType), false); 65 LLSDType[] fieldAttributes =
66 (LLSDType[]) fieldValue.GetType().GetCustomAttributes(typeof (LLSDType), false);
66 if (fieldAttributes.Length > 0) 67 if (fieldAttributes.Length > 0)
67 { 68 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty); 69 writer.WriteStartElement(String.Empty, "key", String.Empty);
@@ -83,7 +84,7 @@ namespace OpenSim.Region.Capabilities
83 case "ARRAY": 84 case "ARRAY":
84 // LLSDArray arrayObject = obj as LLSDArray; 85 // LLSDArray arrayObject = obj as LLSDArray;
85 // ArrayList a = arrayObject.Array; 86 // ArrayList a = arrayObject.Array;
86 ArrayList a = (ArrayList)obj.GetType().GetField("Array").GetValue(obj); 87 ArrayList a = (ArrayList) obj.GetType().GetField("Array").GetValue(obj);
87 if (a != null) 88 if (a != null)
88 { 89 {
89 writer.WriteStartElement(String.Empty, "array", String.Empty); 90 writer.WriteStartElement(String.Empty, "array", String.Empty);
@@ -105,7 +106,7 @@ namespace OpenSim.Region.Capabilities
105 public static object DeserialiseLLSDMap(Hashtable llsd, object obj) 106 public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
106 { 107 {
107 Type myType = obj.GetType(); 108 Type myType = obj.GetType();
108 LLSDType[] llsdattributes = (LLSDType[])myType.GetCustomAttributes(typeof(LLSDType), false); 109 LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
109 if (llsdattributes.Length > 0) 110 if (llsdattributes.Length > 0)
110 { 111 {
111 switch (llsdattributes[0].ObjectType) 112 switch (llsdattributes[0].ObjectType)
@@ -114,7 +115,7 @@ namespace OpenSim.Region.Capabilities
114 IDictionaryEnumerator enumerator = llsd.GetEnumerator(); 115 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
115 while (enumerator.MoveNext()) 116 while (enumerator.MoveNext())
116 { 117 {
117 FieldInfo field = myType.GetField((string)enumerator.Key); 118 FieldInfo field = myType.GetField((string) enumerator.Key);
118 if (field != null) 119 if (field != null)
119 { 120 {
120 if (enumerator.Value is Hashtable) 121 if (enumerator.Value is Hashtable)
@@ -142,23 +143,4 @@ namespace OpenSim.Region.Capabilities
142 return obj; 143 return obj;
143 } 144 }
144 } 145 }
145 146} \ No newline at end of file
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164}
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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 29using libsecondlife;
33 30
34namespace OpenSim.Region.Capabilities 31namespace OpenSim.Region.Capabilities
@@ -42,4 +39,4 @@ namespace OpenSim.Region.Capabilities
42 { 39 {
43 } 40 }
44 } 41 }
45} 42} \ 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
40 40
41 public LLSDMapLayer() 41 public LLSDMapLayer()
42 { 42 {
43
44 } 43 }
45 } 44 }
46} 45} \ 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
35 35
36 public LLSDMapLayerResponse() 36 public LLSDMapLayerResponse()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ 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
35 35
36 public LLSDMapRequest() 36 public LLSDMapRequest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Region.Capabilities 29namespace OpenSim.Region.Capabilities
34{ 30{
35 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request); 31 public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
36} 32} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework.Servers;
33using System.IO;
34using System.Collections; 29using System.Collections;
30using System.IO;
31using System.Text;
35using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Servers;
36 34
37namespace OpenSim.Region.Capabilities 35namespace OpenSim.Region.Capabilities
38{ 36{
@@ -42,11 +40,11 @@ namespace OpenSim.Region.Capabilities
42 private LLSDMethod<TRequest, TResponse> m_method; 40 private LLSDMethod<TRequest, TResponse> m_method;
43 41
44 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) 42 public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
45 : base(httpMethod, path ) 43 : base(httpMethod, path)
46 { 44 {
47 m_method = method; 45 m_method = method;
48 } 46 }
49 47
50 public override byte[] Handle(string path, Stream request) 48 public override byte[] Handle(string path, Stream request)
51 { 49 {
52 //Encoding encoding = Encoding.UTF8; 50 //Encoding encoding = Encoding.UTF8;
@@ -55,16 +53,15 @@ namespace OpenSim.Region.Capabilities
55 //string requestBody = streamReader.ReadToEnd(); 53 //string requestBody = streamReader.ReadToEnd();
56 //streamReader.Close(); 54 //streamReader.Close();
57 55
58 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize( request ); 56 Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
59 TRequest llsdRequest = new TRequest(); 57 TRequest llsdRequest = new TRequest();
60 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest); 58 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
61 59
62 TResponse response = m_method(llsdRequest); 60 TResponse response = m_method(llsdRequest);
63 61
64 Encoding encoding = new UTF8Encoding(false); 62 Encoding encoding = new UTF8Encoding(false);
65
66 return encoding.GetBytes( LLSDHelpers.SerialiseLLSDReply(response) );
67 63
64 return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
68 } 65 }
69 } 66 }
70} 67} \ 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
35 35
36 public LLSDTest() 36 public LLSDTest()
37 { 37 {
38
39 } 38 }
40 } 39 }
41} 40} \ 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
37 public LLSDType(string type) 37 public LLSDType(string type)
38 { 38 {
39 myType = type; 39 myType = type;
40
41 } 40 }
42 41
43 public string ObjectType 42 public string ObjectType
44 { 43 {
45 get 44 get { return myType; }
46 {
47 return myType;
48 }
49 } 45 }
50 } 46 }
51 47
52 [AttributeUsage(AttributeTargets.Class)] 48 [AttributeUsage(AttributeTargets.Class)]
53 public class LLSDMap : LLSDType 49 public class LLSDMap : LLSDType
54 { 50 {
55 public LLSDMap() : base( "MAP" ) 51 public LLSDMap() : base("MAP")
56 { 52 {
57 } 53 }
58 } 54 }
59} 55} \ 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 @@
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Communications.Cache; 30using OpenSim.Framework.Communications.Cache;
31using OpenSim.Framework.Console;
31using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
32using OpenSim.Framework.Servers; 33using OpenSim.Framework.Servers;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35 34
36namespace OpenSim.Framework.Communications 35namespace OpenSim.Framework.Communications
37{ 36{
38 public class CommunicationsManager 37 public class CommunicationsManager
39 { 38 {
40 protected IUserService m_userService; 39 protected IUserService m_userService;
40
41 public IUserService UserService 41 public IUserService UserService
42 { 42 {
43 get { return m_userService; } 43 get { return m_userService; }
44 } 44 }
45 45
46 protected IGridServices m_gridService; 46 protected IGridServices m_gridService;
47
47 public IGridServices GridService 48 public IGridServices GridService
48 { 49 {
49 get { return m_gridService; } 50 get { return m_gridService; }
50 } 51 }
51 52
52 protected IInventoryServices m_inventoryService; 53 protected IInventoryServices m_inventoryService;
54
53 public IInventoryServices InventoryService 55 public IInventoryServices InventoryService
54 { 56 {
55 get { return m_inventoryService; } 57 get { return m_inventoryService; }
56 } 58 }
57 59
58 protected IInterRegionCommunications m_interRegion; 60 protected IInterRegionCommunications m_interRegion;
61
59 public IInterRegionCommunications InterRegion 62 public IInterRegionCommunications InterRegion
60 { 63 {
61 get { return m_interRegion; } 64 get { return m_interRegion; }
62 } 65 }
63 66
64 protected UserProfileCache m_userProfileCache; 67 protected UserProfileCache m_userProfileCache;
68
65 public UserProfileCache UserProfileCache 69 public UserProfileCache UserProfileCache
66 { 70 {
67 get { return m_userProfileCache; } 71 get { return m_userProfileCache; }
68 } 72 }
69 73
70 protected AssetTransactionManager m_transactionsManager; 74 protected AssetTransactionManager m_transactionsManager;
75
71 public AssetTransactionManager TransactionsManager 76 public AssetTransactionManager TransactionsManager
72 { 77 {
73 get { return m_transactionsManager; } 78 get { return m_transactionsManager; }
74 } 79 }
75 80
76 protected AssetCache m_assetCache; 81 protected AssetCache m_assetCache;
82
77 public AssetCache AssetCache 83 public AssetCache AssetCache
78 { 84 {
79 get { return m_assetCache; } 85 get { return m_assetCache; }
80 } 86 }
81 87
82 protected NetworkServersInfo m_networkServersInfo; 88 protected NetworkServersInfo m_networkServersInfo;
89
83 public NetworkServersInfo NetworkServersInfo 90 public NetworkServersInfo NetworkServersInfo
84 { 91 {
85 get { return m_networkServersInfo; } 92 get { return m_networkServersInfo; }
86 } 93 }
87 94
88 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile) 95 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
96 bool dumpAssetsToFile)
89 { 97 {
90 m_networkServersInfo = serversInfo; 98 m_networkServersInfo = serversInfo;
91 m_assetCache = assetCache; 99 m_assetCache = assetCache;
92 m_userProfileCache = new UserProfileCache(this); 100 m_userProfileCache = new UserProfileCache(this);
93 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile ); 101 m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
94 } 102 }
95 103
96 public void doCreate(string[] cmmdParams) 104 public void doCreate(string[] cmmdParams)
@@ -106,7 +114,6 @@ namespace OpenSim.Framework.Communications
106 114
107 if (cmmdParams.Length < 2) 115 if (cmmdParams.Length < 2)
108 { 116 {
109
110 firstName = MainLog.Instance.CmdPrompt("First name", "Default"); 117 firstName = MainLog.Instance.CmdPrompt("First name", "Default");
111 lastName = MainLog.Instance.CmdPrompt("Last name", "User"); 118 lastName = MainLog.Instance.CmdPrompt("Last name", "User");
112 password = MainLog.Instance.PasswdPrompt("Password"); 119 password = MainLog.Instance.PasswdPrompt("Password");
@@ -120,7 +127,6 @@ namespace OpenSim.Framework.Communications
120 password = cmmdParams[3]; 127 password = cmmdParams[3];
121 regX = Convert.ToUInt32(cmmdParams[4]); 128 regX = Convert.ToUInt32(cmmdParams[4]);
122 regY = Convert.ToUInt32(cmmdParams[5]); 129 regY = Convert.ToUInt32(cmmdParams[5]);
123
124 } 130 }
125 131
126 AddUser(firstName, lastName, password, regX, regY); 132 AddUser(firstName, lastName, password, regX, regY);
@@ -140,7 +146,7 @@ namespace OpenSim.Framework.Communications
140 } 146 }
141 else 147 else
142 { 148 {
143 this.m_inventoryService.CreateNewUserInventory(userProf.UUID); 149 m_inventoryService.CreateNewUserInventory(userProf.UUID);
144 System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); 150 System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
145 return userProf.UUID; 151 return userProf.UUID;
146 } 152 }
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 @@
27*/ 27*/
28 28
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net;
31using libsecondlife;
32
33using OpenSim.Framework;
34 30
35namespace OpenSim.Framework.Communications 31namespace OpenSim.Framework.Communications
36{ 32{
@@ -41,4 +37,4 @@ namespace OpenSim.Framework.Communications
41 RegionInfo RequestNeighbourInfo(ulong regionHandle); 37 RegionInfo RequestNeighbourInfo(ulong regionHandle);
42 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 38 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
43 } 39 }
44} 40} \ 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 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework.Communications 30namespace OpenSim.Framework.Communications
32{ 31{
@@ -36,4 +35,4 @@ namespace OpenSim.Framework.Communications
36 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 35 bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
37 bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId); 36 bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId);
38 } 37 }
39} 38} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using libsecondlife; 30using libsecondlife;
33using OpenSim.Framework.Communications.Cache; 31using OpenSim.Framework.Communications.Cache;
34using OpenSim.Framework;
35 32
36namespace OpenSim.Framework.Communications 33namespace OpenSim.Framework.Communications
37{ 34{
38 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo); 35 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
36
39 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); 37 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
40 38
41 public interface IInventoryServices 39 public interface IInventoryServices
@@ -53,4 +51,4 @@ namespace OpenSim.Framework.Communications
53 /// <returns></returns> 51 /// <returns></returns>
54 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID); 52 List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
55 } 53 }
56} 54} \ 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;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using libsecondlife; 32using libsecondlife;
33using OpenSim.Framework.Communications;
34using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
36using OpenSim.Framework;
37 35
38namespace OpenSim.Framework.Communications 36namespace OpenSim.Framework.Communications
39{ 37{
@@ -67,10 +65,10 @@ namespace OpenSim.Framework.Communications
67 if (typeInterface != null) 65 if (typeInterface != null)
68 { 66 {
69 IInventoryData plug = 67 IInventoryData plug =
70 (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
71 plug.Initialise(); 69 plug.Initialise();
72 this.m_plugins.Add(plug.getName(), plug); 70 m_plugins.Add(plug.getName(), plug);
73 MainLog.Instance.Verbose("INVENTORY","Added IInventoryData Interface"); 71 MainLog.Instance.Verbose("INVENTORY", "Added IInventoryData Interface");
74 } 72 }
75 } 73 }
76 } 74 }
@@ -168,7 +166,7 @@ namespace OpenSim.Framework.Communications
168 { 166 {
169 foreach (InventoryFolderBase folder in inventory.Folders.Values) 167 foreach (InventoryFolderBase folder in inventory.Folders.Values)
170 { 168 {
171 this.AddFolder(folder); 169 AddFolder(folder);
172 } 170 }
173 } 171 }
174 172
@@ -176,7 +174,7 @@ namespace OpenSim.Framework.Communications
176 { 174 {
177 UsersInventory inven = new UsersInventory(); 175 UsersInventory inven = new UsersInventory();
178 inven.CreateNewInventorySet(user); 176 inven.CreateNewInventorySet(user);
179 this.AddNewInventorySet(inven); 177 AddNewInventorySet(inven);
180 } 178 }
181 179
182 public class UsersInventory 180 public class UsersInventory
@@ -186,7 +184,6 @@ namespace OpenSim.Framework.Communications
186 184
187 public UsersInventory() 185 public UsersInventory()
188 { 186 {
189
190 } 187 }
191 188
192 public virtual void CreateNewInventorySet(LLUUID user) 189 public virtual void CreateNewInventorySet(LLUUID user)
@@ -231,9 +228,11 @@ namespace OpenSim.Framework.Communications
231 } 228 }
232 } 229 }
233 230
234 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); 231 public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
232 InventoryItemInfo itemCallBack);
233
235 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder); 234 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder);
236 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 235 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
237 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 236 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
238 } 237 }
239} 238} \ 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;
34 34
35namespace OpenSim.Framework.UserManagement 35namespace OpenSim.Framework.UserManagement
36{ 36{
37
38 /// <summary> 37 /// <summary>
39 /// A temp class to handle login response. 38 /// A temp class to handle login response.
40 /// Should make use of UserProfileManager where possible. 39 /// Should make use of UserProfileManager where possible.
41 /// </summary> 40 /// </summary>
42
43 public class LoginResponse 41 public class LoginResponse
44 { 42 {
45 private Hashtable loginFlagsHash; 43 private Hashtable loginFlagsHash;
@@ -103,211 +101,222 @@ namespace OpenSim.Framework.UserManagement
103 101
104 public LoginResponse() 102 public LoginResponse()
105 { 103 {
106 this.loginFlags = new ArrayList(); 104 loginFlags = new ArrayList();
107 this.globalTextures = new ArrayList(); 105 globalTextures = new ArrayList();
108 this.eventCategories = new ArrayList(); 106 eventCategories = new ArrayList();
109 this.uiConfig = new ArrayList(); 107 uiConfig = new ArrayList();
110 this.classifiedCategories = new ArrayList(); 108 classifiedCategories = new ArrayList();
111 109
112 this.loginError = new Hashtable(); 110 loginError = new Hashtable();
113 this.uiConfigHash = new Hashtable(); 111 uiConfigHash = new Hashtable();
114 112
115 this.defaultXmlRpcResponse = new XmlRpcResponse(); 113 defaultXmlRpcResponse = new XmlRpcResponse();
116 this.userProfile = new UserInfo(); 114 userProfile = new UserInfo();
117 this.inventoryRoot = new ArrayList(); 115 inventoryRoot = new ArrayList();
118 this.initialOutfit = new ArrayList(); 116 initialOutfit = new ArrayList();
119 this.agentInventory = new ArrayList(); 117 agentInventory = new ArrayList();
120 this.inventoryLibrary = new ArrayList(); 118 inventoryLibrary = new ArrayList();
121 this.inventoryLibraryOwner = new ArrayList(); 119 inventoryLibraryOwner = new ArrayList();
122 120
123 this.xmlRpcResponse = new XmlRpcResponse(); 121 xmlRpcResponse = new XmlRpcResponse();
124 this.defaultXmlRpcResponse = new XmlRpcResponse(); 122 defaultXmlRpcResponse = new XmlRpcResponse();
125 123
126 this.SetDefaultValues(); 124 SetDefaultValues();
127 } // LoginServer 125 } // LoginServer
128 126
129 public void SetDefaultValues() 127 public void SetDefaultValues()
130 { 128 {
131 this.DST = "N"; 129 DST = "N";
132 this.StipendSinceLogin = "N"; 130 StipendSinceLogin = "N";
133 this.Gendered = "Y"; 131 Gendered = "Y";
134 this.EverLoggedIn = "Y"; 132 EverLoggedIn = "Y";
135 this.login = "false"; 133 login = "false";
136 this.firstname = "Test"; 134 firstname = "Test";
137 this.lastname = "User"; 135 lastname = "User";
138 this.agentAccess = "M"; 136 agentAccess = "M";
139 this.startLocation = "last"; 137 startLocation = "last";
140 this.allowFirstLife = "Y"; 138 allowFirstLife = "Y";
141 139
142 this.SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271"; 140 SunTexture = "cce0f112-878f-4586-a2e2-a8f104bba271";
143 this.CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 141 CloudTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
144 this.MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621"; 142 MoonTexture = "fc4b9f0b-d008-45c6-96a4-01dd947ac621";
145 143
146 this.ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock."; 144 ErrorMessage = "You have entered an invalid name/password combination. Check Caps/lock.";
147 this.ErrorReason = "key"; 145 ErrorReason = "key";
148 this.welcomeMessage = "Welcome to OpenSim!"; 146 welcomeMessage = "Welcome to OpenSim!";
149 this.seedCapability = ""; 147 seedCapability = "";
150 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() + "]}"; 148 home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" +
151 this.lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; 149 userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
152 this.RegionX = (uint)255232; 150 userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
153 this.RegionY = (uint)254976; 151 userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
154 152 lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]";
155 // Classifieds; 153 RegionX = (uint) 255232;
156 this.AddClassifiedCategory((Int32)1, "Shopping"); 154 RegionY = (uint) 254976;
157 this.AddClassifiedCategory((Int32)2, "Land Rental"); 155
158 this.AddClassifiedCategory((Int32)3, "Property Rental"); 156 // Classifieds;
159 this.AddClassifiedCategory((Int32)4, "Special Attraction"); 157 AddClassifiedCategory((Int32) 1, "Shopping");
160 this.AddClassifiedCategory((Int32)5, "New Products"); 158 AddClassifiedCategory((Int32) 2, "Land Rental");
161 this.AddClassifiedCategory((Int32)6, "Employment"); 159 AddClassifiedCategory((Int32) 3, "Property Rental");
162 this.AddClassifiedCategory((Int32)7, "Wanted"); 160 AddClassifiedCategory((Int32) 4, "Special Attraction");
163 this.AddClassifiedCategory((Int32)8, "Service"); 161 AddClassifiedCategory((Int32) 5, "New Products");
164 this.AddClassifiedCategory((Int32)9, "Personal"); 162 AddClassifiedCategory((Int32) 6, "Employment");
165 163 AddClassifiedCategory((Int32) 7, "Wanted");
166 164 AddClassifiedCategory((Int32) 8, "Service");
167 this.SessionID = LLUUID.Random(); 165 AddClassifiedCategory((Int32) 9, "Personal");
168 this.SecureSessionID = LLUUID.Random(); 166
169 this.AgentID = LLUUID.Random(); 167
170 168 SessionID = LLUUID.Random();
171 Hashtable InitialOutfitHash = new Hashtable(); 169 SecureSessionID = LLUUID.Random();
172 InitialOutfitHash["folder_name"] = "Nightclub Female"; 170 AgentID = LLUUID.Random();
173 InitialOutfitHash["gender"] = "female"; 171
174 this.initialOutfit.Add(InitialOutfitHash); 172 Hashtable InitialOutfitHash = new Hashtable();
175 173 InitialOutfitHash["folder_name"] = "Nightclub Female";
176 174 InitialOutfitHash["gender"] = "female";
175 initialOutfit.Add(InitialOutfitHash);
177 } // SetDefaultValues 176 } // SetDefaultValues
178 177
179 #region Login Failure Methods 178 #region Login Failure Methods
179
180 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login) 180 public XmlRpcResponse GenerateFailureResponse(string reason, string message, string login)
181 { 181 {
182 // Overwrite any default values; 182 // Overwrite any default values;
183 this.xmlRpcResponse = new XmlRpcResponse(); 183 xmlRpcResponse = new XmlRpcResponse();
184 184
185 // Ensure Login Failed message/reason; 185 // Ensure Login Failed message/reason;
186 this.ErrorMessage = message; 186 ErrorMessage = message;
187 this.ErrorReason = reason; 187 ErrorReason = reason;
188 188
189 this.loginError["reason"] = this.ErrorReason; 189 loginError["reason"] = ErrorReason;
190 this.loginError["message"] = this.ErrorMessage; 190 loginError["message"] = ErrorMessage;
191 this.loginError["login"] = login; 191 loginError["login"] = login;
192 this.xmlRpcResponse.Value = this.loginError; 192 xmlRpcResponse.Value = loginError;
193 return (this.xmlRpcResponse); 193 return (xmlRpcResponse);
194 } // GenerateResponse 194 } // GenerateResponse
195 195
196 public XmlRpcResponse CreateFailedResponse() 196 public XmlRpcResponse CreateFailedResponse()
197 { 197 {
198 return (this.CreateLoginFailedResponse()); 198 return (CreateLoginFailedResponse());
199 } // CreateErrorConnectingToGridResponse() 199 } // CreateErrorConnectingToGridResponse()
200 200
201 public XmlRpcResponse CreateLoginFailedResponse() 201 public XmlRpcResponse CreateLoginFailedResponse()
202 { 202 {
203 return (this.GenerateFailureResponse("key", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false")); 203 return
204 (GenerateFailureResponse("key",
205 "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
206 "false"));
204 } // LoginFailedResponse 207 } // LoginFailedResponse
205 208
206 public XmlRpcResponse CreateAlreadyLoggedInResponse() 209 public XmlRpcResponse CreateAlreadyLoggedInResponse()
207 { 210 {
208 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")); 211 return
212 (GenerateFailureResponse("presence",
213 "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",
214 "false"));
209 } // CreateAlreadyLoggedInResponse() 215 } // CreateAlreadyLoggedInResponse()
210 216
211 public XmlRpcResponse CreateDeadRegionResponse() 217 public XmlRpcResponse CreateDeadRegionResponse()
212 { 218 {
213 return (this.GenerateFailureResponse("key", "The region you are attempting to log into is not responding. Please select another region and try again.", "false")); 219 return
220 (GenerateFailureResponse("key",
221 "The region you are attempting to log into is not responding. Please select another region and try again.",
222 "false"));
214 } 223 }
215 224
216 public XmlRpcResponse CreateGridErrorResponse() 225 public XmlRpcResponse CreateGridErrorResponse()
217 { 226 {
218 return (this.GenerateFailureResponse("key", "Error connecting to grid. Could not percieve credentials from login XML.", "false")); 227 return
228 (GenerateFailureResponse("key",
229 "Error connecting to grid. Could not percieve credentials from login XML.",
230 "false"));
219 } 231 }
220 232
221 #endregion 233 #endregion
222 234
223 public XmlRpcResponse ToXmlRpcResponse() 235 public XmlRpcResponse ToXmlRpcResponse()
224 { 236 {
225 try 237 try
226 { 238 {
227
228 Hashtable responseData = new Hashtable(); 239 Hashtable responseData = new Hashtable();
229 240
230 this.loginFlagsHash = new Hashtable(); 241 loginFlagsHash = new Hashtable();
231 this.loginFlagsHash["daylight_savings"] = this.DST; 242 loginFlagsHash["daylight_savings"] = DST;
232 this.loginFlagsHash["stipend_since_login"] = this.StipendSinceLogin; 243 loginFlagsHash["stipend_since_login"] = StipendSinceLogin;
233 this.loginFlagsHash["gendered"] = this.Gendered; 244 loginFlagsHash["gendered"] = Gendered;
234 this.loginFlagsHash["ever_logged_in"] = this.EverLoggedIn; 245 loginFlagsHash["ever_logged_in"] = EverLoggedIn;
235 this.loginFlags.Add(this.loginFlagsHash); 246 loginFlags.Add(loginFlagsHash);
236 247
237 responseData["first_name"] = this.Firstname; 248 responseData["first_name"] = Firstname;
238 responseData["last_name"] = this.Lastname; 249 responseData["last_name"] = Lastname;
239 responseData["agent_access"] = this.agentAccess; 250 responseData["agent_access"] = agentAccess;
240 251
241 this.globalTexturesHash = new Hashtable(); 252 globalTexturesHash = new Hashtable();
242 this.globalTexturesHash["sun_texture_id"] = this.SunTexture; 253 globalTexturesHash["sun_texture_id"] = SunTexture;
243 this.globalTexturesHash["cloud_texture_id"] = this.CloudTexture; 254 globalTexturesHash["cloud_texture_id"] = CloudTexture;
244 this.globalTexturesHash["moon_texture_id"] = this.MoonTexture; 255 globalTexturesHash["moon_texture_id"] = MoonTexture;
245 this.globalTextures.Add(this.globalTexturesHash); 256 globalTextures.Add(globalTexturesHash);
246 // this.eventCategories.Add(this.eventCategoriesHash); 257 // this.eventCategories.Add(this.eventCategoriesHash);
247 258
248 this.AddToUIConfig("allow_first_life", this.allowFirstLife); 259 AddToUIConfig("allow_first_life", allowFirstLife);
249 this.uiConfig.Add(this.uiConfigHash); 260 uiConfig.Add(uiConfigHash);
250 261
251 responseData["sim_port"] =(Int32) this.SimPort; 262 responseData["sim_port"] = (Int32) SimPort;
252 responseData["sim_ip"] = this.SimAddress; 263 responseData["sim_ip"] = SimAddress;
253 264
254 responseData["agent_id"] = this.AgentID.ToStringHyphenated(); 265 responseData["agent_id"] = AgentID.ToStringHyphenated();
255 responseData["session_id"] = this.SessionID.ToStringHyphenated(); 266 responseData["session_id"] = SessionID.ToStringHyphenated();
256 responseData["secure_session_id"] = this.SecureSessionID.ToStringHyphenated(); 267 responseData["secure_session_id"] = SecureSessionID.ToStringHyphenated();
257 responseData["circuit_code"] = this.CircuitCode; 268 responseData["circuit_code"] = CircuitCode;
258 responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 269 responseData["seconds_since_epoch"] = (Int32) (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
259 responseData["login-flags"] = this.loginFlags; 270 responseData["login-flags"] = loginFlags;
260 responseData["global-textures"] = this.globalTextures; 271 responseData["global-textures"] = globalTextures;
261 responseData["seed_capability"] = this.seedCapability; 272 responseData["seed_capability"] = seedCapability;
262 273
263 responseData["event_categories"] = this.eventCategories; 274 responseData["event_categories"] = eventCategories;
264 responseData["event_notifications"] = new ArrayList(); // todo 275 responseData["event_notifications"] = new ArrayList(); // todo
265 responseData["classified_categories"] = this.classifiedCategories; 276 responseData["classified_categories"] = classifiedCategories;
266 responseData["ui-config"] = this.uiConfig; 277 responseData["ui-config"] = uiConfig;
267 278
268 responseData["inventory-skeleton"] = this.agentInventory; 279 responseData["inventory-skeleton"] = agentInventory;
269 responseData["inventory-skel-lib"] = this.inventoryLibrary; 280 responseData["inventory-skel-lib"] = inventoryLibrary;
270 responseData["inventory-root"] = this.inventoryRoot; 281 responseData["inventory-root"] = inventoryRoot;
271 responseData["gestures"] = new ArrayList(); // todo 282 responseData["gestures"] = new ArrayList(); // todo
272 responseData["inventory-lib-owner"] = this.inventoryLibraryOwner; 283 responseData["inventory-lib-owner"] = inventoryLibraryOwner;
273 responseData["initial-outfit"] = this.initialOutfit; 284 responseData["initial-outfit"] = initialOutfit;
274 responseData["start_location"] = this.startLocation; 285 responseData["start_location"] = startLocation;
275 responseData["seed_capability"] = this.seedCapability; 286 responseData["seed_capability"] = seedCapability;
276 responseData["home"] = this.home; 287 responseData["home"] = home;
277 responseData["look_at"] = this.lookAt; 288 responseData["look_at"] = lookAt;
278 responseData["message"] = this.welcomeMessage; 289 responseData["message"] = welcomeMessage;
279 responseData["region_x"] = (Int32)this.RegionX * 256; 290 responseData["region_x"] = (Int32) RegionX*256;
280 responseData["region_y"] = (Int32)this.RegionY * 256; 291 responseData["region_y"] = (Int32) RegionY*256;
281 292
282 //responseData["inventory-lib-root"] = new ArrayList(); // todo 293 //responseData["inventory-lib-root"] = new ArrayList(); // todo
283 //responseData["buddy-list"] = new ArrayList(); // todo 294 //responseData["buddy-list"] = new ArrayList(); // todo
284 295
285 responseData["login"] = "true"; 296 responseData["login"] = "true";
286 this.xmlRpcResponse.Value = responseData; 297 xmlRpcResponse.Value = responseData;
287 298
288 return (this.xmlRpcResponse); 299 return (xmlRpcResponse);
289 } 300 }
290 catch (Exception e) 301 catch (Exception e)
291 { 302 {
292 MainLog.Instance.Warn( 303 MainLog.Instance.Warn(
293 "CLIENT", 304 "CLIENT",
294 "LoginResponse: Error creating XML-RPC Response: " + e.Message 305 "LoginResponse: Error creating XML-RPC Response: " + e.Message
295 ); 306 );
296 return (this.GenerateFailureResponse("Internal Error", "Error generating Login Response", "false")); 307 return (GenerateFailureResponse("Internal Error", "Error generating Login Response", "false"));
297
298 } 308 }
299
300 } // ToXmlRpcResponse 309 } // ToXmlRpcResponse
301 310
302 public void SetEventCategories(string category, string value) 311 public void SetEventCategories(string category, string value)
303 { 312 {
304 // this.eventCategoriesHash[category] = value; 313 // this.eventCategoriesHash[category] = value;
305 //TODO 314 //TODO
306 } // SetEventCategories 315 } // SetEventCategories
307 316
308 public void AddToUIConfig(string itemName, string item) 317 public void AddToUIConfig(string itemName, string item)
309 { 318 {
310 this.uiConfigHash[itemName] = item; 319 uiConfigHash[itemName] = item;
311 } // SetUIConfig 320 } // SetUIConfig
312 321
313 public void AddClassifiedCategory(Int32 ID, string categoryName) 322 public void AddClassifiedCategory(Int32 ID, string categoryName)
@@ -315,372 +324,193 @@ namespace OpenSim.Framework.UserManagement
315 Hashtable hash = new Hashtable(); 324 Hashtable hash = new Hashtable();
316 hash["category_name"] = categoryName; 325 hash["category_name"] = categoryName;
317 hash["category_id"] = ID; 326 hash["category_id"] = ID;
318 this.classifiedCategories.Add(hash); 327 classifiedCategories.Add(hash);
319 // this.classifiedCategoriesHash.Clear(); 328 // this.classifiedCategoriesHash.Clear();
320 } // SetClassifiedCategory 329 } // SetClassifiedCategory
321 330
322 #region Properties 331 #region Properties
332
323 public string Login 333 public string Login
324 { 334 {
325 get 335 get { return login; }
326 { 336 set { login = value; }
327 return this.login;
328 }
329 set
330 {
331 this.login = value;
332 }
333 } // Login 337 } // Login
334 338
335 public string DST 339 public string DST
336 { 340 {
337 get 341 get { return dst; }
338 { 342 set { dst = value; }
339 return this.dst;
340 }
341 set
342 {
343 this.dst = value;
344 }
345 } // DST 343 } // DST
346 344
347 public string StipendSinceLogin 345 public string StipendSinceLogin
348 { 346 {
349 get 347 get { return stipendSinceLogin; }
350 { 348 set { stipendSinceLogin = value; }
351 return this.stipendSinceLogin;
352 }
353 set
354 {
355 this.stipendSinceLogin = value;
356 }
357 } // StipendSinceLogin 349 } // StipendSinceLogin
358 350
359 public string Gendered 351 public string Gendered
360 { 352 {
361 get 353 get { return gendered; }
362 { 354 set { gendered = value; }
363 return this.gendered;
364 }
365 set
366 {
367 this.gendered = value;
368 }
369 } // Gendered 355 } // Gendered
370 356
371 public string EverLoggedIn 357 public string EverLoggedIn
372 { 358 {
373 get 359 get { return everLoggedIn; }
374 { 360 set { everLoggedIn = value; }
375 return this.everLoggedIn;
376 }
377 set
378 {
379 this.everLoggedIn = value;
380 }
381 } // EverLoggedIn 361 } // EverLoggedIn
382 362
383 public int SimPort 363 public int SimPort
384 { 364 {
385 get 365 get { return simPort; }
386 { 366 set { simPort = value; }
387 return this.simPort;
388 }
389 set
390 {
391 this.simPort = value;
392 }
393 } // SimPort 367 } // SimPort
394 368
395 public string SimAddress 369 public string SimAddress
396 { 370 {
397 get 371 get { return simAddress; }
398 { 372 set { simAddress = value; }
399 return this.simAddress;
400 }
401 set
402 {
403 this.simAddress = value;
404 }
405 } // SimAddress 373 } // SimAddress
406 374
407 public LLUUID AgentID 375 public LLUUID AgentID
408 { 376 {
409 get 377 get { return agentID; }
410 { 378 set { agentID = value; }
411 return this.agentID;
412 }
413 set
414 {
415 this.agentID = value;
416 }
417 } // AgentID 379 } // AgentID
418 380
419 public LLUUID SessionID 381 public LLUUID SessionID
420 { 382 {
421 get 383 get { return sessionID; }
422 { 384 set { sessionID = value; }
423 return this.sessionID;
424 }
425 set
426 {
427 this.sessionID = value;
428 }
429 } // SessionID 385 } // SessionID
430 386
431 public LLUUID SecureSessionID 387 public LLUUID SecureSessionID
432 { 388 {
433 get 389 get { return secureSessionID; }
434 { 390 set { secureSessionID = value; }
435 return this.secureSessionID;
436 }
437 set
438 {
439 this.secureSessionID = value;
440 }
441 } // SecureSessionID 391 } // SecureSessionID
442 392
443 public Int32 CircuitCode 393 public Int32 CircuitCode
444 { 394 {
445 get 395 get { return circuitCode; }
446 { 396 set { circuitCode = value; }
447 return this.circuitCode;
448 }
449 set
450 {
451 this.circuitCode = value;
452 }
453 } // CircuitCode 397 } // CircuitCode
454 398
455 public uint RegionX 399 public uint RegionX
456 { 400 {
457 get 401 get { return regionX; }
458 { 402 set { regionX = value; }
459 return this.regionX;
460 }
461 set
462 {
463 this.regionX = value;
464 }
465 } // RegionX 403 } // RegionX
466 404
467 public uint RegionY 405 public uint RegionY
468 { 406 {
469 get 407 get { return regionY; }
470 { 408 set { regionY = value; }
471 return this.regionY;
472 }
473 set
474 {
475 this.regionY = value;
476 }
477 } // RegionY 409 } // RegionY
478 410
479 public string SunTexture 411 public string SunTexture
480 { 412 {
481 get 413 get { return sunTexture; }
482 { 414 set { sunTexture = value; }
483 return this.sunTexture;
484 }
485 set
486 {
487 this.sunTexture = value;
488 }
489 } // SunTexture 415 } // SunTexture
490 416
491 public string CloudTexture 417 public string CloudTexture
492 { 418 {
493 get 419 get { return cloudTexture; }
494 { 420 set { cloudTexture = value; }
495 return this.cloudTexture;
496 }
497 set
498 {
499 this.cloudTexture = value;
500 }
501 } // CloudTexture 421 } // CloudTexture
502 422
503 public string MoonTexture 423 public string MoonTexture
504 { 424 {
505 get 425 get { return moonTexture; }
506 { 426 set { moonTexture = value; }
507 return this.moonTexture;
508 }
509 set
510 {
511 this.moonTexture = value;
512 }
513 } // MoonTexture 427 } // MoonTexture
514 428
515 public string Firstname 429 public string Firstname
516 { 430 {
517 get 431 get { return firstname; }
518 { 432 set { firstname = value; }
519 return this.firstname;
520 }
521 set
522 {
523 this.firstname = value;
524 }
525 } // Firstname 433 } // Firstname
526 434
527 public string Lastname 435 public string Lastname
528 { 436 {
529 get 437 get { return lastname; }
530 { 438 set { lastname = value; }
531 return this.lastname;
532 }
533 set
534 {
535 this.lastname = value;
536 }
537 } // Lastname 439 } // Lastname
538 440
539 public string AgentAccess 441 public string AgentAccess
540 { 442 {
541 get 443 get { return agentAccess; }
542 { 444 set { agentAccess = value; }
543 return this.agentAccess;
544 }
545 set
546 {
547 this.agentAccess = value;
548 }
549 } 445 }
550 446
551 public string StartLocation 447 public string StartLocation
552 { 448 {
553 get 449 get { return startLocation; }
554 { 450 set { startLocation = value; }
555 return this.startLocation;
556 }
557 set
558 {
559 this.startLocation = value;
560 }
561 } // StartLocation 451 } // StartLocation
562 452
563 public string LookAt 453 public string LookAt
564 { 454 {
565 get 455 get { return lookAt; }
566 { 456 set { lookAt = value; }
567 return this.lookAt;
568 }
569 set
570 {
571 this.lookAt = value;
572 }
573 } 457 }
574 458
575 public string SeedCapability 459 public string SeedCapability
576 { 460 {
577 get 461 get { return seedCapability; }
578 { 462 set { seedCapability = value; }
579 return this.seedCapability;
580 }
581 set
582 {
583 this.seedCapability = value;
584 }
585 } // SeedCapability 463 } // SeedCapability
586 464
587 public string ErrorReason 465 public string ErrorReason
588 { 466 {
589 get 467 get { return errorReason; }
590 { 468 set { errorReason = value; }
591 return this.errorReason;
592 }
593 set
594 {
595 this.errorReason = value;
596 }
597 } // ErrorReason 469 } // ErrorReason
598 470
599 public string ErrorMessage 471 public string ErrorMessage
600 { 472 {
601 get 473 get { return errorMessage; }
602 { 474 set { errorMessage = value; }
603 return this.errorMessage;
604 }
605 set
606 {
607 this.errorMessage = value;
608 }
609 } // ErrorMessage 475 } // ErrorMessage
610 476
611 public ArrayList InventoryRoot 477 public ArrayList InventoryRoot
612 { 478 {
613 get 479 get { return inventoryRoot; }
614 { 480 set { inventoryRoot = value; }
615 return this.inventoryRoot;
616 }
617 set
618 {
619 this.inventoryRoot = value;
620 }
621 } 481 }
622 482
623 public ArrayList InventorySkeleton 483 public ArrayList InventorySkeleton
624 { 484 {
625 get 485 get { return agentInventory; }
626 { 486 set { agentInventory = value; }
627 return this.agentInventory;
628 }
629 set
630 {
631 this.agentInventory = value;
632 }
633 } 487 }
634 488
635 public ArrayList InventoryLibrary 489 public ArrayList InventoryLibrary
636 { 490 {
637 get 491 get { return inventoryLibrary; }
638 { 492 set { inventoryLibrary = value; }
639 return this.inventoryLibrary;
640 }
641 set
642 {
643 this.inventoryLibrary = value;
644 }
645 } 493 }
646 494
647 public ArrayList InventoryLibraryOwner 495 public ArrayList InventoryLibraryOwner
648 { 496 {
649 get 497 get { return inventoryLibraryOwner; }
650 { 498 set { inventoryLibraryOwner = value; }
651 return this.inventoryLibraryOwner;
652 }
653 set
654 {
655 this.inventoryLibraryOwner = value;
656 }
657 } 499 }
658 500
659 public string Home 501 public string Home
660 { 502 {
661 get 503 get { return home; }
662 { 504 set { home = value; }
663 return this.home;
664 }
665 set
666 {
667 this.home = value;
668 }
669 } 505 }
670 506
671 public string Message 507 public string Message
672 { 508 {
673 get 509 get { return welcomeMessage; }
674 { 510 set { welcomeMessage = value; }
675 return this.welcomeMessage;
676 }
677 set
678 {
679 this.welcomeMessage = value;
680 }
681 } 511 }
682 #endregion
683 512
513 #endregion
684 514
685 public class UserInfo 515 public class UserInfo
686 { 516 {
@@ -691,6 +521,4 @@ namespace OpenSim.Framework.UserManagement
691 public LLVector3 homelookat; 521 public LLVector3 homelookat;
692 } 522 }
693 } 523 }
694} 524} \ No newline at end of file
695
696
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 @@
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic;
32using System.Reflection;
33using System.Security.Cryptography;
34using libsecondlife; 31using libsecondlife;
35using Nwc.XmlRpc; 32using Nwc.XmlRpc;
36using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
37 34
38using OpenSim.Framework;
39using InventoryFolder = OpenSim.Framework.InventoryFolder;
40
41namespace OpenSim.Framework.UserManagement 35namespace OpenSim.Framework.UserManagement
42{ 36{
43 public class LoginService 37 public class LoginService
@@ -61,12 +55,12 @@ namespace OpenSim.Framework.UserManagement
61 /// <returns>The response to send</returns> 55 /// <returns>The response to send</returns>
62 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) 56 public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
63 { 57 {
64 58 MainLog.Instance.Verbose("LOGIN", "Attempting login now...");
65 MainLog.Instance.Verbose("LOGIN","Attempting login now...");
66 XmlRpcResponse response = new XmlRpcResponse(); 59 XmlRpcResponse response = new XmlRpcResponse();
67 Hashtable requestData = (Hashtable)request.Params[0]; 60 Hashtable requestData = (Hashtable) request.Params[0];
68 61
69 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); 62 bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") &&
63 requestData.Contains("passwd"));
70 bool GoodLogin = false; 64 bool GoodLogin = false;
71 65
72 UserProfileData userProfile; 66 UserProfileData userProfile;
@@ -74,9 +68,9 @@ namespace OpenSim.Framework.UserManagement
74 68
75 if (GoodXML) 69 if (GoodXML)
76 { 70 {
77 string firstname = (string)requestData["first"]; 71 string firstname = (string) requestData["first"];
78 string lastname = (string)requestData["last"]; 72 string lastname = (string) requestData["last"];
79 string passwd = (string)requestData["passwd"]; 73 string passwd = (string) requestData["passwd"];
80 74
81 userProfile = GetTheUser(firstname, lastname); 75 userProfile = GetTheUser(firstname, lastname);
82 if (userProfile == null) 76 if (userProfile == null)
@@ -110,7 +104,7 @@ namespace OpenSim.Framework.UserManagement
110 LLUUID agentID = userProfile.UUID; 104 LLUUID agentID = userProfile.UUID;
111 105
112 // Inventory Library Section 106 // Inventory Library Section
113 InventoryData inventData = this.CreateInventoryData(agentID); 107 InventoryData inventData = CreateInventoryData(agentID);
114 ArrayList AgentInventoryArray = inventData.InventoryArray; 108 ArrayList AgentInventoryArray = inventData.InventoryArray;
115 109
116 Hashtable InventoryRootHash = new Hashtable(); 110 Hashtable InventoryRootHash = new Hashtable();
@@ -120,7 +114,7 @@ namespace OpenSim.Framework.UserManagement
120 userProfile.rootInventoryFolderID = inventData.RootFolderID; 114 userProfile.rootInventoryFolderID = inventData.RootFolderID;
121 115
122 // Circuit Code 116 // Circuit Code
123 uint circode = (uint)(Util.RandomClass.Next()); 117 uint circode = (uint) (Util.RandomClass.Next());
124 118
125 logResponse.Lastname = userProfile.surname; 119 logResponse.Lastname = userProfile.surname;
126 logResponse.Firstname = userProfile.username; 120 logResponse.Firstname = userProfile.username;
@@ -129,20 +123,20 @@ namespace OpenSim.Framework.UserManagement
129 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); 123 logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated();
130 logResponse.InventoryRoot = InventoryRoot; 124 logResponse.InventoryRoot = InventoryRoot;
131 logResponse.InventorySkeleton = AgentInventoryArray; 125 logResponse.InventorySkeleton = AgentInventoryArray;
132 logResponse.InventoryLibrary = this.GetInventoryLibrary(); 126 logResponse.InventoryLibrary = GetInventoryLibrary();
133 logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); 127 logResponse.InventoryLibraryOwner = GetLibraryOwner();
134 logResponse.CircuitCode = (Int32)circode; 128 logResponse.CircuitCode = (Int32) circode;
135 //logResponse.RegionX = 0; //overwritten 129 //logResponse.RegionX = 0; //overwritten
136 //logResponse.RegionY = 0; //overwritten 130 //logResponse.RegionY = 0; //overwritten
137 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten 131 logResponse.Home = "!!null temporary value {home}!!"; // Overwritten
138 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n"; 132 //logResponse.LookAt = "\n[r" + TheUser.homeLookAt.X.ToString() + ",r" + TheUser.homeLookAt.Y.ToString() + ",r" + TheUser.homeLookAt.Z.ToString() + "]\n";
139 //logResponse.SimAddress = "127.0.0.1"; //overwritten 133 //logResponse.SimAddress = "127.0.0.1"; //overwritten
140 //logResponse.SimPort = 0; //overwritten 134 //logResponse.SimPort = 0; //overwritten
141 logResponse.Message = this.GetMessage(); 135 logResponse.Message = GetMessage();
142 136
143 try 137 try
144 { 138 {
145 this.CustomiseResponse(logResponse, userProfile); 139 CustomiseResponse(logResponse, userProfile);
146 } 140 }
147 catch (Exception e) 141 catch (Exception e)
148 { 142 {
@@ -152,7 +146,6 @@ namespace OpenSim.Framework.UserManagement
152 } 146 }
153 CommitAgent(ref userProfile); 147 CommitAgent(ref userProfile);
154 return logResponse.ToXmlRpcResponse(); 148 return logResponse.ToXmlRpcResponse();
155
156 } 149 }
157 150
158 catch (Exception E) 151 catch (Exception E)
@@ -162,7 +155,6 @@ namespace OpenSim.Framework.UserManagement
162 //} 155 //}
163 } 156 }
164 return response; 157 return response;
165
166 } 158 }
167 159
168 /// <summary> 160 /// <summary>
@@ -174,7 +166,7 @@ namespace OpenSim.Framework.UserManagement
174 { 166 {
175 } 167 }
176 168
177 /// <summary> 169 /// <summary>
178 /// Saves a target agent to the database 170 /// Saves a target agent to the database
179 /// </summary> 171 /// </summary>
180 /// <param name="profile">The users profile</param> 172 /// <param name="profile">The users profile</param>
@@ -194,8 +186,7 @@ namespace OpenSim.Framework.UserManagement
194 /// <returns>Authenticated?</returns> 186 /// <returns>Authenticated?</returns>
195 public virtual bool AuthenticateUser(UserProfileData profile, string password) 187 public virtual bool AuthenticateUser(UserProfileData profile, string password)
196 { 188 {
197 189 MainLog.Instance.Verbose("LOGIN", "Authenticating " + profile.username + " " + profile.surname);
198 MainLog.Instance.Verbose("LOGIN","Authenticating " + profile.username + " " + profile.surname);
199 190
200 password = password.Remove(0, 3); //remove $1$ 191 password = password.Remove(0, 3); //remove $1$
201 192
@@ -211,7 +202,7 @@ namespace OpenSim.Framework.UserManagement
211 /// <param name="request"></param> 202 /// <param name="request"></param>
212 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 203 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
213 { 204 {
214 this.m_userManager.CreateAgent(profile, request); 205 m_userManager.CreateAgent(profile, request);
215 } 206 }
216 207
217 /// <summary> 208 /// <summary>
@@ -222,7 +213,7 @@ namespace OpenSim.Framework.UserManagement
222 /// <returns></returns> 213 /// <returns></returns>
223 public virtual UserProfileData GetTheUser(string firstname, string lastname) 214 public virtual UserProfileData GetTheUser(string firstname, string lastname)
224 { 215 {
225 return this.m_userManager.GetUserProfile(firstname, lastname); 216 return m_userManager.GetUserProfile(firstname, lastname);
226 } 217 }
227 218
228 /// <summary> 219 /// <summary>
@@ -286,8 +277,8 @@ namespace OpenSim.Framework.UserManagement
286 TempHash = new Hashtable(); 277 TempHash = new Hashtable();
287 TempHash["name"] = InvFolder.FolderName; 278 TempHash["name"] = InvFolder.FolderName;
288 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); 279 TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
289 TempHash["version"] = (Int32)InvFolder.Version; 280 TempHash["version"] = (Int32) InvFolder.Version;
290 TempHash["type_default"] = (Int32)InvFolder.DefaultType; 281 TempHash["type_default"] = (Int32) InvFolder.DefaultType;
291 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); 282 TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated();
292 AgentInventoryArray.Add(TempHash); 283 AgentInventoryArray.Add(TempHash);
293 } 284 }
@@ -307,4 +298,4 @@ namespace OpenSim.Framework.UserManagement
307 } 298 }
308 } 299 }
309 } 300 }
310} 301} \ 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 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -27,25 +27,29 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// General Information about an assembly is controlled through the following 31// General Information about an assembly is controlled through the following
31// set of attributes. Change these attribute values to modify the information 32// set of attributes. Change these attribute values to modify the information
32// associated with an assembly. 33// associated with an assembly.
33[assembly: AssemblyTitle("OpenGrid.Framework.Communications")] 34
34[assembly: AssemblyDescription("")] 35[assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
35[assembly: AssemblyConfiguration("")] 36[assembly : AssemblyDescription("")]
36[assembly: AssemblyCompany("")] 37[assembly : AssemblyConfiguration("")]
37[assembly: AssemblyProduct("OpenGrid.Framework.Communications")] 38[assembly : AssemblyCompany("")]
38[assembly: AssemblyCopyright("Copyright © 2007")] 39[assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
39[assembly: AssemblyTrademark("")] 40[assembly : AssemblyCopyright("Copyright © 2007")]
40[assembly: AssemblyCulture("")] 41[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")]
41 43
42// Setting ComVisible to false makes the types in this assembly not visible 44// Setting ComVisible to false makes the types in this assembly not visible
43// to COM components. If you need to access a type in this assembly from 45// to COM components. If you need to access a type in this assembly from
44// COM, set the ComVisible attribute to true on that type. 46// COM, set the ComVisible attribute to true on that type.
45[assembly: ComVisible(false)] 47
48[assembly : ComVisible(false)]
46 49
47// The following GUID is for the ID of the typelib if this project is exposed to COM 50// The following GUID is for the ID of the typelib if this project is exposed to COM
48[assembly: Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] 51
52[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
49 53
50// Version information for an assembly consists of the following four values: 54// Version information for an assembly consists of the following four values:
51// 55//
@@ -56,5 +60,6 @@ using System.Runtime.InteropServices;
56// 60//
57// You can specify all the values or you can default the Revision and Build Numbers 61// You can specify all the values or you can default the Revision and Build Numbers
58// by using the '*' as shown below: 62// by using the '*' as shown below:
59[assembly: AssemblyVersion("1.0.0.0")] 63
60[assembly: AssemblyFileVersion("1.0.0.0")] 64[assembly : AssemblyVersion("1.0.0.0")]
65[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 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading; 2using System.Threading;
5 3
6namespace OpenSim.Framework.Communications 4namespace OpenSim.Framework.Communications
7{ 5{
8 internal class SimpleAsyncResult : IAsyncResult 6 internal class SimpleAsyncResult : IAsyncResult
9 { 7 {
10
11 private readonly AsyncCallback m_callback; 8 private readonly AsyncCallback m_callback;
12 9
13 /// <summary> 10 /// <summary>
@@ -36,7 +33,6 @@ namespace OpenSim.Framework.Communications
36 m_completedSynchronously = 1; 33 m_completedSynchronously = 1;
37 } 34 }
38 35
39
40 #region IAsyncResult Members 36 #region IAsyncResult Members
41 37
42 public object AsyncState 38 public object AsyncState
@@ -45,7 +41,6 @@ namespace OpenSim.Framework.Communications
45 } 41 }
46 42
47 43
48
49 public WaitHandle AsyncWaitHandle 44 public WaitHandle AsyncWaitHandle
50 { 45 {
51 get 46 get
@@ -82,19 +77,18 @@ namespace OpenSim.Framework.Communications
82 get { return Thread.VolatileRead(ref m_completed) == 1; } 77 get { return Thread.VolatileRead(ref m_completed) == 1; }
83 } 78 }
84 79
85
86 #endregion 80 #endregion
87 81
88
89 #region class Methods 82 #region class Methods
83
90 internal void SetAsCompleted(bool completedSynchronously) 84 internal void SetAsCompleted(bool completedSynchronously)
91 { 85 {
92 m_completed = 1; 86 m_completed = 1;
93 if(completedSynchronously) 87 if (completedSynchronously)
94 m_completedSynchronously = 1; 88 m_completedSynchronously = 1;
95 else 89 else
96 m_completedSynchronously = 0; 90 m_completedSynchronously = 0;
97 91
98 SignalCompletion(); 92 SignalCompletion();
99 } 93 }
100 94
@@ -112,9 +106,9 @@ namespace OpenSim.Framework.Communications
112 106
113 private void SignalCompletion() 107 private void SignalCompletion()
114 { 108 {
115 if(m_waitHandle != null) m_waitHandle.Set(); 109 if (m_waitHandle != null) m_waitHandle.Set();
116 110
117 if(m_callback != null) m_callback(this); 111 if (m_callback != null) m_callback(this);
118 } 112 }
119 113
120 public void EndInvoke() 114 public void EndInvoke()
@@ -125,14 +119,14 @@ namespace OpenSim.Framework.Communications
125 // If the operation isn't done, wait for it 119 // If the operation isn't done, wait for it
126 AsyncWaitHandle.WaitOne(); 120 AsyncWaitHandle.WaitOne();
127 AsyncWaitHandle.Close(); 121 AsyncWaitHandle.Close();
128 m_waitHandle = null; // Allow early GC 122 m_waitHandle = null; // Allow early GC
129 } 123 }
130 124
131 // Operation is done: if an exception occured, throw it 125 // Operation is done: if an exception occured, throw it
132 if (m_exception != null) throw m_exception; 126 if (m_exception != null) throw m_exception;
133 } 127 }
134 128
135 #endregion 129 #endregion
136 } 130 }
137 131
138 internal class AsyncResult<T> : SimpleAsyncResult 132 internal class AsyncResult<T> : SimpleAsyncResult
@@ -140,10 +134,12 @@ namespace OpenSim.Framework.Communications
140 private T m_result = default(T); 134 private T m_result = default(T);
141 135
142 public AsyncResult(AsyncCallback asyncCallback, Object state) : 136 public AsyncResult(AsyncCallback asyncCallback, Object state) :
143 base(asyncCallback, state) { } 137 base(asyncCallback, state)
138 {
139 }
144 140
145 141
146 public void SetAsCompleted(T result, bool completedSynchronously) 142 public void SetAsCompleted(T result, bool completedSynchronously)
147 { 143 {
148 // Save the asynchronous operation's result 144 // Save the asynchronous operation's result
149 m_result = result; 145 m_result = result;
@@ -153,11 +149,10 @@ namespace OpenSim.Framework.Communications
153 base.SetAsCompleted(completedSynchronously); 149 base.SetAsCompleted(completedSynchronously);
154 } 150 }
155 151
156 new public T EndInvoke() 152 public new T EndInvoke()
157 { 153 {
158 base.EndInvoke(); 154 base.EndInvoke();
159 return m_result; 155 return m_result;
160 } 156 }
161
162 } 157 }
163} 158} \ 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 @@
1using System; 1using System;
2using System.Collections.Generic;
2using System.IO; 3using System.IO;
3using System.Net; 4using System.Net;
4using System.Web;
5using System.Text; 5using System.Text;
6using System.Collections.Generic;
7using System.Threading; 6using System.Threading;
8 7using System.Web;
9using OpenSim.Framework.Console;
10 8
11namespace OpenSim.Framework.Communications 9namespace OpenSim.Framework.Communications
12{ 10{
@@ -29,9 +27,10 @@ namespace OpenSim.Framework.Communications
29 /// </remarks> 27 /// </remarks>
30 public class RestClient 28 public class RestClient
31 { 29 {
30 private string realuri;
32 31
33 string realuri;
34 #region member variables 32 #region member variables
33
35 /// <summary> 34 /// <summary>
36 /// The base Uri of the web-service e.g. http://www.google.com 35 /// The base Uri of the web-service e.g. http://www.google.com
37 /// </summary> 36 /// </summary>
@@ -60,7 +59,7 @@ namespace OpenSim.Framework.Communications
60 /// <summary> 59 /// <summary>
61 /// MemoryStream representing the resultiong resource 60 /// MemoryStream representing the resultiong resource
62 /// </summary> 61 /// </summary>
63 Stream _resource; 62 private Stream _resource;
64 63
65 /// <summary> 64 /// <summary>
66 /// WebRequest object, held as a member variable 65 /// WebRequest object, held as a member variable
@@ -80,12 +79,12 @@ namespace OpenSim.Framework.Communications
80 /// <summary> 79 /// <summary>
81 /// Default time out period 80 /// Default time out period
82 /// </summary> 81 /// </summary>
83 const int DefaultTimeout = 10 * 1000; // 10 seconds timeout 82 private const int DefaultTimeout = 10*1000; // 10 seconds timeout
84 83
85 /// <summary> 84 /// <summary>
86 /// Default Buffer size of a block requested from the web-server 85 /// Default Buffer size of a block requested from the web-server
87 /// </summary> 86 /// </summary>
88 const int BufferSize = 4096; // Read blocks of 4 KB. 87 private const int BufferSize = 4096; // Read blocks of 4 KB.
89 88
90 89
91 /// <summary> 90 /// <summary>
@@ -97,6 +96,7 @@ namespace OpenSim.Framework.Communications
97 #endregion member variables 96 #endregion member variables
98 97
99 #region constructors 98 #region constructors
99
100 /// <summary> 100 /// <summary>
101 /// Instantiate a new RestClient 101 /// Instantiate a new RestClient
102 /// </summary> 102 /// </summary>
@@ -111,7 +111,8 @@ namespace OpenSim.Framework.Communications
111 _lock = new object(); 111 _lock = new object();
112 } 112 }
113 113
114 object _lock; 114 private object _lock;
115
115 #endregion constructors 116 #endregion constructors
116 117
117 /// <summary> 118 /// <summary>
@@ -120,8 +121,8 @@ namespace OpenSim.Framework.Communications
120 /// <param name="element">path entry</param> 121 /// <param name="element">path entry</param>
121 public void AddResourcePath(string element) 122 public void AddResourcePath(string element)
122 { 123 {
123 if(isSlashed(element)) 124 if (isSlashed(element))
124 _pathElements.Add(element.Substring(0, element.Length-1)); 125 _pathElements.Add(element.Substring(0, element.Length - 1));
125 else 126 else
126 _pathElements.Add(element); 127 _pathElements.Add(element);
127 } 128 }
@@ -178,7 +179,7 @@ namespace OpenSim.Framework.Communications
178 /// Build a Uri based on the intial Url, path elements and parameters 179 /// Build a Uri based on the intial Url, path elements and parameters
179 /// </summary> 180 /// </summary>
180 /// <returns>fully constructed Uri</returns> 181 /// <returns>fully constructed Uri</returns>
181 Uri buildUri() 182 private Uri buildUri()
182 { 183 {
183 StringBuilder sb = new StringBuilder(); 184 StringBuilder sb = new StringBuilder();
184 sb.Append(_url); 185 sb.Append(_url);
@@ -196,7 +197,8 @@ namespace OpenSim.Framework.Communications
196 { 197 {
197 sb.Append("?"); 198 sb.Append("?");
198 firstElement = false; 199 firstElement = false;
199 } else 200 }
201 else
200 sb.Append("&"); 202 sb.Append("&");
201 203
202 sb.Append(kv.Key); 204 sb.Append(kv.Key);
@@ -209,7 +211,9 @@ namespace OpenSim.Framework.Communications
209 realuri = sb.ToString(); 211 realuri = sb.ToString();
210 return new Uri(sb.ToString()); 212 return new Uri(sb.ToString());
211 } 213 }
214
212 #region Async communications with server 215 #region Async communications with server
216
213 /// <summary> 217 /// <summary>
214 /// Async method, invoked when a block of data has been received from the service 218 /// Async method, invoked when a block of data has been received from the service
215 /// </summary> 219 /// </summary>
@@ -218,13 +222,14 @@ namespace OpenSim.Framework.Communications
218 { 222 {
219 try 223 try
220 { 224 {
221 Stream s = (Stream)ar.AsyncState; 225 Stream s = (Stream) ar.AsyncState;
222 int read = s.EndRead(ar); 226 int read = s.EndRead(ar);
223 227
224 if (read > 0) 228 if (read > 0)
225 { 229 {
226 _resource.Write(_readbuf, 0, read); 230 _resource.Write(_readbuf, 0, read);
227 IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); 231 IAsyncResult asynchronousResult =
232 s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
228 233
229 // TODO! Implement timeout, without killing the server 234 // TODO! Implement timeout, without killing the server
230 //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); 235 //ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
@@ -251,12 +256,13 @@ namespace OpenSim.Framework.Communications
251 try 256 try
252 { 257 {
253 // grab response 258 // grab response
254 WebRequest wr = (WebRequest)ar.AsyncState; 259 WebRequest wr = (WebRequest) ar.AsyncState;
255 _response = (HttpWebResponse)wr.EndGetResponse(ar); 260 _response = (HttpWebResponse) wr.EndGetResponse(ar);
256 261
257 // get response stream, and setup async reading 262 // get response stream, and setup async reading
258 Stream s = _response.GetResponseStream(); 263 Stream s = _response.GetResponseStream();
259 IAsyncResult asynchronousResult = s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s); 264 IAsyncResult asynchronousResult =
265 s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
260 266
261 // TODO! Implement timeout, without killing the server 267 // TODO! Implement timeout, without killing the server
262 // wait until completed, or we timed out 268 // wait until completed, or we timed out
@@ -281,6 +287,7 @@ namespace OpenSim.Framework.Communications
281 } 287 }
282 } 288 }
283 } 289 }
290
284 #endregion Async communications with server 291 #endregion Async communications with server
285 292
286 /// <summary> 293 /// <summary>
@@ -290,17 +297,17 @@ namespace OpenSim.Framework.Communications
290 { 297 {
291 lock (_lock) 298 lock (_lock)
292 { 299 {
293 _request = (HttpWebRequest)WebRequest.Create(buildUri()); 300 _request = (HttpWebRequest) WebRequest.Create(buildUri());
294 _request.KeepAlive = false; 301 _request.KeepAlive = false;
295 _request.ContentType = "application/xml"; 302 _request.ContentType = "application/xml";
296 _request.Timeout = 200000; 303 _request.Timeout = 200000;
297 _asyncException = null; 304 _asyncException = null;
298 305
299// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 306// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
300 _response = (HttpWebResponse)_request.GetResponse(); 307 _response = (HttpWebResponse) _request.GetResponse();
301 Stream src = _response.GetResponseStream(); 308 Stream src = _response.GetResponseStream();
302 int length = src.Read(_readbuf, 0, BufferSize); 309 int length = src.Read(_readbuf, 0, BufferSize);
303 while(length > 0) 310 while (length > 0)
304 { 311 {
305 _resource.Write(_readbuf, 0, length); 312 _resource.Write(_readbuf, 0, length);
306 length = src.Read(_readbuf, 0, BufferSize); 313 length = src.Read(_readbuf, 0, BufferSize);
@@ -329,7 +336,7 @@ namespace OpenSim.Framework.Communications
329 336
330 public Stream Request(Stream src) 337 public Stream Request(Stream src)
331 { 338 {
332 _request = (HttpWebRequest)WebRequest.Create(buildUri()); 339 _request = (HttpWebRequest) WebRequest.Create(buildUri());
333 _request.KeepAlive = false; 340 _request.KeepAlive = false;
334 _request.ContentType = "application/xml"; 341 _request.ContentType = "application/xml";
335 _request.Timeout = 900000; 342 _request.Timeout = 900000;
@@ -340,13 +347,13 @@ namespace OpenSim.Framework.Communications
340 src.Seek(0, SeekOrigin.Begin); 347 src.Seek(0, SeekOrigin.Begin);
341 Stream dst = _request.GetRequestStream(); 348 Stream dst = _request.GetRequestStream();
342 byte[] buf = new byte[1024]; 349 byte[] buf = new byte[1024];
343 int length = src.Read(buf,0, 1024); 350 int length = src.Read(buf, 0, 1024);
344 while (length > 0) 351 while (length > 0)
345 { 352 {
346 dst.Write(buf, 0, length); 353 dst.Write(buf, 0, length);
347 length = src.Read(buf, 0, 1024); 354 length = src.Read(buf, 0, 1024);
348 } 355 }
349 _response = (HttpWebResponse)_request.GetResponse(); 356 _response = (HttpWebResponse) _request.GetResponse();
350 357
351// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); 358// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
352 359
@@ -357,8 +364,8 @@ namespace OpenSim.Framework.Communications
357 return null; 364 return null;
358 } 365 }
359 366
360
361 #region Async Invocation 367 #region Async Invocation
368
362 public IAsyncResult BeginRequest(AsyncCallback callback, object state) 369 public IAsyncResult BeginRequest(AsyncCallback callback, object state)
363 { 370 {
364 /// <summary> 371 /// <summary>
@@ -371,7 +378,7 @@ namespace OpenSim.Framework.Communications
371 378
372 public Stream EndRequest(IAsyncResult asyncResult) 379 public Stream EndRequest(IAsyncResult asyncResult)
373 { 380 {
374 AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; 381 AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
375 382
376 // Wait for operation to complete, then return result or 383 // Wait for operation to complete, then return result or
377 // throw exception 384 // throw exception
@@ -381,7 +388,7 @@ namespace OpenSim.Framework.Communications
381 private void RequestHelper(Object asyncResult) 388 private void RequestHelper(Object asyncResult)
382 { 389 {
383 // We know that it's really an AsyncResult<DateTime> object 390 // We know that it's really an AsyncResult<DateTime> object
384 AsyncResult<Stream> ar = (AsyncResult<Stream>)asyncResult; 391 AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
385 try 392 try
386 { 393 {
387 // Perform the operation; if sucessful set the result 394 // Perform the operation; if sucessful set the result
@@ -394,6 +401,7 @@ namespace OpenSim.Framework.Communications
394 ar.HandleException(e, false); 401 ar.HandleException(e, false);
395 } 402 }
396 } 403 }
404
397 #endregion Async Invocation 405 #endregion Async Invocation
398 } 406 }
399} 407} \ 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;
33using System.Security.Cryptography; 33using System.Security.Cryptography;
34using libsecondlife; 34using libsecondlife;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework;
37using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
38using OpenSim.Framework.Data;
39using OpenSim.Framework.Interfaces; 37using OpenSim.Framework.Interfaces;
40 38
41
42namespace OpenSim.Framework.UserManagement 39namespace OpenSim.Framework.UserManagement
43{ 40{
44 public abstract class UserManagerBase : IUserService 41 public abstract class UserManagerBase : IUserService
45 { 42 {
46 public UserConfig _config; 43 public UserConfig _config;
47 Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 44 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
48 45
49 /// <summary> 46 /// <summary>
50 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 47 /// 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
78 public void AddPlugin(IUserData plug) 75 public void AddPlugin(IUserData plug)
79 { 76 {
80 plug.Initialise(); 77 plug.Initialise();
81 this._plugins.Add(plug.getName(), plug); 78 _plugins.Add(plug.getName(), plug);
82 MainLog.Instance.Verbose( "Userstorage: Added IUserData Interface"); 79 MainLog.Instance.Verbose("Userstorage: Added IUserData Interface");
83 } 80 }
84 81
85 #region Get UserProfile 82 #region Get UserProfile
83
86 /// <summary> 84 /// <summary>
87 /// Loads a user profile from a database by UUID 85 /// Loads a user profile from a database by UUID
88 /// </summary> 86 /// </summary>
@@ -100,7 +98,7 @@ namespace OpenSim.Framework.UserManagement
100 } 98 }
101 catch (Exception e) 99 catch (Exception e)
102 { 100 {
103 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 101 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
104 } 102 }
105 } 103 }
106 104
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.UserManagement
126 catch (Exception e) 124 catch (Exception e)
127 { 125 {
128 System.Console.WriteLine("EEK!"); 126 System.Console.WriteLine("EEK!");
129 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 127 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
130 } 128 }
131 } 129 }
132 130
@@ -145,7 +143,7 @@ namespace OpenSim.Framework.UserManagement
145 { 143 {
146 try 144 try
147 { 145 {
148 UserProfileData profile = plugin.Value.GetUserByName(fname,lname); 146 UserProfileData profile = plugin.Value.GetUserByName(fname, lname);
149 147
150 profile.currentAgent = getUserAgent(profile.UUID); 148 profile.currentAgent = getUserAgent(profile.UUID);
151 149
@@ -153,7 +151,7 @@ namespace OpenSim.Framework.UserManagement
153 } 151 }
154 catch (Exception e) 152 catch (Exception e)
155 { 153 {
156 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 154 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
157 } 155 }
158 } 156 }
159 157
@@ -170,20 +168,24 @@ namespace OpenSim.Framework.UserManagement
170 { 168 {
171 foreach (KeyValuePair<string, IUserData> plugin in _plugins) 169 foreach (KeyValuePair<string, IUserData> plugin in _plugins)
172 { 170 {
173 try { 171 try
172 {
174 plugin.Value.UpdateUserProfile(data); 173 plugin.Value.UpdateUserProfile(data);
175 return true; 174 return true;
176 } catch (Exception e) { 175 }
177 MainLog.Instance.Verbose( "Unable to set user via " + plugin.Key + "(" + e.ToString() + ")"); 176 catch (Exception e)
177 {
178 MainLog.Instance.Verbose("Unable to set user via " + plugin.Key + "(" + e.ToString() + ")");
178 } 179 }
179 } 180 }
180 181
181 return false; 182 return false;
182 } 183 }
183 184
184 #endregion 185 #endregion
185 186
186 #region Get UserAgent 187 #region Get UserAgent
188
187 /// <summary> 189 /// <summary>
188 /// Loads a user agent by uuid (not called directly) 190 /// Loads a user agent by uuid (not called directly)
189 /// </summary> 191 /// </summary>
@@ -199,7 +201,7 @@ namespace OpenSim.Framework.UserManagement
199 } 201 }
200 catch (Exception e) 202 catch (Exception e)
201 { 203 {
202 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 204 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
203 } 205 }
204 } 206 }
205 207
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.UserManagement
221 } 223 }
222 catch (Exception e) 224 catch (Exception e)
223 { 225 {
224 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 226 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
225 } 227 }
226 } 228 }
227 229
@@ -249,11 +251,11 @@ namespace OpenSim.Framework.UserManagement
249 { 251 {
250 try 252 try
251 { 253 {
252 return plugin.Value.GetAgentByName(fname,lname); 254 return plugin.Value.GetAgentByName(fname, lname);
253 } 255 }
254 catch (Exception e) 256 catch (Exception e)
255 { 257 {
256 MainLog.Instance.Verbose( "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); 258 MainLog.Instance.Verbose("Unable to find user via " + plugin.Key + "(" + e.ToString() + ")");
257 } 259 }
258 } 260 }
259 261
@@ -263,6 +265,7 @@ namespace OpenSim.Framework.UserManagement
263 #endregion 265 #endregion
264 266
265 #region CreateAgent 267 #region CreateAgent
268
266 /// <summary> 269 /// <summary>
267 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB 270 /// Creates and initialises a new user agent - make sure to use CommitAgent when done to submit to the DB
268 /// </summary> 271 /// </summary>
@@ -270,7 +273,7 @@ namespace OpenSim.Framework.UserManagement
270 /// <param name="request">The users loginrequest</param> 273 /// <param name="request">The users loginrequest</param>
271 public void CreateAgent(UserProfileData profile, XmlRpcRequest request) 274 public void CreateAgent(UserProfileData profile, XmlRpcRequest request)
272 { 275 {
273 Hashtable requestData = (Hashtable)request.Params[0]; 276 Hashtable requestData = (Hashtable) request.Params[0];
274 277
275 UserAgentData agent = new UserAgentData(); 278 UserAgentData agent = new UserAgentData();
276 279
@@ -297,7 +300,7 @@ namespace OpenSim.Framework.UserManagement
297 // If user specified additional start, use that 300 // If user specified additional start, use that
298 if (requestData.ContainsKey("start")) 301 if (requestData.ContainsKey("start"))
299 { 302 {
300 string startLoc = ((string)requestData["start"]).Trim(); 303 string startLoc = ((string) requestData["start"]).Trim();
301 if (!(startLoc == "last" || startLoc == "home")) 304 if (!(startLoc == "last" || startLoc == "home"))
302 { 305 {
303 // Format: uri:Ahern&162&213&34 306 // Format: uri:Ahern&162&213&34
@@ -312,7 +315,6 @@ namespace OpenSim.Framework.UserManagement
312 } 315 }
313 catch (Exception) 316 catch (Exception)
314 { 317 {
315
316 } 318 }
317 } 319 }
318 } 320 }
@@ -323,7 +325,7 @@ namespace OpenSim.Framework.UserManagement
323 325
324 // Current location 326 // Current location
325 agent.regionID = new LLUUID(); // Fill in later 327 agent.regionID = new LLUUID(); // Fill in later
326 agent.currentRegion = new LLUUID(); // Fill in later 328 agent.currentRegion = new LLUUID(); // Fill in later
327 329
328 profile.currentAgent = agent; 330 profile.currentAgent = agent;
329 } 331 }
@@ -364,7 +366,6 @@ namespace OpenSim.Framework.UserManagement
364 try 366 try
365 { 367 {
366 plugin.Value.AddNewUserProfile(user); 368 plugin.Value.AddNewUserProfile(user);
367
368 } 369 }
369 catch (Exception e) 370 catch (Exception e)
370 { 371 {
@@ -376,4 +377,4 @@ namespace OpenSim.Framework.UserManagement
376 public abstract UserProfileData SetupMasterUser(string firstName, string lastName); 377 public abstract UserProfileData SetupMasterUser(string firstName, string lastName);
377 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password); 378 public abstract UserProfileData SetupMasterUser(string firstName, string lastName, string password);
378 } 379 }
379} 380} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Net;
32using System.IO; 29using System.IO;
30using System.Net;
33using System.Text; 31using System.Text;
34 32using OpenSim.Framework.Console;
35using OpenSim.Framework;
36 33
37namespace OpenSim.Framework.Configuration.HTTP 34namespace OpenSim.Framework.Configuration.HTTP
38{ 35{
39 public class HTTPConfiguration : IGenericConfig 36 public class HTTPConfiguration : IGenericConfig
40 { 37 {
41 RemoteConfigSettings remoteConfigSettings; 38 private RemoteConfigSettings remoteConfigSettings;
42 39
43 XmlConfiguration xmlConfig; 40 private XmlConfiguration xmlConfig;
44 41
45 private string configFileName = ""; 42 private string configFileName = "";
46 43
@@ -62,8 +59,9 @@ namespace OpenSim.Framework.Configuration.HTTP
62 StringBuilder sb = new StringBuilder(); 59 StringBuilder sb = new StringBuilder();
63 60
64 byte[] buf = new byte[8192]; 61 byte[] buf = new byte[8192];
65 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.remoteConfigSettings.baseConfigURL + this.configFileName); 62 HttpWebRequest request =
66 HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 63 (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
64 HttpWebResponse response = (HttpWebResponse) request.GetResponse();
67 65
68 Stream resStream = response.GetResponseStream(); 66 Stream resStream = response.GetResponseStream();
69 67
@@ -78,13 +76,14 @@ namespace OpenSim.Framework.Configuration.HTTP
78 tempString = Encoding.ASCII.GetString(buf, 0, count); 76 tempString = Encoding.ASCII.GetString(buf, 0, count);
79 sb.Append(tempString); 77 sb.Append(tempString);
80 } 78 }
81 } 79 } while (count > 0);
82 while (count > 0);
83 LoadDataFromString(sb.ToString()); 80 LoadDataFromString(sb.ToString());
84 } 81 }
85 catch (WebException) 82 catch (WebException)
86 { 83 {
87 Console.MainLog.Instance.Warn("Unable to connect to remote configuration file (" + remoteConfigSettings.baseConfigURL + configFileName + "). Creating local file instead."); 84 MainLog.Instance.Warn("Unable to connect to remote configuration file (" +
85 remoteConfigSettings.baseConfigURL + configFileName +
86 "). Creating local file instead.");
88 xmlConfig.SetFileName(configFileName); 87 xmlConfig.SetFileName(configFileName);
89 xmlConfig.LoadData(); 88 xmlConfig.LoadData();
90 } 89 }
@@ -93,7 +92,6 @@ namespace OpenSim.Framework.Configuration.HTTP
93 public void LoadDataFromString(string data) 92 public void LoadDataFromString(string data)
94 { 93 {
95 xmlConfig.LoadDataFromString(data); 94 xmlConfig.LoadDataFromString(data);
96
97 } 95 }
98 96
99 public string GetAttribute(string attributeName) 97 public string GetAttribute(string attributeName)
@@ -114,4 +112,4 @@ namespace OpenSim.Framework.Configuration.HTTP
114 { 112 {
115 } 113 }
116 } 114 }
117} 115} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33using OpenSim.Framework;
34
35namespace OpenSim.Framework.Configuration.HTTP 29namespace OpenSim.Framework.Configuration.HTTP
36{ 30{
37 public class RemoteConfigSettings 31 public class RemoteConfigSettings
@@ -39,24 +33,30 @@ namespace OpenSim.Framework.Configuration.HTTP
39 private ConfigurationMember configMember; 33 private ConfigurationMember configMember;
40 34
41 public string baseConfigURL = ""; 35 public string baseConfigURL = "";
36
42 public RemoteConfigSettings(string filename) 37 public RemoteConfigSettings(string filename)
43 { 38 {
44 configMember = new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions, handleIncomingConfiguration); 39 configMember =
40 new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
41 handleIncomingConfiguration);
45 configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll"); 42 configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
46 configMember.performConfigurationRetrieve(); 43 configMember.performConfigurationRetrieve();
47 } 44 }
48 45
49 public void loadConfigurationOptions() 46 public void loadConfigurationOptions()
50 { 47 {
51 configMember.addConfigurationOption("base_config_url", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "URL Containing Configuration Files", "http://localhost/", false); 48 configMember.addConfigurationOption("base_config_url",
49 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
50 "URL Containing Configuration Files", "http://localhost/", false);
52 } 51 }
52
53 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 53 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
54 { 54 {
55 if (configuration_key == "base_config_url") 55 if (configuration_key == "base_config_url")
56 { 56 {
57 baseConfigURL = (string)configuration_result; 57 baseConfigURL = (string) configuration_result;
58 } 58 }
59 return true; 59 return true;
60 } 60 }
61 } 61 }
62} 62} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.IO; 30using System.IO;
30using System.Xml; 31using System.Xml;
31 32
32using OpenSim.Framework;
33
34namespace OpenSim.Framework.Configuration 33namespace OpenSim.Framework.Configuration
35{ 34{
36 public class XmlConfiguration : IGenericConfig 35 public class XmlConfiguration : IGenericConfig
@@ -56,6 +55,7 @@ namespace OpenSim.Framework.Configuration
56 if (configNode.Name != "Config") 55 if (configNode.Name != "Config")
57 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>"); 56 throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
58 } 57 }
58
59 public void LoadData() 59 public void LoadData()
60 { 60 {
61 lock (this) 61 lock (this)
@@ -81,7 +81,7 @@ namespace OpenSim.Framework.Configuration
81 81
82 if (createdFile) 82 if (createdFile)
83 { 83 {
84 this.Commit(); 84 Commit();
85 } 85 }
86 } 86 }
87 } 87 }
@@ -93,12 +93,13 @@ namespace OpenSim.Framework.Configuration
93 93
94 LoadDataToClass(); 94 LoadDataToClass();
95 } 95 }
96
96 public string GetAttribute(string attributeName) 97 public string GetAttribute(string attributeName)
97 { 98 {
98 string result = null; 99 string result = null;
99 if (configNode.Attributes[attributeName] != null) 100 if (configNode.Attributes[attributeName] != null)
100 { 101 {
101 result = ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value; 102 result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value;
102 } 103 }
103 return result; 104 return result;
104 } 105 }
@@ -107,7 +108,7 @@ namespace OpenSim.Framework.Configuration
107 { 108 {
108 if (configNode.Attributes[attributeName] != null) 109 if (configNode.Attributes[attributeName] != null)
109 { 110 {
110 ((XmlAttribute)configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue; 111 ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
111 } 112 }
112 else 113 else
113 { 114 {
@@ -124,7 +125,7 @@ namespace OpenSim.Framework.Configuration
124 if (!Directory.Exists(Util.configDir())) 125 if (!Directory.Exists(Util.configDir()))
125 { 126 {
126 Directory.CreateDirectory(Util.configDir()); 127 Directory.CreateDirectory(Util.configDir());
127 } 128 }
128 doc.Save(fileName); 129 doc.Save(fileName);
129 } 130 }
130 131
@@ -134,6 +135,5 @@ namespace OpenSim.Framework.Configuration
134 rootNode = null; 135 rootNode = null;
135 doc = null; 136 doc = null;
136 } 137 }
137
138 } 138 }
139} 139} \ 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 @@
27*/ 27*/
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30
30// Information about this assembly is defined by the following 31// Information about this assembly is defined by the following
31// attributes. 32// attributes.
32// 33//
33// change them to the information which is associated with the assembly 34// change them to the information which is associated with the assembly
34// you compile. 35// you compile.
35 36
36[assembly: AssemblyTitle("ServerConsole")] 37[assembly : AssemblyTitle("ServerConsole")]
37[assembly: AssemblyDescription("")] 38[assembly : AssemblyDescription("")]
38[assembly: AssemblyConfiguration("")] 39[assembly : AssemblyConfiguration("")]
39[assembly: AssemblyCompany("")] 40[assembly : AssemblyCompany("")]
40[assembly: AssemblyProduct("ServerConsole")] 41[assembly : AssemblyProduct("ServerConsole")]
41[assembly: AssemblyCopyright("")] 42[assembly : AssemblyCopyright("")]
42[assembly: AssemblyTrademark("")] 43[assembly : AssemblyTrademark("")]
43[assembly: AssemblyCulture("")] 44[assembly : AssemblyCulture("")]
44 45
45// This sets the default COM visibility of types in the assembly to invisible. 46// This sets the default COM visibility of types in the assembly to invisible.
46// If you need to expose a type to COM, use [ComVisible(true)] on that type. 47// If you need to expose a type to COM, use [ComVisible(true)] on that type.
47[assembly: ComVisible(false)] 48
49[assembly : ComVisible(false)]
48 50
49// The assembly version has following format : 51// The assembly version has following format :
50// 52//
@@ -53,4 +55,4 @@ using System.Runtime.InteropServices;
53// You can specify all values by your own or you can build default build and revision 55// You can specify all values by your own or you can build default build and revision
54// numbers with the '*' character (the default): 56// numbers with the '*' character (the default):
55 57
56[assembly: AssemblyVersion("1.0.*")] 58[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 @@
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Console 28namespace OpenSim.Framework.Console
29{ 29{
30 public interface conscmd_callback 30 public interface conscmd_callback
31 { 31 {
32 void RunCmd(string cmd, string[] cmdparams); 32 void RunCmd(string cmd, string[] cmdparams);
33 void Show(string ShowWhat); 33 void Show(string ShowWhat);
34 } 34 }
35} 35} \ 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic;
30using System.Diagnostics;
29using System.IO; 31using System.IO;
30using System.Net; 32using System.Net;
31using System.Diagnostics;
32using System.Collections.Generic;
33 33
34namespace OpenSim.Framework.Console 34namespace OpenSim.Framework.Console
35{ 35{
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Console
48 { 48 {
49 private object m_syncRoot = new object(); 49 private object m_syncRoot = new object();
50 50
51 StreamWriter Log; 51 private StreamWriter Log;
52 public conscmd_callback cmdparser; 52 public conscmd_callback cmdparser;
53 public string componentname; 53 public string componentname;
54 private bool m_verbose; 54 private bool m_verbose;
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Console
57 { 57 {
58 this.componentname = componentname; 58 this.componentname = componentname;
59 this.cmdparser = cmdparser; 59 this.cmdparser = cmdparser;
60 this.m_verbose = verbose; 60 m_verbose = verbose;
61 System.Console.WriteLine("Creating new local console"); 61 System.Console.WriteLine("Creating new local console");
62 62
63 if (String.IsNullOrEmpty(LogFile)) 63 if (String.IsNullOrEmpty(LogFile))
@@ -87,8 +87,8 @@ namespace OpenSim.Framework.Console
87 /// <returns>an ansii color</returns> 87 /// <returns>an ansii color</returns>
88 private ConsoleColor DeriveColor(string input) 88 private ConsoleColor DeriveColor(string input)
89 { 89 {
90 int colIdx = (input.ToUpper().GetHashCode() % 6) + 9; 90 int colIdx = (input.ToUpper().GetHashCode()%6) + 9;
91 return (ConsoleColor)colIdx; 91 return (ConsoleColor) colIdx;
92 } 92 }
93 93
94 /// <summary> 94 /// <summary>
@@ -236,7 +236,7 @@ namespace OpenSim.Framework.Console
236 { 236 {
237 lock (m_syncRoot) 237 lock (m_syncRoot)
238 { 238 {
239 string now = System.DateTime.Now.ToString("[MM-dd hh:mm:ss] "); 239 string now = DateTime.Now.ToString("[MM-dd hh:mm:ss] ");
240 Log.Write(now); 240 Log.Write(now);
241 Log.WriteLine(format, args); 241 Log.WriteLine(format, args);
242 Log.Flush(); 242 Log.Flush();
@@ -306,7 +306,7 @@ namespace OpenSim.Framework.Console
306 public int Read() 306 public int Read()
307 { 307 {
308 int TempInt = System.Console.Read(); 308 int TempInt = System.Console.Read();
309 Log.Write((char)TempInt); 309 Log.Write((char) TempInt);
310 return TempInt; 310 return TempInt;
311 } 311 }
312 312
@@ -359,7 +359,7 @@ namespace OpenSim.Framework.Console
359 { 359 {
360 // FIXME: Needs to be better abstracted 360 // FIXME: Needs to be better abstracted
361 Log.WriteLine(prompt); 361 Log.WriteLine(prompt);
362 this.Notice(prompt); 362 Notice(prompt);
363 ConsoleColor oldfg = System.Console.ForegroundColor; 363 ConsoleColor oldfg = System.Console.ForegroundColor;
364 System.Console.ForegroundColor = System.Console.BackgroundColor; 364 System.Console.ForegroundColor = System.Console.BackgroundColor;
365 string temp = System.Console.ReadLine(); 365 string temp = System.Console.ReadLine();
@@ -370,8 +370,8 @@ namespace OpenSim.Framework.Console
370 // Displays a command prompt and waits for the user to enter a string, then returns that string 370 // Displays a command prompt and waits for the user to enter a string, then returns that string
371 public string CmdPrompt(string prompt) 371 public string CmdPrompt(string prompt)
372 { 372 {
373 this.Notice(String.Format("{0}: ", prompt)); 373 Notice(String.Format("{0}: ", prompt));
374 return this.ReadLine(); 374 return ReadLine();
375 } 375 }
376 376
377 // Displays a command prompt and returns a default value if the user simply presses enter 377 // Displays a command prompt and returns a default value if the user simply presses enter
@@ -423,8 +423,7 @@ namespace OpenSim.Framework.Console
423 423
424 public void MainLogPrompt() 424 public void MainLogPrompt()
425 { 425 {
426 426 string tempstr = CmdPrompt(componentname + "# ");
427 string tempstr = this.CmdPrompt(this.componentname + "# ");
428 MainLogRunCommand(tempstr); 427 MainLogRunCommand(tempstr);
429 } 428 }
430 429
@@ -436,7 +435,7 @@ namespace OpenSim.Framework.Console
436 Array.Reverse(tempstrarray); 435 Array.Reverse(tempstrarray);
437 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1); 436 Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
438 Array.Reverse(tempstrarray); 437 Array.Reverse(tempstrarray);
439 string[] cmdparams = (string[])tempstrarray; 438 string[] cmdparams = (string[]) tempstrarray;
440 try 439 try
441 { 440 {
442 RunCmd(cmd, cmdparams); 441 RunCmd(cmd, cmdparams);
@@ -454,7 +453,7 @@ namespace OpenSim.Framework.Console
454 string result = String.Empty; 453 string result = String.Empty;
455 454
456 string stacktrace = Environment.StackTrace; 455 string stacktrace = Environment.StackTrace;
457 List<string> lines = new List<string>(stacktrace.Split(new string[] { "at " }, StringSplitOptions.None)); 456 List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None));
458 457
459 if (lines.Count > 4) 458 if (lines.Count > 4)
460 { 459 {
@@ -481,4 +480,4 @@ namespace OpenSim.Framework.Console
481 } 480 }
482 } 481 }
483 } 482 }
484} 483} \ 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 @@
27*/ 27*/
28namespace OpenSim.Framework.Console 28namespace OpenSim.Framework.Console
29{ 29{
30 public class MainLog { 30 public class MainLog
31 31 {
32 private static LogBase instance; 32 private static LogBase instance;
33 33
34 public static LogBase Instance 34 public static LogBase Instance
35 { 35 {
36 get { return instance; } 36 get { return instance; }
37 set { instance = value; } 37 set { instance = value; }
38 } 38 }
39 } 39 }
40 40} \ No newline at end of file
41}
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
34 /// <summary> 34 /// <summary>
35 /// A grid server storage mechanism employing the DB4o database system 35 /// A grid server storage mechanism employing the DB4o database system
36 /// </summary> 36 /// </summary>
37 class DB4oGridData : IGridData 37 internal class DB4oGridData : IGridData
38 { 38 {
39 /// <summary> 39 /// <summary>
40 /// The database manager object 40 /// The database manager object
41 /// </summary> 41 /// </summary>
42 DB4oGridManager manager; 42 private DB4oGridManager manager;
43 43
44 /// <summary> 44 /// <summary>
45 /// Called when the plugin is first loaded (as constructors are not called) 45 /// Called when the plugin is first loaded (as constructors are not called)
46 /// </summary> 46 /// </summary>
47 public void Initialise() { 47 public void Initialise()
48 manager = new DB4oGridManager("gridserver.yap"); 48 {
49 manager = new DB4oGridManager("gridserver.yap");
49 } 50 }
50 51
51 /// <summary> 52 /// <summary>
@@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o
93 if (manager.simProfiles.ContainsKey(uuid)) 94 if (manager.simProfiles.ContainsKey(uuid))
94 return manager.simProfiles[uuid]; 95 return manager.simProfiles[uuid];
95 } 96 }
96 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); 97 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() +
98 "). Total Registered Regions: " + manager.simProfiles.Count);
97 } 99 }
98 100
99 /// <summary> 101 /// <summary>
@@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o
123 /// <param name="handle">The location the region is logging into (unused in Db4o)</param> 125 /// <param name="handle">The location the region is logging into (unused in Db4o)</param>
124 /// <param name="key">The shared secret</param> 126 /// <param name="key">The shared secret</param>
125 /// <returns>Authenticated?</returns> 127 /// <returns>Authenticated?</returns>
126 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { 128 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key)
129 {
127 if (manager.simProfiles[uuid].regionRecvKey == key) 130 if (manager.simProfiles[uuid].regionRecvKey == key)
128 return true; 131 return true;
129 return false; 132 return false;
@@ -160,4 +163,4 @@ namespace OpenSim.Framework.Data.DB4o
160 return null; 163 return null;
161 } 164 }
162 } 165 }
163} 166} \ 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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Db4objects.Db4o; 30using Db4objects.Db4o;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework;
33 32
34namespace OpenSim.Framework.Data.DB4o 33namespace OpenSim.Framework.Data.DB4o
35{ 34{
36 /// <summary> 35 /// <summary>
37 /// A Database manager for Db4o 36 /// A Database manager for Db4o
38 /// </summary> 37 /// </summary>
39 class DB4oGridManager 38 internal class DB4oGridManager
40 { 39 {
41 /// <summary> 40 /// <summary>
42 /// A list of the current regions connected (in-memory cache) 41 /// A list of the current regions connected (in-memory cache)
43 /// </summary> 42 /// </summary>
44 public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); 43 public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>();
44
45 /// <summary> 45 /// <summary>
46 /// Database File Name 46 /// Database File Name
47 /// </summary> 47 /// </summary>
48 string dbfl; 48 private string dbfl;
49 49
50 /// <summary> 50 /// <summary>
51 /// Creates a new grid storage manager 51 /// Creates a new grid storage manager
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
56 dbfl = db4odb; 56 dbfl = db4odb;
57 IObjectContainer database; 57 IObjectContainer database;
58 database = Db4oFactory.OpenFile(dbfl); 58 database = Db4oFactory.OpenFile(dbfl);
59 IObjectSet result = database.Get(typeof(RegionProfileData)); 59 IObjectSet result = database.Get(typeof (RegionProfileData));
60 // Loads the file into the in-memory cache 60 // Loads the file into the in-memory cache
61 foreach (RegionProfileData row in result) 61 foreach (RegionProfileData row in result)
62 { 62 {
@@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o
94 return false; 94 return false;
95 } 95 }
96 } 96 }
97
98
99 } 97 }
100 98
101 /// <summary> 99 /// <summary>
102 /// A manager for the DB4o database (user profiles) 100 /// A manager for the DB4o database (user profiles)
103 /// </summary> 101 /// </summary>
104 class DB4oUserManager 102 internal class DB4oUserManager
105 { 103 {
106 /// <summary> 104 /// <summary>
107 /// A list of the user profiles (in memory cache) 105 /// A list of the user profiles (in memory cache)
108 /// </summary> 106 /// </summary>
109 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); 107 public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>();
108
110 /// <summary> 109 /// <summary>
111 /// Database filename 110 /// Database filename
112 /// </summary> 111 /// </summary>
113 string dbfl; 112 private string dbfl;
114 113
115 /// <summary> 114 /// <summary>
116 /// Initialises a new DB manager 115 /// Initialises a new DB manager
@@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o
122 IObjectContainer database; 121 IObjectContainer database;
123 database = Db4oFactory.OpenFile(dbfl); 122 database = Db4oFactory.OpenFile(dbfl);
124 // Load to cache 123 // Load to cache
125 IObjectSet result = database.Get(typeof(UserProfileData)); 124 IObjectSet result = database.Get(typeof (UserProfileData));
126 foreach (UserProfileData row in result) 125 foreach (UserProfileData row in result)
127 { 126 {
128 if (userProfiles.ContainsKey(row.UUID)) 127 if (userProfiles.ContainsKey(row.UUID))
@@ -144,7 +143,7 @@ namespace OpenSim.Framework.Data.DB4o
144 /// <param name="record">The profile to update</param> 143 /// <param name="record">The profile to update</param>
145 /// <returns>true on success, false on fail to persist to db</returns> 144 /// <returns>true on success, false on fail to persist to db</returns>
146 public bool UpdateRecord(UserProfileData record) 145 public bool UpdateRecord(UserProfileData record)
147 { 146 {
148 if (userProfiles.ContainsKey(record.UUID)) 147 if (userProfiles.ContainsKey(record.UUID))
149 { 148 {
150 userProfiles[record.UUID] = record; 149 userProfiles[record.UUID] = record;
@@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o
168 } 167 }
169 } 168 }
170 } 169 }
171} 170} \ 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 @@
28using System; 28using System;
29using System.IO; 29using System.IO;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
32using OpenSim.Framework;
33 31
34namespace OpenSim.Framework.Data.DB4o 32namespace OpenSim.Framework.Data.DB4o
35{ 33{
@@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o
41 /// <summary> 39 /// <summary>
42 /// The database manager 40 /// The database manager
43 /// </summary> 41 /// </summary>
44 DB4oUserManager manager; 42 private DB4oUserManager manager;
45 43
46 /// <summary> 44 /// <summary>
47 /// Artificial constructor called upon plugin load 45 /// Artificial constructor called upon plugin load
48 /// </summary> 46 /// </summary>
49 public void Initialise() 47 public void Initialise()
50 { 48 {
51 manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); 49 manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap"));
52 } 50 }
53 51
54 /// <summary> 52 /// <summary>
@@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o
58 /// <returns>A user profile</returns> 56 /// <returns>A user profile</returns>
59 public UserProfileData GetUserByUUID(LLUUID uuid) 57 public UserProfileData GetUserByUUID(LLUUID uuid)
60 { 58 {
61 if(manager.userProfiles.ContainsKey(uuid)) 59 if (manager.userProfiles.ContainsKey(uuid))
62 return manager.userProfiles[uuid]; 60 return manager.userProfiles[uuid];
63 return null; 61 return null;
64 } 62 }
@@ -95,7 +93,7 @@ namespace OpenSim.Framework.Data.DB4o
95 /// <param name="uuid">The users account ID</param> 93 /// <param name="uuid">The users account ID</param>
96 /// <returns>A matching users profile</returns> 94 /// <returns>A matching users profile</returns>
97 public UserAgentData GetAgentByUUID(LLUUID uuid) 95 public UserAgentData GetAgentByUUID(LLUUID uuid)
98 { 96 {
99 try 97 try
100 { 98 {
101 return GetUserByUUID(uuid).currentAgent; 99 return GetUserByUUID(uuid).currentAgent;
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o
126 { 124 {
127 try 125 try
128 { 126 {
129 return GetUserByName(fname,lname).currentAgent; 127 return GetUserByName(fname, lname).currentAgent;
130 } 128 }
131 catch (Exception) 129 catch (Exception)
132 { 130 {
@@ -149,7 +147,7 @@ namespace OpenSim.Framework.Data.DB4o
149 Console.WriteLine(e.ToString()); 147 Console.WriteLine(e.ToString());
150 } 148 }
151 } 149 }
152 150
153 /// <summary> 151 /// <summary>
154 /// Creates a new user profile 152 /// Creates a new user profile
155 /// </summary> 153 /// </summary>
@@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o
157 /// <returns>True on success, false on error</returns> 155 /// <returns>True on success, false on error</returns>
158 public bool UpdateUserProfile(UserProfileData user) 156 public bool UpdateUserProfile(UserProfileData user)
159 { 157 {
160 try { 158 try
159 {
161 return manager.UpdateRecord(user); 160 return manager.UpdateRecord(user);
162 } catch (Exception e) { 161 }
162 catch (Exception e)
163 {
163 Console.WriteLine(e.ToString()); 164 Console.WriteLine(e.ToString());
164 return false; 165 return false;
165 } 166 }
166 } 167 }
167 168
168
169 169
170 /// <summary> 170 /// <summary>
171 /// Creates a new user agent 171 /// Creates a new user agent
@@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o
219 return "0.1"; 219 return "0.1";
220 } 220 }
221 } 221 }
222} 222} \ 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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] 24
25[assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[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
185 byte[] hash = HashProvider.ComputeHash(stream); 185 byte[] hash = HashProvider.ComputeHash(stream);
186 return false; 186 return false;
187 } 187 }
188
188 public ReservationData GetReservationAtPoint(uint x, uint y) 189 public ReservationData GetReservationAtPoint(uint x, uint y)
189 { 190 {
190 return null; 191 return null;
191 } 192 }
192 } 193 }
193 194} \ No newline at end of file
194}
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
36 /// <summary> 36 /// <summary>
37 /// A management class for the MS SQL Storage Engine 37 /// A management class for the MS SQL Storage Engine
38 /// </summary> 38 /// </summary>
39 class MSSqlManager 39 internal class MSSqlManager
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 private IDbConnection dbcon;
45 45
46 /// <summary> 46 /// <summary>
47 /// Initialises and creates a new Sql connection and maintains it. 47 /// Initialises and creates a new Sql connection and maintains it.
@@ -55,7 +55,8 @@ namespace OpenSim.Framework.Data.MSSQL
55 { 55 {
56 try 56 try
57 { 57 {
58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; 58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username +
59 ";Password=" + password + ";Pooling=" + cpooling + ";";
59 dbcon = new SqlConnection(connectionString); 60 dbcon = new SqlConnection(connectionString);
60 61
61 dbcon.Open(); 62 dbcon.Open();
@@ -83,14 +84,14 @@ namespace OpenSim.Framework.Data.MSSQL
83 /// <returns>A Sql DB Command</returns> 84 /// <returns>A Sql DB Command</returns>
84 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 85 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
85 { 86 {
86 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); 87 SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand();
87 dbcommand.CommandText = sql; 88 dbcommand.CommandText = sql;
88 foreach (KeyValuePair<string, string> param in parameters) 89 foreach (KeyValuePair<string, string> param in parameters)
89 { 90 {
90 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 91 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
91 } 92 }
92 93
93 return (IDbCommand)dbcommand; 94 return (IDbCommand) dbcommand;
94 } 95 }
95 96
96 /// <summary> 97 /// <summary>
@@ -105,42 +106,42 @@ namespace OpenSim.Framework.Data.MSSQL
105 if (reader.Read()) 106 if (reader.Read())
106 { 107 {
107 // Region Main 108 // Region Main
108 regionprofile.regionHandle = (ulong)reader["regionHandle"]; 109 regionprofile.regionHandle = (ulong) reader["regionHandle"];
109 regionprofile.regionName = (string)reader["regionName"]; 110 regionprofile.regionName = (string) reader["regionName"];
110 regionprofile.UUID = new LLUUID((string)reader["uuid"]); 111 regionprofile.UUID = new LLUUID((string) reader["uuid"]);
111 112
112 // Secrets 113 // Secrets
113 regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; 114 regionprofile.regionRecvKey = (string) reader["regionRecvKey"];
114 regionprofile.regionSecret = (string)reader["regionSecret"]; 115 regionprofile.regionSecret = (string) reader["regionSecret"];
115 regionprofile.regionSendKey = (string)reader["regionSendKey"]; 116 regionprofile.regionSendKey = (string) reader["regionSendKey"];
116 117
117 // Region Server 118 // Region Server
118 regionprofile.regionDataURI = (string)reader["regionDataURI"]; 119 regionprofile.regionDataURI = (string) reader["regionDataURI"];
119 regionprofile.regionOnline = false; // Needs to be pinged before this can be set. 120 regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
120 regionprofile.serverIP = (string)reader["serverIP"]; 121 regionprofile.serverIP = (string) reader["serverIP"];
121 regionprofile.serverPort = (uint)reader["serverPort"]; 122 regionprofile.serverPort = (uint) reader["serverPort"];
122 regionprofile.serverURI = (string)reader["serverURI"]; 123 regionprofile.serverURI = (string) reader["serverURI"];
123 124
124 // Location 125 // Location
125 regionprofile.regionLocX = (uint)((int)reader["locX"]); 126 regionprofile.regionLocX = (uint) ((int) reader["locX"]);
126 regionprofile.regionLocY = (uint)((int)reader["locY"]); 127 regionprofile.regionLocY = (uint) ((int) reader["locY"]);
127 regionprofile.regionLocZ = (uint)((int)reader["locZ"]); 128 regionprofile.regionLocZ = (uint) ((int) reader["locZ"]);
128 129
129 // Neighbours - 0 = No Override 130 // Neighbours - 0 = No Override
130 regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; 131 regionprofile.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
131 regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; 132 regionprofile.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
132 regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; 133 regionprofile.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
133 regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; 134 regionprofile.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
134 135
135 // Assets 136 // Assets
136 regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; 137 regionprofile.regionAssetURI = (string) reader["regionAssetURI"];
137 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 138 regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
138 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 139 regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"];
139 140
140 // Userserver 141 // Userserver
141 regionprofile.regionUserURI = (string)reader["regionUserURI"]; 142 regionprofile.regionUserURI = (string) reader["regionUserURI"];
142 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 143 regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"];
143 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; 144 regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"];
144 } 145 }
145 else 146 else
146 { 147 {
@@ -156,12 +157,15 @@ namespace OpenSim.Framework.Data.MSSQL
156 /// <returns>Successful?</returns> 157 /// <returns>Successful?</returns>
157 public bool insertRow(RegionProfileData profile) 158 public bool insertRow(RegionProfileData profile)
158 { 159 {
159 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 160 string sql =
160 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 161 "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
162 sql +=
163 "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
161 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; 164 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
162 165
163 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 166 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
164 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 167 sql +=
168 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
165 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; 169 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
166 170
167 Dictionary<string, string> parameters = new Dictionary<string, string>(); 171 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -208,4 +212,4 @@ namespace OpenSim.Framework.Data.MSSQL
208 return returnval; 212 return returnval;
209 } 213 }
210 } 214 }
211} 215} \ 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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.MSSQL")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.MSSQL")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] 24
25[assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[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 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using MySql.Data.MySqlClient; 31using System.Data;
32
33using libsecondlife; 32using libsecondlife;
33using MySql.Data.MySqlClient;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37 35
38namespace OpenSim.Framework.Data.MySQL 36namespace OpenSim.Framework.Data.MySQL
39{ 37{
40 class MySQLAssetData : IAssetProvider 38 internal class MySQLAssetData : IAssetProvider
41 { 39 {
42 MySQLManager _dbConnection; 40 private MySQLManager _dbConnection;
41
43 #region IAssetProvider Members 42 #region IAssetProvider Members
44 43
45 private void UpgradeAssetsTable(string oldVersion) 44 private void UpgradeAssetsTable(string oldVersion)
@@ -58,14 +57,12 @@ namespace OpenSim.Framework.Data.MySQL
58 /// </summary> 57 /// </summary>
59 private void TestTables() 58 private void TestTables()
60 { 59 {
61
62 Dictionary<string, string> tableList = new Dictionary<string, string>(); 60 Dictionary<string, string> tableList = new Dictionary<string, string>();
63 61
64 tableList["assets"] = null; 62 tableList["assets"] = null;
65 _dbConnection.GetTableVersion(tableList); 63 _dbConnection.GetTableVersion(tableList);
66 64
67 UpgradeAssetsTable(tableList["assets"]); 65 UpgradeAssetsTable(tableList["assets"]);
68
69 } 66 }
70 67
71 public AssetBase FetchAsset(LLUUID assetID) 68 public AssetBase FetchAsset(LLUUID assetID)
@@ -73,21 +70,24 @@ namespace OpenSim.Framework.Data.MySQL
73 AssetBase asset = null; 70 AssetBase asset = null;
74 lock (_dbConnection) 71 lock (_dbConnection)
75 { 72 {
76 MySqlCommand cmd = new MySqlCommand("SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id", _dbConnection.Connection); 73 MySqlCommand cmd =
74 new MySqlCommand(
75 "SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id",
76 _dbConnection.Connection);
77 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); 77 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
78 p.Value = assetID.GetBytes(); 78 p.Value = assetID.GetBytes();
79 using (MySqlDataReader dbReader = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow)) 79 using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
80 { 80 {
81 if (dbReader.Read()) 81 if (dbReader.Read())
82 { 82 {
83 asset = new AssetBase(); 83 asset = new AssetBase();
84 asset.Data = (byte[])dbReader["data"]; 84 asset.Data = (byte[]) dbReader["data"];
85 asset.Description = (string)dbReader["description"]; 85 asset.Description = (string) dbReader["description"];
86 asset.FullID = assetID; 86 asset.FullID = assetID;
87 asset.InvType = (sbyte)dbReader["invType"]; 87 asset.InvType = (sbyte) dbReader["invType"];
88 asset.Local = ((sbyte)dbReader["local"]) != 0 ? true : false; 88 asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
89 asset.Name = (string)dbReader["name"]; 89 asset.Name = (string) dbReader["name"];
90 asset.Type = (sbyte)dbReader["assetType"]; 90 asset.Type = (sbyte) dbReader["assetType"];
91 } 91 }
92 } 92 }
93 } 93 }
@@ -96,8 +96,11 @@ namespace OpenSim.Framework.Data.MySQL
96 96
97 public void CreateAsset(AssetBase asset) 97 public void CreateAsset(AssetBase asset)
98 { 98 {
99 MySqlCommand cmd = new MySqlCommand("REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + 99 MySqlCommand cmd =
100 "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", _dbConnection.Connection); 100 new MySqlCommand(
101 "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
102 "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)",
103 _dbConnection.Connection);
101 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); 104 MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
102 p.Value = asset.FullID.GetBytes(); 105 p.Value = asset.FullID.GetBytes();
103 cmd.Parameters.AddWithValue("?name", asset.Name); 106 cmd.Parameters.AddWithValue("?name", asset.Name);
@@ -148,7 +151,7 @@ namespace OpenSim.Framework.Data.MySQL
148 151
149 public string Version 152 public string Version
150 { 153 {
151 get { return _dbConnection.getVersion(); } 154 get { return _dbConnection.getVersion(); }
152 } 155 }
153 156
154 public string Name 157 public string Name
@@ -158,4 +161,4 @@ namespace OpenSim.Framework.Data.MySQL
158 161
159 #endregion 162 #endregion
160 } 163 }
161} 164} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
31using System.Security.Cryptography; 32using System.Security.Cryptography;
32using System.Text; 33using System.Text;
33using libsecondlife; 34using libsecondlife;
34
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36 36
37namespace OpenSim.Framework.Data.MySQL 37namespace OpenSim.Framework.Data.MySQL
@@ -59,7 +59,9 @@ namespace OpenSim.Framework.Data.MySQL
59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
61 61
62 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 62 database =
63 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
64 settingPort);
63 } 65 }
64 66
65 /// <summary> 67 /// <summary>
@@ -108,7 +110,10 @@ namespace OpenSim.Framework.Data.MySQL
108 param["?xmax"] = xmax.ToString(); 110 param["?xmax"] = xmax.ToString();
109 param["?ymax"] = ymax.ToString(); 111 param["?ymax"] = ymax.ToString();
110 112
111 IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); 113 IDbCommand result =
114 database.Query(
115 "SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
116 param);
112 IDataReader reader = result.ExecuteReader(); 117 IDataReader reader = result.ExecuteReader();
113 118
114 RegionProfileData row; 119 RegionProfileData row;
@@ -123,7 +128,6 @@ namespace OpenSim.Framework.Data.MySQL
123 result.Dispose(); 128 result.Dispose();
124 129
125 return rows.ToArray(); 130 return rows.ToArray();
126
127 } 131 }
128 } 132 }
129 catch (Exception e) 133 catch (Exception e)
@@ -266,7 +270,10 @@ namespace OpenSim.Framework.Data.MySQL
266 Dictionary<string, string> param = new Dictionary<string, string>(); 270 Dictionary<string, string> param = new Dictionary<string, string>();
267 param["?x"] = x.ToString(); 271 param["?x"] = x.ToString();
268 param["?y"] = y.ToString(); 272 param["?y"] = y.ToString();
269 IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); 273 IDbCommand result =
274 database.Query(
275 "SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
276 param);
270 IDataReader reader = result.ExecuteReader(); 277 IDataReader reader = result.ExecuteReader();
271 278
272 ReservationData row = database.readReservationRow(reader); 279 ReservationData row = database.readReservationRow(reader);
@@ -284,6 +291,4 @@ namespace OpenSim.Framework.Data.MySQL
284 } 291 }
285 } 292 }
286 } 293 }
287 294} \ No newline at end of file
288
289}
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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using System.Data;
31using System.Collections.Generic; 29using System.Collections.Generic;
32using libsecondlife; 30using libsecondlife;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using MySql.Data.MySqlClient; 31using MySql.Data.MySqlClient;
32using OpenSim.Framework.Console;
36 33
37namespace OpenSim.Framework.Data.MySQL 34namespace OpenSim.Framework.Data.MySQL
38{ 35{
@@ -59,7 +56,9 @@ namespace OpenSim.Framework.Data.MySQL
59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 56 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 57 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
61 58
62 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 59 database =
60 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
61 settingPort);
63 TestTables(database.Connection); 62 TestTables(database.Connection);
64 } 63 }
65 64
@@ -99,7 +98,6 @@ namespace OpenSim.Framework.Data.MySQL
99 98
100 private void TestTables(MySqlConnection conn) 99 private void TestTables(MySqlConnection conn)
101 { 100 {
102
103 Dictionary<string, string> tableList = new Dictionary<string, string>(); 101 Dictionary<string, string> tableList = new Dictionary<string, string>();
104 102
105 tableList["inventoryfolders"] = null; 103 tableList["inventoryfolders"] = null;
@@ -110,6 +108,7 @@ namespace OpenSim.Framework.Data.MySQL
110 UpgradeFoldersTable(tableList["inventoryfolders"]); 108 UpgradeFoldersTable(tableList["inventoryfolders"]);
111 UpgradeItemsTable(tableList["inventoryitems"]); 109 UpgradeItemsTable(tableList["inventoryitems"]);
112 } 110 }
111
113 #endregion 112 #endregion
114 113
115 /// <summary> 114 /// <summary>
@@ -151,11 +150,13 @@ namespace OpenSim.Framework.Data.MySQL
151 { 150 {
152 List<InventoryItemBase> items = new List<InventoryItemBase>(); 151 List<InventoryItemBase> items = new List<InventoryItemBase>();
153 152
154 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", database.Connection); 153 MySqlCommand result =
154 new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid",
155 database.Connection);
155 result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); 156 result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
156 MySqlDataReader reader = result.ExecuteReader(); 157 MySqlDataReader reader = result.ExecuteReader();
157 158
158 while(reader.Read()) 159 while (reader.Read())
159 items.Add(readInventoryItem(reader)); 160 items.Add(readInventoryItem(reader));
160 161
161 reader.Close(); 162 reader.Close();
@@ -183,13 +184,16 @@ namespace OpenSim.Framework.Data.MySQL
183 { 184 {
184 lock (database) 185 lock (database)
185 { 186 {
186 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); 187 MySqlCommand result =
188 new MySqlCommand(
189 "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
190 database.Connection);
187 result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); 191 result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated());
188 result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); 192 result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated());
189 MySqlDataReader reader = result.ExecuteReader(); 193 MySqlDataReader reader = result.ExecuteReader();
190 194
191 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 195 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
192 while(reader.Read()) 196 while (reader.Read())
193 items.Add(readInventoryFolder(reader)); 197 items.Add(readInventoryFolder(reader));
194 198
195 199
@@ -218,17 +222,21 @@ namespace OpenSim.Framework.Data.MySQL
218 { 222 {
219 lock (database) 223 lock (database)
220 { 224 {
221 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", database.Connection); 225 MySqlCommand result =
226 new MySqlCommand(
227 "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
228 database.Connection);
222 result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated()); 229 result.Parameters.AddWithValue("?uuid", user.ToStringHyphenated());
223 result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated()); 230 result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToStringHyphenated());
224 231
225 MySqlDataReader reader = result.ExecuteReader(); 232 MySqlDataReader reader = result.ExecuteReader();
226 233
227 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 234 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
228 while(reader.Read()) 235 while (reader.Read())
229 items.Add(readInventoryFolder(reader)); 236 items.Add(readInventoryFolder(reader));
230 237
231 InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). 238 InventoryFolderBase rootFolder = items[0];
239 //should only be one folder with parent set to zero (the root one).
232 reader.Close(); 240 reader.Close();
233 result.Dispose(); 241 result.Dispose();
234 242
@@ -254,13 +262,15 @@ namespace OpenSim.Framework.Data.MySQL
254 { 262 {
255 lock (database) 263 lock (database)
256 { 264 {
257 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", database.Connection); 265 MySqlCommand result =
266 new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid",
267 database.Connection);
258 result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated()); 268 result.Parameters.AddWithValue("?uuid", parentID.ToStringHyphenated());
259 MySqlDataReader reader = result.ExecuteReader(); 269 MySqlDataReader reader = result.ExecuteReader();
260 270
261 List<InventoryFolderBase> items = new List<InventoryFolderBase>(); 271 List<InventoryFolderBase> items = new List<InventoryFolderBase>();
262 272
263 while(reader.Read()) 273 while (reader.Read())
264 items.Add(readInventoryFolder(reader)); 274 items.Add(readInventoryFolder(reader));
265 275
266 reader.Close(); 276 reader.Close();
@@ -288,19 +298,19 @@ namespace OpenSim.Framework.Data.MySQL
288 { 298 {
289 InventoryItemBase item = new InventoryItemBase(); 299 InventoryItemBase item = new InventoryItemBase();
290 300
291 item.inventoryID = new LLUUID((string)reader["inventoryID"]); 301 item.inventoryID = new LLUUID((string) reader["inventoryID"]);
292 item.assetID = new LLUUID((string)reader["assetID"]); 302 item.assetID = new LLUUID((string) reader["assetID"]);
293 item.assetType = (int)reader["assetType"]; 303 item.assetType = (int) reader["assetType"];
294 item.parentFolderID = new LLUUID((string)reader["parentFolderID"]); 304 item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
295 item.avatarID = new LLUUID((string)reader["avatarID"]); 305 item.avatarID = new LLUUID((string) reader["avatarID"]);
296 item.inventoryName = (string)reader["inventoryName"]; 306 item.inventoryName = (string) reader["inventoryName"];
297 item.inventoryDescription = (string)reader["inventoryDescription"]; 307 item.inventoryDescription = (string) reader["inventoryDescription"];
298 item.inventoryNextPermissions = (uint)reader["inventoryNextPermissions"]; 308 item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"];
299 item.inventoryCurrentPermissions = (uint)reader["inventoryCurrentPermissions"]; 309 item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"];
300 item.invType = (int)reader["invType"]; 310 item.invType = (int) reader["invType"];
301 item.creatorsID = new LLUUID((string)reader["creatorID"]); 311 item.creatorsID = new LLUUID((string) reader["creatorID"]);
302 item.inventoryBasePermissions = (uint)reader["inventoryBasePermissions"]; 312 item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"];
303 item.inventoryEveryOnePermissions = (uint)reader["inventoryEveryOnePermissions"]; 313 item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
304 return item; 314 return item;
305 } 315 }
306 catch (MySqlException e) 316 catch (MySqlException e)
@@ -324,12 +334,13 @@ namespace OpenSim.Framework.Data.MySQL
324 { 334 {
325 Dictionary<string, string> param = new Dictionary<string, string>(); 335 Dictionary<string, string> param = new Dictionary<string, string>();
326 336
327 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection); 337 MySqlCommand result =
338 new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
328 result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); 339 result.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated());
329 MySqlDataReader reader = result.ExecuteReader(); 340 MySqlDataReader reader = result.ExecuteReader();
330 341
331 InventoryItemBase item = null; 342 InventoryItemBase item = null;
332 if(reader.Read()) 343 if (reader.Read())
333 item = readInventoryItem(reader); 344 item = readInventoryItem(reader);
334 345
335 reader.Close(); 346 reader.Close();
@@ -356,12 +367,12 @@ namespace OpenSim.Framework.Data.MySQL
356 try 367 try
357 { 368 {
358 InventoryFolderBase folder = new InventoryFolderBase(); 369 InventoryFolderBase folder = new InventoryFolderBase();
359 folder.agentID = new LLUUID((string)reader["agentID"]); 370 folder.agentID = new LLUUID((string) reader["agentID"]);
360 folder.parentID = new LLUUID((string)reader["parentFolderID"]); 371 folder.parentID = new LLUUID((string) reader["parentFolderID"]);
361 folder.folderID = new LLUUID((string)reader["folderID"]); 372 folder.folderID = new LLUUID((string) reader["folderID"]);
362 folder.name = (string)reader["folderName"]; 373 folder.name = (string) reader["folderName"];
363 folder.type = (short)reader["type"]; 374 folder.type = (short) reader["type"];
364 folder.version = (ushort)((int)reader["version"]); 375 folder.version = (ushort) ((int) reader["version"]);
365 return folder; 376 return folder;
366 } 377 }
367 catch (Exception e) 378 catch (Exception e)
@@ -384,7 +395,8 @@ namespace OpenSim.Framework.Data.MySQL
384 { 395 {
385 lock (database) 396 lock (database)
386 { 397 {
387 MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection); 398 MySqlCommand result =
399 new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection);
388 result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); 400 result.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
389 MySqlDataReader reader = result.ExecuteReader(); 401 MySqlDataReader reader = result.ExecuteReader();
390 402
@@ -410,8 +422,10 @@ namespace OpenSim.Framework.Data.MySQL
410 /// <param name="item">The inventory item</param> 422 /// <param name="item">The inventory item</param>
411 public void addInventoryItem(InventoryItemBase item) 423 public void addInventoryItem(InventoryItemBase item)
412 { 424 {
413 string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES "; 425 string sql =
414 sql += "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)"; 426 "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES ";
427 sql +=
428 "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)";
415 429
416 try 430 try
417 { 431 {
@@ -424,7 +438,8 @@ namespace OpenSim.Framework.Data.MySQL
424 result.Parameters.AddWithValue("?inventoryName", item.inventoryName); 438 result.Parameters.AddWithValue("?inventoryName", item.inventoryName);
425 result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); 439 result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription);
426 result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString()); 440 result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString());
427 result.Parameters.AddWithValue("?inventoryCurrentPermissions", item.inventoryCurrentPermissions.ToString()); 441 result.Parameters.AddWithValue("?inventoryCurrentPermissions",
442 item.inventoryCurrentPermissions.ToString());
428 result.Parameters.AddWithValue("?invType", item.invType); 443 result.Parameters.AddWithValue("?invType", item.invType);
429 result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated()); 444 result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToStringHyphenated());
430 result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); 445 result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions);
@@ -455,7 +470,8 @@ namespace OpenSim.Framework.Data.MySQL
455 { 470 {
456 try 471 try
457 { 472 {
458 MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); 473 MySqlCommand cmd =
474 new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection);
459 cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated()); 475 cmd.Parameters.AddWithValue("?uuid", itemID.ToStringHyphenated());
460 cmd.ExecuteNonQuery(); 476 cmd.ExecuteNonQuery();
461 } 477 }
@@ -472,7 +488,8 @@ namespace OpenSim.Framework.Data.MySQL
472 /// <param name="folder">Folder to create</param> 488 /// <param name="folder">Folder to create</param>
473 public void addInventoryFolder(InventoryFolderBase folder) 489 public void addInventoryFolder(InventoryFolderBase folder)
474 { 490 {
475 string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES "; 491 string sql =
492 "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
476 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)"; 493 sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
477 494
478 MySqlCommand cmd = new MySqlCommand(sql, database.Connection); 495 MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
@@ -480,9 +497,9 @@ namespace OpenSim.Framework.Data.MySQL
480 cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated()); 497 cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToStringHyphenated());
481 cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated()); 498 cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToStringHyphenated());
482 cmd.Parameters.AddWithValue("?folderName", folder.name); 499 cmd.Parameters.AddWithValue("?folderName", folder.name);
483 cmd.Parameters.AddWithValue("?type", (short)folder.type); 500 cmd.Parameters.AddWithValue("?type", (short) folder.type);
484 cmd.Parameters.AddWithValue("?version", folder.version); 501 cmd.Parameters.AddWithValue("?version", folder.version);
485 502
486 try 503 try
487 { 504 {
488 cmd.ExecuteNonQuery(); 505 cmd.ExecuteNonQuery();
@@ -515,7 +532,7 @@ namespace OpenSim.Framework.Data.MySQL
515 foreach (InventoryFolderBase f in subfolderList) 532 foreach (InventoryFolderBase f in subfolderList)
516 folders.Add(f); 533 folders.Add(f);
517 } 534 }
518 535
519 /// <summary> 536 /// <summary>
520 /// Returns all child folders in the hierarchy from the parent folder and down 537 /// Returns all child folders in the hierarchy from the parent folder and down
521 /// </summary> 538 /// </summary>
@@ -536,7 +553,8 @@ namespace OpenSim.Framework.Data.MySQL
536 { 553 {
537 try 554 try
538 { 555 {
539 MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); 556 MySqlCommand cmd =
557 new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
540 cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); 558 cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
541 cmd.ExecuteNonQuery(); 559 cmd.ExecuteNonQuery();
542 } 560 }
@@ -551,7 +569,8 @@ namespace OpenSim.Framework.Data.MySQL
551 { 569 {
552 try 570 try
553 { 571 {
554 MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); 572 MySqlCommand cmd =
573 new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
555 cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated()); 574 cmd.Parameters.AddWithValue("?uuid", folderID.ToStringHyphenated());
556 cmd.ExecuteNonQuery(); 575 cmd.ExecuteNonQuery();
557 } 576 }
@@ -586,4 +605,4 @@ namespace OpenSim.Framework.Data.MySQL
586 } 605 }
587 } 606 }
588 } 607 }
589} 608} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29
30namespace OpenSim.Framework.Data.MySQL 28namespace OpenSim.Framework.Data.MySQL
31{ 29{
32 /// <summary> 30 /// <summary>
33 /// An interface to the log database for MySQL 31 /// An interface to the log database for MySQL
34 /// </summary> 32 /// </summary>
35 class MySQLLogData : ILogData 33 internal class MySQLLogData : ILogData
36 { 34 {
37 /// <summary> 35 /// <summary>
38 /// The database manager 36 /// The database manager
@@ -52,7 +50,9 @@ namespace OpenSim.Framework.Data.MySQL
52 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 50 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
53 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 51 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
54 52
55 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 53 database =
54 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
55 settingPort);
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
@@ -64,7 +64,8 @@ namespace OpenSim.Framework.Data.MySQL
64 /// <param name="arguments">The arguments passed to the method</param> 64 /// <param name="arguments">The arguments passed to the method</param>
65 /// <param name="priority">How critical is this?</param> 65 /// <param name="priority">How critical is this?</param>
66 /// <param name="logMessage">The message to log</param> 66 /// <param name="logMessage">The message to log</param>
67 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 67 public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
68 string logMessage)
68 { 69 {
69 try 70 try
70 { 71 {
@@ -102,4 +103,4 @@ namespace OpenSim.Framework.Data.MySQL
102 return "0.1"; 103 return "0.1";
103 } 104 }
104 } 105 }
105} 106} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.IO; 30using System.Collections.Generic;
30using System.Data; 31using System.Data;
32using System.IO;
31using System.Reflection; 33using System.Reflection;
32using System.Collections.Generic;
33using libsecondlife; 34using libsecondlife;
34
35using MySql.Data.MySqlClient; 35using MySql.Data.MySqlClient;
36
37using OpenSim.Framework;
38using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
39 37
40namespace OpenSim.Framework.Data.MySQL 38namespace OpenSim.Framework.Data.MySQL
@@ -42,16 +40,17 @@ namespace OpenSim.Framework.Data.MySQL
42 /// <summary> 40 /// <summary>
43 /// A MySQL Database manager 41 /// A MySQL Database manager
44 /// </summary> 42 /// </summary>
45 class MySQLManager 43 internal class MySQLManager
46 { 44 {
47 /// <summary> 45 /// <summary>
48 /// The database connection object 46 /// The database connection object
49 /// </summary> 47 /// </summary>
50 MySqlConnection dbcon; 48 private MySqlConnection dbcon;
49
51 /// <summary> 50 /// <summary>
52 /// Connection string for ADO.net 51 /// Connection string for ADO.net
53 /// </summary> 52 /// </summary>
54 string connectionString; 53 private string connectionString;
55 54
56 /// <summary> 55 /// <summary>
57 /// Initialises and creates a new MySQL connection and maintains it. 56 /// Initialises and creates a new MySQL connection and maintains it.
@@ -61,11 +60,13 @@ namespace OpenSim.Framework.Data.MySQL
61 /// <param name="username">The username logging into the database</param> 60 /// <param name="username">The username logging into the database</param>
62 /// <param name="password">The password for the user logging in</param> 61 /// <param name="password">The password for the user logging in</param>
63 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> 62 /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
64 public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) 63 public MySQLManager(string hostname, string database, string username, string password, string cpooling,
64 string port)
65 { 65 {
66 try 66 try
67 { 67 {
68 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; 68 connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" +
69 username + ";Password=" + password + ";Pooling=" + cpooling + ";";
69 dbcon = new MySqlConnection(connectionString); 70 dbcon = new MySqlConnection(connectionString);
70 71
71 dbcon.Open(); 72 dbcon.Open();
@@ -123,15 +124,17 @@ namespace OpenSim.Framework.Data.MySQL
123 /// <returns>A string containing the DB provider</returns> 124 /// <returns>A string containing the DB provider</returns>
124 public string getVersion() 125 public string getVersion()
125 { 126 {
126 System.Reflection.Module module = this.GetType().Module; 127 Module module = GetType().Module;
127 string dllName = module.Assembly.ManifestModule.Name; 128 string dllName = module.Assembly.ManifestModule.Name;
128 Version dllVersion = module.Assembly.GetName().Version; 129 Version dllVersion = module.Assembly.GetName().Version;
129 130
130 131
131 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); 132 return
133 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
134 dllVersion.Revision);
132 } 135 }
133 136
134 137
135 /// <summary> 138 /// <summary>
136 /// Extract a named string resource from the embedded resources 139 /// Extract a named string resource from the embedded resources
137 /// </summary> 140 /// </summary>
@@ -139,7 +142,7 @@ namespace OpenSim.Framework.Data.MySQL
139 /// <returns>string contained within the embedded resource</returns> 142 /// <returns>string contained within the embedded resource</returns>
140 private string getResourceString(string name) 143 private string getResourceString(string name)
141 { 144 {
142 Assembly assem = this.GetType().Assembly; 145 Assembly assem = GetType().Assembly;
143 string[] names = assem.GetManifestResourceNames(); 146 string[] names = assem.GetManifestResourceNames();
144 147
145 foreach (string s in names) 148 foreach (string s in names)
@@ -173,7 +176,10 @@ namespace OpenSim.Framework.Data.MySQL
173 { 176 {
174 lock (dbcon) 177 lock (dbcon)
175 { 178 {
176 MySqlCommand tablesCmd = new MySqlCommand("SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", dbcon); 179 MySqlCommand tablesCmd =
180 new MySqlCommand(
181 "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
182 dbcon);
177 tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); 183 tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
178 using (MySqlDataReader tables = tablesCmd.ExecuteReader()) 184 using (MySqlDataReader tables = tablesCmd.ExecuteReader())
179 { 185 {
@@ -181,9 +187,9 @@ namespace OpenSim.Framework.Data.MySQL
181 { 187 {
182 try 188 try
183 { 189 {
184 string tableName = (string)tables["TABLE_NAME"]; 190 string tableName = (string) tables["TABLE_NAME"];
185 string comment = (string)tables["TABLE_COMMENT"]; 191 string comment = (string) tables["TABLE_COMMENT"];
186 if(tableList.ContainsKey(tableName)) 192 if (tableList.ContainsKey(tableName))
187 tableList[tableName] = comment; 193 tableList[tableName] = comment;
188 } 194 }
189 catch (Exception e) 195 catch (Exception e)
@@ -198,7 +204,7 @@ namespace OpenSim.Framework.Data.MySQL
198 204
199 205
200 // at some time this code should be cleaned up 206 // at some time this code should be cleaned up
201 207
202 /// <summary> 208 /// <summary>
203 /// Runs a query with protection against SQL Injection by using parameterised input. 209 /// Runs a query with protection against SQL Injection by using parameterised input.
204 /// </summary> 210 /// </summary>
@@ -209,14 +215,14 @@ namespace OpenSim.Framework.Data.MySQL
209 { 215 {
210 try 216 try
211 { 217 {
212 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 218 MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
213 dbcommand.CommandText = sql; 219 dbcommand.CommandText = sql;
214 foreach (KeyValuePair<string, string> param in parameters) 220 foreach (KeyValuePair<string, string> param in parameters)
215 { 221 {
216 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 222 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
217 } 223 }
218 224
219 return (IDbCommand)dbcommand; 225 return (IDbCommand) dbcommand;
220 } 226 }
221 catch 227 catch
222 { 228 {
@@ -227,7 +233,9 @@ namespace OpenSim.Framework.Data.MySQL
227 { 233 {
228 dbcon.Close(); 234 dbcon.Close();
229 } 235 }
230 catch { } 236 catch
237 {
238 }
231 239
232 // Try reopen it 240 // Try reopen it
233 try 241 try
@@ -243,14 +251,14 @@ namespace OpenSim.Framework.Data.MySQL
243 // Run the query again 251 // Run the query again
244 try 252 try
245 { 253 {
246 MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); 254 MySqlCommand dbcommand = (MySqlCommand) dbcon.CreateCommand();
247 dbcommand.CommandText = sql; 255 dbcommand.CommandText = sql;
248 foreach (KeyValuePair<string, string> param in parameters) 256 foreach (KeyValuePair<string, string> param in parameters)
249 { 257 {
250 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 258 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
251 } 259 }
252 260
253 return (IDbCommand)dbcommand; 261 return (IDbCommand) dbcommand;
254 } 262 }
255 catch (Exception e) 263 catch (Exception e)
256 { 264 {
@@ -275,20 +283,20 @@ namespace OpenSim.Framework.Data.MySQL
275 { 283 {
276 // Region Main 284 // Region Main
277 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); 285 retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
278 retval.regionName = (string)reader["regionName"]; 286 retval.regionName = (string) reader["regionName"];
279 retval.UUID = new LLUUID((string)reader["uuid"]); 287 retval.UUID = new LLUUID((string) reader["uuid"]);
280 288
281 // Secrets 289 // Secrets
282 retval.regionRecvKey = (string)reader["regionRecvKey"]; 290 retval.regionRecvKey = (string) reader["regionRecvKey"];
283 retval.regionSecret = (string)reader["regionSecret"]; 291 retval.regionSecret = (string) reader["regionSecret"];
284 retval.regionSendKey = (string)reader["regionSendKey"]; 292 retval.regionSendKey = (string) reader["regionSendKey"];
285 293
286 // Region Server 294 // Region Server
287 retval.regionDataURI = (string)reader["regionDataURI"]; 295 retval.regionDataURI = (string) reader["regionDataURI"];
288 retval.regionOnline = false; // Needs to be pinged before this can be set. 296 retval.regionOnline = false; // Needs to be pinged before this can be set.
289 retval.serverIP = (string)reader["serverIP"]; 297 retval.serverIP = (string) reader["serverIP"];
290 retval.serverPort = (uint)reader["serverPort"]; 298 retval.serverPort = (uint) reader["serverPort"];
291 retval.serverURI = (string)reader["serverURI"]; 299 retval.serverURI = (string) reader["serverURI"];
292 retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString()); 300 retval.httpPort = Convert.ToUInt32(reader["serverHttpPort"].ToString());
293 retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString()); 301 retval.remotingPort = Convert.ToUInt32(reader["serverRemotingPort"].ToString());
294 302
@@ -304,14 +312,14 @@ namespace OpenSim.Framework.Data.MySQL
304 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); 312 retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString());
305 313
306 // Assets 314 // Assets
307 retval.regionAssetURI = (string)reader["regionAssetURI"]; 315 retval.regionAssetURI = (string) reader["regionAssetURI"];
308 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 316 retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
309 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 317 retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
310 318
311 // Userserver 319 // Userserver
312 retval.regionUserURI = (string)reader["regionUserURI"]; 320 retval.regionUserURI = (string) reader["regionUserURI"];
313 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 321 retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
314 retval.regionUserSendKey = (string)reader["regionUserSendKey"]; 322 retval.regionUserSendKey = (string) reader["regionUserSendKey"];
315 323
316 // World Map Addition 324 // World Map Addition
317 string tempRegionMap = reader["regionMapTexture"].ToString(); 325 string tempRegionMap = reader["regionMapTexture"].ToString();
@@ -341,17 +349,16 @@ namespace OpenSim.Framework.Data.MySQL
341 ReservationData retval = new ReservationData(); 349 ReservationData retval = new ReservationData();
342 if (reader.Read()) 350 if (reader.Read())
343 { 351 {
344 retval.gridRecvKey = (string)reader["gridRecvKey"]; 352 retval.gridRecvKey = (string) reader["gridRecvKey"];
345 retval.gridSendKey = (string)reader["gridSendKey"]; 353 retval.gridSendKey = (string) reader["gridSendKey"];
346 retval.reservationCompany = (string)reader["resCompany"]; 354 retval.reservationCompany = (string) reader["resCompany"];
347 retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString()); 355 retval.reservationMaxX = Convert.ToInt32(reader["resXMax"].ToString());
348 retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString()); 356 retval.reservationMaxY = Convert.ToInt32(reader["resYMax"].ToString());
349 retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString()); 357 retval.reservationMinX = Convert.ToInt32(reader["resXMin"].ToString());
350 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString()); 358 retval.reservationMinY = Convert.ToInt32(reader["resYMin"].ToString());
351 retval.reservationName = (string)reader["resName"]; 359 retval.reservationName = (string) reader["resName"];
352 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1; 360 retval.status = Convert.ToInt32(reader["status"].ToString()) == 1;
353 retval.userUUID = new LLUUID((string)reader["userUUID"]); 361 retval.userUUID = new LLUUID((string) reader["userUUID"]);
354
355 } 362 }
356 else 363 else
357 { 364 {
@@ -359,6 +366,7 @@ namespace OpenSim.Framework.Data.MySQL
359 } 366 }
360 return retval; 367 return retval;
361 } 368 }
369
362 /// <summary> 370 /// <summary>
363 /// Reads an agent row from a database reader 371 /// Reads an agent row from a database reader
364 /// </summary> 372 /// </summary>
@@ -371,12 +379,12 @@ namespace OpenSim.Framework.Data.MySQL
371 if (reader.Read()) 379 if (reader.Read())
372 { 380 {
373 // Agent IDs 381 // Agent IDs
374 retval.UUID = new LLUUID((string)reader["UUID"]); 382 retval.UUID = new LLUUID((string) reader["UUID"]);
375 retval.sessionID = new LLUUID((string)reader["sessionID"]); 383 retval.sessionID = new LLUUID((string) reader["sessionID"]);
376 retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]); 384 retval.secureSessionID = new LLUUID((string) reader["secureSessionID"]);
377 385
378 // Agent Who? 386 // Agent Who?
379 retval.agentIP = (string)reader["agentIP"]; 387 retval.agentIP = (string) reader["agentIP"];
380 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); 388 retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString());
381 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); 389 retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString());
382 390
@@ -385,9 +393,9 @@ namespace OpenSim.Framework.Data.MySQL
385 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); 393 retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString());
386 394
387 // Current position 395 // Current position
388 retval.currentRegion = (string)reader["currentRegion"]; 396 retval.currentRegion = (string) reader["currentRegion"];
389 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); 397 retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
390 LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); 398 LLVector3.TryParse((string) reader["currentPos"], out retval.currentPos);
391 } 399 }
392 else 400 else
393 { 401 {
@@ -407,12 +415,12 @@ namespace OpenSim.Framework.Data.MySQL
407 415
408 if (reader.Read()) 416 if (reader.Read())
409 { 417 {
410 retval.UUID = new LLUUID((string)reader["UUID"]); 418 retval.UUID = new LLUUID((string) reader["UUID"]);
411 retval.username = (string)reader["username"]; 419 retval.username = (string) reader["username"];
412 retval.surname = (string)reader["lastname"]; 420 retval.surname = (string) reader["lastname"];
413 421
414 retval.passwordHash = (string)reader["passwordHash"]; 422 retval.passwordHash = (string) reader["passwordHash"];
415 retval.passwordSalt = (string)reader["passwordSalt"]; 423 retval.passwordSalt = (string) reader["passwordSalt"];
416 424
417 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); 425 retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
418 retval.homeLocation = new LLVector3( 426 retval.homeLocation = new LLVector3(
@@ -427,18 +435,17 @@ namespace OpenSim.Framework.Data.MySQL
427 retval.created = Convert.ToInt32(reader["created"].ToString()); 435 retval.created = Convert.ToInt32(reader["created"].ToString());
428 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); 436 retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
429 437
430 retval.userInventoryURI = (string)reader["userInventoryURI"]; 438 retval.userInventoryURI = (string) reader["userInventoryURI"];
431 retval.userAssetURI = (string)reader["userAssetURI"]; 439 retval.userAssetURI = (string) reader["userAssetURI"];
432 440
433 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); 441 retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString());
434 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); 442 retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString());
435 443
436 retval.profileAboutText = (string)reader["profileAboutText"]; 444 retval.profileAboutText = (string) reader["profileAboutText"];
437 retval.profileFirstText = (string)reader["profileFirstText"]; 445 retval.profileFirstText = (string) reader["profileFirstText"];
438
439 retval.profileImage = new LLUUID((string)reader["profileImage"]);
440 retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
441 446
447 retval.profileImage = new LLUUID((string) reader["profileImage"]);
448 retval.profileFirstImage = new LLUUID((string) reader["profileFirstImage"]);
442 } 449 }
443 else 450 else
444 { 451 {
@@ -448,7 +455,6 @@ namespace OpenSim.Framework.Data.MySQL
448 } 455 }
449 456
450 457
451
452 /// <summary> 458 /// <summary>
453 /// Inserts a new row into the log database 459 /// Inserts a new row into the log database
454 /// </summary> 460 /// </summary>
@@ -459,7 +465,8 @@ namespace OpenSim.Framework.Data.MySQL
459 /// <param name="priority">How critical is this?</param> 465 /// <param name="priority">How critical is this?</param>
460 /// <param name="logMessage">Extra message info</param> 466 /// <param name="logMessage">Extra message info</param>
461 /// <returns>Saved successfully?</returns> 467 /// <returns>Saved successfully?</returns>
462 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) 468 public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority,
469 string logMessage)
463 { 470 {
464 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; 471 string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
465 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; 472 sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
@@ -493,89 +500,97 @@ namespace OpenSim.Framework.Data.MySQL
493 } 500 }
494 501
495 502
496 /// <summary> 503 /// <summary>
497 /// Creates a new user and inserts it into the database 504 /// Creates a new user and inserts it into the database
498 /// </summary> 505 /// </summary>
499 /// <param name="uuid">User ID</param> 506 /// <param name="uuid">User ID</param>
500 /// <param name="username">First part of the login</param> 507 /// <param name="username">First part of the login</param>
501 /// <param name="lastname">Second part of the login</param> 508 /// <param name="lastname">Second part of the login</param>
502 /// <param name="passwordHash">A salted hash of the users password</param> 509 /// <param name="passwordHash">A salted hash of the users password</param>
503 /// <param name="passwordSalt">The salt used for the password hash</param> 510 /// <param name="passwordSalt">The salt used for the password hash</param>
504 /// <param name="homeRegion">A regionHandle of the users home region</param> 511 /// <param name="homeRegion">A regionHandle of the users home region</param>
505 /// <param name="homeLocX">Home region position vector</param> 512 /// <param name="homeLocX">Home region position vector</param>
506 /// <param name="homeLocY">Home region position vector</param> 513 /// <param name="homeLocY">Home region position vector</param>
507 /// <param name="homeLocZ">Home region position vector</param> 514 /// <param name="homeLocZ">Home region position vector</param>
508 /// <param name="homeLookAtX">Home region 'look at' vector</param> 515 /// <param name="homeLookAtX">Home region 'look at' vector</param>
509 /// <param name="homeLookAtY">Home region 'look at' vector</param> 516 /// <param name="homeLookAtY">Home region 'look at' vector</param>
510 /// <param name="homeLookAtZ">Home region 'look at' vector</param> 517 /// <param name="homeLookAtZ">Home region 'look at' vector</param>
511 /// <param name="created">Account created (unix timestamp)</param> 518 /// <param name="created">Account created (unix timestamp)</param>
512 /// <param name="lastlogin">Last login (unix timestamp)</param> 519 /// <param name="lastlogin">Last login (unix timestamp)</param>
513 /// <param name="inventoryURI">Users inventory URI</param> 520 /// <param name="inventoryURI">Users inventory URI</param>
514 /// <param name="assetURI">Users asset URI</param> 521 /// <param name="assetURI">Users asset URI</param>
515 /// <param name="canDoMask">I can do mask</param> 522 /// <param name="canDoMask">I can do mask</param>
516 /// <param name="wantDoMask">I want to do mask</param> 523 /// <param name="wantDoMask">I want to do mask</param>
517 /// <param name="aboutText">Profile text</param> 524 /// <param name="aboutText">Profile text</param>
518 /// <param name="firstText">Firstlife text</param> 525 /// <param name="firstText">Firstlife text</param>
519 /// <param name="profileImage">UUID for profile image</param> 526 /// <param name="profileImage">UUID for profile image</param>
520 /// <param name="firstImage">UUID for firstlife image</param> 527 /// <param name="firstImage">UUID for firstlife image</param>
521 /// <returns>Success?</returns> 528 /// <returns>Success?</returns>
522 public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, 529 public bool insertUserRow(LLUUID uuid, string username, string lastname, string passwordHash,
523 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, 530 string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
524 libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) 531 float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
525 { 532 string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
526 string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, "; 533 string aboutText, string firstText,
527 sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; 534 LLUUID profileImage, LLUUID firstImage)
528 sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; 535 {
529 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES "; 536 string sql =
530 537 "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
531 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, "; 538 sql +=
532 sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; 539 "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
533 sql += "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; 540 sql +=
534 sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; 541 "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
535 542 sql += "`profileFirstText`, `profileImage`, `profileFirstImage`) VALUES ";
536 Dictionary<string, string> parameters = new Dictionary<string, string>(); 543
537 parameters["?UUID"] = uuid.ToStringHyphenated(); 544 sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
538 parameters["?username"] = username.ToString(); 545 sql +=
539 parameters["?lastname"] = lastname.ToString(); 546 "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
540 parameters["?passwordHash"] = passwordHash.ToString(); 547 sql +=
541 parameters["?passwordSalt"] = passwordSalt.ToString(); 548 "?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
542 parameters["?homeRegion"] = homeRegion.ToString(); 549 sql += "?profileFirstText, ?profileImage, ?profileFirstImage)";
543 parameters["?homeLocationX"] = homeLocX.ToString(); 550
544 parameters["?homeLocationY"] = homeLocY.ToString(); 551 Dictionary<string, string> parameters = new Dictionary<string, string>();
545 parameters["?homeLocationZ"] = homeLocZ.ToString(); 552 parameters["?UUID"] = uuid.ToStringHyphenated();
546 parameters["?homeLookAtX"] = homeLookAtX.ToString(); 553 parameters["?username"] = username.ToString();
547 parameters["?homeLookAtY"] = homeLookAtY.ToString(); 554 parameters["?lastname"] = lastname.ToString();
548 parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); 555 parameters["?passwordHash"] = passwordHash.ToString();
549 parameters["?created"] = created.ToString(); 556 parameters["?passwordSalt"] = passwordSalt.ToString();
550 parameters["?lastLogin"] = lastlogin.ToString(); 557 parameters["?homeRegion"] = homeRegion.ToString();
551 parameters["?userInventoryURI"] = ""; 558 parameters["?homeLocationX"] = homeLocX.ToString();
552 parameters["?userAssetURI"] = ""; 559 parameters["?homeLocationY"] = homeLocY.ToString();
553 parameters["?profileCanDoMask"] = "0"; 560 parameters["?homeLocationZ"] = homeLocZ.ToString();
554 parameters["?profileWantDoMask"] = "0"; 561 parameters["?homeLookAtX"] = homeLookAtX.ToString();
555 parameters["?profileAboutText"] = ""; 562 parameters["?homeLookAtY"] = homeLookAtY.ToString();
556 parameters["?profileFirstText"] = ""; 563 parameters["?homeLookAtZ"] = homeLookAtZ.ToString();
557 parameters["?profileImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); 564 parameters["?created"] = created.ToString();
558 parameters["?profileFirstImage"] = libsecondlife.LLUUID.Zero.ToStringHyphenated(); 565 parameters["?lastLogin"] = lastlogin.ToString();
559 566 parameters["?userInventoryURI"] = "";
560 bool returnval = false; 567 parameters["?userAssetURI"] = "";
561 568 parameters["?profileCanDoMask"] = "0";
562 try 569 parameters["?profileWantDoMask"] = "0";
563 { 570 parameters["?profileAboutText"] = "";
564 IDbCommand result = Query(sql, parameters); 571 parameters["?profileFirstText"] = "";
565 572 parameters["?profileImage"] = LLUUID.Zero.ToStringHyphenated();
566 if (result.ExecuteNonQuery() == 1) 573 parameters["?profileFirstImage"] = LLUUID.Zero.ToStringHyphenated();
567 returnval = true; 574
568 575 bool returnval = false;
569 result.Dispose(); 576
570 } 577 try
571 catch (Exception e) 578 {
572 { 579 IDbCommand result = Query(sql, parameters);
573 MainLog.Instance.Error(e.ToString()); 580
574 return false; 581 if (result.ExecuteNonQuery() == 1)
575 } 582 returnval = true;
576 583
577 return returnval; 584 result.Dispose();
578 } 585 }
586 catch (Exception e)
587 {
588 MainLog.Instance.Error(e.ToString());
589 return false;
590 }
591
592 return returnval;
593 }
579 594
580 595
581 /// <summary> 596 /// <summary>
@@ -585,13 +600,18 @@ namespace OpenSim.Framework.Data.MySQL
585 /// <returns>Success?</returns> 600 /// <returns>Success?</returns>
586 public bool insertRegion(RegionProfileData regiondata) 601 public bool insertRegion(RegionProfileData regiondata)
587 { 602 {
588 string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 603 string sql =
589 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 604 "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
590 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES "; 605 sql +=
606 "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
607 sql +=
608 "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture, serverHttpPort, serverRemotingPort) VALUES ";
591 609
592 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; 610 sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, ";
593 sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; 611 sql +=
594 sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; 612 "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
613 sql +=
614 "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);";
595 615
596 Dictionary<string, string> parameters = new Dictionary<string, string>(); 616 Dictionary<string, string> parameters = new Dictionary<string, string>();
597 617
@@ -626,7 +646,6 @@ namespace OpenSim.Framework.Data.MySQL
626 646
627 try 647 try
628 { 648 {
629
630 IDbCommand result = Query(sql, parameters); 649 IDbCommand result = Query(sql, parameters);
631 650
632 //Console.WriteLine(result.CommandText); 651 //Console.WriteLine(result.CommandText);
@@ -646,4 +665,4 @@ namespace OpenSim.Framework.Data.MySQL
646 return returnval; 665 return returnval;
647 } 666 }
648 } 667 }
649} 668} \ 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;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Data; 30using System.Data;
31using libsecondlife; 31using libsecondlife;
32using OpenSim.Framework;
33using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
34 33
35namespace OpenSim.Framework.Data.MySQL 34namespace OpenSim.Framework.Data.MySQL
@@ -37,7 +36,7 @@ namespace OpenSim.Framework.Data.MySQL
37 /// <summary> 36 /// <summary>
38 /// A database interface class to a user profile storage system 37 /// A database interface class to a user profile storage system
39 /// </summary> 38 /// </summary>
40 class MySQLUserData : IUserData 39 internal class MySQLUserData : IUserData
41 { 40 {
42 /// <summary> 41 /// <summary>
43 /// Database manager for MySQL 42 /// Database manager for MySQL
@@ -59,7 +58,9 @@ namespace OpenSim.Framework.Data.MySQL
59 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); 58 string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
60 string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); 59 string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
61 60
62 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 61 database =
62 new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
63 settingPort);
63 } 64 }
64 65
65 /// <summary> 66 /// <summary>
@@ -88,11 +89,12 @@ namespace OpenSim.Framework.Data.MySQL
88 param["?first"] = user; 89 param["?first"] = user;
89 param["?second"] = last; 90 param["?second"] = last;
90 91
91 IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); 92 IDbCommand result =
93 database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
92 IDataReader reader = result.ExecuteReader(); 94 IDataReader reader = result.ExecuteReader();
93 95
94 UserProfileData row = database.readUserRow(reader); 96 UserProfileData row = database.readUserRow(reader);
95 97
96 reader.Close(); 98 reader.Close();
97 result.Dispose(); 99 result.Dispose();
98 100
@@ -201,21 +203,25 @@ namespace OpenSim.Framework.Data.MySQL
201 /// <param name="user">The user profile to create</param> 203 /// <param name="user">The user profile to create</param>
202 public void AddNewUserProfile(UserProfileData user) 204 public void AddNewUserProfile(UserProfileData user)
203 { 205 {
204 try 206 try
205 { 207 {
206 lock (database) 208 lock (database)
207 { 209 {
208 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, 210 database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt,
209 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, 211 user.homeRegion, user.homeLocation.X, user.homeLocation.Y,
210 user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); 212 user.homeLocation.Z,
211 } 213 user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created,
212 } 214 user.lastLogin, user.userInventoryURI, user.userAssetURI,
213 catch (Exception e) 215 user.profileCanDoMask, user.profileWantDoMask,
214 { 216 user.profileAboutText, user.profileFirstText, user.profileImage,
215 database.Reconnect(); 217 user.profileFirstImage);
216 MainLog.Instance.Error(e.ToString()); 218 }
217 } 219 }
218 220 catch (Exception e)
221 {
222 database.Reconnect();
223 MainLog.Instance.Error(e.ToString());
224 }
219 } 225 }
220 226
221 /// <summary> 227 /// <summary>
@@ -226,8 +232,8 @@ namespace OpenSim.Framework.Data.MySQL
226 { 232 {
227 // Do nothing. 233 // Do nothing.
228 } 234 }
229 235
230 236
231 public bool UpdateUserProfile(UserProfileData user) 237 public bool UpdateUserProfile(UserProfileData user)
232 { 238 {
233 return true; 239 return true;
@@ -277,4 +283,4 @@ namespace OpenSim.Framework.Data.MySQL
277 return "0.1"; 283 return "0.1";
278 } 284 }
279 } 285 }
280} 286} \ 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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.MySQL")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.MySQL")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] 24
25[assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data.SQLite")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data.SQLite")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] 24
25[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("0.4.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("0.4.0.0")]
38[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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using libsecondlife;
31using OpenSim.Framework;
32using System.Data; 29using System.Data;
33using System.Data.SqlTypes; 30using System.Reflection;
31using libsecondlife;
34using Mono.Data.SqliteClient; 32using Mono.Data.SqliteClient;
35using OpenSim.Framework.Console; 33using OpenSim.Framework.Console;
36using OpenSim.Framework;
37using OpenSim.Framework.Interfaces;
38 34
39namespace OpenSim.Framework.Data.SQLite 35namespace OpenSim.Framework.Data.SQLite
40{ 36{
@@ -46,11 +42,11 @@ namespace OpenSim.Framework.Data.SQLite
46 /// <summary> 42 /// <summary>
47 /// The database manager 43 /// The database manager
48 /// </summary> 44 /// </summary>
49
50 /// <summary> 45 /// <summary>
51 /// Artificial constructor called upon plugin load 46 /// Artificial constructor called upon plugin load
52 /// </summary> 47 /// </summary>
53 private const string assetSelect = "select * from assets"; 48 private const string assetSelect = "select * from assets";
49
54 private DataSet ds; 50 private DataSet ds;
55 private SqliteDataAdapter da; 51 private SqliteDataAdapter da;
56 52
@@ -58,13 +54,14 @@ namespace OpenSim.Framework.Data.SQLite
58 { 54 {
59 SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3"); 55 SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3");
60 TestTables(conn); 56 TestTables(conn);
61 57
62 ds = new DataSet(); 58 ds = new DataSet();
63 da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn)); 59 da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn));
64 60
65 lock (ds) { 61 lock (ds)
62 {
66 ds.Tables.Add(createAssetsTable()); 63 ds.Tables.Add(createAssetsTable());
67 64
68 setupAssetCommands(da, conn); 65 setupAssetCommands(da, conn);
69 try 66 try
70 { 67 {
@@ -75,11 +72,11 @@ namespace OpenSim.Framework.Data.SQLite
75 MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table"); 72 MainLog.Instance.Verbose("AssetStorage", "Caught fill error on asset table");
76 } 73 }
77 } 74 }
78 75
79 return; 76 return;
80 } 77 }
81 78
82 public AssetBase FetchAsset(LLUUID uuid) 79 public AssetBase FetchAsset(LLUUID uuid)
83 { 80 {
84 AssetBase asset = new AssetBase(); 81 AssetBase asset = new AssetBase();
85 DataRow row = ds.Tables["assets"].Rows.Find(uuid); 82 DataRow row = ds.Tables["assets"].Rows.Find(uuid);
@@ -92,27 +89,28 @@ namespace OpenSim.Framework.Data.SQLite
92 return null; 89 return null;
93 } 90 }
94 } 91 }
95 92
96 public void CreateAsset(AssetBase asset) 93 public void CreateAsset(AssetBase asset)
97 { 94 {
98 // no difference for now 95 // no difference for now
99 UpdateAsset(asset); 96 UpdateAsset(asset);
100 } 97 }
101 98
102 public void UpdateAsset(AssetBase asset) 99 public void UpdateAsset(AssetBase asset)
103 { 100 {
104 LogAssetLoad(asset); 101 LogAssetLoad(asset);
105 102
106 DataTable assets = ds.Tables["assets"]; 103 DataTable assets = ds.Tables["assets"];
107 lock(ds) { 104 lock (ds)
105 {
108 DataRow row = assets.Rows.Find(asset.FullID); 106 DataRow row = assets.Rows.Find(asset.FullID);
109 if (row == null) 107 if (row == null)
110 { 108 {
111 row = assets.NewRow(); 109 row = assets.NewRow();
112 fillAssetRow(row, asset); 110 fillAssetRow(row, asset);
113 assets.Rows.Add(row); 111 assets.Rows.Add(row);
114 } 112 }
115 else 113 else
116 { 114 {
117 fillAssetRow(row, asset); 115 fillAssetRow(row, asset);
118 } 116 }
@@ -124,9 +122,10 @@ namespace OpenSim.Framework.Data.SQLite
124 string temporary = asset.Temporary ? "Temporary" : "Stored"; 122 string temporary = asset.Temporary ? "Temporary" : "Stored";
125 string local = asset.Local ? "Local" : "Remote"; 123 string local = asset.Local ? "Local" : "Remote";
126 124
127 MainLog.Instance.Verbose("ASSETSTORAGE", 125 MainLog.Instance.Verbose("ASSETSTORAGE",
128 string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)", 126 string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)",
129 asset.FullID, asset.Name, asset.Description, asset.Type, asset.InvType, temporary, local, asset.Data.Length) ); 127 asset.FullID, asset.Name, asset.Description, asset.Type,
128 asset.InvType, temporary, local, asset.Data.Length));
130 } 129 }
131 130
132 public bool ExistsAsset(LLUUID uuid) 131 public bool ExistsAsset(LLUUID uuid)
@@ -137,23 +136,26 @@ namespace OpenSim.Framework.Data.SQLite
137 136
138 public void DeleteAsset(LLUUID uuid) 137 public void DeleteAsset(LLUUID uuid)
139 { 138 {
140 lock (ds) { 139 lock (ds)
140 {
141 DataRow row = ds.Tables["assets"].Rows.Find(uuid); 141 DataRow row = ds.Tables["assets"].Rows.Find(uuid);
142 if (row != null) { 142 if (row != null)
143 {
143 row.Delete(); 144 row.Delete();
144 } 145 }
145 } 146 }
146 } 147 }
147 148
148 public void CommitAssets() // force a sync to the database 149 public void CommitAssets() // force a sync to the database
149 { 150 {
150 MainLog.Instance.Verbose("AssetStorage", "Attempting commit"); 151 MainLog.Instance.Verbose("AssetStorage", "Attempting commit");
151 lock (ds) { 152 lock (ds)
153 {
152 da.Update(ds, "assets"); 154 da.Update(ds, "assets");
153 ds.AcceptChanges(); 155 ds.AcceptChanges();
154 } 156 }
155 } 157 }
156 158
157 /*********************************************************************** 159 /***********************************************************************
158 * 160 *
159 * Database Definition Functions 161 * Database Definition Functions
@@ -161,24 +163,24 @@ namespace OpenSim.Framework.Data.SQLite
161 * This should be db agnostic as we define them in ADO.NET terms 163 * This should be db agnostic as we define them in ADO.NET terms
162 * 164 *
163 **********************************************************************/ 165 **********************************************************************/
164 166
165 private DataTable createAssetsTable() 167 private DataTable createAssetsTable()
166 { 168 {
167 DataTable assets = new DataTable("assets"); 169 DataTable assets = new DataTable("assets");
168 170
169 createCol(assets, "UUID", typeof(System.String)); 171 createCol(assets, "UUID", typeof (String));
170 createCol(assets, "Name", typeof(System.String)); 172 createCol(assets, "Name", typeof (String));
171 createCol(assets, "Description", typeof(System.String)); 173 createCol(assets, "Description", typeof (String));
172 createCol(assets, "Type", typeof(System.Int32)); 174 createCol(assets, "Type", typeof (Int32));
173 createCol(assets, "InvType", typeof(System.Int32)); 175 createCol(assets, "InvType", typeof (Int32));
174 createCol(assets, "Local", typeof(System.Boolean)); 176 createCol(assets, "Local", typeof (Boolean));
175 createCol(assets, "Temporary", typeof(System.Boolean)); 177 createCol(assets, "Temporary", typeof (Boolean));
176 createCol(assets, "Data", typeof(System.Byte[])); 178 createCol(assets, "Data", typeof (Byte[]));
177 // Add in contraints 179 // Add in contraints
178 assets.PrimaryKey = new DataColumn[] { assets.Columns["UUID"] }; 180 assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]};
179 return assets; 181 return assets;
180 } 182 }
181 183
182 /*********************************************************************** 184 /***********************************************************************
183 * 185 *
184 * Convert between ADO.NET <=> OpenSim Objects 186 * Convert between ADO.NET <=> OpenSim Objects
@@ -193,19 +195,19 @@ namespace OpenSim.Framework.Data.SQLite
193 // interesting has to be done to actually get these values 195 // interesting has to be done to actually get these values
194 // back out. Not enough time to figure it out yet. 196 // back out. Not enough time to figure it out yet.
195 AssetBase asset = new AssetBase(); 197 AssetBase asset = new AssetBase();
196 198
197 asset.FullID = new LLUUID((String)row["UUID"]); 199 asset.FullID = new LLUUID((String) row["UUID"]);
198 asset.Name = (String)row["Name"]; 200 asset.Name = (String) row["Name"];
199 asset.Description = (String)row["Description"]; 201 asset.Description = (String) row["Description"];
200 asset.Type = Convert.ToSByte(row["Type"]); 202 asset.Type = Convert.ToSByte(row["Type"]);
201 asset.InvType = Convert.ToSByte(row["InvType"]); 203 asset.InvType = Convert.ToSByte(row["InvType"]);
202 asset.Local = Convert.ToBoolean(row["Local"]); 204 asset.Local = Convert.ToBoolean(row["Local"]);
203 asset.Temporary = Convert.ToBoolean(row["Temporary"]); 205 asset.Temporary = Convert.ToBoolean(row["Temporary"]);
204 asset.Data = (byte[])row["Data"]; 206 asset.Data = (byte[]) row["Data"];
205 return asset; 207 return asset;
206 } 208 }
207 209
208 210
209 private void fillAssetRow(DataRow row, AssetBase asset) 211 private void fillAssetRow(DataRow row, AssetBase asset)
210 { 212 {
211 row["UUID"] = asset.FullID; 213 row["UUID"] = asset.FullID;
@@ -225,8 +227,10 @@ namespace OpenSim.Framework.Data.SQLite
225 row["Data"] = asset.Data; 227 row["Data"] = asset.Data;
226 228
227 // ADO.NET doesn't handle NULL very well 229 // ADO.NET doesn't handle NULL very well
228 foreach (DataColumn col in ds.Tables["assets"].Columns) { 230 foreach (DataColumn col in ds.Tables["assets"].Columns)
229 if (row[col] == null) { 231 {
232 if (row[col] == null)
233 {
230 row[col] = ""; 234 row[col] = "";
231 } 235 }
232 } 236 }
@@ -250,18 +254,18 @@ namespace OpenSim.Framework.Data.SQLite
250 da.UpdateCommand.Connection = conn; 254 da.UpdateCommand.Connection = conn;
251 255
252 SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID"); 256 SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID");
253 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 257 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
254 delete.Connection = conn; 258 delete.Connection = conn;
255 da.DeleteCommand = delete; 259 da.DeleteCommand = delete;
256 } 260 }
257 261
258 private void InitDB(SqliteConnection conn) 262 private void InitDB(SqliteConnection conn)
259 { 263 {
260 string createAssets = defineTable(createAssetsTable()); 264 string createAssets = defineTable(createAssetsTable());
261 SqliteCommand pcmd = new SqliteCommand(createAssets, conn); 265 SqliteCommand pcmd = new SqliteCommand(createAssets, conn);
262 conn.Open(); 266 conn.Open();
263 pcmd.ExecuteNonQuery(); 267 pcmd.ExecuteNonQuery();
264 conn.Close(); 268 conn.Close();
265 } 269 }
266 270
267 private bool TestTables(SqliteConnection conn) 271 private bool TestTables(SqliteConnection conn)
@@ -269,9 +273,12 @@ namespace OpenSim.Framework.Data.SQLite
269 SqliteCommand cmd = new SqliteCommand(assetSelect, conn); 273 SqliteCommand cmd = new SqliteCommand(assetSelect, conn);
270 SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); 274 SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
271 DataSet tmpDS = new DataSet(); 275 DataSet tmpDS = new DataSet();
272 try { 276 try
277 {
273 pDa.Fill(tmpDS, "assets"); 278 pDa.Fill(tmpDS, "assets");
274 } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { 279 }
280 catch (SqliteSyntaxException)
281 {
275 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 282 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
276 InitDB(conn); 283 InitDB(conn);
277 } 284 }
@@ -279,14 +286,18 @@ namespace OpenSim.Framework.Data.SQLite
279 } 286 }
280 287
281 #region IPlugin interface 288 #region IPlugin interface
282 public string Version { 289
290 public string Version
291 {
283 get 292 get
284 { 293 {
285 System.Reflection.Module module = this.GetType().Module; 294 Module module = GetType().Module;
286 string dllName = module.Assembly.ManifestModule.Name; 295 string dllName = module.Assembly.ManifestModule.Name;
287 Version dllVersion = module.Assembly.GetName().Version; 296 Version dllVersion = module.Assembly.GetName().Version;
288 297
289 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); 298 return
299 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
300 dllVersion.Revision);
290 } 301 }
291 } 302 }
292 303
@@ -295,9 +306,11 @@ namespace OpenSim.Framework.Data.SQLite
295 Initialise("AssetStorage.db", ""); 306 Initialise("AssetStorage.db", "");
296 } 307 }
297 308
298 public string Name { 309 public string Name
310 {
299 get { return "SQLite Asset storage engine"; } 311 get { return "SQLite Asset storage engine"; }
300 } 312 }
313
301 #endregion 314 #endregion
302 } 315 }
303} 316} \ 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using libsecondlife;
31using OpenSim.Framework;
32using System.Data; 29using System.Data;
33using System.Data.SqlTypes;
34using Mono.Data.SqliteClient; 30using Mono.Data.SqliteClient;
35using OpenSim.Framework.Console;
36 31
37namespace OpenSim.Framework.Data.SQLite 32namespace OpenSim.Framework.Data.SQLite
38{ 33{
@@ -48,8 +43,8 @@ namespace OpenSim.Framework.Data.SQLite
48 * This should be db agnostic as we define them in ADO.NET terms 43 * This should be db agnostic as we define them in ADO.NET terms
49 * 44 *
50 **********************************************************************/ 45 **********************************************************************/
51 46
52 protected static void createCol(DataTable dt, string name, System.Type type) 47 protected static void createCol(DataTable dt, string name, Type type)
53 { 48 {
54 DataColumn col = new DataColumn(name, type); 49 DataColumn col = new DataColumn(name, type);
55 dt.Columns.Add(col); 50 dt.Columns.Add(col);
@@ -77,7 +72,8 @@ namespace OpenSim.Framework.Data.SQLite
77 * generate these strings instead of typing them out. 72 * generate these strings instead of typing them out.
78 */ 73 */
79 string[] cols = new string[dt.Columns.Count]; 74 string[] cols = new string[dt.Columns.Count];
80 for (int i = 0; i < dt.Columns.Count; i++) { 75 for (int i = 0; i < dt.Columns.Count; i++)
76 {
81 DataColumn col = dt.Columns[i]; 77 DataColumn col = dt.Columns[i];
82 cols[i] = col.ColumnName; 78 cols[i] = col.ColumnName;
83 } 79 }
@@ -92,7 +88,7 @@ namespace OpenSim.Framework.Data.SQLite
92 88
93 // this provides the binding for all our parameters, so 89 // this provides the binding for all our parameters, so
94 // much less code than it used to be 90 // much less code than it used to be
95 foreach (DataColumn col in dt.Columns) 91 foreach (DataColumn col in dt.Columns)
96 { 92 {
97 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); 93 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
98 } 94 }
@@ -106,7 +102,8 @@ namespace OpenSim.Framework.Data.SQLite
106 foreach (DataColumn col in dt.Columns) 102 foreach (DataColumn col in dt.Columns)
107 { 103 {
108 if (subsql.Length > 0) 104 if (subsql.Length > 0)
109 { // a map function would rock so much here 105 {
106 // a map function would rock so much here
110 subsql += ", "; 107 subsql += ", ";
111 } 108 }
112 subsql += col.ColumnName + "= :" + col.ColumnName; 109 subsql += col.ColumnName + "= :" + col.ColumnName;
@@ -118,7 +115,7 @@ namespace OpenSim.Framework.Data.SQLite
118 // this provides the binding for all our parameters, so 115 // this provides the binding for all our parameters, so
119 // much less code than it used to be 116 // much less code than it used to be
120 117
121 foreach (DataColumn col in dt.Columns) 118 foreach (DataColumn col in dt.Columns)
122 { 119 {
123 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType)); 120 cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
124 } 121 }
@@ -133,11 +130,12 @@ namespace OpenSim.Framework.Data.SQLite
133 foreach (DataColumn col in dt.Columns) 130 foreach (DataColumn col in dt.Columns)
134 { 131 {
135 if (subsql.Length > 0) 132 if (subsql.Length > 0)
136 { // a map function would rock so much here 133 {
134 // a map function would rock so much here
137 subsql += ",\n"; 135 subsql += ",\n";
138 } 136 }
139 subsql += col.ColumnName + " " + sqliteType(col.DataType); 137 subsql += col.ColumnName + " " + sqliteType(col.DataType);
140 if(col == dt.PrimaryKey[0]) 138 if (col == dt.PrimaryKey[0])
141 { 139 {
142 subsql += " primary key"; 140 subsql += " primary key";
143 } 141 }
@@ -167,7 +165,7 @@ namespace OpenSim.Framework.Data.SQLite
167 /// for us. 165 /// for us.
168 ///</summary> 166 ///</summary>
169 ///<returns>a built sqlite parameter</returns> 167 ///<returns>a built sqlite parameter</returns>
170 protected static SqliteParameter createSqliteParameter(string name, System.Type type) 168 protected static SqliteParameter createSqliteParameter(string name, Type type)
171 { 169 {
172 SqliteParameter param = new SqliteParameter(); 170 SqliteParameter param = new SqliteParameter();
173 param.ParameterName = ":" + name; 171 param.ParameterName = ":" + name;
@@ -182,53 +180,87 @@ namespace OpenSim.Framework.Data.SQLite
182 * Type conversion functions 180 * Type conversion functions
183 * 181 *
184 **********************************************************************/ 182 **********************************************************************/
185 183
186 protected static DbType dbtypeFromType(Type type) 184 protected static DbType dbtypeFromType(Type type)
187 { 185 {
188 if (type == typeof(System.String)) { 186 if (type == typeof (String))
187 {
189 return DbType.String; 188 return DbType.String;
190 } else if (type == typeof(System.Int32)) { 189 }
190 else if (type == typeof (Int32))
191 {
191 return DbType.Int32; 192 return DbType.Int32;
192 } else if (type == typeof(System.UInt32)) { 193 }
194 else if (type == typeof (UInt32))
195 {
193 return DbType.UInt32; 196 return DbType.UInt32;
194 } else if (type == typeof(System.Int64)) { 197 }
198 else if (type == typeof (Int64))
199 {
195 return DbType.Int64; 200 return DbType.Int64;
196 } else if (type == typeof(System.UInt64)) { 201 }
202 else if (type == typeof (UInt64))
203 {
197 return DbType.UInt64; 204 return DbType.UInt64;
198 } else if (type == typeof(System.Double)) { 205 }
206 else if (type == typeof (Double))
207 {
199 return DbType.Double; 208 return DbType.Double;
200 } else if (type == typeof(System.Boolean)) { 209 }
210 else if (type == typeof (Boolean))
211 {
201 return DbType.Boolean; 212 return DbType.Boolean;
202 } else if (type == typeof(System.Byte[])) { 213 }
214 else if (type == typeof (Byte[]))
215 {
203 return DbType.Binary; 216 return DbType.Binary;
204 } else { 217 }
218 else
219 {
205 return DbType.String; 220 return DbType.String;
206 } 221 }
207 } 222 }
208 223
209 // this is something we'll need to implement for each db 224 // this is something we'll need to implement for each db
210 // slightly differently. 225 // slightly differently.
211 protected static string sqliteType(Type type) 226 protected static string sqliteType(Type type)
212 { 227 {
213 if (type == typeof(System.String)) { 228 if (type == typeof (String))
229 {
214 return "varchar(255)"; 230 return "varchar(255)";
215 } else if (type == typeof(System.Int32)) { 231 }
232 else if (type == typeof (Int32))
233 {
216 return "integer"; 234 return "integer";
217 } else if (type == typeof(System.UInt32)) { 235 }
236 else if (type == typeof (UInt32))
237 {
218 return "integer"; 238 return "integer";
219 } else if (type == typeof(System.Int64)) { 239 }
240 else if (type == typeof (Int64))
241 {
220 return "varchar(255)"; 242 return "varchar(255)";
221 } else if (type == typeof(System.UInt64)) { 243 }
244 else if (type == typeof (UInt64))
245 {
222 return "varchar(255)"; 246 return "varchar(255)";
223 } else if (type == typeof(System.Double)) { 247 }
248 else if (type == typeof (Double))
249 {
224 return "float"; 250 return "float";
225 } else if (type == typeof(System.Boolean)) { 251 }
252 else if (type == typeof (Boolean))
253 {
226 return "integer"; 254 return "integer";
227 } else if (type == typeof(System.Byte[])) { 255 }
256 else if (type == typeof (Byte[]))
257 {
228 return "blob"; 258 return "blob";
229 } else { 259 }
260 else
261 {
230 return "string"; 262 return "string";
231 } 263 }
232 } 264 }
233 } 265 }
234} 266} \ 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
192 return null; 192 return null;
193 } 193 }
194 } 194 }
195} 195} \ 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 @@
28 28
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Data;
32using System.Reflection; 32using System.Reflection;
33
34using OpenSim.Framework.Console;
35using OpenSim.Framework;
36using OpenSim.Framework;
37using libsecondlife; 33using libsecondlife;
38
39using System.Data;
40using System.Data.SqlTypes;
41
42using Mono.Data.SqliteClient; 34using Mono.Data.SqliteClient;
35using OpenSim.Framework.Console;
43 36
44namespace OpenSim.Framework.Data.SQLite 37namespace OpenSim.Framework.Data.SQLite
45{ 38{
46
47 public class SQLiteInventoryStore : SQLiteBase, IInventoryData 39 public class SQLiteInventoryStore : SQLiteBase, IInventoryData
48 { 40 {
49 private const string invItemsSelect = "select * from inventoryitems"; 41 private const string invItemsSelect = "select * from inventoryitems";
@@ -96,14 +88,14 @@ namespace OpenSim.Framework.Data.SQLite
96 public InventoryItemBase buildItem(DataRow row) 88 public InventoryItemBase buildItem(DataRow row)
97 { 89 {
98 InventoryItemBase item = new InventoryItemBase(); 90 InventoryItemBase item = new InventoryItemBase();
99 item.inventoryID = new LLUUID((string)row["UUID"]); 91 item.inventoryID = new LLUUID((string) row["UUID"]);
100 item.assetID = new LLUUID((string)row["assetID"]); 92 item.assetID = new LLUUID((string) row["assetID"]);
101 item.assetType = Convert.ToInt32(row["assetType"]); 93 item.assetType = Convert.ToInt32(row["assetType"]);
102 item.invType = Convert.ToInt32(row["invType"]); 94 item.invType = Convert.ToInt32(row["invType"]);
103 item.parentFolderID = new LLUUID((string)row["parentFolderID"]); 95 item.parentFolderID = new LLUUID((string) row["parentFolderID"]);
104 item.avatarID = new LLUUID((string)row["avatarID"]); 96 item.avatarID = new LLUUID((string) row["avatarID"]);
105 item.creatorsID = new LLUUID((string)row["creatorsID"]); 97 item.creatorsID = new LLUUID((string) row["creatorsID"]);
106 item.inventoryName =(string) row["inventoryName"]; 98 item.inventoryName = (string) row["inventoryName"];
107 item.inventoryDescription = (string) row["inventoryDescription"]; 99 item.inventoryDescription = (string) row["inventoryDescription"];
108 100
109 item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); 101 item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
@@ -147,7 +139,7 @@ namespace OpenSim.Framework.Data.SQLite
147 fillFolderRow(inventoryRow, folder); 139 fillFolderRow(inventoryRow, folder);
148 } 140 }
149 141
150 this.invFoldersDa.Update(ds, "inventoryfolders"); 142 invFoldersDa.Update(ds, "inventoryfolders");
151 } 143 }
152 144
153 private void addItem(InventoryItemBase item) 145 private void addItem(InventoryItemBase item)
@@ -165,7 +157,7 @@ namespace OpenSim.Framework.Data.SQLite
165 { 157 {
166 fillItemRow(inventoryRow, item); 158 fillItemRow(inventoryRow, item);
167 } 159 }
168 this.invItemsDa.Update(ds, "inventoryitems"); 160 invItemsDa.Update(ds, "inventoryitems");
169 } 161 }
170 162
171 public void Shutdown() 163 public void Shutdown()
@@ -195,12 +187,14 @@ namespace OpenSim.Framework.Data.SQLite
195 /// <returns>A string containing the plugin version</returns> 187 /// <returns>A string containing the plugin version</returns>
196 public string getVersion() 188 public string getVersion()
197 { 189 {
198 System.Reflection.Module module = this.GetType().Module; 190 Module module = GetType().Module;
199 string dllName = module.Assembly.ManifestModule.Name; 191 string dllName = module.Assembly.ManifestModule.Name;
200 Version dllVersion = module.Assembly.GetName().Version; 192 Version dllVersion = module.Assembly.GetName().Version;
201 193
202 194
203 return string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, dllVersion.Revision); 195 return
196 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
197 dllVersion.Revision);
204 } 198 }
205 199
206 /// <summary> 200 /// <summary>
@@ -306,7 +300,7 @@ namespace OpenSim.Framework.Data.SQLite
306 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 300 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
307 getInventoryFolders(ref folders, parentID); 301 getInventoryFolders(ref folders, parentID);
308 302
309 for(int i=0; i<folders.Count; i++) 303 for (int i = 0; i < folders.Count; i++)
310 getInventoryFolders(ref folders, folders[i].folderID); 304 getInventoryFolders(ref folders, folders[i].folderID);
311 305
312 return folders; 306 return folders;
@@ -320,9 +314,12 @@ namespace OpenSim.Framework.Data.SQLite
320 public InventoryItemBase getInventoryItem(LLUUID item) 314 public InventoryItemBase getInventoryItem(LLUUID item)
321 { 315 {
322 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); 316 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item);
323 if (row != null) { 317 if (row != null)
318 {
324 return buildItem(row); 319 return buildItem(row);
325 } else { 320 }
321 else
322 {
326 return null; 323 return null;
327 } 324 }
328 } 325 }
@@ -334,19 +331,21 @@ namespace OpenSim.Framework.Data.SQLite
334 /// <returns>A class containing folder information</returns> 331 /// <returns>A class containing folder information</returns>
335 public InventoryFolderBase getInventoryFolder(LLUUID folder) 332 public InventoryFolderBase getInventoryFolder(LLUUID folder)
336 { 333 {
337 334 // TODO: Deep voodoo here. If you enable this code then
338 // TODO: Deep voodoo here. If you enable this code then 335 // multi region breaks. No idea why, but I figured it was
339 // multi region breaks. No idea why, but I figured it was 336 // better to leave multi region at this point. It does mean
340 // better to leave multi region at this point. It does mean 337 // that you don't get to see system textures why creating
341 // that you don't get to see system textures why creating 338 // clothes and the like. :(
342 // clothes and the like. :( 339
343 340 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder);
344 DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder); 341 if (row != null)
345 if (row != null) { 342 {
346 return buildFolder(row); 343 return buildFolder(row);
347 } else { 344 }
345 else
346 {
348 return null; 347 return null;
349 } 348 }
350 } 349 }
351 350
352 /// <summary> 351 /// <summary>
@@ -355,7 +354,7 @@ namespace OpenSim.Framework.Data.SQLite
355 /// <param name="item">The item to be created</param> 354 /// <param name="item">The item to be created</param>
356 public void addInventoryItem(InventoryItemBase item) 355 public void addInventoryItem(InventoryItemBase item)
357 { 356 {
358 this.addItem(item); 357 addItem(item);
359 } 358 }
360 359
361 /// <summary> 360 /// <summary>
@@ -364,7 +363,7 @@ namespace OpenSim.Framework.Data.SQLite
364 /// <param name="item">The updated item</param> 363 /// <param name="item">The updated item</param>
365 public void updateInventoryItem(InventoryItemBase item) 364 public void updateInventoryItem(InventoryItemBase item)
366 { 365 {
367 this.addItem(item); 366 addItem(item);
368 } 367 }
369 368
370 /// <summary> 369 /// <summary>
@@ -376,12 +375,12 @@ namespace OpenSim.Framework.Data.SQLite
376 DataTable inventoryItemTable = ds.Tables["inventoryitems"]; 375 DataTable inventoryItemTable = ds.Tables["inventoryitems"];
377 376
378 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID); 377 DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID);
379 if (inventoryRow != null) 378 if (inventoryRow != null)
380 { 379 {
381 inventoryRow.Delete(); 380 inventoryRow.Delete();
382 } 381 }
383 382
384 this.invItemsDa.Update(ds, "inventoryitems"); 383 invItemsDa.Update(ds, "inventoryitems");
385 } 384 }
386 385
387 386
@@ -394,7 +393,7 @@ namespace OpenSim.Framework.Data.SQLite
394 { 393 {
395 List<InventoryItemBase> items = getInventoryInFolder(folderId); 394 List<InventoryItemBase> items = getInventoryInFolder(folderId);
396 395
397 foreach(InventoryItemBase i in items) 396 foreach (InventoryItemBase i in items)
398 deleteInventoryItem(i.inventoryID); 397 deleteInventoryItem(i.inventoryID);
399 } 398 }
400 399
@@ -404,7 +403,7 @@ namespace OpenSim.Framework.Data.SQLite
404 /// <param name="folder">The inventory folder</param> 403 /// <param name="folder">The inventory folder</param>
405 public void addInventoryFolder(InventoryFolderBase folder) 404 public void addInventoryFolder(InventoryFolderBase folder)
406 { 405 {
407 this.addFolder(folder); 406 addFolder(folder);
408 } 407 }
409 408
410 /// <summary> 409 /// <summary>
@@ -413,7 +412,7 @@ namespace OpenSim.Framework.Data.SQLite
413 /// <param name="folder">The inventory folder</param> 412 /// <param name="folder">The inventory folder</param>
414 public void updateInventoryFolder(InventoryFolderBase folder) 413 public void updateInventoryFolder(InventoryFolderBase folder)
415 { 414 {
416 this.addFolder(folder); 415 addFolder(folder);
417 } 416 }
418 417
419 418
@@ -427,7 +426,7 @@ namespace OpenSim.Framework.Data.SQLite
427 public void deleteInventoryFolder(LLUUID folderID) 426 public void deleteInventoryFolder(LLUUID folderID)
428 { 427 {
429 List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); 428 List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
430 429
431 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 430 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
432 DataRow inventoryRow; 431 DataRow inventoryRow;
433 432
@@ -450,7 +449,7 @@ namespace OpenSim.Framework.Data.SQLite
450 inventoryRow.Delete(); 449 inventoryRow.Delete();
451 } 450 }
452 451
453 this.invFoldersDa.Update(ds, "inventoryfolders"); 452 invFoldersDa.Update(ds, "inventoryfolders");
454 } 453 }
455 454
456 /*********************************************************************** 455 /***********************************************************************
@@ -458,43 +457,43 @@ namespace OpenSim.Framework.Data.SQLite
458 * Data Table definitions 457 * Data Table definitions
459 * 458 *
460 **********************************************************************/ 459 **********************************************************************/
461 460
462 private static DataTable createInventoryItemsTable() 461 private static DataTable createInventoryItemsTable()
463 { 462 {
464 DataTable inv = new DataTable("inventoryitems"); 463 DataTable inv = new DataTable("inventoryitems");
465 464
466 createCol(inv, "UUID", typeof(System.String)); //inventoryID 465 createCol(inv, "UUID", typeof (String)); //inventoryID
467 createCol(inv, "assetID", typeof(System.String)); 466 createCol(inv, "assetID", typeof (String));
468 createCol(inv, "assetType", typeof(System.Int32)); 467 createCol(inv, "assetType", typeof (Int32));
469 createCol(inv, "invType", typeof(System.Int32)); 468 createCol(inv, "invType", typeof (Int32));
470 createCol(inv, "parentFolderID", typeof(System.String)); 469 createCol(inv, "parentFolderID", typeof (String));
471 createCol(inv, "avatarID", typeof(System.String)); 470 createCol(inv, "avatarID", typeof (String));
472 createCol(inv, "creatorsID", typeof(System.String)); 471 createCol(inv, "creatorsID", typeof (String));
473 472
474 createCol(inv, "inventoryName", typeof(System.String)); 473 createCol(inv, "inventoryName", typeof (String));
475 createCol(inv, "inventoryDescription", typeof(System.String)); 474 createCol(inv, "inventoryDescription", typeof (String));
476 // permissions 475 // permissions
477 createCol(inv, "inventoryNextPermissions", typeof(System.Int32)); 476 createCol(inv, "inventoryNextPermissions", typeof (Int32));
478 createCol(inv, "inventoryCurrentPermissions", typeof(System.Int32)); 477 createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
479 createCol(inv, "inventoryBasePermissions", typeof(System.Int32)); 478 createCol(inv, "inventoryBasePermissions", typeof (Int32));
480 createCol(inv, "inventoryEveryOnePermissions", typeof(System.Int32)); 479 createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
481 480
482 inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] }; 481 inv.PrimaryKey = new DataColumn[] {inv.Columns["UUID"]};
483 return inv; 482 return inv;
484 } 483 }
485 484
486 private DataTable createInventoryFoldersTable() 485 private DataTable createInventoryFoldersTable()
487 { 486 {
488 DataTable fol = new DataTable("inventoryfolders"); 487 DataTable fol = new DataTable("inventoryfolders");
489 488
490 createCol(fol, "UUID", typeof(System.String)); //folderID 489 createCol(fol, "UUID", typeof (String)); //folderID
491 createCol(fol, "name", typeof(System.String)); 490 createCol(fol, "name", typeof (String));
492 createCol(fol, "agentID", typeof(System.String)); 491 createCol(fol, "agentID", typeof (String));
493 createCol(fol, "parentID", typeof(System.String)); 492 createCol(fol, "parentID", typeof (String));
494 createCol(fol, "type", typeof(System.Int32)); 493 createCol(fol, "type", typeof (Int32));
495 createCol(fol, "version", typeof(System.Int32)); 494 createCol(fol, "version", typeof (Int32));
496 495
497 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; 496 fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
498 return fol; 497 return fol;
499 } 498 }
500 499
@@ -507,7 +506,7 @@ namespace OpenSim.Framework.Data.SQLite
507 da.UpdateCommand.Connection = conn; 506 da.UpdateCommand.Connection = conn;
508 507
509 SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID"); 508 SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
510 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 509 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
511 delete.Connection = conn; 510 delete.Connection = conn;
512 da.DeleteCommand = delete; 511 da.DeleteCommand = delete;
513 } 512 }
@@ -521,7 +520,7 @@ namespace OpenSim.Framework.Data.SQLite
521 da.UpdateCommand.Connection = conn; 520 da.UpdateCommand.Connection = conn;
522 521
523 SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID"); 522 SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
524 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 523 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
525 delete.Connection = conn; 524 delete.Connection = conn;
526 da.DeleteCommand = delete; 525 da.DeleteCommand = delete;
527 } 526 }
@@ -529,10 +528,10 @@ namespace OpenSim.Framework.Data.SQLite
529 private InventoryFolderBase buildFolder(DataRow row) 528 private InventoryFolderBase buildFolder(DataRow row)
530 { 529 {
531 InventoryFolderBase folder = new InventoryFolderBase(); 530 InventoryFolderBase folder = new InventoryFolderBase();
532 folder.folderID = new LLUUID((string)row["UUID"]); 531 folder.folderID = new LLUUID((string) row["UUID"]);
533 folder.name = (string)row["name"]; 532 folder.name = (string) row["name"];
534 folder.agentID = new LLUUID((string)row["agentID"]); 533 folder.agentID = new LLUUID((string) row["agentID"]);
535 folder.parentID = new LLUUID((string)row["parentID"]); 534 folder.parentID = new LLUUID((string) row["parentID"]);
536 folder.type = Convert.ToInt16(row["type"]); 535 folder.type = Convert.ToInt16(row["type"]);
537 folder.version = Convert.ToUInt16(row["version"]); 536 folder.version = Convert.ToUInt16(row["version"]);
538 return folder; 537 return folder;
@@ -554,17 +553,18 @@ namespace OpenSim.Framework.Data.SQLite
554 * Test and Initialization code 553 * Test and Initialization code
555 * 554 *
556 **********************************************************************/ 555 **********************************************************************/
556
557 private void InitDB(SqliteConnection conn) 557 private void InitDB(SqliteConnection conn)
558 { 558 {
559 string createInventoryItems = defineTable(createInventoryItemsTable()); 559 string createInventoryItems = defineTable(createInventoryItemsTable());
560 string createInventoryFolders = defineTable(createInventoryFoldersTable()); 560 string createInventoryFolders = defineTable(createInventoryFoldersTable());
561 561
562 SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); 562 SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn);
563 SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); 563 SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn);
564 conn.Open(); 564 conn.Open();
565 pcmd.ExecuteNonQuery(); 565 pcmd.ExecuteNonQuery();
566 scmd.ExecuteNonQuery(); 566 scmd.ExecuteNonQuery();
567 conn.Close(); 567 conn.Close();
568 } 568 }
569 569
570 private bool TestTables(SqliteConnection conn) 570 private bool TestTables(SqliteConnection conn)
@@ -575,10 +575,13 @@ namespace OpenSim.Framework.Data.SQLite
575 SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd); 575 SqliteDataAdapter sDa = new SqliteDataAdapter(invFoldersSelectCmd);
576 576
577 DataSet tmpDS = new DataSet(); 577 DataSet tmpDS = new DataSet();
578 try { 578 try
579 {
579 pDa.Fill(tmpDS, "inventoryitems"); 580 pDa.Fill(tmpDS, "inventoryitems");
580 sDa.Fill(tmpDS, "inventoryfolders"); 581 sDa.Fill(tmpDS, "inventoryfolders");
581 } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { 582 }
583 catch (SqliteSyntaxException)
584 {
582 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 585 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
583 InitDB(conn); 586 InitDB(conn);
584 } 587 }
@@ -586,14 +589,18 @@ namespace OpenSim.Framework.Data.SQLite
586 pDa.Fill(tmpDS, "inventoryitems"); 589 pDa.Fill(tmpDS, "inventoryitems");
587 sDa.Fill(tmpDS, "inventoryfolders"); 590 sDa.Fill(tmpDS, "inventoryfolders");
588 591
589 foreach (DataColumn col in createInventoryItemsTable().Columns) { 592 foreach (DataColumn col in createInventoryItemsTable().Columns)
590 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName) ) { 593 {
594 if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName))
595 {
591 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); 596 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
592 return false; 597 return false;
593 } 598 }
594 } 599 }
595 foreach (DataColumn col in createInventoryFoldersTable().Columns) { 600 foreach (DataColumn col in createInventoryFoldersTable().Columns)
596 if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName) ) { 601 {
602 if (! tmpDS.Tables["inventoryfolders"].Columns.Contains(col.ColumnName))
603 {
597 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName); 604 MainLog.Instance.Verbose("DATASTORE", "Missing required column:" + col.ColumnName);
598 return false; 605 return false;
599 } 606 }
@@ -601,8 +608,4 @@ namespace OpenSim.Framework.Data.SQLite
601 return true; 608 return true;
602 } 609 }
603 } 610 }
604} 611} \ No newline at end of file
605
606
607
608
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;
30using System.Data; 30using System.Data;
31using System.Data.SQLite; 31using System.Data.SQLite;
32using libsecondlife; 32using libsecondlife;
33using Mono.Data.SqliteClient;
33using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;
34 35
35namespace OpenSim.Framework.Data.SQLite 36namespace OpenSim.Framework.Data.SQLite
36{ 37{
37 class SQLiteManager : SQLiteBase 38 internal class SQLiteManager : SQLiteBase
38 { 39 {
39 IDbConnection dbcon; 40 private IDbConnection dbcon;
40 41
41 /// <summary> 42 /// <summary>
42 /// Initialises and creates a new SQLite connection and maintains it. 43 /// Initialises and creates a new SQLite connection and maintains it.
@@ -78,15 +79,15 @@ namespace OpenSim.Framework.Data.SQLite
78 /// <returns>A SQLite DB Command</returns> 79 /// <returns>A SQLite DB Command</returns>
79 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 80 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
80 { 81 {
81 SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); 82 SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
82 dbcommand.CommandText = sql; 83 dbcommand.CommandText = sql;
83 foreach (KeyValuePair<string, string> param in parameters) 84 foreach (KeyValuePair<string, string> param in parameters)
84 { 85 {
85 SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); 86 SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
86 dbcommand.Parameters.Add(paramx); 87 dbcommand.Parameters.Add(paramx);
87 } 88 }
88 89
89 return (IDbCommand)dbcommand; 90 return (IDbCommand) dbcommand;
90 } 91 }
91 92
92 private bool TestTables(SQLiteConnection conn) 93 private bool TestTables(SQLiteConnection conn)
@@ -98,7 +99,7 @@ namespace OpenSim.Framework.Data.SQLite
98 { 99 {
99 pDa.Fill(tmpDS, "regions"); 100 pDa.Fill(tmpDS, "regions");
100 } 101 }
101 catch (Mono.Data.SqliteClient.SqliteSyntaxException) 102 catch (SqliteSyntaxException)
102 { 103 {
103 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 104 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
104 InitDB(conn); 105 InitDB(conn);
@@ -110,39 +111,39 @@ namespace OpenSim.Framework.Data.SQLite
110 { 111 {
111 DataTable regions = new DataTable("regions"); 112 DataTable regions = new DataTable("regions");
112 113
113 createCol(regions, "regionHandle", typeof(ulong)); 114 createCol(regions, "regionHandle", typeof (ulong));
114 createCol(regions, "regionName", typeof(System.String)); 115 createCol(regions, "regionName", typeof (String));
115 createCol(regions, "uuid", typeof(System.String)); 116 createCol(regions, "uuid", typeof (String));
116 117
117 createCol(regions, "regionRecvKey", typeof(System.String)); 118 createCol(regions, "regionRecvKey", typeof (String));
118 createCol(regions, "regionSecret", typeof(System.String)); 119 createCol(regions, "regionSecret", typeof (String));
119 createCol(regions, "regionSendKey", typeof(System.String)); 120 createCol(regions, "regionSendKey", typeof (String));
120 121
121 createCol(regions, "regionDataURI", typeof(System.String)); 122 createCol(regions, "regionDataURI", typeof (String));
122 createCol(regions, "serverIP", typeof(System.String)); 123 createCol(regions, "serverIP", typeof (String));
123 createCol(regions, "serverPort", typeof(System.String)); 124 createCol(regions, "serverPort", typeof (String));
124 createCol(regions, "serverURI", typeof(System.String)); 125 createCol(regions, "serverURI", typeof (String));
125 126
126 127
127 createCol(regions, "locX", typeof( uint)); 128 createCol(regions, "locX", typeof (uint));
128 createCol(regions, "locY", typeof( uint)); 129 createCol(regions, "locY", typeof (uint));
129 createCol(regions, "locZ", typeof( uint)); 130 createCol(regions, "locZ", typeof (uint));
130 131
131 createCol(regions, "eastOverrideHandle", typeof( ulong )); 132 createCol(regions, "eastOverrideHandle", typeof (ulong));
132 createCol(regions, "westOverrideHandle", typeof( ulong )); 133 createCol(regions, "westOverrideHandle", typeof (ulong));
133 createCol(regions, "southOverrideHandle", typeof( ulong )); 134 createCol(regions, "southOverrideHandle", typeof (ulong));
134 createCol(regions, "northOverrideHandle", typeof( ulong )); 135 createCol(regions, "northOverrideHandle", typeof (ulong));
135 136
136 createCol(regions, "regionAssetURI", typeof(System.String)); 137 createCol(regions, "regionAssetURI", typeof (String));
137 createCol(regions, "regionAssetRecvKey", typeof(System.String)); 138 createCol(regions, "regionAssetRecvKey", typeof (String));
138 createCol(regions, "regionAssetSendKey", typeof(System.String)); 139 createCol(regions, "regionAssetSendKey", typeof (String));
139 140
140 createCol(regions, "regionUserURI", typeof(System.String)); 141 createCol(regions, "regionUserURI", typeof (String));
141 createCol(regions, "regionUserRecvKey", typeof(System.String)); 142 createCol(regions, "regionUserRecvKey", typeof (String));
142 createCol(regions, "regionUserSendKey", typeof(System.String)); 143 createCol(regions, "regionUserSendKey", typeof (String));
143 144
144 // Add in contraints 145 // Add in contraints
145 regions.PrimaryKey = new DataColumn[] { regions.Columns["UUID"] }; 146 regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
146 return regions; 147 return regions;
147 } 148 }
148 149
@@ -168,42 +169,42 @@ namespace OpenSim.Framework.Data.SQLite
168 if (reader.Read()) 169 if (reader.Read())
169 { 170 {
170 // Region Main 171 // Region Main
171 retval.regionHandle = (ulong)reader["regionHandle"]; 172 retval.regionHandle = (ulong) reader["regionHandle"];
172 retval.regionName = (string)reader["regionName"]; 173 retval.regionName = (string) reader["regionName"];
173 retval.UUID = new LLUUID((string)reader["uuid"]); 174 retval.UUID = new LLUUID((string) reader["uuid"]);
174 175
175 // Secrets 176 // Secrets
176 retval.regionRecvKey = (string)reader["regionRecvKey"]; 177 retval.regionRecvKey = (string) reader["regionRecvKey"];
177 retval.regionSecret = (string)reader["regionSecret"]; 178 retval.regionSecret = (string) reader["regionSecret"];
178 retval.regionSendKey = (string)reader["regionSendKey"]; 179 retval.regionSendKey = (string) reader["regionSendKey"];
179 180
180 // Region Server 181 // Region Server
181 retval.regionDataURI = (string)reader["regionDataURI"]; 182 retval.regionDataURI = (string) reader["regionDataURI"];
182 retval.regionOnline = false; // Needs to be pinged before this can be set. 183 retval.regionOnline = false; // Needs to be pinged before this can be set.
183 retval.serverIP = (string)reader["serverIP"]; 184 retval.serverIP = (string) reader["serverIP"];
184 retval.serverPort = (uint)reader["serverPort"]; 185 retval.serverPort = (uint) reader["serverPort"];
185 retval.serverURI = (string)reader["serverURI"]; 186 retval.serverURI = (string) reader["serverURI"];
186 187
187 // Location 188 // Location
188 retval.regionLocX = (uint)((int)reader["locX"]); 189 retval.regionLocX = (uint) ((int) reader["locX"]);
189 retval.regionLocY = (uint)((int)reader["locY"]); 190 retval.regionLocY = (uint) ((int) reader["locY"]);
190 retval.regionLocZ = (uint)((int)reader["locZ"]); 191 retval.regionLocZ = (uint) ((int) reader["locZ"]);
191 192
192 // Neighbours - 0 = No Override 193 // Neighbours - 0 = No Override
193 retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; 194 retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
194 retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; 195 retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
195 retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; 196 retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
196 retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; 197 retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
197 198
198 // Assets 199 // Assets
199 retval.regionAssetURI = (string)reader["regionAssetURI"]; 200 retval.regionAssetURI = (string) reader["regionAssetURI"];
200 retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 201 retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
201 retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 202 retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
202 203
203 // Userserver 204 // Userserver
204 retval.regionUserURI = (string)reader["regionUserURI"]; 205 retval.regionUserURI = (string) reader["regionUserURI"];
205 retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 206 retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
206 retval.regionUserSendKey = (string)reader["regionUserSendKey"]; 207 retval.regionUserSendKey = (string) reader["regionUserSendKey"];
207 } 208 }
208 else 209 else
209 { 210 {
@@ -219,12 +220,15 @@ namespace OpenSim.Framework.Data.SQLite
219 /// <returns>Success?</returns> 220 /// <returns>Success?</returns>
220 public bool insertRow(RegionProfileData profile) 221 public bool insertRow(RegionProfileData profile)
221 { 222 {
222 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 223 string sql =
223 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 224 "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
225 sql +=
226 "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
224 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; 227 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
225 228
226 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 229 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
227 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 230 sql +=
231 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
228 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; 232 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
229 233
230 Dictionary<string, string> parameters = new Dictionary<string, string>(); 234 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -271,4 +275,4 @@ namespace OpenSim.Framework.Data.SQLite
271 return returnval; 275 return returnval;
272 } 276 }
273 } 277 }
274} 278} \ 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.IO;
30using libsecondlife;
31using OpenSim.Framework;
32using OpenSim.Framework;
33using System.Data; 29using System.Data;
34using System.Data.SqlTypes; 30using libsecondlife;
35using Mono.Data.SqliteClient; 31using Mono.Data.SqliteClient;
36using OpenSim.Framework.Console; 32using OpenSim.Framework.Console;
37 33
@@ -45,30 +41,31 @@ namespace OpenSim.Framework.Data.SQLite
45 /// <summary> 41 /// <summary>
46 /// The database manager 42 /// The database manager
47 /// </summary> 43 /// </summary>
48
49 /// <summary> 44 /// <summary>
50 /// Artificial constructor called upon plugin load 45 /// Artificial constructor called upon plugin load
51 /// </summary> 46 /// </summary>
52 private const string userSelect = "select * from users"; 47 private const string userSelect = "select * from users";
48
53 private DataSet ds; 49 private DataSet ds;
54 private SqliteDataAdapter da; 50 private SqliteDataAdapter da;
55 51
56 public void Initialise() 52 public void Initialise()
57 { 53 {
58 SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); 54 SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3");
59 TestTables(conn); 55 TestTables(conn);
60 56
61 ds = new DataSet(); 57 ds = new DataSet();
62 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); 58 da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
63 59
64 lock (ds) { 60 lock (ds)
61 {
65 ds.Tables.Add(createUsersTable()); 62 ds.Tables.Add(createUsersTable());
66 ds.Tables.Add(createUserAgentsTable()); 63 ds.Tables.Add(createUserAgentsTable());
67 64
68 setupUserCommands(da, conn); 65 setupUserCommands(da, conn);
69 da.Fill(ds.Tables["users"]); 66 da.Fill(ds.Tables["users"]);
70 } 67 }
71 68
72 return; 69 return;
73 } 70 }
74 71
@@ -79,16 +76,21 @@ namespace OpenSim.Framework.Data.SQLite
79 /// <returns>A user profile</returns> 76 /// <returns>A user profile</returns>
80 public UserProfileData GetUserByUUID(LLUUID uuid) 77 public UserProfileData GetUserByUUID(LLUUID uuid)
81 { 78 {
82 lock (ds) { 79 lock (ds)
80 {
83 DataRow row = ds.Tables["users"].Rows.Find(uuid); 81 DataRow row = ds.Tables["users"].Rows.Find(uuid);
84 if(row != null) { 82 if (row != null)
83 {
85 UserProfileData user = buildUserProfile(row); 84 UserProfileData user = buildUserProfile(row);
86 row = ds.Tables["useragents"].Rows.Find(uuid); 85 row = ds.Tables["useragents"].Rows.Find(uuid);
87 if(row != null) { 86 if (row != null)
87 {
88 user.currentAgent = buildUserAgent(row); 88 user.currentAgent = buildUserAgent(row);
89 } 89 }
90 return user; 90 return user;
91 } else { 91 }
92 else
93 {
92 return null; 94 return null;
93 } 95 }
94 } 96 }
@@ -113,16 +115,21 @@ namespace OpenSim.Framework.Data.SQLite
113 public UserProfileData GetUserByName(string fname, string lname) 115 public UserProfileData GetUserByName(string fname, string lname)
114 { 116 {
115 string select = "surname = '" + lname + "' and username = '" + fname + "'"; 117 string select = "surname = '" + lname + "' and username = '" + fname + "'";
116 lock (ds) { 118 lock (ds)
119 {
117 DataRow[] rows = ds.Tables["users"].Select(select); 120 DataRow[] rows = ds.Tables["users"].Select(select);
118 if(rows.Length > 0) { 121 if (rows.Length > 0)
122 {
119 UserProfileData user = buildUserProfile(rows[0]); 123 UserProfileData user = buildUserProfile(rows[0]);
120 DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID); 124 DataRow row = ds.Tables["useragents"].Rows.Find(user.UUID);
121 if(row != null) { 125 if (row != null)
126 {
122 user.currentAgent = buildUserAgent(row); 127 user.currentAgent = buildUserAgent(row);
123 } 128 }
124 return user; 129 return user;
125 } else { 130 }
131 else
132 {
126 return null; 133 return null;
127 } 134 }
128 } 135 }
@@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data.SQLite
134 /// <param name="uuid">The users account ID</param> 141 /// <param name="uuid">The users account ID</param>
135 /// <returns>A matching users profile</returns> 142 /// <returns>A matching users profile</returns>
136 public UserAgentData GetAgentByUUID(LLUUID uuid) 143 public UserAgentData GetAgentByUUID(LLUUID uuid)
137 { 144 {
138 try 145 try
139 { 146 {
140 return GetUserByUUID(uuid).currentAgent; 147 return GetUserByUUID(uuid).currentAgent;
@@ -165,7 +172,7 @@ namespace OpenSim.Framework.Data.SQLite
165 { 172 {
166 try 173 try
167 { 174 {
168 return GetUserByName(fname,lname).currentAgent; 175 return GetUserByName(fname, lname).currentAgent;
169 } 176 }
170 catch (Exception) 177 catch (Exception)
171 { 178 {
@@ -180,8 +187,9 @@ namespace OpenSim.Framework.Data.SQLite
180 public void AddNewUserProfile(UserProfileData user) 187 public void AddNewUserProfile(UserProfileData user)
181 { 188 {
182 DataTable users = ds.Tables["users"]; 189 DataTable users = ds.Tables["users"];
183 lock (ds) { 190 lock (ds)
184 DataRow row = users.Rows.Find(user.UUID); 191 {
192 DataRow row = users.Rows.Find(user.UUID);
185 if (row == null) 193 if (row == null)
186 { 194 {
187 row = users.NewRow(); 195 row = users.NewRow();
@@ -192,10 +200,11 @@ namespace OpenSim.Framework.Data.SQLite
192 { 200 {
193 fillUserRow(row, user); 201 fillUserRow(row, user);
194 } 202 }
195 203
196 if(user.currentAgent != null) { 204 if (user.currentAgent != null)
205 {
197 DataTable ua = ds.Tables["useragents"]; 206 DataTable ua = ds.Tables["useragents"];
198 row = ua.Rows.Find(user.UUID); 207 row = ua.Rows.Find(user.UUID);
199 if (row == null) 208 if (row == null)
200 { 209 {
201 row = ua.NewRow(); 210 row = ua.NewRow();
@@ -207,12 +216,13 @@ namespace OpenSim.Framework.Data.SQLite
207 fillUserAgentRow(row, user.currentAgent); 216 fillUserAgentRow(row, user.currentAgent);
208 } 217 }
209 } 218 }
210 MainLog.Instance.Verbose("SQLITE", "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored"); 219 MainLog.Instance.Verbose("SQLITE",
220 "Syncing user database: " + ds.Tables["users"].Rows.Count + " users stored");
211 // save changes off to disk 221 // save changes off to disk
212 da.Update(ds, "users"); 222 da.Update(ds, "users");
213 } 223 }
214 } 224 }
215 225
216 /// <summary> 226 /// <summary>
217 /// Creates a new user profile 227 /// Creates a new user profile
218 /// </summary> 228 /// </summary>
@@ -220,10 +230,13 @@ namespace OpenSim.Framework.Data.SQLite
220 /// <returns>True on success, false on error</returns> 230 /// <returns>True on success, false on error</returns>
221 public bool UpdateUserProfile(UserProfileData user) 231 public bool UpdateUserProfile(UserProfileData user)
222 { 232 {
223 try { 233 try
234 {
224 AddNewUserProfile(user); 235 AddNewUserProfile(user);
225 return true; 236 return true;
226 } catch (Exception) { 237 }
238 catch (Exception)
239 {
227 return false; 240 return false;
228 } 241 }
229 } 242 }
@@ -279,51 +292,51 @@ namespace OpenSim.Framework.Data.SQLite
279 { 292 {
280 return "0.1"; 293 return "0.1";
281 } 294 }
282 295
283 /*********************************************************************** 296 /***********************************************************************
284 * 297 *
285 * DataTable creation 298 * DataTable creation
286 * 299 *
287 **********************************************************************/ 300 **********************************************************************/
288 /*********************************************************************** 301 /***********************************************************************
289 * 302 *
290 * Database Definition Functions 303 * Database Definition Functions
291 * 304 *
292 * This should be db agnostic as we define them in ADO.NET terms 305 * This should be db agnostic as we define them in ADO.NET terms
293 * 306 *
294 **********************************************************************/ 307 **********************************************************************/
295 308
296 private DataTable createUsersTable() 309 private DataTable createUsersTable()
297 { 310 {
298 DataTable users = new DataTable("users"); 311 DataTable users = new DataTable("users");
299 312
300 createCol(users, "UUID", typeof(System.String)); 313 createCol(users, "UUID", typeof (String));
301 createCol(users, "username", typeof(System.String)); 314 createCol(users, "username", typeof (String));
302 createCol(users, "surname", typeof(System.String)); 315 createCol(users, "surname", typeof (String));
303 createCol(users, "passwordHash", typeof(System.String)); 316 createCol(users, "passwordHash", typeof (String));
304 createCol(users, "passwordSalt", typeof(System.String)); 317 createCol(users, "passwordSalt", typeof (String));
305 318
306 createCol(users, "homeRegionX", typeof(System.Int32)); 319 createCol(users, "homeRegionX", typeof (Int32));
307 createCol(users, "homeRegionY", typeof(System.Int32)); 320 createCol(users, "homeRegionY", typeof (Int32));
308 createCol(users, "homeLocationX", typeof(System.Double)); 321 createCol(users, "homeLocationX", typeof (Double));
309 createCol(users, "homeLocationY", typeof(System.Double)); 322 createCol(users, "homeLocationY", typeof (Double));
310 createCol(users, "homeLocationZ", typeof(System.Double)); 323 createCol(users, "homeLocationZ", typeof (Double));
311 createCol(users, "homeLookAtX", typeof(System.Double)); 324 createCol(users, "homeLookAtX", typeof (Double));
312 createCol(users, "homeLookAtY", typeof(System.Double)); 325 createCol(users, "homeLookAtY", typeof (Double));
313 createCol(users, "homeLookAtZ", typeof(System.Double)); 326 createCol(users, "homeLookAtZ", typeof (Double));
314 createCol(users, "created", typeof(System.Int32)); 327 createCol(users, "created", typeof (Int32));
315 createCol(users, "lastLogin", typeof(System.Int32)); 328 createCol(users, "lastLogin", typeof (Int32));
316 createCol(users, "rootInventoryFolderID", typeof(System.String)); 329 createCol(users, "rootInventoryFolderID", typeof (String));
317 createCol(users, "userInventoryURI", typeof(System.String)); 330 createCol(users, "userInventoryURI", typeof (String));
318 createCol(users, "userAssetURI", typeof(System.String)); 331 createCol(users, "userAssetURI", typeof (String));
319 createCol(users, "profileCanDoMask", typeof(System.Int32)); 332 createCol(users, "profileCanDoMask", typeof (Int32));
320 createCol(users, "profileWantDoMask", typeof(System.Int32)); 333 createCol(users, "profileWantDoMask", typeof (Int32));
321 createCol(users, "profileAboutText", typeof(System.String)); 334 createCol(users, "profileAboutText", typeof (String));
322 createCol(users, "profileFirstText", typeof(System.String)); 335 createCol(users, "profileFirstText", typeof (String));
323 createCol(users, "profileImage", typeof(System.String)); 336 createCol(users, "profileImage", typeof (String));
324 createCol(users, "profileFirstImage", typeof(System.String)); 337 createCol(users, "profileFirstImage", typeof (String));
325 // Add in contraints 338 // Add in contraints
326 users.PrimaryKey = new DataColumn[] { users.Columns["UUID"] }; 339 users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
327 return users; 340 return users;
328 } 341 }
329 342
@@ -331,27 +344,27 @@ namespace OpenSim.Framework.Data.SQLite
331 { 344 {
332 DataTable ua = new DataTable("useragents"); 345 DataTable ua = new DataTable("useragents");
333 // this is the UUID of the user 346 // this is the UUID of the user
334 createCol(ua, "UUID", typeof(System.String)); 347 createCol(ua, "UUID", typeof (String));
335 createCol(ua, "agentIP", typeof(System.String)); 348 createCol(ua, "agentIP", typeof (String));
336 createCol(ua, "agentPort", typeof(System.Int32)); 349 createCol(ua, "agentPort", typeof (Int32));
337 createCol(ua, "agentOnline", typeof(System.Boolean)); 350 createCol(ua, "agentOnline", typeof (Boolean));
338 createCol(ua, "sessionID", typeof(System.String)); 351 createCol(ua, "sessionID", typeof (String));
339 createCol(ua, "secureSessionID", typeof(System.String)); 352 createCol(ua, "secureSessionID", typeof (String));
340 createCol(ua, "regionID", typeof(System.String)); 353 createCol(ua, "regionID", typeof (String));
341 createCol(ua, "loginTime", typeof(System.Int32)); 354 createCol(ua, "loginTime", typeof (Int32));
342 createCol(ua, "logoutTime", typeof(System.Int32)); 355 createCol(ua, "logoutTime", typeof (Int32));
343 createCol(ua, "currentRegion", typeof(System.String)); 356 createCol(ua, "currentRegion", typeof (String));
344 createCol(ua, "currentHandle", typeof(System.Int32)); 357 createCol(ua, "currentHandle", typeof (Int32));
345 // vectors 358 // vectors
346 createCol(ua, "currentPosX", typeof(System.Double)); 359 createCol(ua, "currentPosX", typeof (Double));
347 createCol(ua, "currentPosY", typeof(System.Double)); 360 createCol(ua, "currentPosY", typeof (Double));
348 createCol(ua, "currentPosZ", typeof(System.Double)); 361 createCol(ua, "currentPosZ", typeof (Double));
349 // constraints 362 // constraints
350 ua.PrimaryKey = new DataColumn[] { ua.Columns["UUID"] }; 363 ua.PrimaryKey = new DataColumn[] {ua.Columns["UUID"]};
351 364
352 return ua; 365 return ua;
353 } 366 }
354 367
355 /*********************************************************************** 368 /***********************************************************************
356 * 369 *
357 * Convert between ADO.NET <=> OpenSim Objects 370 * Convert between ADO.NET <=> OpenSim Objects
@@ -366,35 +379,35 @@ namespace OpenSim.Framework.Data.SQLite
366 // interesting has to be done to actually get these values 379 // interesting has to be done to actually get these values
367 // back out. Not enough time to figure it out yet. 380 // back out. Not enough time to figure it out yet.
368 UserProfileData user = new UserProfileData(); 381 UserProfileData user = new UserProfileData();
369 user.UUID = new LLUUID((String)row["UUID"]); 382 user.UUID = new LLUUID((String) row["UUID"]);
370 user.username = (String)row["username"]; 383 user.username = (String) row["username"];
371 user.surname = (String)row["surname"]; 384 user.surname = (String) row["surname"];
372 user.passwordHash = (String)row["passwordHash"]; 385 user.passwordHash = (String) row["passwordHash"];
373 user.passwordSalt = (String)row["passwordSalt"]; 386 user.passwordSalt = (String) row["passwordSalt"];
374 387
375 user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]); 388 user.homeRegionX = Convert.ToUInt32(row["homeRegionX"]);
376 user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]); 389 user.homeRegionY = Convert.ToUInt32(row["homeRegionY"]);
377 user.homeLocation = new LLVector3( 390 user.homeLocation = new LLVector3(
378 Convert.ToSingle(row["homeLocationX"]), 391 Convert.ToSingle(row["homeLocationX"]),
379 Convert.ToSingle(row["homeLocationY"]), 392 Convert.ToSingle(row["homeLocationY"]),
380 Convert.ToSingle(row["homeLocationZ"]) 393 Convert.ToSingle(row["homeLocationZ"])
381 ); 394 );
382 user.homeLookAt = new LLVector3( 395 user.homeLookAt = new LLVector3(
383 Convert.ToSingle(row["homeLookAtX"]), 396 Convert.ToSingle(row["homeLookAtX"]),
384 Convert.ToSingle(row["homeLookAtY"]), 397 Convert.ToSingle(row["homeLookAtY"]),
385 Convert.ToSingle(row["homeLookAtZ"]) 398 Convert.ToSingle(row["homeLookAtZ"])
386 ); 399 );
387 user.created = Convert.ToInt32(row["created"]); 400 user.created = Convert.ToInt32(row["created"]);
388 user.lastLogin = Convert.ToInt32(row["lastLogin"]); 401 user.lastLogin = Convert.ToInt32(row["lastLogin"]);
389 user.rootInventoryFolderID = new LLUUID((String)row["rootInventoryFolderID"]); 402 user.rootInventoryFolderID = new LLUUID((String) row["rootInventoryFolderID"]);
390 user.userInventoryURI = (String)row["userInventoryURI"]; 403 user.userInventoryURI = (String) row["userInventoryURI"];
391 user.userAssetURI = (String)row["userAssetURI"]; 404 user.userAssetURI = (String) row["userAssetURI"];
392 user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]); 405 user.profileCanDoMask = Convert.ToUInt32(row["profileCanDoMask"]);
393 user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]); 406 user.profileWantDoMask = Convert.ToUInt32(row["profileWantDoMask"]);
394 user.profileAboutText = (String)row["profileAboutText"]; 407 user.profileAboutText = (String) row["profileAboutText"];
395 user.profileFirstText = (String)row["profileFirstText"]; 408 user.profileFirstText = (String) row["profileFirstText"];
396 user.profileImage = new LLUUID((String)row["profileImage"]); 409 user.profileImage = new LLUUID((String) row["profileImage"]);
397 user.profileFirstImage = new LLUUID((String)row["profileFirstImage"]); 410 user.profileFirstImage = new LLUUID((String) row["profileFirstImage"]);
398 return user; 411 return user;
399 } 412 }
400 413
@@ -405,8 +418,8 @@ namespace OpenSim.Framework.Data.SQLite
405 row["surname"] = user.surname; 418 row["surname"] = user.surname;
406 row["passwordHash"] = user.passwordHash; 419 row["passwordHash"] = user.passwordHash;
407 row["passwordSalt"] = user.passwordSalt; 420 row["passwordSalt"] = user.passwordSalt;
408 421
409 422
410 row["homeRegionX"] = user.homeRegionX; 423 row["homeRegionX"] = user.homeRegionX;
411 row["homeRegionY"] = user.homeRegionY; 424 row["homeRegionY"] = user.homeRegionY;
412 row["homeLocationX"] = user.homeLocation.X; 425 row["homeLocationX"] = user.homeLocation.X;
@@ -427,10 +440,12 @@ namespace OpenSim.Framework.Data.SQLite
427 row["profileFirstText"] = user.profileFirstText; 440 row["profileFirstText"] = user.profileFirstText;
428 row["profileImage"] = user.profileImage; 441 row["profileImage"] = user.profileImage;
429 row["profileFirstImage"] = user.profileFirstImage; 442 row["profileFirstImage"] = user.profileFirstImage;
430 443
431 // ADO.NET doesn't handle NULL very well 444 // ADO.NET doesn't handle NULL very well
432 foreach (DataColumn col in ds.Tables["users"].Columns) { 445 foreach (DataColumn col in ds.Tables["users"].Columns)
433 if (row[col] == null) { 446 {
447 if (row[col] == null)
448 {
434 row[col] = ""; 449 row[col] = "";
435 } 450 }
436 } 451 }
@@ -439,33 +454,33 @@ namespace OpenSim.Framework.Data.SQLite
439 private UserAgentData buildUserAgent(DataRow row) 454 private UserAgentData buildUserAgent(DataRow row)
440 { 455 {
441 UserAgentData ua = new UserAgentData(); 456 UserAgentData ua = new UserAgentData();
442 457
443 ua.UUID = new LLUUID((String)row["UUID"]); 458 ua.UUID = new LLUUID((String) row["UUID"]);
444 ua.agentIP = (String)row["agentIP"]; 459 ua.agentIP = (String) row["agentIP"];
445 ua.agentPort = Convert.ToUInt32(row["agentPort"]); 460 ua.agentPort = Convert.ToUInt32(row["agentPort"]);
446 ua.agentOnline = Convert.ToBoolean(row["agentOnline"]); 461 ua.agentOnline = Convert.ToBoolean(row["agentOnline"]);
447 ua.sessionID = new LLUUID((String)row["sessionID"]); 462 ua.sessionID = new LLUUID((String) row["sessionID"]);
448 ua.secureSessionID = new LLUUID((String)row["secureSessionID"]); 463 ua.secureSessionID = new LLUUID((String) row["secureSessionID"]);
449 ua.regionID = new LLUUID((String)row["regionID"]); 464 ua.regionID = new LLUUID((String) row["regionID"]);
450 ua.loginTime = Convert.ToInt32(row["loginTime"]); 465 ua.loginTime = Convert.ToInt32(row["loginTime"]);
451 ua.logoutTime = Convert.ToInt32(row["logoutTime"]); 466 ua.logoutTime = Convert.ToInt32(row["logoutTime"]);
452 ua.currentRegion = new LLUUID((String)row["currentRegion"]); 467 ua.currentRegion = new LLUUID((String) row["currentRegion"]);
453 ua.currentHandle = Convert.ToUInt32(row["currentHandle"]); 468 ua.currentHandle = Convert.ToUInt32(row["currentHandle"]);
454 ua.currentPos = new LLVector3( 469 ua.currentPos = new LLVector3(
455 Convert.ToSingle(row["currentPosX"]), 470 Convert.ToSingle(row["currentPosX"]),
456 Convert.ToSingle(row["currentPosY"]), 471 Convert.ToSingle(row["currentPosY"]),
457 Convert.ToSingle(row["currentPosZ"]) 472 Convert.ToSingle(row["currentPosZ"])
458 ); 473 );
459 return ua; 474 return ua;
460 } 475 }
461 476
462 private void fillUserAgentRow(DataRow row, UserAgentData ua) 477 private void fillUserAgentRow(DataRow row, UserAgentData ua)
463 { 478 {
464 row["UUID"] = ua.UUID; 479 row["UUID"] = ua.UUID;
465 row["agentIP"] = ua.agentIP; 480 row["agentIP"] = ua.agentIP;
466 row["agentPort"] = ua.agentPort; 481 row["agentPort"] = ua.agentPort;
467 row["agentOnline"] = ua.agentOnline; 482 row["agentOnline"] = ua.agentOnline;
468 row["sessionID"] = ua.sessionID; 483 row["sessionID"] = ua.sessionID;
469 row["secureSessionID"] = ua.secureSessionID; 484 row["secureSessionID"] = ua.secureSessionID;
470 row["regionID"] = ua.regionID; 485 row["regionID"] = ua.regionID;
471 row["loginTime"] = ua.loginTime; 486 row["loginTime"] = ua.loginTime;
@@ -496,18 +511,18 @@ namespace OpenSim.Framework.Data.SQLite
496 da.UpdateCommand.Connection = conn; 511 da.UpdateCommand.Connection = conn;
497 512
498 SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID"); 513 SqliteCommand delete = new SqliteCommand("delete from users where UUID = :UUID");
499 delete.Parameters.Add(createSqliteParameter("UUID", typeof(System.String))); 514 delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
500 delete.Connection = conn; 515 delete.Connection = conn;
501 da.DeleteCommand = delete; 516 da.DeleteCommand = delete;
502 } 517 }
503 518
504 private void InitDB(SqliteConnection conn) 519 private void InitDB(SqliteConnection conn)
505 { 520 {
506 string createUsers = defineTable(createUsersTable()); 521 string createUsers = defineTable(createUsersTable());
507 SqliteCommand pcmd = new SqliteCommand(createUsers, conn); 522 SqliteCommand pcmd = new SqliteCommand(createUsers, conn);
508 conn.Open(); 523 conn.Open();
509 pcmd.ExecuteNonQuery(); 524 pcmd.ExecuteNonQuery();
510 conn.Close(); 525 conn.Close();
511 } 526 }
512 527
513 private bool TestTables(SqliteConnection conn) 528 private bool TestTables(SqliteConnection conn)
@@ -515,14 +530,16 @@ namespace OpenSim.Framework.Data.SQLite
515 SqliteCommand cmd = new SqliteCommand(userSelect, conn); 530 SqliteCommand cmd = new SqliteCommand(userSelect, conn);
516 SqliteDataAdapter pDa = new SqliteDataAdapter(cmd); 531 SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
517 DataSet tmpDS = new DataSet(); 532 DataSet tmpDS = new DataSet();
518 try { 533 try
534 {
519 pDa.Fill(tmpDS, "users"); 535 pDa.Fill(tmpDS, "users");
520 } catch (Mono.Data.SqliteClient.SqliteSyntaxException) { 536 }
537 catch (SqliteSyntaxException)
538 {
521 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating"); 539 MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
522 InitDB(conn); 540 InitDB(conn);
523 } 541 }
524 return true; 542 return true;
525 } 543 }
526
527 } 544 }
528} 545} \ 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
106 DataResponse AddProfile(RegionProfileData profile); 106 DataResponse AddProfile(RegionProfileData profile);
107 107
108 ReservationData GetReservationAtPoint(uint x, uint y); 108 ReservationData GetReservationAtPoint(uint x, uint y);
109
110 } 109 }
111} 110} \ 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
63 /// </summary> 63 /// </summary>
64 public interface ILogData 64 public interface ILogData
65 { 65 {
66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); 66 void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
67 string logMessage);
68
67 /// <summary> 69 /// <summary>
68 /// Initialises the interface 70 /// Initialises the interface
69 /// </summary> 71 /// </summary>
@@ -86,5 +88,4 @@ namespace OpenSim.Framework.Data
86 /// <returns>A string containing the plugin version</returns> 88 /// <returns>A string containing the plugin version</returns>
87 string getVersion(); 89 string getVersion();
88 } 90 }
89 91} \ No newline at end of file
90}
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 @@
27*/ 27*/
28using System.IO; 28using System.IO;
29using System.Text.RegularExpressions; 29using System.Text.RegularExpressions;
30
30/* 31/*
31 Taken from public code listing at by Alex Pinsker 32 Taken from public code listing at by Alex Pinsker
32 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html 33 http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
@@ -52,7 +53,8 @@ namespace OpenSim.Framework.Data
52 RegexOptions.Compiled | 53 RegexOptions.Compiled |
53 RegexOptions.CultureInvariant); 54 RegexOptions.CultureInvariant);
54 } 55 }
55 static private Regex _iniKeyValuePatternRegex; 56
57 private static Regex _iniKeyValuePatternRegex;
56 58
57 public IniFile(string iniFileName) 59 public IniFile(string iniFileName)
58 { 60 {
@@ -62,7 +64,7 @@ namespace OpenSim.Framework.Data
62 public string ParseFileReadValue(string key) 64 public string ParseFileReadValue(string key)
63 { 65 {
64 using (StreamReader reader = 66 using (StreamReader reader =
65 new StreamReader(_iniFileName)) 67 new StreamReader(_iniFileName))
66 { 68 {
67 do 69 do
68 { 70 {
@@ -72,18 +74,16 @@ namespace OpenSim.Framework.Data
72 if (match.Success) 74 if (match.Success)
73 { 75 {
74 string currentKey = 76 string currentKey =
75 match.Groups["Key"].Value as string; 77 match.Groups["Key"].Value as string;
76 if (currentKey != null && 78 if (currentKey != null &&
77 currentKey.Trim().CompareTo(key) == 0) 79 currentKey.Trim().CompareTo(key) == 0)
78 { 80 {
79 string value = 81 string value =
80 match.Groups["Value"].Value as string; 82 match.Groups["Value"].Value as string;
81 return value; 83 return value;
82 } 84 }
83 } 85 }
84 86 } while (reader.Peek() != -1);
85 }
86 while (reader.Peek() != -1);
87 } 87 }
88 return null; 88 return null;
89 } 89 }
@@ -91,6 +91,8 @@ namespace OpenSim.Framework.Data
91 public string IniFileName 91 public string IniFileName
92 { 92 {
93 get { return _iniFileName; } 93 get { return _iniFileName; }
94 } private string _iniFileName; 94 }
95
96 private string _iniFileName;
95 } 97 }
96} 98} \ 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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.Framework.Data")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.Framework.Data")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.Framework.Data")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.Framework.Data")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] 24
25[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices;
29// 33//
30// You can specify all the values or you can default the Revision and Build Numbers 34// You can specify all the values or you can default the Revision and Build Numbers
31// by using the '*' as shown below: 35// by using the '*' as shown below:
32[assembly: AssemblyVersion("1.0.0.0")] 36
33[assembly: AssemblyFileVersion("1.0.0.0")] 37[assembly : AssemblyVersion("1.0.0.0")]
38[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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using Nwc.XmlRpc;
30 28
31using System; 29using System;
32using System.Collections; 30using System.Collections;
31using libsecondlife;
32using Nwc.XmlRpc;
33 33
34namespace OpenSim.Framework.Data 34namespace OpenSim.Framework.Data
35{ 35{
@@ -57,6 +57,7 @@ namespace OpenSim.Framework.Data
57 /// Coordinates of the region 57 /// Coordinates of the region
58 /// </summary> 58 /// </summary>
59 public uint regionLocX; 59 public uint regionLocX;
60
60 public uint regionLocY; 61 public uint regionLocY;
61 public uint regionLocZ; // Reserved (round-robin, layers, etc) 62 public uint regionLocZ; // Reserved (round-robin, layers, etc)
62 63
@@ -65,6 +66,7 @@ namespace OpenSim.Framework.Data
65 /// </summary> 66 /// </summary>
66 /// <remarks>Not very secure, needs improvement.</remarks> 67 /// <remarks>Not very secure, needs improvement.</remarks>
67 public string regionSendKey = ""; 68 public string regionSendKey = "";
69
68 public string regionRecvKey = ""; 70 public string regionRecvKey = "";
69 public string regionSecret = ""; 71 public string regionSecret = "";
70 72
@@ -77,6 +79,7 @@ namespace OpenSim.Framework.Data
77 /// Information about the server that the region is currently hosted on 79 /// Information about the server that the region is currently hosted on
78 /// </summary> 80 /// </summary>
79 public string serverIP = ""; 81 public string serverIP = "";
82
80 public uint serverPort; 83 public uint serverPort;
81 public string serverURI = ""; 84 public string serverURI = "";
82 85
@@ -88,6 +91,7 @@ namespace OpenSim.Framework.Data
88 /// Set of optional overrides. Can be used to create non-eulicidean spaces. 91 /// Set of optional overrides. Can be used to create non-eulicidean spaces.
89 /// </summary> 92 /// </summary>
90 public ulong regionNorthOverrideHandle; 93 public ulong regionNorthOverrideHandle;
94
91 public ulong regionSouthOverrideHandle; 95 public ulong regionSouthOverrideHandle;
92 public ulong regionEastOverrideHandle; 96 public ulong regionEastOverrideHandle;
93 public ulong regionWestOverrideHandle; 97 public ulong regionWestOverrideHandle;
@@ -102,6 +106,7 @@ namespace OpenSim.Framework.Data
102 /// Region Asset Details 106 /// Region Asset Details
103 /// </summary> 107 /// </summary>
104 public string regionAssetURI = ""; 108 public string regionAssetURI = "";
109
105 public string regionAssetSendKey = ""; 110 public string regionAssetSendKey = "";
106 public string regionAssetRecvKey = ""; 111 public string regionAssetRecvKey = "";
107 112
@@ -109,6 +114,7 @@ namespace OpenSim.Framework.Data
109 /// Region Userserver Details 114 /// Region Userserver Details
110 /// </summary> 115 /// </summary>
111 public string regionUserURI = ""; 116 public string regionUserURI = "";
117
112 public string regionUserSendKey = ""; 118 public string regionUserSendKey = "";
113 public string regionUserRecvKey = ""; 119 public string regionUserRecvKey = "";
114 120
@@ -124,7 +130,8 @@ namespace OpenSim.Framework.Data
124 /// <param name="gridserver_url"></param> 130 /// <param name="gridserver_url"></param>
125 /// <param name="?"></param> 131 /// <param name="?"></param>
126 /// <returns></returns> 132 /// <returns></returns>
127 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) 133 public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
134 string gridserver_sendkey, string gridserver_recvkey)
128 { 135 {
129 Hashtable requestData = new Hashtable(); 136 Hashtable requestData = new Hashtable();
130 requestData["region_uuid"] = region_uuid.UUID.ToString(); 137 requestData["region_uuid"] = region_uuid.UUID.ToString();
@@ -134,7 +141,7 @@ namespace OpenSim.Framework.Data
134 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 141 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
135 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); 142 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
136 143
137 Hashtable responseData = (Hashtable)GridResp.Value; 144 Hashtable responseData = (Hashtable) GridResp.Value;
138 145
139 if (responseData.ContainsKey("error")) 146 if (responseData.ContainsKey("error"))
140 { 147 {
@@ -142,21 +149,23 @@ namespace OpenSim.Framework.Data
142 } 149 }
143 150
144 RegionProfileData simData = new RegionProfileData(); 151 RegionProfileData simData = new RegionProfileData();
145 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); 152 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
146 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); 153 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
147 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); 154 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
148 simData.serverIP = (string)responseData["sim_ip"]; 155 simData.serverIP = (string) responseData["sim_ip"];
149 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); 156 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
150 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); 157 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
151 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 158 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
152 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 159 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
153 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 160 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
154 simData.UUID = new LLUUID((string)responseData["region_UUID"]); 161 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
155 simData.regionName = (string)responseData["region_name"]; 162 simData.regionName = (string) responseData["region_name"];
156 163
157 return simData; 164 return simData;
158 } 165 }
159 public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, string gridserver_sendkey, string gridserver_recvkey) 166
167 public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
168 string gridserver_sendkey, string gridserver_recvkey)
160 { 169 {
161 Hashtable requestData = new Hashtable(); 170 Hashtable requestData = new Hashtable();
162 requestData["region_handle"] = region_handle.ToString(); 171 requestData["region_handle"] = region_handle.ToString();
@@ -166,7 +175,7 @@ namespace OpenSim.Framework.Data
166 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 175 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
167 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); 176 XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
168 177
169 Hashtable responseData = (Hashtable)GridResp.Value; 178 Hashtable responseData = (Hashtable) GridResp.Value;
170 179
171 if (responseData.ContainsKey("error")) 180 if (responseData.ContainsKey("error"))
172 { 181 {
@@ -174,19 +183,19 @@ namespace OpenSim.Framework.Data
174 } 183 }
175 184
176 RegionProfileData simData = new RegionProfileData(); 185 RegionProfileData simData = new RegionProfileData();
177 simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); 186 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
178 simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); 187 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
179 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * 256), (simData.regionLocY * 256)); 188 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
180 simData.serverIP = (string)responseData["sim_ip"]; 189 simData.serverIP = (string) responseData["sim_ip"];
181 simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); 190 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
182 simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); 191 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
183 simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 192 simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
184 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; 193 simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
185 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/"; 194 simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
186 simData.UUID = new LLUUID((string)responseData["region_UUID"]); 195 simData.UUID = new LLUUID((string) responseData["region_UUID"]);
187 simData.regionName = (string)responseData["region_name"]; 196 simData.regionName = (string) responseData["region_name"];
188 197
189 return simData; 198 return simData;
190 } 199 }
191 } 200 }
192} 201} \ 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
36 public int reservationMinY = 0; 36 public int reservationMinY = 0;
37 public int reservationMaxX = 65536; 37 public int reservationMaxX = 65536;
38 public int reservationMaxY = 65536; 38 public int reservationMaxY = 65536;
39 39
40 public string reservationName = ""; 40 public string reservationName = "";
41 public string reservationCompany = ""; 41 public string reservationCompany = "";
42 public bool status = true; 42 public bool status = true;
@@ -44,4 +44,4 @@ namespace OpenSim.Framework.Data
44 public string gridSendKey = ""; 44 public string gridSendKey = "";
45 public string gridRecvKey = ""; 45 public string gridRecvKey = "";
46 } 46 }
47} 47} \ 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 @@
27*/ 27*/
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text;
31 30
32namespace OpenSim.Framework 31namespace OpenSim.Framework
33{ 32{
@@ -37,15 +36,15 @@ namespace OpenSim.Framework
37 // permissions rather than just the first. Deny permissions will 36 // permissions rather than just the first. Deny permissions will
38 // override all others. 37 // override all others.
39 38
40
41 #region ACL Core Class 39 #region ACL Core Class
40
42 /// <summary> 41 /// <summary>
43 /// Access Control List Engine 42 /// Access Control List Engine
44 /// </summary> 43 /// </summary>
45 public class ACL 44 public class ACL
46 { 45 {
47 Dictionary<string, Role> Roles = new Dictionary<string, Role>(); 46 private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
48 Dictionary<string, Resource> Resources = new Dictionary<string, Resource>(); 47 private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
49 48
50 public ACL AddRole(Role role) 49 public ACL AddRole(Role role)
51 { 50 {
@@ -114,9 +113,11 @@ namespace OpenSim.Framework
114 return this; 113 return this;
115 } 114 }
116 } 115 }
116
117 #endregion 117 #endregion
118 118
119 #region Exceptions 119 #region Exceptions
120
120 /// <summary> 121 /// <summary>
121 /// Thrown when an ACL attempts to add a duplicate role. 122 /// Thrown when an ACL attempts to add a duplicate role.
122 /// </summary> 123 /// </summary>
@@ -139,6 +140,7 @@ namespace OpenSim.Framework
139 return "This ACL already contains a role called '" + m_role.Name + "'."; 140 return "This ACL already contains a role called '" + m_role.Name + "'.";
140 } 141 }
141 } 142 }
143
142 #endregion 144 #endregion
143 145
144 #region Roles and Resources 146 #region Roles and Resources
@@ -146,7 +148,12 @@ namespace OpenSim.Framework
146 /// <summary> 148 /// <summary>
147 /// Does this Role have permission to access a specified Resource? 149 /// Does this Role have permission to access a specified Resource?
148 /// </summary> 150 /// </summary>
149 public enum Permission { Deny, None, Allow }; 151 public enum Permission
152 {
153 Deny,
154 None,
155 Allow
156 } ;
150 157
151 /// <summary> 158 /// <summary>
152 /// A role class, for use with Users or Groups 159 /// A role class, for use with Users or Groups
@@ -227,7 +234,7 @@ namespace OpenSim.Framework
227 234
228 #region Tests 235 #region Tests
229 236
230 class ACLTester 237 internal class ACLTester
231 { 238 {
232 public ACLTester() 239 public ACLTester()
233 { 240 {
@@ -249,9 +256,8 @@ namespace OpenSim.Framework
249 acl.GrantPermission("Guests", "CanBuild"); 256 acl.GrantPermission("Guests", "CanBuild");
250 257
251 acl.HasPermission("JoeGuest", "CanBuild"); 258 acl.HasPermission("JoeGuest", "CanBuild");
252
253 } 259 }
254 } 260 }
255 261
256 #endregion 262 #endregion
257} 263} \ 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 @@
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework;
32 30
33namespace OpenSim.Framework 31namespace OpenSim.Framework
34{ 32{
@@ -38,15 +36,14 @@ namespace OpenSim.Framework
38 36
39 public AgentCircuitManager() 37 public AgentCircuitManager()
40 { 38 {
41
42 } 39 }
43 40
44 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) 41 public virtual AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode)
45 { 42 {
46 AgentCircuitData validcircuit = null; 43 AgentCircuitData validcircuit = null;
47 if (this.AgentCircuits.ContainsKey(circuitcode)) 44 if (AgentCircuits.ContainsKey(circuitcode))
48 { 45 {
49 validcircuit = this.AgentCircuits[circuitcode]; 46 validcircuit = AgentCircuits[circuitcode];
50 } 47 }
51 AuthenticateResponse user = new AuthenticateResponse(); 48 AuthenticateResponse user = new AuthenticateResponse();
52 if (validcircuit == null) 49 if (validcircuit == null)
@@ -79,50 +76,50 @@ namespace OpenSim.Framework
79 76
80 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData) 77 public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
81 { 78 {
82 if (this.AgentCircuits.ContainsKey(circuitCode)) 79 if (AgentCircuits.ContainsKey(circuitCode))
83 { 80 {
84 this.AgentCircuits[circuitCode] = agentData; 81 AgentCircuits[circuitCode] = agentData;
85 } 82 }
86 else 83 else
87 { 84 {
88 this.AgentCircuits.Add(circuitCode, agentData); 85 AgentCircuits.Add(circuitCode, agentData);
89 } 86 }
90 } 87 }
91 88
92 public LLVector3 GetPosition(uint circuitCode) 89 public LLVector3 GetPosition(uint circuitCode)
93 { 90 {
94 LLVector3 vec = new LLVector3(); 91 LLVector3 vec = new LLVector3();
95 if (this.AgentCircuits.ContainsKey(circuitCode)) 92 if (AgentCircuits.ContainsKey(circuitCode))
96 { 93 {
97 vec = this.AgentCircuits[circuitCode].startpos; 94 vec = AgentCircuits[circuitCode].startpos;
98 } 95 }
99 return vec; 96 return vec;
100 } 97 }
101 98
102 public void UpdateAgentData(AgentCircuitData agentData) 99 public void UpdateAgentData(AgentCircuitData agentData)
103 { 100 {
104 if (this.AgentCircuits.ContainsKey((uint)agentData.circuitcode)) 101 if (AgentCircuits.ContainsKey((uint) agentData.circuitcode))
105 { 102 {
106 this.AgentCircuits[(uint)agentData.circuitcode].firstname = agentData.firstname; 103 AgentCircuits[(uint) agentData.circuitcode].firstname = agentData.firstname;
107 this.AgentCircuits[(uint)agentData.circuitcode].lastname = agentData.lastname; 104 AgentCircuits[(uint) agentData.circuitcode].lastname = agentData.lastname;
108 this.AgentCircuits[(uint)agentData.circuitcode].startpos = agentData.startpos; 105 AgentCircuits[(uint) agentData.circuitcode].startpos = agentData.startpos;
109 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z); 106 // Console.WriteLine("update user start pos is " + agentData.startpos.X + " , " + agentData.startpos.Y + " , " + agentData.startpos.Z);
110 } 107 }
111 } 108 }
112 109
113 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus) 110 public void UpdateAgentChildStatus(uint circuitcode, bool childstatus)
114 { 111 {
115 if (this.AgentCircuits.ContainsKey(circuitcode)) 112 if (AgentCircuits.ContainsKey(circuitcode))
116 { 113 {
117 this.AgentCircuits[circuitcode].child = childstatus; 114 AgentCircuits[circuitcode].child = childstatus;
118 } 115 }
119 } 116 }
120 117
121 public bool GetAgentChildStatus(uint circuitcode) 118 public bool GetAgentChildStatus(uint circuitcode)
122 { 119 {
123 if (this.AgentCircuits.ContainsKey(circuitcode)) 120 if (AgentCircuits.ContainsKey(circuitcode))
124 { 121 {
125 return this.AgentCircuits[circuitcode].child; 122 return AgentCircuits[circuitcode].child;
126 } 123 }
127 return false; 124 return false;
128 } 125 }
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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using System; 28using System;
29using libsecondlife;
30 30
31namespace OpenSim.Framework 31namespace OpenSim.Framework
32{ 32{
33 [Serializable] 33 [Serializable]
34 public class AgentCircuitData 34 public class AgentCircuitData
35 { 35 {
36 public AgentCircuitData() { } 36 public AgentCircuitData()
37 {
38 }
39
37 public LLUUID AgentID; 40 public LLUUID AgentID;
38 public LLUUID SessionID; 41 public LLUUID SessionID;
39 public LLUUID SecureSessionID; 42 public LLUUID SecureSessionID;
@@ -44,6 +47,6 @@ namespace OpenSim.Framework
44 public bool child; 47 public bool child;
45 public LLUUID InventoryFolder; 48 public LLUUID InventoryFolder;
46 public LLUUID BaseFolder; 49 public LLUUID BaseFolder;
47 public string CapsPath = ""; 50 public string CapsPath = "";
48 } 51 }
49} 52} \ 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 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework;
32
33 31
34namespace OpenSim.Framework 32namespace OpenSim.Framework
35{ 33{
@@ -39,7 +37,7 @@ namespace OpenSim.Framework
39 public Dictionary<LLUUID, InventoryFolder> InventoryFolders; 37 public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
40 public Dictionary<LLUUID, InventoryItem> InventoryItems; 38 public Dictionary<LLUUID, InventoryItem> InventoryItems;
41 public InventoryFolder InventoryRoot; 39 public InventoryFolder InventoryRoot;
42 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server 40 public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
43 public LLUUID AgentID; 41 public LLUUID AgentID;
44 public AvatarWearable[] Wearables; 42 public AvatarWearable[] Wearables;
45 43
@@ -47,12 +45,12 @@ namespace OpenSim.Framework
47 { 45 {
48 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>(); 46 InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
49 InventoryItems = new Dictionary<LLUUID, InventoryItem>(); 47 InventoryItems = new Dictionary<LLUUID, InventoryItem>();
50 this.Initialise(); 48 Initialise();
51 } 49 }
52 50
53 public virtual void Initialise() 51 public virtual void Initialise()
54 { 52 {
55 Wearables = new AvatarWearable[13]; 53 Wearables = new AvatarWearable[13];
56 for (int i = 0; i < 13; i++) 54 for (int i = 0; i < 13; i++)
57 { 55 {
58 Wearables[i] = new AvatarWearable(); 56 Wearables[i] = new AvatarWearable();
@@ -63,27 +61,27 @@ namespace OpenSim.Framework
63 { 61 {
64 InventoryFolder Folder = new InventoryFolder(); 62 InventoryFolder Folder = new InventoryFolder();
65 Folder.FolderID = folderID; 63 Folder.FolderID = folderID;
66 Folder.OwnerID = this.AgentID; 64 Folder.OwnerID = AgentID;
67 Folder.DefaultType = type; 65 Folder.DefaultType = type;
68 this.InventoryFolders.Add(Folder.FolderID, Folder); 66 InventoryFolders.Add(Folder.FolderID, Folder);
69 return (true); 67 return (true);
70 } 68 }
71 69
72 public void CreateRootFolder(LLUUID newAgentID, bool createTextures) 70 public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
73 { 71 {
74 this.AgentID = newAgentID; 72 AgentID = newAgentID;
75 InventoryRoot = new InventoryFolder(); 73 InventoryRoot = new InventoryFolder();
76 InventoryRoot.FolderID = LLUUID.Random(); 74 InventoryRoot.FolderID = LLUUID.Random();
77 InventoryRoot.ParentID = new LLUUID(); 75 InventoryRoot.ParentID = new LLUUID();
78 InventoryRoot.Version = 1; 76 InventoryRoot.Version = 1;
79 InventoryRoot.DefaultType = 8; 77 InventoryRoot.DefaultType = 8;
80 InventoryRoot.OwnerID = this.AgentID; 78 InventoryRoot.OwnerID = AgentID;
81 InventoryRoot.FolderName = "My Inventory"; 79 InventoryRoot.FolderName = "My Inventory";
82 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot); 80 InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
83 InventoryRoot.OwnerID = this.AgentID; 81 InventoryRoot.OwnerID = AgentID;
84 if (createTextures) 82 if (createTextures)
85 { 83 {
86 this.CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID); 84 CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
87 } 85 }
88 } 86 }
89 87
@@ -91,32 +89,32 @@ namespace OpenSim.Framework
91 { 89 {
92 InventoryFolder Folder = new InventoryFolder(); 90 InventoryFolder Folder = new InventoryFolder();
93 Folder.FolderID = folderID; 91 Folder.FolderID = folderID;
94 Folder.OwnerID = this.AgentID; 92 Folder.OwnerID = AgentID;
95 Folder.DefaultType = type; 93 Folder.DefaultType = type;
96 Folder.FolderName = folderName; 94 Folder.FolderName = folderName;
97 this.InventoryFolders.Add(Folder.FolderID, Folder); 95 InventoryFolders.Add(Folder.FolderID, Folder);
98 return (true); 96 return (true);
99 } 97 }
100 98
101 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID) 99 public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
102 { 100 {
103 if (!this.InventoryFolders.ContainsKey(folderID)) 101 if (!InventoryFolders.ContainsKey(folderID))
104 { 102 {
105 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); 103 System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
106 InventoryFolder Folder = new InventoryFolder(); 104 InventoryFolder Folder = new InventoryFolder();
107 Folder.FolderID = folderID; 105 Folder.FolderID = folderID;
108 Folder.OwnerID = this.AgentID; 106 Folder.OwnerID = AgentID;
109 Folder.DefaultType = type; 107 Folder.DefaultType = type;
110 Folder.FolderName = folderName; 108 Folder.FolderName = folderName;
111 Folder.ParentID = parentID; 109 Folder.ParentID = parentID;
112 this.InventoryFolders.Add(Folder.FolderID, Folder); 110 InventoryFolders.Add(Folder.FolderID, Folder);
113 } 111 }
114 return (true); 112 return (true);
115 } 113 }
116 114
117 public bool HasFolder(LLUUID folderID) 115 public bool HasFolder(LLUUID folderID)
118 { 116 {
119 if (this.InventoryFolders.ContainsKey(folderID)) 117 if (InventoryFolders.ContainsKey(folderID))
120 { 118 {
121 return true; 119 return true;
122 } 120 }
@@ -125,7 +123,7 @@ namespace OpenSim.Framework
125 123
126 public LLUUID GetFolderID(string folderName) 124 public LLUUID GetFolderID(string folderName)
127 { 125 {
128 foreach (InventoryFolder inv in this.InventoryFolders.Values) 126 foreach (InventoryFolder inv in InventoryFolders.Values)
129 { 127 {
130 if (inv.FolderName == folderName) 128 if (inv.FolderName == folderName)
131 { 129 {
@@ -137,11 +135,12 @@ namespace OpenSim.Framework
137 135
138 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset) 136 public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
139 { 137 {
140 if(this.InventoryItems.ContainsKey(itemID)) 138 if (InventoryItems.ContainsKey(itemID))
141 { 139 {
142 InventoryItem Item = this.InventoryItems[itemID]; 140 InventoryItem Item = InventoryItems[itemID];
143 Item.AssetID = asset.FullID; 141 Item.AssetID = asset.FullID;
144 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() + " so it now is set to asset " + asset.FullID.ToStringHyphenated()); 142 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated() +
143 " so it now is set to asset " + asset.FullID.ToStringHyphenated());
145 //TODO need to update the rest of the info 144 //TODO need to update the rest of the info
146 } 145 }
147 return true; 146 return true;
@@ -150,10 +149,10 @@ namespace OpenSim.Framework
150 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet) 149 public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
151 { 150 {
152 System.Console.WriteLine("updating inventory item details"); 151 System.Console.WriteLine("updating inventory item details");
153 if (this.InventoryItems.ContainsKey(itemID)) 152 if (InventoryItems.ContainsKey(itemID))
154 { 153 {
155 System.Console.WriteLine("changing name to "+ Util.FieldToString(packet.Name)); 154 System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name));
156 InventoryItem Item = this.InventoryItems[itemID]; 155 InventoryItem Item = InventoryItems[itemID];
157 Item.Name = Util.FieldToString(packet.Name); 156 Item.Name = Util.FieldToString(packet.Name);
158 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated()); 157 System.Console.WriteLine("updated inventory item " + itemID.ToStringHyphenated());
159 //TODO need to update the rest of the info 158 //TODO need to update the rest of the info
@@ -163,7 +162,7 @@ namespace OpenSim.Framework
163 162
164 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset) 163 public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
165 { 164 {
166 if (this.InventoryFolders.ContainsKey(folderID)) 165 if (InventoryFolders.ContainsKey(folderID))
167 { 166 {
168 LLUUID NewItemID = LLUUID.Random(); 167 LLUUID NewItemID = LLUUID.Random();
169 168
@@ -176,7 +175,7 @@ namespace OpenSim.Framework
176 Item.Name = asset.Name; 175 Item.Name = asset.Name;
177 Item.Description = asset.Description; 176 Item.Description = asset.Description;
178 Item.InvType = asset.InvType; 177 Item.InvType = asset.InvType;
179 this.InventoryItems.Add(Item.ItemID, Item); 178 InventoryItems.Add(Item.ItemID, Item);
180 InventoryFolder Folder = InventoryFolders[Item.FolderID]; 179 InventoryFolder Folder = InventoryFolders[Item.FolderID];
181 Folder.Items.Add(Item); 180 Folder.Items.Add(Item);
182 return (Item.ItemID); 181 return (Item.ItemID);
@@ -190,10 +189,10 @@ namespace OpenSim.Framework
190 public bool DeleteFromInventory(LLUUID itemID) 189 public bool DeleteFromInventory(LLUUID itemID)
191 { 190 {
192 bool res = false; 191 bool res = false;
193 if (this.InventoryItems.ContainsKey(itemID)) 192 if (InventoryItems.ContainsKey(itemID))
194 { 193 {
195 InventoryItem item = this.InventoryItems[itemID]; 194 InventoryItem item = InventoryItems[itemID];
196 this.InventoryItems.Remove(itemID); 195 InventoryItems.Remove(itemID);
197 foreach (InventoryFolder fold in InventoryFolders.Values) 196 foreach (InventoryFolder fold in InventoryFolders.Values)
198 { 197 {
199 if (fold.Items.Contains(item)) 198 if (fold.Items.Contains(item))
@@ -203,7 +202,6 @@ namespace OpenSim.Framework
203 } 202 }
204 } 203 }
205 res = true; 204 res = true;
206
207 } 205 }
208 return res; 206 return res;
209 } 207 }
@@ -225,7 +223,6 @@ namespace OpenSim.Framework
225 Items = new List<InventoryItem>(); 223 Items = new List<InventoryItem>();
226 //Subfolders = new List<InventoryFolder>(); 224 //Subfolders = new List<InventoryFolder>();
227 } 225 }
228
229 } 226 }
230 227
231 public class InventoryItem 228 public class InventoryItem
@@ -237,12 +234,12 @@ namespace OpenSim.Framework
237 public LLUUID CreatorID; 234 public LLUUID CreatorID;
238 public sbyte InvType; 235 public sbyte InvType;
239 public sbyte Type; 236 public sbyte Type;
240 public string Name =""; 237 public string Name = "";
241 public string Description; 238 public string Description;
242 239
243 public InventoryItem() 240 public InventoryItem()
244 { 241 {
245 this.CreatorID = LLUUID.Zero; 242 CreatorID = LLUUID.Zero;
246 } 243 }
247 244
248 public string ExportString() 245 public string ExportString()
@@ -251,11 +248,11 @@ namespace OpenSim.Framework
251 string result = ""; 248 string result = "";
252 result += "\tinv_object\t0\n\t{\n"; 249 result += "\tinv_object\t0\n\t{\n";
253 result += "\t\tobj_id\t%s\n"; 250 result += "\t\tobj_id\t%s\n";
254 result += "\t\tparent_id\t"+ ItemID.ToString() +"\n"; 251 result += "\t\tparent_id\t" + ItemID.ToString() + "\n";
255 result += "\t\ttype\t"+ typ +"\n"; 252 result += "\t\ttype\t" + typ + "\n";
256 result += "\t\tname\t" + Name+"|\n"; 253 result += "\t\tname\t" + Name + "|\n";
257 result += "\t}\n"; 254 result += "\t}\n";
258 return result; 255 return result;
259 } 256 }
260 } 257 }
261} 258} \ 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
36 36
37 public AvatarWearable() 37 public AvatarWearable()
38 { 38 {
39
40 } 39 }
41 40
42 public AvatarWearable( LLUUID itemId, LLUUID assetId ) 41 public AvatarWearable(LLUUID itemId, LLUUID assetId)
43 { 42 {
44 AssetID = assetId; 43 AssetID = assetId;
45 ItemID = itemId; 44 ItemID = itemId;
@@ -69,4 +68,4 @@ namespace OpenSim.Framework
69 } 68 }
70 } 69 }
71 } 70 }
72} 71} \ 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
44 44
45 public AssetBase() 45 public AssetBase()
46 { 46 {
47
48 } 47 }
49 48
50 public AssetBase(LLUUID assetId, string name) 49 public AssetBase(LLUUID assetId, string name)
@@ -53,4 +52,4 @@ namespace OpenSim.Framework
53 Name = name; 52 Name = name;
54 } 53 }
55 } 54 }
56} 55} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework 29namespace OpenSim.Framework
34{ 30{
35 /// <summary> 31 /// <summary>
@@ -48,18 +44,22 @@ namespace OpenSim.Framework
48 44
49 public AssetConfig(string description, string filename) 45 public AssetConfig(string description, string filename)
50 { 46 {
51 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); 47 configMember =
48 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
52 configMember.performConfigurationRetrieve(); 49 configMember.performConfigurationRetrieve();
53 } 50 }
54 51
55 public void loadConfigurationOptions() 52 public void loadConfigurationOptions()
56 { 53 {
57 configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); 54 configMember.addConfigurationOption("default_startup_message",
58 55 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
59 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); 56 "Default Startup Message", "Welcome to OGS", false);
60 57
61 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); 58 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
59 "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
62 60
61 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
62 "Http Listener port", DefaultHttpPort.ToString(), false);
63 } 63 }
64 64
65 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 65 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -67,17 +67,17 @@ namespace OpenSim.Framework
67 switch (configuration_key) 67 switch (configuration_key)
68 { 68 {
69 case "default_startup_message": 69 case "default_startup_message":
70 this.DefaultStartupMsg = (string)configuration_result; 70 DefaultStartupMsg = (string) configuration_result;
71 break; 71 break;
72 case "database_provider": 72 case "database_provider":
73 this.DatabaseProvider = (string)configuration_result; 73 DatabaseProvider = (string) configuration_result;
74 break; 74 break;
75 case "http_port": 75 case "http_port":
76 HttpPort = (uint)configuration_result; 76 HttpPort = (uint) configuration_result;
77 break; 77 break;
78 } 78 }
79 79
80 return true; 80 return true;
81 } 81 }
82 } 82 }
83} 83} \ 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
38 38
39 public AssetLandmark(AssetBase a) 39 public AssetLandmark(AssetBase a)
40 { 40 {
41 this.Data = a.Data; 41 Data = a.Data;
42 this.FullID = a.FullID; 42 FullID = a.FullID;
43 this.Type = a.Type; 43 Type = a.Type;
44 this.InvType = a.InvType; 44 InvType = a.InvType;
45 this.Name = a.Name; 45 Name = a.Name;
46 this.Description = a.Description; 46 Description = a.Description;
47 InternData(); 47 InternData();
48 } 48 }
49 49
50 private void InternData() 50 private void InternData()
51 { 51 {
52 string temp = Encoding.UTF8.GetString(Data).Trim(); 52 string temp = Encoding.UTF8.GetString(Data).Trim();
53 string[] parts = temp.Split('\n'); 53 string[] parts = temp.Split('\n');
54 int.TryParse(parts[0].Substring(17, 1), out Version); 54 int.TryParse(parts[0].Substring(17, 1), out Version);
55 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID); 55 LLUUID.TryParse(parts[1].Substring(10, 36), out RegionID);
56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position); 56 LLVector3.TryParse(parts[2].Substring(11, parts[2].Length - 11), out Position);
57 } 57 }
58 } 58 }
59} 59} \ 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;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 public class AssetStorage 32 public class AssetStorage
33 { 33 {
34 public AssetStorage()
35 {
36 }
34 37
35 public AssetStorage() { 38 public AssetStorage(LLUUID assetUUID)
36 } 39 {
40 UUID = assetUUID;
41 }
37 42
38 public AssetStorage(LLUUID assetUUID) { 43 public byte[] Data;
39 UUID=assetUUID; 44 public sbyte Type;
40 } 45 public string Name;
41 46 public LLUUID UUID;
42 public byte[] Data; 47 }
43 public sbyte Type; 48} \ No newline at end of file
44 public string Name;
45 public LLUUID UUID;
46 }
47}
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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using OpenSim.Framework;
29
30namespace OpenSim.Framework 28namespace OpenSim.Framework
31{ 29{
32 public class AuthenticateResponse 30 public class AuthenticateResponse
@@ -36,8 +34,6 @@ namespace OpenSim.Framework
36 34
37 public AuthenticateResponse() 35 public AuthenticateResponse()
38 { 36 {
39
40 } 37 }
41
42 } 38 }
43} 39} \ 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
55 } 55 }
56 } 56 }
57 } 57 }
58} 58} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Text;
32using libsecondlife.Packets;
33using OpenSim.Framework.Interfaces;
34using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets;
35 32
36namespace OpenSim.Framework 33namespace OpenSim.Framework
37{ 34{
38 public delegate void ForEachClientDelegate(IClientAPI client); 35 public delegate void ForEachClientDelegate(IClientAPI client);
36
39 public class ClientManager 37 public class ClientManager
40 { 38 {
41 private Dictionary<uint, IClientAPI> m_clients; 39 private Dictionary<uint, IClientAPI> m_clients;
@@ -63,7 +61,7 @@ namespace OpenSim.Framework
63 m_clients.Add(id, client); 61 m_clients.Add(id, client);
64 } 62 }
65 63
66 public void InPacket(uint circuitCode, libsecondlife.Packets.Packet packet) 64 public void InPacket(uint circuitCode, Packet packet)
67 { 65 {
68 IClientAPI client; 66 IClientAPI client;
69 67
@@ -83,10 +81,10 @@ namespace OpenSim.Framework
83 } 81 }
84 } 82 }
85 83
86 public void CloseAllCircuits( LLUUID agentId ) 84 public void CloseAllCircuits(LLUUID agentId)
87 { 85 {
88 uint[] circuits = GetAllCircuits(agentId); 86 uint[] circuits = GetAllCircuits(agentId);
89 foreach (uint circuit in circuits ) 87 foreach (uint circuit in circuits)
90 { 88 {
91 IClientAPI client; 89 IClientAPI client;
92 if (m_clients.TryGetValue(circuit, out client)) 90 if (m_clients.TryGetValue(circuit, out client))
@@ -94,7 +92,7 @@ namespace OpenSim.Framework
94 Remove(circuit); 92 Remove(circuit);
95 client.Close(); 93 client.Close();
96 } 94 }
97 } 95 }
98 } 96 }
99 97
100 private uint[] GetAllCircuits(LLUUID agentId) 98 private uint[] GetAllCircuits(LLUUID agentId)
@@ -103,16 +101,16 @@ namespace OpenSim.Framework
103 101
104 foreach (KeyValuePair<uint, IClientAPI> pair in m_clients) 102 foreach (KeyValuePair<uint, IClientAPI> pair in m_clients)
105 { 103 {
106 if( pair.Value.AgentId == agentId ) 104 if (pair.Value.AgentId == agentId)
107 { 105 {
108 circuits.Add( pair.Key ); 106 circuits.Add(pair.Key);
109 } 107 }
110 } 108 }
111 109
112 return circuits.ToArray(); 110 return circuits.ToArray();
113 } 111 }
114 112
115 113
116 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock) 114 public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
117 { 115 {
118 ViewerEffectPacket packet = new ViewerEffectPacket(); 116 ViewerEffectPacket packet = new ViewerEffectPacket();
@@ -134,4 +132,4 @@ namespace OpenSim.Framework
134 return m_clients.TryGetValue(circuitId, out user); 132 return m_clients.TryGetValue(circuitId, out user);
135 } 133 }
136 } 134 }
137} 135} \ 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 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Reflection;
31using System.Collections;
32using System.Collections.Generic; 30using System.Collections.Generic;
33using System.Text; 31using System.Globalization;
34using System.Net; 32using System.Net;
35 33using System.Reflection;
36using libsecondlife; 34using libsecondlife;
37
38using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
39using System.Globalization;
40 36
41namespace OpenSim.Framework 37namespace OpenSim.Framework
42{ 38{
43 public class ConfigurationMember 39 public class ConfigurationMember
44 { 40 {
45 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result); 41 public delegate bool ConfigurationOptionResult(string configuration_key, object configuration_result);
42
46 public delegate void ConfigurationOptionsLoad(); 43 public delegate void ConfigurationOptionsLoad();
47 44
48 private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>(); 45 private List<ConfigurationOption> configurationOptions = new List<ConfigurationOption>();
@@ -53,22 +50,26 @@ namespace OpenSim.Framework
53 private ConfigurationOptionResult resultFunction; 50 private ConfigurationOptionResult resultFunction;
54 51
55 private IGenericConfig configurationPlugin = null; 52 private IGenericConfig configurationPlugin = null;
53
56 /// <summary> 54 /// <summary>
57 /// This is the default configuration DLL loaded 55 /// This is the default configuration DLL loaded
58 /// </summary> 56 /// </summary>
59 private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll"; 57 private string configurationPluginFilename = "OpenSim.Framework.Configuration.XML.dll";
60 public ConfigurationMember(string configuration_filename, string configuration_description, ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function) 58
59 public ConfigurationMember(string configuration_filename, string configuration_description,
60 ConfigurationOptionsLoad load_function, ConfigurationOptionResult result_function)
61 { 61 {
62 this.configurationFilename = configuration_filename; 62 configurationFilename = configuration_filename;
63 this.configurationDescription = configuration_description; 63 configurationDescription = configuration_description;
64 this.loadFunction = load_function; 64 loadFunction = load_function;
65 this.resultFunction = result_function; 65 resultFunction = result_function;
66 } 66 }
67 67
68 public void setConfigurationFilename(string filename) 68 public void setConfigurationFilename(string filename)
69 { 69 {
70 configurationFilename = filename; 70 configurationFilename = filename;
71 } 71 }
72
72 public void setConfigurationDescription(string desc) 73 public void setConfigurationDescription(string desc)
73 { 74 {
74 configurationDescription = desc; 75 configurationDescription = desc;
@@ -83,7 +84,11 @@ namespace OpenSim.Framework
83 { 84 {
84 configurationPluginFilename = dll_filename; 85 configurationPluginFilename = dll_filename;
85 } 86 }
86 public void addConfigurationOption(string configuration_key, ConfigurationOption.ConfigurationTypes configuration_type, string configuration_question, string configuration_default, bool use_default_no_prompt) 87
88 public void addConfigurationOption(string configuration_key,
89 ConfigurationOption.ConfigurationTypes configuration_type,
90 string configuration_question, string configuration_default,
91 bool use_default_no_prompt)
87 { 92 {
88 ConfigurationOption configOption = new ConfigurationOption(); 93 ConfigurationOption configOption = new ConfigurationOption();
89 configOption.configurationKey = configuration_key; 94 configOption.configurationKey = configuration_key;
@@ -92,7 +97,8 @@ namespace OpenSim.Framework
92 configOption.configurationType = configuration_type; 97 configOption.configurationType = configuration_type;
93 configOption.configurationUseDefaultNoPrompt = use_default_no_prompt; 98 configOption.configurationUseDefaultNoPrompt = use_default_no_prompt;
94 99
95 if ((configuration_key != "" && configuration_question != "") || (configuration_key != "" && use_default_no_prompt)) 100 if ((configuration_key != "" && configuration_question != "") ||
101 (configuration_key != "" && use_default_no_prompt))
96 { 102 {
97 if (!configurationOptions.Contains(configOption)) 103 if (!configurationOptions.Contains(configOption))
98 { 104 {
@@ -101,32 +107,37 @@ namespace OpenSim.Framework
101 } 107 }
102 else 108 else
103 { 109 {
104 MainLog.Instance.Notice("Required fields for adding a configuration option is invalid. Will not add this option (" + configuration_key + ")"); 110 MainLog.Instance.Notice(
111 "Required fields for adding a configuration option is invalid. Will not add this option (" +
112 configuration_key + ")");
105 } 113 }
106 } 114 }
107 115
108 public void performConfigurationRetrieve() 116 public void performConfigurationRetrieve()
109 { 117 {
110 configurationPlugin = this.LoadConfigDll(configurationPluginFilename); 118 configurationPlugin = LoadConfigDll(configurationPluginFilename);
111 configurationOptions.Clear(); 119 configurationOptions.Clear();
112 if(loadFunction == null) 120 if (loadFunction == null)
113 { 121 {
114 MainLog.Instance.Error("Load Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); 122 MainLog.Instance.Error("Load Function for '" + configurationDescription +
123 "' is null. Refusing to run configuration.");
115 return; 124 return;
116 } 125 }
117 126
118 if(resultFunction == null) 127 if (resultFunction == null)
119 { 128 {
120 MainLog.Instance.Error("Result Function for '" + this.configurationDescription + "' is null. Refusing to run configuration."); 129 MainLog.Instance.Error("Result Function for '" + configurationDescription +
130 "' is null. Refusing to run configuration.");
121 return; 131 return;
122 } 132 }
123 133
124 MainLog.Instance.Verbose("Calling Configuration Load Function..."); 134 MainLog.Instance.Verbose("Calling Configuration Load Function...");
125 this.loadFunction(); 135 loadFunction();
126 136
127 if(configurationOptions.Count <= 0) 137 if (configurationOptions.Count <= 0)
128 { 138 {
129 MainLog.Instance.Error("No configuration options were specified for '" + this.configurationOptions + "'. Refusing to continue configuration."); 139 MainLog.Instance.Error("No configuration options were specified for '" + configurationOptions +
140 "'. Refusing to continue configuration.");
130 return; 141 return;
131 } 142 }
132 143
@@ -157,7 +168,6 @@ namespace OpenSim.Framework
157 bool ignoreNextFromConfig = false; 168 bool ignoreNextFromConfig = false;
158 while (convertSuccess == false) 169 while (convertSuccess == false)
159 { 170 {
160
161 string console_result = ""; 171 string console_result = "";
162 string attribute = null; 172 string attribute = null;
163 if (useFile) 173 if (useFile)
@@ -180,16 +190,20 @@ namespace OpenSim.Framework
180 } 190 }
181 else 191 else
182 { 192 {
183
184 if (configurationDescription.Trim() != "") 193 if (configurationDescription.Trim() != "")
185 { 194 {
186 console_result = MainLog.Instance.CmdPrompt(configurationDescription + ": " + configOption.configurationQuestion, configOption.configurationDefault); 195 console_result =
196 MainLog.Instance.CmdPrompt(
197 configurationDescription + ": " + configOption.configurationQuestion,
198 configOption.configurationDefault);
187 } 199 }
188 else 200 else
189 { 201 {
190 console_result = MainLog.Instance.CmdPrompt(configOption.configurationQuestion, configOption.configurationDefault); 202 console_result =
203 MainLog.Instance.CmdPrompt(configOption.configurationQuestion,
204 configOption.configurationDefault);
191 } 205 }
192 } 206 }
193 } 207 }
194 else 208 else
195 { 209 {
@@ -252,7 +266,6 @@ namespace OpenSim.Framework
252 { 266 {
253 convertSuccess = true; 267 convertSuccess = true;
254 return_result = intResult; 268 return_result = intResult;
255
256 } 269 }
257 errorMessage = "a signed 32 bit integer (int)"; 270 errorMessage = "a signed 32 bit integer (int)";
258 break; 271 break;
@@ -307,7 +320,6 @@ namespace OpenSim.Framework
307 { 320 {
308 convertSuccess = true; 321 convertSuccess = true;
309 return_result = uintResult; 322 return_result = uintResult;
310
311 } 323 }
312 errorMessage = "an unsigned 32 bit integer (uint)"; 324 errorMessage = "an unsigned 32 bit integer (uint)";
313 break; 325 break;
@@ -322,7 +334,9 @@ namespace OpenSim.Framework
322 break; 334 break;
323 case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT: 335 case ConfigurationOption.ConfigurationTypes.TYPE_FLOAT:
324 float floatResult; 336 float floatResult;
325 if (float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out floatResult)) 337 if (
338 float.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
339 out floatResult))
326 { 340 {
327 convertSuccess = true; 341 convertSuccess = true;
328 return_result = floatResult; 342 return_result = floatResult;
@@ -331,7 +345,9 @@ namespace OpenSim.Framework
331 break; 345 break;
332 case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE: 346 case ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE:
333 double doubleResult; 347 double doubleResult;
334 if (Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo, out doubleResult)) 348 if (
349 Double.TryParse(console_result, NumberStyles.AllowDecimalPoint, Culture.NumberFormatInfo,
350 out doubleResult))
335 { 351 {
336 convertSuccess = true; 352 convertSuccess = true;
337 return_result = doubleResult; 353 return_result = doubleResult;
@@ -348,9 +364,10 @@ namespace OpenSim.Framework
348 } 364 }
349 365
350 366
351 if (!this.resultFunction(configOption.configurationKey, return_result)) 367 if (!resultFunction(configOption.configurationKey, return_result))
352 { 368 {
353 Console.MainLog.Instance.Notice("The handler for the last configuration option denied that input, please try again."); 369 MainLog.Instance.Notice(
370 "The handler for the last configuration option denied that input, please try again.");
354 convertSuccess = false; 371 convertSuccess = false;
355 ignoreNextFromConfig = true; 372 ignoreNextFromConfig = true;
356 } 373 }
@@ -359,19 +376,27 @@ namespace OpenSim.Framework
359 { 376 {
360 if (configOption.configurationUseDefaultNoPrompt) 377 if (configOption.configurationUseDefaultNoPrompt)
361 { 378 {
362 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)); 379 MainLog.Instance.Error("CONFIG",
380 string.Format(
381 "[{3}]:[{1}] is not valid default for parameter [{0}].\nThe configuration result must be parsable to {2}.\n",
382 configOption.configurationKey, console_result, errorMessage,
383 configurationFilename));
363 convertSuccess = true; 384 convertSuccess = true;
364 } 385 }
365 else 386 else
366 { 387 {
367 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)); 388 MainLog.Instance.Warn("CONFIG",
389 string.Format(
390 "[{3}]:[{1}] is not a valid value [{0}].\nThe configuration result must be parsable to {2}.\n",
391 configOption.configurationKey, console_result, errorMessage,
392 configurationFilename));
368 ignoreNextFromConfig = true; 393 ignoreNextFromConfig = true;
369 } 394 }
370 } 395 }
371 } 396 }
372 } 397 }
373 398
374 if(useFile) 399 if (useFile)
375 { 400 {
376 configurationPlugin.Commit(); 401 configurationPlugin.Commit();
377 configurationPlugin.Close(); 402 configurationPlugin.Close();
@@ -393,7 +418,8 @@ namespace OpenSim.Framework
393 418
394 if (typeInterface != null) 419 if (typeInterface != null)
395 { 420 {
396 plug = (IGenericConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 421 plug =
422 (IGenericConfig) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
397 } 423 }
398 } 424 }
399 } 425 }
@@ -405,10 +431,10 @@ namespace OpenSim.Framework
405 431
406 public void forceSetConfigurationOption(string configuration_key, string configuration_value) 432 public void forceSetConfigurationOption(string configuration_key, string configuration_value)
407 { 433 {
408 this.configurationPlugin.LoadData(); 434 configurationPlugin.LoadData();
409 this.configurationPlugin.SetAttribute(configuration_key, configuration_value); 435 configurationPlugin.SetAttribute(configuration_key, configuration_value);
410 this.configurationPlugin.Commit(); 436 configurationPlugin.Commit();
411 this.configurationPlugin.Close(); 437 configurationPlugin.Close();
412 } 438 }
413 } 439 }
414} 440} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework 29namespace OpenSim.Framework
34{ 30{
35 public class ConfigurationOption 31 public class ConfigurationOption
@@ -40,7 +36,7 @@ namespace OpenSim.Framework
40 TYPE_STRING_NOT_EMPTY, 36 TYPE_STRING_NOT_EMPTY,
41 TYPE_UINT16, 37 TYPE_UINT16,
42 TYPE_UINT32, 38 TYPE_UINT32,
43 TYPE_UINT64, 39 TYPE_UINT64,
44 TYPE_INT16, 40 TYPE_INT16,
45 TYPE_INT32, 41 TYPE_INT32,
46 TYPE_INT64, 42 TYPE_INT64,
@@ -52,7 +48,7 @@ namespace OpenSim.Framework
52 TYPE_LLVECTOR3, 48 TYPE_LLVECTOR3,
53 TYPE_FLOAT, 49 TYPE_FLOAT,
54 TYPE_DOUBLE 50 TYPE_DOUBLE
55 }; 51 } ;
56 52
57 public string configurationKey = ""; 53 public string configurationKey = "";
58 public string configurationQuestion = ""; 54 public string configurationQuestion = "";
@@ -61,4 +57,4 @@ namespace OpenSim.Framework
61 public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING; 57 public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING;
62 public bool configurationUseDefaultNoPrompt = false; 58 public bool configurationUseDefaultNoPrompt = false;
63 } 59 }
64} 60} \ 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 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Globalization; 30using System.Globalization;
32using System.Text;
33using System.Threading; 31using System.Threading;
34 32
35namespace OpenSim.Framework 33namespace OpenSim.Framework
36{ 34{
37 public class Culture 35 public class Culture
38 { 36 {
39 private static readonly CultureInfo m_cultureInfo = new System.Globalization.CultureInfo("en-US", true); 37 private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true);
40 38
41 public static NumberFormatInfo NumberFormatInfo 39 public static NumberFormatInfo NumberFormatInfo
42 { 40 {
43 get 41 get { return m_cultureInfo.NumberFormat; }
44 {
45 return m_cultureInfo.NumberFormat;
46 }
47 } 42 }
48 43
49 public static IFormatProvider FormatProvider 44 public static IFormatProvider FormatProvider
50 { 45 {
51 get 46 get { return m_cultureInfo; }
52 {
53 return m_cultureInfo;
54 }
55 } 47 }
56 48
57 public static void SetCurrentCulture() 49 public static void SetCurrentCulture()
@@ -59,4 +51,4 @@ namespace OpenSim.Framework
59 Thread.CurrentThread.CurrentCulture = m_cultureInfo; 51 Thread.CurrentThread.CurrentCulture = m_cultureInfo;
60 } 52 }
61 } 53 }
62} 54} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
28using System.IO; 29using System.IO;
29using libsecondlife; 30using libsecondlife;
30using OpenSim.Framework;
31using System.Globalization;
32 31
33namespace OpenSim.Framework 32namespace OpenSim.Framework
34{ 33{
35 public class EstateSettings 34 public class EstateSettings
36 { 35 {
37
38 //Settings to this island 36 //Settings to this island
39 private float m_billableFactor; 37 private float m_billableFactor;
38
40 public float billableFactor 39 public float billableFactor
41 { 40 {
42 get 41 get { return m_billableFactor; }
43 {
44 return m_billableFactor;
45 }
46 set 42 set
47 { 43 {
48 m_billableFactor = value; 44 m_billableFactor = value;
@@ -52,12 +48,10 @@ namespace OpenSim.Framework
52 48
53 49
54 private uint m_estateID; 50 private uint m_estateID;
51
55 public uint estateID 52 public uint estateID
56 { 53 {
57 get 54 get { return m_estateID; }
58 {
59 return m_estateID;
60 }
61 set 55 set
62 { 56 {
63 m_estateID = value; 57 m_estateID = value;
@@ -67,12 +61,10 @@ namespace OpenSim.Framework
67 61
68 62
69 private uint m_parentEstateID; 63 private uint m_parentEstateID;
64
70 public uint parentEstateID 65 public uint parentEstateID
71 { 66 {
72 get 67 get { return m_parentEstateID; }
73 {
74 return m_parentEstateID;
75 }
76 set 68 set
77 { 69 {
78 m_parentEstateID = value; 70 m_parentEstateID = value;
@@ -81,12 +73,10 @@ namespace OpenSim.Framework
81 } 73 }
82 74
83 private byte m_maxAgents; 75 private byte m_maxAgents;
76
84 public byte maxAgents 77 public byte maxAgents
85 { 78 {
86 get 79 get { return m_maxAgents; }
87 {
88 return m_maxAgents;
89 }
90 set 80 set
91 { 81 {
92 m_maxAgents = value; 82 m_maxAgents = value;
@@ -95,12 +85,10 @@ namespace OpenSim.Framework
95 } 85 }
96 86
97 private float m_objectBonusFactor; 87 private float m_objectBonusFactor;
88
98 public float objectBonusFactor 89 public float objectBonusFactor
99 { 90 {
100 get 91 get { return m_objectBonusFactor; }
101 {
102 return m_objectBonusFactor;
103 }
104 set 92 set
105 { 93 {
106 m_objectBonusFactor = value; 94 m_objectBonusFactor = value;
@@ -109,12 +97,10 @@ namespace OpenSim.Framework
109 } 97 }
110 98
111 private int m_redirectGridX; 99 private int m_redirectGridX;
100
112 public int redirectGridX 101 public int redirectGridX
113 { 102 {
114 get 103 get { return m_redirectGridX; }
115 {
116 return m_redirectGridX;
117 }
118 set 104 set
119 { 105 {
120 m_redirectGridX = value; 106 m_redirectGridX = value;
@@ -123,12 +109,10 @@ namespace OpenSim.Framework
123 } 109 }
124 110
125 private int m_redirectGridY; 111 private int m_redirectGridY;
112
126 public int redirectGridY 113 public int redirectGridY
127 { 114 {
128 get 115 get { return m_redirectGridY; }
129 {
130 return m_redirectGridY;
131 }
132 set 116 set
133 { 117 {
134 m_redirectGridY = value; 118 m_redirectGridY = value;
@@ -137,12 +121,10 @@ namespace OpenSim.Framework
137 } 121 }
138 122
139 private Simulator.RegionFlags m_regionFlags; 123 private Simulator.RegionFlags m_regionFlags;
124
140 public Simulator.RegionFlags regionFlags 125 public Simulator.RegionFlags regionFlags
141 { 126 {
142 get 127 get { return m_regionFlags; }
143 {
144 return m_regionFlags;
145 }
146 set 128 set
147 { 129 {
148 m_regionFlags = value; 130 m_regionFlags = value;
@@ -152,12 +134,10 @@ namespace OpenSim.Framework
152 134
153 135
154 private Simulator.SimAccess m_simAccess; 136 private Simulator.SimAccess m_simAccess;
137
155 public Simulator.SimAccess simAccess 138 public Simulator.SimAccess simAccess
156 { 139 {
157 get 140 get { return m_simAccess; }
158 {
159 return m_simAccess;
160 }
161 set 141 set
162 { 142 {
163 m_simAccess = value; 143 m_simAccess = value;
@@ -166,12 +146,10 @@ namespace OpenSim.Framework
166 } 146 }
167 147
168 private float m_sunHour; 148 private float m_sunHour;
149
169 public float sunHour 150 public float sunHour
170 { 151 {
171 get 152 get { return m_sunHour; }
172 {
173 return m_sunHour;
174 }
175 set 153 set
176 { 154 {
177 m_sunHour = value; 155 m_sunHour = value;
@@ -180,12 +158,10 @@ namespace OpenSim.Framework
180 } 158 }
181 159
182 private float m_terrainRaiseLimit; 160 private float m_terrainRaiseLimit;
161
183 public float terrainRaiseLimit 162 public float terrainRaiseLimit
184 { 163 {
185 get 164 get { return m_terrainRaiseLimit; }
186 {
187 return m_terrainRaiseLimit;
188 }
189 set 165 set
190 { 166 {
191 m_terrainRaiseLimit = value; 167 m_terrainRaiseLimit = value;
@@ -194,12 +170,10 @@ namespace OpenSim.Framework
194 } 170 }
195 171
196 private float m_terrainLowerLimit; 172 private float m_terrainLowerLimit;
173
197 public float terrainLowerLimit 174 public float terrainLowerLimit
198 { 175 {
199 get 176 get { return m_terrainLowerLimit; }
200 {
201 return m_terrainLowerLimit;
202 }
203 set 177 set
204 { 178 {
205 m_terrainLowerLimit = value; 179 m_terrainLowerLimit = value;
@@ -208,12 +182,10 @@ namespace OpenSim.Framework
208 } 182 }
209 183
210 private bool m_useFixedSun; 184 private bool m_useFixedSun;
185
211 public bool useFixedSun 186 public bool useFixedSun
212 { 187 {
213 get 188 get { return m_useFixedSun; }
214 {
215 return m_useFixedSun;
216 }
217 set 189 set
218 { 190 {
219 m_useFixedSun = value; 191 m_useFixedSun = value;
@@ -223,12 +195,10 @@ namespace OpenSim.Framework
223 195
224 196
225 private int m_pricePerMeter; 197 private int m_pricePerMeter;
198
226 public int pricePerMeter 199 public int pricePerMeter
227 { 200 {
228 get 201 get { return m_pricePerMeter; }
229 {
230 return m_pricePerMeter;
231 }
232 set 202 set
233 { 203 {
234 m_pricePerMeter = value; 204 m_pricePerMeter = value;
@@ -238,12 +208,10 @@ namespace OpenSim.Framework
238 208
239 209
240 private ushort m_regionWaterHeight; 210 private ushort m_regionWaterHeight;
211
241 public ushort regionWaterHeight 212 public ushort regionWaterHeight
242 { 213 {
243 get 214 get { return m_regionWaterHeight; }
244 {
245 return m_regionWaterHeight;
246 }
247 set 215 set
248 { 216 {
249 m_regionWaterHeight = value; 217 m_regionWaterHeight = value;
@@ -253,12 +221,10 @@ namespace OpenSim.Framework
253 221
254 222
255 private bool m_regionAllowTerraform; 223 private bool m_regionAllowTerraform;
224
256 public bool regionAllowTerraform 225 public bool regionAllowTerraform
257 { 226 {
258 get 227 get { return m_regionAllowTerraform; }
259 {
260 return m_regionAllowTerraform;
261 }
262 set 228 set
263 { 229 {
264 m_regionAllowTerraform = value; 230 m_regionAllowTerraform = value;
@@ -266,16 +232,14 @@ namespace OpenSim.Framework
266 } 232 }
267 } 233 }
268 234
269 235
270 // Region Information 236 // Region Information
271 // Low resolution 'base' textures. No longer used. 237 // Low resolution 'base' textures. No longer used.
272 private LLUUID m_terrainBase0; 238 private LLUUID m_terrainBase0;
239
273 public LLUUID terrainBase0 240 public LLUUID terrainBase0
274 { 241 {
275 get 242 get { return m_terrainBase0; }
276 {
277 return m_terrainBase0;
278 }
279 set 243 set
280 { 244 {
281 m_terrainBase0 = value; 245 m_terrainBase0 = value;
@@ -284,12 +248,10 @@ namespace OpenSim.Framework
284 } 248 }
285 249
286 private LLUUID m_terrainBase1; 250 private LLUUID m_terrainBase1;
251
287 public LLUUID terrainBase1 252 public LLUUID terrainBase1
288 { 253 {
289 get 254 get { return m_terrainBase1; }
290 {
291 return m_terrainBase1;
292 }
293 set 255 set
294 { 256 {
295 m_terrainBase1 = value; 257 m_terrainBase1 = value;
@@ -298,12 +260,10 @@ namespace OpenSim.Framework
298 } 260 }
299 261
300 private LLUUID m_terrainBase2; 262 private LLUUID m_terrainBase2;
263
301 public LLUUID terrainBase2 264 public LLUUID terrainBase2
302 { 265 {
303 get 266 get { return m_terrainBase2; }
304 {
305 return m_terrainBase2;
306 }
307 set 267 set
308 { 268 {
309 m_terrainBase2 = value; 269 m_terrainBase2 = value;
@@ -312,12 +272,10 @@ namespace OpenSim.Framework
312 } 272 }
313 273
314 private LLUUID m_terrainBase3; 274 private LLUUID m_terrainBase3;
275
315 public LLUUID terrainBase3 276 public LLUUID terrainBase3
316 { 277 {
317 get 278 get { return m_terrainBase3; }
318 {
319 return m_terrainBase3;
320 }
321 set 279 set
322 { 280 {
323 m_terrainBase3 = value; 281 m_terrainBase3 = value;
@@ -328,53 +286,46 @@ namespace OpenSim.Framework
328 286
329 // Higher resolution terrain textures 287 // Higher resolution terrain textures
330 private LLUUID m_terrainDetail0; 288 private LLUUID m_terrainDetail0;
289
331 public LLUUID terrainDetail0 290 public LLUUID terrainDetail0
332 { 291 {
333 get 292 get { return m_terrainDetail0; }
334 {
335 return m_terrainDetail0;
336 }
337 set 293 set
338 { 294 {
339
340 m_terrainDetail0 = value; 295 m_terrainDetail0 = value;
341 configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString()); 296 configMember.forceSetConfigurationOption("terrain_detail_0", m_terrainDetail0.ToString());
342 } 297 }
343 } 298 }
344 299
345 private LLUUID m_terrainDetail1; 300 private LLUUID m_terrainDetail1;
301
346 public LLUUID terrainDetail1 302 public LLUUID terrainDetail1
347 { 303 {
348 get 304 get { return m_terrainDetail1; }
349 {
350 return m_terrainDetail1;
351 }
352 set 305 set
353 { 306 {
354 m_terrainDetail1 = value; 307 m_terrainDetail1 = value;
355 configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString()); 308 configMember.forceSetConfigurationOption("terrain_detail_1", m_terrainDetail1.ToString());
356 } 309 }
357 } 310 }
311
358 private LLUUID m_terrainDetail2; 312 private LLUUID m_terrainDetail2;
313
359 public LLUUID terrainDetail2 314 public LLUUID terrainDetail2
360 { 315 {
361 get 316 get { return m_terrainDetail2; }
362 {
363 return m_terrainDetail2;
364 }
365 set 317 set
366 { 318 {
367 m_terrainDetail2 = value; 319 m_terrainDetail2 = value;
368 configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString()); 320 configMember.forceSetConfigurationOption("terrain_detail_2", m_terrainDetail2.ToString());
369 } 321 }
370 } 322 }
323
371 private LLUUID m_terrainDetail3; 324 private LLUUID m_terrainDetail3;
325
372 public LLUUID terrainDetail3 326 public LLUUID terrainDetail3
373 { 327 {
374 get 328 get { return m_terrainDetail3; }
375 {
376 return m_terrainDetail3;
377 }
378 set 329 set
379 { 330 {
380 m_terrainDetail3 = value; 331 m_terrainDetail3 = value;
@@ -384,12 +335,10 @@ namespace OpenSim.Framework
384 335
385 // First quad - each point is bilinearly interpolated at each meter of terrain 336 // First quad - each point is bilinearly interpolated at each meter of terrain
386 private float m_terrainStartHeight0; 337 private float m_terrainStartHeight0;
338
387 public float terrainStartHeight0 339 public float terrainStartHeight0
388 { 340 {
389 get 341 get { return m_terrainStartHeight0; }
390 {
391 return m_terrainStartHeight0;
392 }
393 set 342 set
394 { 343 {
395 m_terrainStartHeight0 = value; 344 m_terrainStartHeight0 = value;
@@ -399,12 +348,10 @@ namespace OpenSim.Framework
399 348
400 349
401 private float m_terrainStartHeight1; 350 private float m_terrainStartHeight1;
351
402 public float terrainStartHeight1 352 public float terrainStartHeight1
403 { 353 {
404 get 354 get { return m_terrainStartHeight1; }
405 {
406 return m_terrainStartHeight1;
407 }
408 set 355 set
409 { 356 {
410 m_terrainStartHeight1 = value; 357 m_terrainStartHeight1 = value;
@@ -413,12 +360,10 @@ namespace OpenSim.Framework
413 } 360 }
414 361
415 private float m_terrainStartHeight2; 362 private float m_terrainStartHeight2;
363
416 public float terrainStartHeight2 364 public float terrainStartHeight2
417 { 365 {
418 get 366 get { return m_terrainStartHeight2; }
419 {
420 return m_terrainStartHeight2;
421 }
422 set 367 set
423 { 368 {
424 m_terrainStartHeight2 = value; 369 m_terrainStartHeight2 = value;
@@ -427,28 +372,25 @@ namespace OpenSim.Framework
427 } 372 }
428 373
429 private float m_terrainStartHeight3; 374 private float m_terrainStartHeight3;
375
430 public float terrainStartHeight3 376 public float terrainStartHeight3
431 { 377 {
432 get 378 get { return m_terrainStartHeight3; }
433 {
434 return m_terrainStartHeight3;
435 }
436 set 379 set
437 { 380 {
438 m_terrainStartHeight3 = value; 381 m_terrainStartHeight3 = value;
439 configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString()); 382 configMember.forceSetConfigurationOption("terrain_start_height_3", m_terrainStartHeight3.ToString());
440 } 383 }
441 } 384 }
385
442 // Second quad - also bilinearly interpolated. 386 // Second quad - also bilinearly interpolated.
443 // Terrain texturing is done that: 387 // Terrain texturing is done that:
444 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y] 388 // 0..3 (0 = base0, 3 = base3) = (terrain[x,y] - start[x,y]) / range[x,y]
445 private float m_terrainHeightRange0; 389 private float m_terrainHeightRange0;
390
446 public float terrainHeightRange0 391 public float terrainHeightRange0
447 { 392 {
448 get 393 get { return m_terrainHeightRange0; }
449 {
450 return m_terrainHeightRange0;
451 }
452 set 394 set
453 { 395 {
454 m_terrainHeightRange0 = value; 396 m_terrainHeightRange0 = value;
@@ -457,12 +399,10 @@ namespace OpenSim.Framework
457 } 399 }
458 400
459 private float m_terrainHeightRange1; 401 private float m_terrainHeightRange1;
402
460 public float terrainHeightRange1 403 public float terrainHeightRange1
461 { 404 {
462 get 405 get { return m_terrainHeightRange1; }
463 {
464 return m_terrainHeightRange1;
465 }
466 set 406 set
467 { 407 {
468 m_terrainHeightRange1 = value; 408 m_terrainHeightRange1 = value;
@@ -471,12 +411,10 @@ namespace OpenSim.Framework
471 } 411 }
472 412
473 private float m_terrainHeightRange2; 413 private float m_terrainHeightRange2;
414
474 public float terrainHeightRange2 415 public float terrainHeightRange2
475 { 416 {
476 get 417 get { return m_terrainHeightRange2; }
477 {
478 return m_terrainHeightRange2;
479 }
480 set 418 set
481 { 419 {
482 m_terrainHeightRange2 = value; 420 m_terrainHeightRange2 = value;
@@ -485,26 +423,23 @@ namespace OpenSim.Framework
485 } 423 }
486 424
487 private float m_terrainHeightRange3; 425 private float m_terrainHeightRange3;
426
488 public float terrainHeightRange3 427 public float terrainHeightRange3
489 { 428 {
490 get 429 get { return m_terrainHeightRange3; }
491 {
492 return m_terrainHeightRange3;
493 }
494 set 430 set
495 { 431 {
496 m_terrainHeightRange3 = value; 432 m_terrainHeightRange3 = value;
497 configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString()); 433 configMember.forceSetConfigurationOption("terrain_height_range_3", m_terrainHeightRange3.ToString());
498 } 434 }
499 } 435 }
436
500 // Terrain Default (Must be in F32 Format!) 437 // Terrain Default (Must be in F32 Format!)
501 private string m_terrainFile; 438 private string m_terrainFile;
439
502 public string terrainFile 440 public string terrainFile
503 { 441 {
504 get 442 get { return m_terrainFile; }
505 {
506 return m_terrainFile;
507 }
508 set 443 set
509 { 444 {
510 m_terrainFile = value; 445 m_terrainFile = value;
@@ -513,12 +448,10 @@ namespace OpenSim.Framework
513 } 448 }
514 449
515 private double m_terrainMultiplier; 450 private double m_terrainMultiplier;
451
516 public double terrainMultiplier 452 public double terrainMultiplier
517 { 453 {
518 get 454 get { return m_terrainMultiplier; }
519 {
520 return m_terrainMultiplier;
521 }
522 set 455 set
523 { 456 {
524 m_terrainMultiplier = value; 457 m_terrainMultiplier = value;
@@ -527,12 +460,10 @@ namespace OpenSim.Framework
527 } 460 }
528 461
529 private float m_waterHeight; 462 private float m_waterHeight;
463
530 public float waterHeight 464 public float waterHeight
531 { 465 {
532 get 466 get { return m_waterHeight; }
533 {
534 return m_waterHeight;
535 }
536 set 467 set
537 { 468 {
538 m_waterHeight = value; 469 m_waterHeight = value;
@@ -541,73 +472,112 @@ namespace OpenSim.Framework
541 } 472 }
542 473
543 private LLUUID m_terrainImageID; 474 private LLUUID m_terrainImageID;
475
544 public LLUUID terrainImageID 476 public LLUUID terrainImageID
545 { 477 {
546 get 478 get { return m_terrainImageID; }
547 {
548 return m_terrainImageID;
549 }
550 set 479 set
551 { 480 {
552 m_terrainImageID = value; 481 m_terrainImageID = value;
553 configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString()); 482 configMember.forceSetConfigurationOption("terrain_image_id", m_terrainImageID.ToString());
554 } 483 }
555 } 484 }
485
556 private ConfigurationMember configMember; 486 private ConfigurationMember configMember;
487
557 public EstateSettings() 488 public EstateSettings()
558 { 489 {
559 // Temporary hack to prevent multiple loadings. 490 // Temporary hack to prevent multiple loadings.
560 if (configMember == null) 491 if (configMember == null)
561 { 492 {
562 configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", this.loadConfigurationOptions, this.handleIncomingConfiguration); 493 configMember =
494 new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS",
495 loadConfigurationOptions, handleIncomingConfiguration);
563 configMember.performConfigurationRetrieve(); 496 configMember.performConfigurationRetrieve();
564 } 497 }
565 } 498 }
566 499
567 public void loadConfigurationOptions() 500 public void loadConfigurationOptions()
568 { 501 {
569 configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "","0.0",true); 502 configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "",
570 configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "","0",true); 503 "0.0", true);
571 configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); 504 configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0",
572 configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40", true); 505 true);
573 506 configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
574 configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "1.0", true); 507 "", "0", true);
575 configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); 508 configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "40",
576 configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "", "0", true); 509 true);
577 configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "0", true); 510
578 configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21", true); 511 configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
579 configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); 512 "", "1.0", true);
580 configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); 513 configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "",
581 configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0", true); 514 "0", true);
582 configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "false", true); 515 configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "",
583 configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "", "1", true); 516 "0", true);
584 configMember.addConfigurationOption("region_water_height", ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true); 517 configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "",
585 configMember.addConfigurationOption("region_allow_terraform", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true); 518 "0", true);
586 519 configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, "", "21",
587 configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); 520 true);
588 configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "abb783e6-3e93-26c0-248a-247666855da3", true); 521 configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "0",
589 configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "179cdabd-398a-9b6b-1391-4dc333ba321f", true); 522 true);
590 configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "beb169c7-11ea-fff2-efe5-0f24dc881df2", true); 523 configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
591 524 "", "0", true);
592 configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); 525 configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
593 configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); 526 "", "0", true);
594 configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); 527 configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "",
595 configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); 528 "false", true);
596 529 configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
597 configMember.addConfigurationOption("terrain_start_height_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); 530 "", "1", true);
598 configMember.addConfigurationOption("terrain_start_height_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); 531 configMember.addConfigurationOption("region_water_height",
599 configMember.addConfigurationOption("terrain_start_height_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); 532 ConfigurationOption.ConfigurationTypes.TYPE_UINT16, "", "20", true);
600 configMember.addConfigurationOption("terrain_start_height_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true); 533 configMember.addConfigurationOption("region_allow_terraform",
601 534 ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, "", "true", true);
602 configMember.addConfigurationOption("terrain_height_range_0", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); 535
603 configMember.addConfigurationOption("terrain_height_range_1", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); 536 configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
604 configMember.addConfigurationOption("terrain_height_range_2", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); 537 "b8d3965a-ad78-bf43-699b-bff8eca6c975", true);
605 configMember.addConfigurationOption("terrain_height_range_3", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); 538 configMember.addConfigurationOption("terrain_base_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
606 539 "abb783e6-3e93-26c0-248a-247666855da3", true);
607 configMember.addConfigurationOption("terrain_file", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "", "default.r32", true); 540 configMember.addConfigurationOption("terrain_base_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
608 configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true); 541 "179cdabd-398a-9b6b-1391-4dc333ba321f", true);
609 configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "", "20.0", true); 542 configMember.addConfigurationOption("terrain_base_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "",
610 configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "", "00000000-0000-0000-0000-000000000000", true); 543 "beb169c7-11ea-fff2-efe5-0f24dc881df2", true);
544
545 configMember.addConfigurationOption("terrain_detail_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
546 "", "00000000-0000-0000-0000-000000000000", true);
547 configMember.addConfigurationOption("terrain_detail_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
548 "", "00000000-0000-0000-0000-000000000000", true);
549 configMember.addConfigurationOption("terrain_detail_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
550 "", "00000000-0000-0000-0000-000000000000", true);
551 configMember.addConfigurationOption("terrain_detail_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
552 "", "00000000-0000-0000-0000-000000000000", true);
553
554 configMember.addConfigurationOption("terrain_start_height_0",
555 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
556 configMember.addConfigurationOption("terrain_start_height_1",
557 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
558 configMember.addConfigurationOption("terrain_start_height_2",
559 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
560 configMember.addConfigurationOption("terrain_start_height_3",
561 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "10.0", true);
562
563 configMember.addConfigurationOption("terrain_height_range_0",
564 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
565 configMember.addConfigurationOption("terrain_height_range_1",
566 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
567 configMember.addConfigurationOption("terrain_height_range_2",
568 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
569 configMember.addConfigurationOption("terrain_height_range_3",
570 ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, "", "60.0", true);
571
572 configMember.addConfigurationOption("terrain_file",
573 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "",
574 "default.r32", true);
575 configMember.addConfigurationOption("terrain_multiplier", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
576 "", "60.0", true);
577 configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, "",
578 "20.0", true);
579 configMember.addConfigurationOption("terrain_image_id", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
580 "", "00000000-0000-0000-0000-000000000000", true);
611 } 581 }
612 582
613 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 583 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -615,123 +585,123 @@ namespace OpenSim.Framework
615 switch (configuration_key) 585 switch (configuration_key)
616 { 586 {
617 case "billable_factor": 587 case "billable_factor":
618 this.m_billableFactor = (float)configuration_result; 588 m_billableFactor = (float) configuration_result;
619 break; 589 break;
620 case "estate_id": 590 case "estate_id":
621 this.m_estateID = (uint)configuration_result; 591 m_estateID = (uint) configuration_result;
622 break; 592 break;
623 case "parent_estate_id": 593 case "parent_estate_id":
624 this.m_parentEstateID = (uint)configuration_result; 594 m_parentEstateID = (uint) configuration_result;
625 break; 595 break;
626 case "max_agents": 596 case "max_agents":
627 this.m_maxAgents = (byte)configuration_result; 597 m_maxAgents = (byte) configuration_result;
628 break; 598 break;
629 599
630 case "object_bonus_factor": 600 case "object_bonus_factor":
631 this.m_objectBonusFactor = (float)configuration_result; 601 m_objectBonusFactor = (float) configuration_result;
632 break; 602 break;
633 case "redirect_grid_x": 603 case "redirect_grid_x":
634 this.m_redirectGridX = (int)configuration_result; 604 m_redirectGridX = (int) configuration_result;
635 break; 605 break;
636 case "redirect_grid_y": 606 case "redirect_grid_y":
637 this.m_redirectGridY = (int)configuration_result; 607 m_redirectGridY = (int) configuration_result;
638 break; 608 break;
639 case "region_flags": 609 case "region_flags":
640 this.m_regionFlags = (Simulator.RegionFlags)((uint)configuration_result); 610 m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result);
641 break; 611 break;
642 case "sim_access": 612 case "sim_access":
643 this.m_simAccess = (Simulator.SimAccess)((byte)configuration_result); 613 m_simAccess = (Simulator.SimAccess) ((byte) configuration_result);
644 break; 614 break;
645 case "sun_hour": 615 case "sun_hour":
646 this.m_sunHour = (float)configuration_result; 616 m_sunHour = (float) configuration_result;
647 break; 617 break;
648 case "terrain_raise_limit": 618 case "terrain_raise_limit":
649 this.m_terrainRaiseLimit = (float)configuration_result; 619 m_terrainRaiseLimit = (float) configuration_result;
650 break; 620 break;
651 case "terrain_lower_limit": 621 case "terrain_lower_limit":
652 this.m_terrainLowerLimit = (float)configuration_result; 622 m_terrainLowerLimit = (float) configuration_result;
653 break; 623 break;
654 case "use_fixed_sun": 624 case "use_fixed_sun":
655 this.m_useFixedSun = (bool)configuration_result; 625 m_useFixedSun = (bool) configuration_result;
656 break; 626 break;
657 case "price_per_meter": 627 case "price_per_meter":
658 this.m_pricePerMeter = System.Convert.ToInt32(configuration_result); 628 m_pricePerMeter = Convert.ToInt32(configuration_result);
659 break; 629 break;
660 case "region_water_height": 630 case "region_water_height":
661 this.m_regionWaterHeight = (ushort)configuration_result; 631 m_regionWaterHeight = (ushort) configuration_result;
662 break; 632 break;
663 case "region_allow_terraform": 633 case "region_allow_terraform":
664 this.m_regionAllowTerraform = (bool)configuration_result; 634 m_regionAllowTerraform = (bool) configuration_result;
665 break; 635 break;
666 636
667 case "terrain_base_0": 637 case "terrain_base_0":
668 this.m_terrainBase0 = (LLUUID)configuration_result; 638 m_terrainBase0 = (LLUUID) configuration_result;
669 break; 639 break;
670 case "terrain_base_1": 640 case "terrain_base_1":
671 this.m_terrainBase1 = (LLUUID)configuration_result; 641 m_terrainBase1 = (LLUUID) configuration_result;
672 break; 642 break;
673 case "terrain_base_2": 643 case "terrain_base_2":
674 this.m_terrainBase2 = (LLUUID)configuration_result; 644 m_terrainBase2 = (LLUUID) configuration_result;
675 break; 645 break;
676 case "terrain_base_3": 646 case "terrain_base_3":
677 this.m_terrainBase3 = (LLUUID)configuration_result; 647 m_terrainBase3 = (LLUUID) configuration_result;
678 break; 648 break;
679 649
680 case "terrain_detail_0": 650 case "terrain_detail_0":
681 this.m_terrainDetail0 = (LLUUID)configuration_result; 651 m_terrainDetail0 = (LLUUID) configuration_result;
682 break; 652 break;
683 case "terrain_detail_1": 653 case "terrain_detail_1":
684 this.m_terrainDetail1 = (LLUUID)configuration_result; 654 m_terrainDetail1 = (LLUUID) configuration_result;
685 break; 655 break;
686 case "terrain_detail_2": 656 case "terrain_detail_2":
687 this.m_terrainDetail2 = (LLUUID)configuration_result; 657 m_terrainDetail2 = (LLUUID) configuration_result;
688 break; 658 break;
689 case "terrain_detail_3": 659 case "terrain_detail_3":
690 this.m_terrainDetail3 = (LLUUID)configuration_result; 660 m_terrainDetail3 = (LLUUID) configuration_result;
691 break; 661 break;
692 662
693 case "terrain_start_height_0": 663 case "terrain_start_height_0":
694 this.m_terrainStartHeight0 = (float)configuration_result; 664 m_terrainStartHeight0 = (float) configuration_result;
695 break; 665 break;
696 case "terrain_start_height_1": 666 case "terrain_start_height_1":
697 this.m_terrainStartHeight1 = (float)configuration_result; 667 m_terrainStartHeight1 = (float) configuration_result;
698 break; 668 break;
699 case "terrain_start_height_2": 669 case "terrain_start_height_2":
700 this.m_terrainStartHeight2 = (float)configuration_result; 670 m_terrainStartHeight2 = (float) configuration_result;
701 break; 671 break;
702 case "terrain_start_height_3": 672 case "terrain_start_height_3":
703 this.m_terrainStartHeight3 = (float)configuration_result; 673 m_terrainStartHeight3 = (float) configuration_result;
704 break; 674 break;
705 675
706 case "terrain_height_range_0": 676 case "terrain_height_range_0":
707 this.m_terrainHeightRange0 = (float)configuration_result; 677 m_terrainHeightRange0 = (float) configuration_result;
708 break; 678 break;
709 case "terrain_height_range_1": 679 case "terrain_height_range_1":
710 this.m_terrainHeightRange1 = (float)configuration_result; 680 m_terrainHeightRange1 = (float) configuration_result;
711 break; 681 break;
712 case "terrain_height_range_2": 682 case "terrain_height_range_2":
713 this.m_terrainHeightRange2 = (float)configuration_result; 683 m_terrainHeightRange2 = (float) configuration_result;
714 break; 684 break;
715 case "terrain_height_range_3": 685 case "terrain_height_range_3":
716 this.m_terrainHeightRange3 = (float)configuration_result; 686 m_terrainHeightRange3 = (float) configuration_result;
717 break; 687 break;
718 688
719 case "terrain_file": 689 case "terrain_file":
720 this.m_terrainFile = (string)configuration_result; 690 m_terrainFile = (string) configuration_result;
721 break; 691 break;
722 case "terrain_multiplier": 692 case "terrain_multiplier":
723 this.m_terrainMultiplier = System.Convert.ToDouble(configuration_result); 693 m_terrainMultiplier = Convert.ToDouble(configuration_result);
724 break; 694 break;
725 case "water_height": 695 case "water_height":
726 double tmpVal = (double) configuration_result; 696 double tmpVal = (double) configuration_result;
727 this.m_waterHeight = (float) tmpVal; 697 m_waterHeight = (float) tmpVal;
728 break; 698 break;
729 case "terrain_image_id": 699 case "terrain_image_id":
730 this.m_terrainImageID = (LLUUID)configuration_result; 700 m_terrainImageID = (LLUUID) configuration_result;
731 break; 701 break;
732 } 702 }
733 703
734 return true; 704 return true;
735 } 705 }
736 } 706 }
737} 707} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework 29namespace OpenSim.Framework
34{ 30{
35 public class GridConfig 31 public class GridConfig
@@ -50,30 +46,49 @@ namespace OpenSim.Framework
50 46
51 public static uint DefaultHttpPort = 8001; 47 public static uint DefaultHttpPort = 8001;
52 public uint HttpPort = DefaultHttpPort; 48 public uint HttpPort = DefaultHttpPort;
53 49
54 private ConfigurationMember configMember; 50 private ConfigurationMember configMember;
51
55 public GridConfig(string description, string filename) 52 public GridConfig(string description, string filename)
56 { 53 {
57 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); 54 configMember =
55 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
58 configMember.performConfigurationRetrieve(); 56 configMember.performConfigurationRetrieve();
59 } 57 }
60 58
61 public void loadConfigurationOptions() 59 public void loadConfigurationOptions()
62 { 60 {
63 configMember.addConfigurationOption("grid_owner", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "OGS Grid Owner", "OGS development team", false); 61 configMember.addConfigurationOption("grid_owner",
64 configMember.addConfigurationOption("default_asset_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Asset Server URI", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/", false); 62 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
65 configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to asset server", "null", false); 63 "OGS Grid Owner", "OGS development team", false);
66 configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from asset server", "null", false); 64 configMember.addConfigurationOption("default_asset_server",
65 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
66 "Default Asset Server URI",
67 "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/",
68 false);
69 configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
70 "Key to send to asset server", "null", false);
71 configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
72 "Key to expect from asset server", "null", false);
67 73
68 configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false); 74 configMember.addConfigurationOption("default_user_server",
69 configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); 75 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
70 configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); 76 "Default User Server URI",
77 "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false);
78 configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
79 "Key to send to user server", "null", false);
80 configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
81 "Key to expect from user server", "null", false);
71 82
72 configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to a simulator", "null", false); 83 configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
73 configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from a simulator", "null", false); 84 "Key to send to a simulator", "null", false);
74 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); 85 configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
86 "Key to expect from a simulator", "null", false);
87 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
88 "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
75 89
76 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); 90 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
91 "Http Listener port", DefaultHttpPort.ToString(), false);
77 } 92 }
78 93
79 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 94 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -81,41 +96,41 @@ namespace OpenSim.Framework
81 switch (configuration_key) 96 switch (configuration_key)
82 { 97 {
83 case "grid_owner": 98 case "grid_owner":
84 this.GridOwner = (string)configuration_result; 99 GridOwner = (string) configuration_result;
85 break; 100 break;
86 case "default_asset_server": 101 case "default_asset_server":
87 this.DefaultAssetServer = (string)configuration_result; 102 DefaultAssetServer = (string) configuration_result;
88 break; 103 break;
89 case "asset_send_key": 104 case "asset_send_key":
90 this.AssetSendKey = (string)configuration_result; 105 AssetSendKey = (string) configuration_result;
91 break; 106 break;
92 case "asset_recv_key": 107 case "asset_recv_key":
93 this.AssetRecvKey = (string)configuration_result; 108 AssetRecvKey = (string) configuration_result;
94 break; 109 break;
95 case "default_user_server": 110 case "default_user_server":
96 this.DefaultUserServer = (string)configuration_result; 111 DefaultUserServer = (string) configuration_result;
97 break; 112 break;
98 case "user_send_key": 113 case "user_send_key":
99 this.UserSendKey = (string)configuration_result; 114 UserSendKey = (string) configuration_result;
100 break; 115 break;
101 case "user_recv_key": 116 case "user_recv_key":
102 this.UserRecvKey = (string)configuration_result; 117 UserRecvKey = (string) configuration_result;
103 break; 118 break;
104 case "sim_send_key": 119 case "sim_send_key":
105 this.SimSendKey = (string)configuration_result; 120 SimSendKey = (string) configuration_result;
106 break; 121 break;
107 case "sim_recv_key": 122 case "sim_recv_key":
108 this.SimRecvKey = (string)configuration_result; 123 SimRecvKey = (string) configuration_result;
109 break; 124 break;
110 case "database_provider": 125 case "database_provider":
111 this.DatabaseProvider = (string)configuration_result; 126 DatabaseProvider = (string) configuration_result;
112 break; 127 break;
113 case "http_port": 128 case "http_port":
114 HttpPort = (uint)configuration_result; 129 HttpPort = (uint) configuration_result;
115 break; 130 break;
116 } 131 }
117 132
118 return true; 133 return true;
119 } 134 }
120 } 135 }
121} 136} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using OpenSim.Framework;
33using libsecondlife; 29using libsecondlife;
34 30
35namespace OpenSim.Framework 31namespace OpenSim.Framework
36{ 32{
37 public interface IAssetProvider : IPlugin 33 public interface IAssetProvider : IPlugin
38 { 34 {
39 AssetBase FetchAsset(LLUUID uuid); 35 AssetBase FetchAsset(LLUUID uuid);
40 void CreateAsset(AssetBase asset); 36 void CreateAsset(AssetBase asset);
@@ -42,4 +38,4 @@ namespace OpenSim.Framework
42 bool ExistsAsset(LLUUID uuid); 38 bool ExistsAsset(LLUUID uuid);
43 void CommitAssets(); // force a sync to the database 39 void CommitAssets(); // force a sync to the database
44 } 40 }
45} 41} \ 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 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework;
32 31
33namespace OpenSim.Framework 32namespace OpenSim.Framework
34{ 33{
35 /// <summary> 34 /// <summary>
36 /// Description of IAssetServer. 35 /// Description of IAssetServer.
37 /// </summary> 36 /// </summary>
38
39 public interface IAssetServer 37 public interface IAssetServer
40 { 38 {
41 void SetReceiver(IAssetReceiver receiver); 39 void SetReceiver(IAssetReceiver receiver);
@@ -68,4 +66,4 @@ namespace OpenSim.Framework
68 public LLUUID AssetID; 66 public LLUUID AssetID;
69 public bool IsTexture; 67 public bool IsTexture;
70 } 68 }
71} 69} \ 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;
30using System.Net; 30using System.Net;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets; 32using libsecondlife.Packets;
33using OpenSim.Framework;
34 33
35namespace OpenSim.Framework 34namespace OpenSim.Framework
36{ 35{
37 // Base Args Interface 36 // Base Args Interface
38 public interface IEventArgs 37 public interface IEventArgs
39 { 38 {
40 IScene Scene 39 IScene Scene { get; set; }
41 {
42 get;
43 set;
44 }
45 40
46 IClientAPI Sender 41 IClientAPI Sender { get; set; }
47 {
48 get;
49 set;
50 }
51 } 42 }
52 43
53 public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock); 44 public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
54 45
55 public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e); 46 public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e);
56 47
57 public enum ChatTypeEnum { Whisper = 0, Say = 1, Shout = 2, Broadcast = 0xFF }; 48 public enum ChatTypeEnum
49 {
50 Whisper = 0,
51 Say = 1,
52 Shout = 2,
53 Broadcast = 0xFF
54 } ;
58 55
59 /// <summary> 56 /// <summary>
60 /// ChatFromViewer Arguments 57 /// ChatFromViewer Arguments
@@ -163,68 +160,127 @@ namespace OpenSim.Framework
163 160
164 public delegate void TextureRequest(Object sender, TextureRequestArgs e); 161 public delegate void TextureRequest(Object sender, TextureRequestArgs e);
165 162
166 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 163 public delegate void ImprovedInstantMessage(
164 LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp,
165 string fromAgentName, string message, byte dialog); // Cut down from full list
167 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos); 166 public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
168 public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient); 167
168 public delegate void ModifyTerrain(
169 float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
170
169 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); 171 public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam);
172
170 public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq); 173 public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID, int seq);
174
171 public delegate void LinkObjects(uint parent, List<uint> children); 175 public delegate void LinkObjects(uint parent, List<uint> children);
176
172 public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY); 177 public delegate void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY);
173 public delegate void TeleportLocationRequest(IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags); 178
179 public delegate void TeleportLocationRequest(
180 IClientAPI remoteClient, ulong regionHandle, LLVector3 position, LLVector3 lookAt, uint flags);
181
174 public delegate void DisconnectUser(); 182 public delegate void DisconnectUser();
183
175 public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID); 184 public delegate void RequestAvatarProperties(IClientAPI remoteClient, LLUUID avatarID);
176 185
177 public delegate void GenericCall(IClientAPI remoteClient); 186 public delegate void GenericCall(IClientAPI remoteClient);
187
178 public delegate void GenericCall2(); 188 public delegate void GenericCall2();
179 public delegate void GenericCall3(Packet packet); // really don't want to be passing packets in these events, so this is very temporary. 189
190 public delegate void GenericCall3(Packet packet);
191
192 // really don't want to be passing packets in these events, so this is very temporary.
180 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); 193 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
194
181 public delegate void GenericCall5(IClientAPI remoteClient, bool status); 195 public delegate void GenericCall5(IClientAPI remoteClient, bool status);
196
182 public delegate void GenericCall6(LLUUID uid); 197 public delegate void GenericCall6(LLUUID uid);
198
183 public delegate void GenericCall7(uint localID, string message); 199 public delegate void GenericCall7(uint localID, string message);
184 200
185 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); 201 public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
202
186 public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); 203 public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data);
204
187 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); 205 public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
206
188 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); 207 public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient);
208
189 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); 209 public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient);
210
190 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); 211 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
212
191 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); 213 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
214
192 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 215 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
216
193 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 217 public delegate void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
194 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient); 218
219 public delegate void UpdatePrimGroupRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
220
195 public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags); 221 public delegate void ObjectDuplicate(uint localID, LLVector3 offset, uint dupeFlags);
222
196 public delegate void StatusChange(bool status); 223 public delegate void StatusChange(bool status);
224
197 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 225 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
226
198 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 227 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
228
199 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID); 229 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID);
230
200 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); 231 public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID);
232
201 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); 233 public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
202 234
203 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); 235 public delegate void ParcelPropertiesRequest(
236 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
237
204 public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client); 238 public delegate void ParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client);
239
205 public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client); 240 public delegate void ParcelJoinRequest(int west, int south, int east, int north, IClientAPI remote_client);
241
206 public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client); 242 public delegate void ParcelPropertiesUpdateRequest(ParcelPropertiesUpdatePacket packet, IClientAPI remote_client);
243
207 public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client); 244 public delegate void ParcelSelectObjects(int land_local_id, int request_type, IClientAPI remote_client);
245
208 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client); 246 public delegate void ParcelObjectOwnerRequest(int local_id, IClientAPI remote_client);
247
209 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client); 248 public delegate void EstateOwnerMessageRequest(EstateOwnerMessagePacket packet, IClientAPI remote_client);
210 249
211 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client); 250 public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
212 251
213 public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape); 252 public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
214 253
215 public delegate void CreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); 254 public delegate void CreateInventoryFolder(
216 public delegate void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); 255 IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID);
217 public delegate void FetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); 256
257 public delegate void CreateNewInventoryItem(
258 IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name,
259 sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask);
260
261 public delegate void FetchInventoryDescendents(
262 IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
263
218 public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID); 264 public delegate void FetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID);
265
219 public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID); 266 public delegate void RequestTaskInventory(IClientAPI remoteClient, uint localID);
220 public delegate void UpdateInventoryItemTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID); 267
268 public delegate void UpdateInventoryItemTransaction(
269 IClientAPI remoteClient, LLUUID transactionID, LLUUID assetID, LLUUID itemID);
270
221 public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID); 271 public delegate void RezScript(IClientAPI remoteClient, LLUUID itemID, uint localID);
272
222 public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID); 273 public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
274
223 public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID); 275 public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
224 276
225 public delegate void UDPAssetUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal); 277 public delegate void UDPAssetUploadRequest(
278 IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal);
279
226 public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data); 280 public delegate void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data);
281
227 public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName); 282 public delegate void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName);
283
228 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID); 284 public delegate void ConfirmXfer(IClientAPI remoteClient, ulong xferID, uint packetID);
229 285
230 public interface IClientAPI 286 public interface IClientAPI
@@ -298,37 +354,17 @@ namespace OpenSim.Framework
298 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; 354 event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
299 event EstateOwnerMessageRequest OnEstateOwnerMessage; 355 event EstateOwnerMessageRequest OnEstateOwnerMessage;
300 356
301 LLVector3 StartPos 357 LLVector3 StartPos { get; set; }
302 {
303 get;
304 set;
305 }
306 358
307 LLUUID AgentId 359 LLUUID AgentId { get; }
308 {
309 get;
310 }
311 360
312 LLUUID SessionId 361 LLUUID SessionId { get; }
313 {
314 get;
315 }
316 362
317 string FirstName 363 string FirstName { get; }
318 {
319 get;
320 }
321 364
322 string LastName 365 string LastName { get; }
323 {
324 get;
325 }
326 366
327 uint CircuitCode 367 uint CircuitCode { get; set; }
328 {
329 get;
330 set;
331 }
332 368
333 void OutPacket(Packet newPack); 369 void OutPacket(Packet newPack);
334 void SendWearables(AvatarWearable[] wearables); 370 void SendWearables(AvatarWearable[] wearables);
@@ -339,28 +375,46 @@ namespace OpenSim.Framework
339 void SendRegionHandshake(RegionInfo regionInfo); 375 void SendRegionHandshake(RegionInfo regionInfo);
340 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 376 void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
341 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); 377 void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
342 void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp); 378
379 void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
380 LLUUID imSessionID, string fromName, byte dialog, uint timeStamp);
381
343 void SendLayerData(float[] map); 382 void SendLayerData(float[] map);
344 void SendLayerData(int px, int py, float[] map); 383 void SendLayerData(int px, int py, float[] map);
345 void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); 384 void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look);
346 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint ); 385 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
347 AgentCircuitData RequestClientInfo(); 386 AgentCircuitData RequestClientInfo();
348 void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL ); 387
388 void CrossRegion(ulong newRegionHandle, LLVector3 pos, LLVector3 lookAt, IPEndPoint newRegionExternalEndPoint,
389 string capsURL);
390
349 void SendMapBlock(List<MapBlockData> mapBlocks); 391 void SendMapBlock(List<MapBlockData> mapBlocks);
350 void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags); 392 void SendLocalTeleport(LLVector3 position, LLVector3 lookAt, uint flags);
351 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL); 393
394 void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID,
395 uint flags, string capsURL);
396
352 void SendTeleportCancel(); 397 void SendTeleportCancel();
353 void SendTeleportLocationStart(); 398 void SendTeleportLocationStart();
354 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance); 399 void SendMoneyBalance(LLUUID transaction, bool success, byte[] description, int balance);
355 400
356 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID); 401 void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID,
357 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity, LLQuaternion rotation); 402 LLVector3 Pos, byte[] textureEntry, uint parentID);
403
404 void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
405 LLVector3 velocity, LLQuaternion rotation);
406
358 void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations); 407 void SendCoarseLocationUpdate(List<LLVector3> CoarseLocations);
359 408
360 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); 409 void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
361 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); 410
362 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); 411 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
363 412 LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text,
413 uint parentID, byte[] particleSystem, LLQuaternion rotation);
414
415 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
416 LLQuaternion rotation);
417
364 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items); 418 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
365 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); 419 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
366 void SendInventoryItemUpdate(InventoryItemBase Item); 420 void SendInventoryItemUpdate(InventoryItemBase Item);
@@ -375,10 +429,13 @@ namespace OpenSim.Framework
375 void SendAlertMessage(string message); 429 void SendAlertMessage(string message);
376 void SendAgentAlertMessage(string message, bool modal); 430 void SendAgentAlertMessage(string message, bool modal);
377 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url); 431 void SendLoadURL(string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, string message, string url);
378 bool AddMoney( int debit ); 432 bool AddMoney(int debit);
379 433
380 void SendViewerTime(int phase); 434 void SendViewerTime(int phase);
381 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout, uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID); 435
436 void SendAvatarProperties(LLUUID avatarID, string aboutText, string bornOn, string charterMember, string flAbout,
437 uint flags, LLUUID flImageID, LLUUID imageID, string profileURL, LLUUID partnerID);
438
382 void SetDebug(int newDebug); 439 void SetDebug(int newDebug);
383 void InPacket(Packet NewPack); 440 void InPacket(Packet NewPack);
384 void Close(); 441 void Close();
@@ -387,4 +444,4 @@ namespace OpenSim.Framework
387 event Action<IClientAPI> OnConnectionClosed; 444 event Action<IClientAPI> OnConnectionClosed;
388 void SendLogoutPacket(); 445 void SendLogoutPacket();
389 } 446 }
390} 447} \ 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
37 void Commit(); 37 void Commit();
38 void Close(); 38 void Close();
39 } 39 }
40} 40} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework 29namespace OpenSim.Framework
34{ 30{
35 /// <summary> 31 /// <summary>
@@ -54,4 +50,4 @@ namespace OpenSim.Framework
54 /// </summary> 50 /// </summary>
55 void Initialise(); 51 void Initialise();
56 } 52 }
57} 53} \ 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 @@
27*/ 27*/
28using System.Collections.Generic; 28using System.Collections.Generic;
29using libsecondlife; 29using libsecondlife;
30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework;
32 30
33namespace OpenSim.Framework 31namespace OpenSim.Framework
34{ 32{
35 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent); 33 public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
34
36 public delegate void UpdateNeighbours(List<RegionInfo> neighbours); 35 public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
36
37 public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying); 37 public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
38
38 public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID); 39 public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
39 40
40 public interface IRegionCommsListener 41 public interface IRegionCommsListener
@@ -45,4 +46,4 @@ namespace OpenSim.Framework
45 event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; 46 event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
46 event UpdateNeighbours OnNeighboursUpdate; 47 event UpdateNeighbours OnNeighboursUpdate;
47 } 48 }
48} 49} \ 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 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework 30namespace OpenSim.Framework
32{ 31{
@@ -34,14 +33,11 @@ namespace OpenSim.Framework
34 { 33 {
35 void AddNewClient(IClientAPI client, bool child); 34 void AddNewClient(IClientAPI client, bool child);
36 void RemoveClient(LLUUID agentID); 35 void RemoveClient(LLUUID agentID);
37 36
38 RegionInfo RegionInfo { get; } 37 RegionInfo RegionInfo { get; }
39 object SyncRoot { get; } 38 object SyncRoot { get; }
40 uint NextLocalId { get; } 39 uint NextLocalId { get; }
41 40
42 ClientManager ClientManager 41 ClientManager ClientManager { get; }
43 {
44 get;
45 }
46 } 42 }
47} 43} \ 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 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework 30namespace OpenSim.Framework
32{ 31{
@@ -132,4 +131,4 @@ namespace OpenSim.Framework
132 /// </summary> 131 /// </summary>
133 void Initialise(); 132 void Initialise();
134 } 133 }
135} 134} \ 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 @@
26* 26*
27*/ 27*/
28using libsecondlife; 28using libsecondlife;
29using OpenSim.Framework;
30 29
31namespace OpenSim.Framework.Interfaces 30namespace OpenSim.Framework.Interfaces
32{ 31{
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
39 /// A UUID containing the ID for the inventory item itself 39 /// A UUID containing the ID for the inventory item itself
40 /// </summary> 40 /// </summary>
41 public LLUUID inventoryID; 41 public LLUUID inventoryID;
42
42 /// <summary> 43 /// <summary>
43 /// The UUID of the associated asset on the asset server 44 /// The UUID of the associated asset on the asset server
44 /// </summary> 45 /// </summary>
45 public LLUUID assetID; 46 public LLUUID assetID;
47
46 /// <summary> 48 /// <summary>
47 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) 49 /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
48 /// </summary> 50 /// </summary>
49 public int assetType; 51 public int assetType;
52
50 /// <summary> 53 /// <summary>
51 /// The type of inventory item. (Can be slightly different to the asset type 54 /// The type of inventory item. (Can be slightly different to the asset type
52 /// </summary> 55 /// </summary>
53 public int invType; 56 public int invType;
57
54 /// <summary> 58 /// <summary>
55 /// The folder this item is contained in 59 /// The folder this item is contained in
56 /// </summary> 60 /// </summary>
57 public LLUUID parentFolderID; 61 public LLUUID parentFolderID;
62
58 /// <summary> 63 /// <summary>
59 /// The owner of this inventory item 64 /// The owner of this inventory item
60 /// </summary> 65 /// </summary>
61 public LLUUID avatarID; 66 public LLUUID avatarID;
67
62 /// <summary> 68 /// <summary>
63 /// The creator of this item 69 /// The creator of this item
64 /// </summary> 70 /// </summary>
65 public LLUUID creatorsID; 71 public LLUUID creatorsID;
72
66 /// <summary> 73 /// <summary>
67 /// The name of the inventory item (must be less than 64 characters) 74 /// The name of the inventory item (must be less than 64 characters)
68 /// </summary> 75 /// </summary>
69 public string inventoryName; 76 public string inventoryName;
77
70 /// <summary> 78 /// <summary>
71 /// The description of the inventory item (must be less than 64 characters) 79 /// The description of the inventory item (must be less than 64 characters)
72 /// </summary> 80 /// </summary>
73 public string inventoryDescription; 81 public string inventoryDescription;
82
74 /// <summary> 83 /// <summary>
75 /// A mask containing the permissions for the next owner (cannot be enforced) 84 /// A mask containing the permissions for the next owner (cannot be enforced)
76 /// </summary> 85 /// </summary>
77 public uint inventoryNextPermissions; 86 public uint inventoryNextPermissions;
87
78 /// <summary> 88 /// <summary>
79 /// A mask containing permissions for the current owner (cannot be enforced) 89 /// A mask containing permissions for the current owner (cannot be enforced)
80 /// </summary> 90 /// </summary>
81 public uint inventoryCurrentPermissions; 91 public uint inventoryCurrentPermissions;
92
82 /// <summary> 93 /// <summary>
83 /// 94 ///
84 /// </summary> 95 /// </summary>
85 public uint inventoryBasePermissions; 96 public uint inventoryBasePermissions;
97
86 /// <summary> 98 /// <summary>
87 /// 99 ///
88 /// </summary> 100 /// </summary>
@@ -98,22 +110,27 @@ namespace OpenSim.Framework
98 /// The name of the folder (64 characters or less) 110 /// The name of the folder (64 characters or less)
99 /// </summary> 111 /// </summary>
100 public string name; 112 public string name;
113
101 /// <summary> 114 /// <summary>
102 /// The agent who's inventory this is contained by 115 /// The agent who's inventory this is contained by
103 /// </summary> 116 /// </summary>
104 public LLUUID agentID; 117 public LLUUID agentID;
118
105 /// <summary> 119 /// <summary>
106 /// The folder this folder is contained in 120 /// The folder this folder is contained in
107 /// </summary> 121 /// </summary>
108 public LLUUID parentID; 122 public LLUUID parentID;
123
109 /// <summary> 124 /// <summary>
110 /// The UUID for this folder 125 /// The UUID for this folder
111 /// </summary> 126 /// </summary>
112 public LLUUID folderID; 127 public LLUUID folderID;
128
113 /// <summary> 129 /// <summary>
114 /// Tyep of Items normally stored in this folder 130 /// Tyep of Items normally stored in this folder
115 /// </summary> 131 /// </summary>
116 public short type; 132 public short type;
133
117 /// <summary> 134 /// <summary>
118 /// 135 ///
119 /// </summary> 136 /// </summary>
@@ -225,4 +242,4 @@ namespace OpenSim.Framework
225 /// <param name="folder">The id of the folder</param> 242 /// <param name="folder">The id of the folder</param>
226 void deleteInventoryFolder(LLUUID folder); 243 void deleteInventoryFolder(LLUUID folder);
227 } 244 }
228} 245} \ 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;
29 29
30namespace OpenSim.Framework 30namespace OpenSim.Framework
31{ 31{
32 32 public class LandData
33 public class LandData 33 {
34 { 34 public byte[] landBitmapByteArray = new byte[512];
35 public byte[] landBitmapByteArray = new byte[512]; 35 public string landName = "Your Parcel";
36 public string landName = "Your Parcel"; 36 public string landDesc = "";
37 public string landDesc = ""; 37 public LLUUID ownerID = new LLUUID();
38 public LLUUID ownerID = new LLUUID(); 38 public bool isGroupOwned = false;
39 public bool isGroupOwned = false; 39 public LLVector3 AABBMin = new LLVector3();
40 public LLVector3 AABBMin = new LLVector3(); 40 public LLVector3 AABBMax = new LLVector3();
41 public LLVector3 AABBMax = new LLVector3(); 41 public int area = 0;
42 public int area = 0; 42 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned
43 public uint auctionID = 0; //Unemplemented. If set to 0, not being auctioned 43 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID
44 public LLUUID authBuyerID = new LLUUID(); //Unemplemented. Authorized Buyer's UUID 44 public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
45 public Parcel.ParcelCategory category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category 45 public int claimDate = 0; //Unemplemented
46 public int claimDate = 0; //Unemplemented 46 public int claimPrice = 0; //Unemplemented
47 public int claimPrice = 0; //Unemplemented 47 public LLUUID groupID = new LLUUID(); //Unemplemented
48 public LLUUID groupID = new LLUUID(); //Unemplemented 48 public int groupPrims = 0;
49 public int groupPrims = 0; 49 public int otherPrims = 0;
50 public int otherPrims = 0; 50 public int ownerPrims = 0;
51 public int ownerPrims = 0; 51 public int selectedPrims = 0;
52 public int selectedPrims = 0; 52 public int simwidePrims = 0;
53 public int simwidePrims = 0; 53 public int simwideArea = 0;
54 public int simwideArea = 0; 54 public int salePrice = 0; //Unemeplemented. Parcels price.
55 public int salePrice = 0; //Unemeplemented. Parcels price. 55 public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased;
56 public Parcel.ParcelStatus landStatus = Parcel.ParcelStatus.Leased; 56
57 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 ; 57 public uint landFlags = (uint) Parcel.ParcelFlags.AllowFly | (uint) Parcel.ParcelFlags.AllowLandmark |
58 public byte landingType = 0; 58 (uint) Parcel.ParcelFlags.AllowAllObjectEntry |
59 public byte mediaAutoScale = 0; 59 (uint) Parcel.ParcelFlags.AllowDeedToGroup | (uint) Parcel.ParcelFlags.AllowTerraform |
60 public LLUUID mediaID = LLUUID.Zero; 60 (uint) Parcel.ParcelFlags.CreateObjects | (uint) Parcel.ParcelFlags.AllowOtherScripts |
61 public int localID = 0; 61 (uint) Parcel.ParcelFlags.SoundLocal;
62 public LLUUID globalID = new LLUUID(); 62
63 public byte landingType = 0;
64 public byte mediaAutoScale = 0;
65 public LLUUID mediaID = LLUUID.Zero;
66 public int localID = 0;
67 public LLUUID globalID = new LLUUID();
63 68
64 public string mediaURL = ""; 69 public string mediaURL = "";
65 public string musicURL = ""; 70 public string musicURL = "";
66 public float passHours = 0; 71 public float passHours = 0;
67 public int passPrice = 0; 72 public int passPrice = 0;
68 public LLUUID snapshotID = LLUUID.Zero; 73 public LLUUID snapshotID = LLUUID.Zero;
69 public LLVector3 userLocation = new LLVector3(); 74 public LLVector3 userLocation = new LLVector3();
70 public LLVector3 userLookAt = new LLVector3(); 75 public LLVector3 userLookAt = new LLVector3();
71 76
72 public LandData() 77 public LandData()
73 { 78 {
74 globalID = LLUUID.Random(); 79 globalID = LLUUID.Random();
75 } 80 }
76 81
77 public LandData Copy() 82 public LandData Copy()
78 { 83 {
79 LandData landData = new LandData(); 84 LandData landData = new LandData();
80 85
81 landData.AABBMax = this.AABBMax; 86 landData.AABBMax = AABBMax;
82 landData.AABBMin = this.AABBMin; 87 landData.AABBMin = AABBMin;
83 landData.area = this.area; 88 landData.area = area;
84 landData.auctionID = this.auctionID; 89 landData.auctionID = auctionID;
85 landData.authBuyerID = this.authBuyerID; 90 landData.authBuyerID = authBuyerID;
86 landData.category = this.category; 91 landData.category = category;
87 landData.claimDate = this.claimDate; 92 landData.claimDate = claimDate;
88 landData.claimPrice = this.claimPrice; 93 landData.claimPrice = claimPrice;
89 landData.globalID = this.globalID; 94 landData.globalID = globalID;
90 landData.groupID = this.groupID; 95 landData.groupID = groupID;
91 landData.groupPrims = this.groupPrims; 96 landData.groupPrims = groupPrims;
92 landData.otherPrims = this.otherPrims; 97 landData.otherPrims = otherPrims;
93 landData.ownerPrims = this.ownerPrims; 98 landData.ownerPrims = ownerPrims;
94 landData.selectedPrims = this.selectedPrims; 99 landData.selectedPrims = selectedPrims;
95 landData.isGroupOwned = this.isGroupOwned; 100 landData.isGroupOwned = isGroupOwned;
96 landData.localID = this.localID; 101 landData.localID = localID;
97 landData.landingType = this.landingType; 102 landData.landingType = landingType;
98 landData.mediaAutoScale = this.mediaAutoScale; 103 landData.mediaAutoScale = mediaAutoScale;
99 landData.mediaID = this.mediaID; 104 landData.mediaID = mediaID;
100 landData.mediaURL = this.mediaURL; 105 landData.mediaURL = mediaURL;
101 landData.musicURL = this.musicURL; 106 landData.musicURL = musicURL;
102 landData.ownerID = this.ownerID; 107 landData.ownerID = ownerID;
103 landData.landBitmapByteArray = (byte[])this.landBitmapByteArray.Clone(); 108 landData.landBitmapByteArray = (byte[]) landBitmapByteArray.Clone();
104 landData.landDesc = this.landDesc; 109 landData.landDesc = landDesc;
105 landData.landFlags = this.landFlags; 110 landData.landFlags = landFlags;
106 landData.landName = this.landName; 111 landData.landName = landName;
107 landData.landStatus = this.landStatus; 112 landData.landStatus = landStatus;
108 landData.passHours = this.passHours; 113 landData.passHours = passHours;
109 landData.passPrice = this.passPrice; 114 landData.passPrice = passPrice;
110 landData.salePrice = this.salePrice; 115 landData.salePrice = salePrice;
111 landData.snapshotID = this.snapshotID; 116 landData.snapshotID = snapshotID;
112 landData.userLocation = this.userLocation; 117 landData.userLocation = userLocation;
113 landData.userLookAt = this.userLookAt; 118 landData.userLookAt = userLookAt;
114 119
115 return landData; 120 return landData;
116
117 }
118 } 121 }
119 122 }
120} 123} \ 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
39 public LLUUID InventoryFolder; 39 public LLUUID InventoryFolder;
40 public LLUUID BaseFolder; 40 public LLUUID BaseFolder;
41 public uint CircuitCode; 41 public uint CircuitCode;
42 public string CapsPath =""; 42 public string CapsPath = "";
43 public LLVector3 StartPos; 43 public LLVector3 StartPos;
44 44
45 public Login() 45 public Login()
@@ -47,4 +47,4 @@ namespace OpenSim.Framework
47 StartPos = new LLVector3(128, 128, 70); 47 StartPos = new LLVector3(128, 128, 70);
48 } 48 }
49 } 49 }
50} 50} \ 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
45 45
46 public MapBlockData() 46 public MapBlockData()
47 { 47 {
48
49 } 48 }
50 } 49 }
51} 50} \ 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
39 public string sim_ip; 39 public string sim_ip;
40 public uint sim_port; 40 public uint sim_port;
41 } 41 }
42} 42} \ 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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System;
29using OpenSim.Framework.Console;
30using OpenSim.Framework.Interfaces;
31using OpenSim.Framework;
32 28
33using Nini.Config; 29using Nini.Config;
30
34namespace OpenSim.Framework 31namespace OpenSim.Framework
35{ 32{
36 public class NetworkServersInfo 33 public class NetworkServersInfo
@@ -63,12 +60,14 @@ namespace OpenSim.Framework
63 } 60 }
64 61
65 private uint? m_defaultHomeLocX; 62 private uint? m_defaultHomeLocX;
63
66 public uint DefaultHomeLocX 64 public uint DefaultHomeLocX
67 { 65 {
68 get { return m_defaultHomeLocX.Value; } 66 get { return m_defaultHomeLocX.Value; }
69 } 67 }
70 68
71 private uint? m_defaultHomeLocY; 69 private uint? m_defaultHomeLocY;
70
72 public uint DefaultHomeLocY 71 public uint DefaultHomeLocY
73 { 72 {
74 get { return m_defaultHomeLocY.Value; } 73 get { return m_defaultHomeLocY.Value; }
@@ -76,19 +75,22 @@ namespace OpenSim.Framework
76 75
77 public void loadFromConfiguration(IConfigSource config) 76 public void loadFromConfiguration(IConfigSource config)
78 { 77 {
79 m_defaultHomeLocX = (uint)config.Configs["StandAlone"].GetInt("default_location_x", 1000); 78 m_defaultHomeLocX = (uint) config.Configs["StandAlone"].GetInt("default_location_x", 1000);
80 m_defaultHomeLocY = (uint)config.Configs["StandAlone"].GetInt("default_location_y", 1000); 79 m_defaultHomeLocY = (uint) config.Configs["StandAlone"].GetInt("default_location_y", 1000);
81 80
82 HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort); 81 HttpListenerPort = config.Configs["Network"].GetInt("http_listener_port", DefaultHttpListenerPort);
83 RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort); 82 RemotingListenerPort = config.Configs["Network"].GetInt("remoting_listener_port", RemotingListenerPort);
84 GridURL = config.Configs["Network"].GetString("grid_server_url", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString()); 83 GridURL =
84 config.Configs["Network"].GetString("grid_server_url",
85 "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString());
85 GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null"); 86 GridSendKey = config.Configs["Network"].GetString("grid_send_key", "null");
86 GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null"); 87 GridRecvKey = config.Configs["Network"].GetString("grid_recv_key", "null");
87 UserURL = config.Configs["Network"].GetString("user_server_url", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString()); 88 UserURL =
89 config.Configs["Network"].GetString("user_server_url",
90 "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString());
88 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); 91 UserSendKey = config.Configs["Network"].GetString("user_send_key", "null");
89 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); 92 UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null");
90 AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); 93 AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL);
91
92 } 94 }
93 } 95 }
94} 96} \ 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 @@
28 28
29using System.Xml.Serialization; 29using System.Xml.Serialization;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets;
32 31
33namespace OpenSim.Framework 32namespace OpenSim.Framework
34{ 33{
@@ -93,47 +92,39 @@ namespace OpenSim.Framework
93 92
94 public ProfileShape ProfileShape 93 public ProfileShape ProfileShape
95 { 94 {
96 get 95 get { return (ProfileShape) (ProfileCurve & 0xf); }
97 {
98 return (ProfileShape)(ProfileCurve & 0xf);
99 }
100 set 96 set
101 { 97 {
102 byte oldValueMasked = (byte)(ProfileCurve & 0xf0); 98 byte oldValueMasked = (byte) (ProfileCurve & 0xf0);
103 ProfileCurve = (byte)(oldValueMasked | (byte)value); 99 ProfileCurve = (byte) (oldValueMasked | (byte) value);
104 } 100 }
105 } 101 }
106 102
107 [XmlIgnore] 103 [XmlIgnore]
108 public HollowShape HollowShape 104 public HollowShape HollowShape
109 { 105 {
110 get 106 get { return (HollowShape) (ProfileHollow & 0xf0); }
111 {
112 return (HollowShape)(ProfileHollow & 0xf0);
113 }
114 set 107 set
115 { 108 {
116 byte oldValueMasked = (byte)(ProfileHollow & 0xf0); 109 byte oldValueMasked = (byte) (ProfileHollow & 0xf0);
117 ProfileHollow = (byte)(oldValueMasked | (byte)value); 110 ProfileHollow = (byte) (oldValueMasked | (byte) value);
118 } 111 }
119 } 112 }
120 113
121 public LLVector3 PrimScale 114 public LLVector3 PrimScale
122 { 115 {
123 get 116 get { return Scale; }
124 {
125 return this.Scale;
126 }
127 } 117 }
128 118
129 static PrimitiveBaseShape() 119 static PrimitiveBaseShape()
130 { 120 {
131 m_defaultTextureEntry = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); 121 m_defaultTextureEntry =
122 new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes();
132 } 123 }
133 124
134 public PrimitiveBaseShape() 125 public PrimitiveBaseShape()
135 { 126 {
136 PCode = (byte)PCodeEnum.Primitive; 127 PCode = (byte) PCodeEnum.Primitive;
137 ExtraParams = new byte[1]; 128 ExtraParams = new byte[1];
138 TextureEntry = m_defaultTextureEntry; 129 TextureEntry = m_defaultTextureEntry;
139 } 130 }
@@ -141,12 +132,11 @@ namespace OpenSim.Framework
141 //void returns need to change of course 132 //void returns need to change of course
142 public virtual void GetMesh() 133 public virtual void GetMesh()
143 { 134 {
144
145 } 135 }
146 136
147 public PrimitiveBaseShape Copy() 137 public PrimitiveBaseShape Copy()
148 { 138 {
149 return (PrimitiveBaseShape)this.MemberwiseClone(); 139 return (PrimitiveBaseShape) MemberwiseClone();
150 } 140 }
151 } 141 }
152 142
@@ -155,7 +145,6 @@ namespace OpenSim.Framework
155 public GenericShape() 145 public GenericShape()
156 : base() 146 : base()
157 { 147 {
158
159 } 148 }
160 } 149 }
161 150
@@ -164,7 +153,7 @@ namespace OpenSim.Framework
164 public BoxShape() 153 public BoxShape()
165 : base() 154 : base()
166 { 155 {
167 PathCurve = (byte)Extrusion.Straight; 156 PathCurve = (byte) Extrusion.Straight;
168 ProfileShape = ProfileShape.Square; 157 ProfileShape = ProfileShape.Square;
169 PathScaleX = 100; 158 PathScaleX = 100;
170 PathScaleY = 100; 159 PathScaleY = 100;
@@ -193,12 +182,13 @@ namespace OpenSim.Framework
193 } 182 }
194 } 183 }
195 } 184 }
185
196 public class CylinderShape : PrimitiveBaseShape 186 public class CylinderShape : PrimitiveBaseShape
197 { 187 {
198 public CylinderShape() 188 public CylinderShape()
199 : base() 189 : base()
200 { 190 {
201 PathCurve = (byte)Extrusion.Straight; 191 PathCurve = (byte) Extrusion.Straight;
202 ProfileShape = ProfileShape.Circle; 192 ProfileShape = ProfileShape.Circle;
203 PathScaleX = 100; 193 PathScaleX = 100;
204 PathScaleY = 100; 194 PathScaleY = 100;
@@ -218,7 +208,7 @@ namespace OpenSim.Framework
218 208
219 private void SetRadius(float radius) 209 private void SetRadius(float radius)
220 { 210 {
221 Scale.X = Scale.Y = radius * 2f; 211 Scale.X = Scale.Y = radius*2f;
222 } 212 }
223 } 213 }
224} 214} \ 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 @@
1using System.Reflection; 1using System.Reflection;
2using System.Runtime.InteropServices; 2using System.Runtime.InteropServices;
3
3// General Information about an assembly is controlled through the following 4// General Information about an assembly is controlled through the following
4// set of attributes. Change these attribute values to modify the information 5// set of attributes. Change these attribute values to modify the information
5// associated with an assembly. 6// associated with an assembly.
6[assembly: AssemblyTitle("OpenSim.FrameWork")] 7
7[assembly: AssemblyDescription("")] 8[assembly : AssemblyTitle("OpenSim.FrameWork")]
8[assembly: AssemblyConfiguration("")] 9[assembly : AssemblyDescription("")]
9[assembly: AssemblyCompany("")] 10[assembly : AssemblyConfiguration("")]
10[assembly: AssemblyProduct("OpenSim.FrameWork")] 11[assembly : AssemblyCompany("")]
11[assembly: AssemblyCopyright("Copyright © 2007")] 12[assembly : AssemblyProduct("OpenSim.FrameWork")]
12[assembly: AssemblyTrademark("")] 13[assembly : AssemblyCopyright("Copyright © 2007")]
13[assembly: AssemblyCulture("")] 14[assembly : AssemblyTrademark("")]
15[assembly : AssemblyCulture("")]
14 16
15// Setting ComVisible to false makes the types in this assembly not visible 17// Setting ComVisible to false makes the types in this assembly not visible
16// to COM components. If you need to access a type in this assembly from 18// to COM components. If you need to access a type in this assembly from
17// COM, set the ComVisible attribute to true on that type. 19// COM, set the ComVisible attribute to true on that type.
18[assembly: ComVisible(false)] 20
21[assembly : ComVisible(false)]
19 22
20// The following GUID is for the ID of the typelib if this project is exposed to COM 23// The following GUID is for the ID of the typelib if this project is exposed to COM
21[assembly: Guid("a08e20c7-f191-4137-b1f0-9291408fa521")] 24
25[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
22 26
23// Version information for an assembly consists of the following four values: 27// Version information for an assembly consists of the following four values:
24// 28//
@@ -27,5 +31,6 @@ using System.Runtime.InteropServices;
27// Build Number 31// Build Number
28// Revision 32// Revision
29// 33//
30[assembly: AssemblyVersion("1.0.0.0")] 34
31[assembly: AssemblyFileVersion("1.0.0.0")] 35[assembly : AssemblyVersion("1.0.0.0")]
36[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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using libsecondlife;
29using OpenSim.Framework.Interfaces;
30using OpenSim.Framework;
31 28
32using System.Collections.Generic; 29using System.Collections.Generic;
30using libsecondlife;
33 31
34namespace OpenSim.Framework 32namespace OpenSim.Framework
35{ 33{
36 public class RegionCommsListener :IRegionCommsListener 34 public class RegionCommsListener : IRegionCommsListener
37 { 35 {
38 public event ExpectUserDelegate OnExpectUser; 36 public event ExpectUserDelegate OnExpectUser;
39 public event GenericCall2 OnExpectChildAgent; 37 public event GenericCall2 OnExpectChildAgent;
@@ -46,11 +44,10 @@ namespace OpenSim.Framework
46 /// </summary> 44 /// </summary>
47 /// <param name="agent"></param> 45 /// <param name="agent"></param>
48 /// <returns></returns> 46 /// <returns></returns>
49 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent) 47 public virtual bool TriggerExpectUser(ulong regionHandle, AgentCircuitData agent)
50 { 48 {
51 if(OnExpectUser != null) 49 if (OnExpectUser != null)
52 { 50 {
53
54 OnExpectUser(regionHandle, agent); 51 OnExpectUser(regionHandle, agent);
55 return true; 52 return true;
56 } 53 }
@@ -58,7 +55,8 @@ namespace OpenSim.Framework
58 return false; 55 return false;
59 } 56 }
60 57
61 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 58 public virtual bool TriggerExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position,
59 bool isFlying)
62 { 60 {
63 if (OnAvatarCrossingIntoRegion != null) 61 if (OnAvatarCrossingIntoRegion != null)
64 { 62 {
@@ -111,4 +109,4 @@ namespace OpenSim.Framework
111 return false; 109 return false;
112 } 110 }
113 } 111 }
114} 112} \ 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 @@
28 28
29using System; 29using System;
30using System.Net; 30using System.Net;
31using System.Net.Sockets;
31 32
32namespace OpenSim.Framework 33namespace OpenSim.Framework
33{ 34{
34 /// <summary> 35 /// <summary>
35 /// A class for manipulating RegionHandle coordinates 36 /// A class for manipulating RegionHandle coordinates
36 /// </summary> 37 /// </summary>
37 class RegionHandle 38 internal class RegionHandle
38 { 39 {
39 private UInt64 handle; 40 private UInt64 handle;
40 41
@@ -48,28 +49,28 @@ namespace OpenSim.Framework
48 { 49 {
49 IPAddress addr = IPAddress.Parse(ip); 50 IPAddress addr = IPAddress.Parse(ip);
50 51
51 if (addr.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork) 52 if (addr.AddressFamily != AddressFamily.InterNetwork)
52 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address"); 53 throw new Exception("Bad RegionHandle Parameter - must be an IPv4 address");
53 54
54 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0); 55 uint baseHandle = BitConverter.ToUInt32(addr.GetAddressBytes(), 0);
55 56
56 // Split the IP address in half 57 // Split the IP address in half
57 short a = (short)((baseHandle << 16) & 0xFFFF); 58 short a = (short) ((baseHandle << 16) & 0xFFFF);
58 short b = (short)((baseHandle << 0) & 0xFFFF); 59 short b = (short) ((baseHandle << 0) & 0xFFFF);
59 60
60 // Raise the bounds a little 61 // Raise the bounds a little
61 uint nx = (uint)x; 62 uint nx = (uint) x;
62 uint ny = (uint)y; 63 uint ny = (uint) y;
63 64
64 // Multiply grid coords to get region coords 65 // Multiply grid coords to get region coords
65 nx *= 256; 66 nx *= 256;
66 ny *= 256; 67 ny *= 256;
67 68
68 // Stuff the IP address in too 69 // Stuff the IP address in too
69 nx = (uint)a << 16; 70 nx = (uint) a << 16;
70 ny = (uint)b << 16; 71 ny = (uint) b << 16;
71 72
72 handle = ((UInt64)nx << 32) | (uint)ny; 73 handle = ((UInt64) nx << 32) | (uint) ny;
73 } 74 }
74 75
75 /// <summary> 76 /// <summary>
@@ -79,7 +80,7 @@ namespace OpenSim.Framework
79 /// <param name="y">Grid Y Coordinate</param> 80 /// <param name="y">Grid Y Coordinate</param>
80 public RegionHandle(uint x, uint y) 81 public RegionHandle(uint x, uint y)
81 { 82 {
82 handle = ((x * 256) << 32) | (y * 256); 83 handle = ((x*256) << 32) | (y*256);
83 } 84 }
84 85
85 /// <summary> 86 /// <summary>
@@ -118,10 +119,10 @@ namespace OpenSim.Framework
118 /// <returns>Grid Server IP Address</returns> 119 /// <returns>Grid Server IP Address</returns>
119 public IPAddress getGridIP() 120 public IPAddress getGridIP()
120 { 121 {
121 uint a = (uint)((handle >> 16) & 0xFFFF); 122 uint a = (uint) ((handle >> 16) & 0xFFFF);
122 uint b = (uint)((handle >> 48) & 0xFFFF); 123 uint b = (uint) ((handle >> 48) & 0xFFFF);
123 124
124 return new IPAddress((long)(a << 16) | (long)b); 125 return new IPAddress((long) (a << 16) | (long) b);
125 } 126 }
126 127
127 /// <summary> 128 /// <summary>
@@ -130,7 +131,7 @@ namespace OpenSim.Framework
130 /// <returns>X Coordinate</returns> 131 /// <returns>X Coordinate</returns>
131 public uint getGridX() 132 public uint getGridX()
132 { 133 {
133 uint x = (uint)((handle >> 32) & 0xFFFF); 134 uint x = (uint) ((handle >> 32) & 0xFFFF);
134 135
135 return x; 136 return x;
136 } 137 }
@@ -141,9 +142,9 @@ namespace OpenSim.Framework
141 /// <returns>Y Coordinate</returns> 142 /// <returns>Y Coordinate</returns>
142 public uint getGridY() 143 public uint getGridY()
143 { 144 {
144 uint y = (uint)((handle >> 0) & 0xFFFF); 145 uint y = (uint) ((handle >> 0) & 0xFFFF);
145 146
146 return y; 147 return y;
147 } 148 }
148 } 149 }
149} 150} \ 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 @@
26* 26*
27*/ 27*/
28using System; 28using System;
29using System.Globalization;
30using System.Net; 29using System.Net;
31using System.Net.Sockets; 30using System.Net.Sockets;
32using Nini.Config;
33using libsecondlife; 31using libsecondlife;
34using OpenSim.Framework.Console; 32using Nini.Config;
35using OpenSim.Framework.Interfaces;
36using OpenSim.Framework;
37 33
38namespace OpenSim.Framework 34namespace OpenSim.Framework
39{ 35{
@@ -45,7 +41,6 @@ namespace OpenSim.Framework
45 41
46 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) 42 public SimpleRegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri)
47 { 43 {
48
49 m_regionLocX = regionLocX; 44 m_regionLocX = regionLocX;
50 m_regionLocY = regionLocY; 45 m_regionLocY = regionLocY;
51 46
@@ -55,7 +50,6 @@ namespace OpenSim.Framework
55 50
56 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port) 51 public SimpleRegionInfo(uint regionLocX, uint regionLocY, string externalUri, int port)
57 { 52 {
58
59 m_regionLocX = regionLocX; 53 m_regionLocX = regionLocX;
60 m_regionLocY = regionLocY; 54 m_regionLocY = regionLocY;
61 55
@@ -67,16 +61,11 @@ namespace OpenSim.Framework
67 public LLUUID RegionID = new LLUUID(); 61 public LLUUID RegionID = new LLUUID();
68 62
69 private uint m_remotingPort; 63 private uint m_remotingPort;
64
70 public uint RemotingPort 65 public uint RemotingPort
71 { 66 {
72 get 67 get { return m_remotingPort; }
73 { 68 set { m_remotingPort = value; }
74 return m_remotingPort;
75 }
76 set
77 {
78 m_remotingPort = value;
79 }
80 } 69 }
81 70
82 public string RemotingAddress; 71 public string RemotingAddress;
@@ -109,76 +98,49 @@ namespace OpenSim.Framework
109 ia = Adr; 98 ia = Adr;
110 break; 99 break;
111 } 100 }
112
113 } 101 }
114 102
115 return new IPEndPoint(ia, m_internalEndPoint.Port); 103 return new IPEndPoint(ia, m_internalEndPoint.Port);
116 } 104 }
117 105
118 set 106 set { m_externalHostName = value.ToString(); }
119 {
120 m_externalHostName = value.ToString();
121 }
122 } 107 }
123 108
124 protected string m_externalHostName; 109 protected string m_externalHostName;
110
125 public string ExternalHostName 111 public string ExternalHostName
126 { 112 {
127 get 113 get { return m_externalHostName; }
128 { 114 set { m_externalHostName = value; }
129 return m_externalHostName;
130 }
131 set
132 {
133 m_externalHostName = value;
134 }
135 } 115 }
136 116
137 protected IPEndPoint m_internalEndPoint; 117 protected IPEndPoint m_internalEndPoint;
118
138 public IPEndPoint InternalEndPoint 119 public IPEndPoint InternalEndPoint
139 { 120 {
140 get 121 get { return m_internalEndPoint; }
141 { 122 set { m_internalEndPoint = value; }
142 return m_internalEndPoint;
143 }
144 set
145 {
146 m_internalEndPoint = value;
147 }
148 } 123 }
149 124
150 protected uint? m_regionLocX; 125 protected uint? m_regionLocX;
126
151 public uint RegionLocX 127 public uint RegionLocX
152 { 128 {
153 get 129 get { return m_regionLocX.Value; }
154 { 130 set { m_regionLocX = value; }
155 return m_regionLocX.Value;
156 }
157 set
158 {
159 m_regionLocX = value;
160 }
161 } 131 }
162 132
163 protected uint? m_regionLocY; 133 protected uint? m_regionLocY;
134
164 public uint RegionLocY 135 public uint RegionLocY
165 { 136 {
166 get 137 get { return m_regionLocY.Value; }
167 { 138 set { m_regionLocY = value; }
168 return m_regionLocY.Value;
169 }
170 set
171 {
172 m_regionLocY = value;
173 }
174 } 139 }
175 140
176 public ulong RegionHandle 141 public ulong RegionHandle
177 { 142 {
178 get 143 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
179 {
180 return Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256));
181 }
182 } 144 }
183 } 145 }
184 146
@@ -196,80 +158,81 @@ namespace OpenSim.Framework
196 158
197 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 159 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
198 private static EstateSettings m_estateSettings; 160 private static EstateSettings m_estateSettings;
161
199 public EstateSettings EstateSettings 162 public EstateSettings EstateSettings
200 { 163 {
201 get 164 get
202 { 165 {
203 if( m_estateSettings == null ) 166 if (m_estateSettings == null)
204 { 167 {
205 m_estateSettings = new EstateSettings(); 168 m_estateSettings = new EstateSettings();
206 } 169 }
207 170
208 return m_estateSettings; 171 return m_estateSettings;
209 } 172 }
210
211 } 173 }
212 174
213 public ConfigurationMember configMember; 175 public ConfigurationMember configMember;
176
214 public RegionInfo(string description, string filename) 177 public RegionInfo(string description, string filename)
215 { 178 {
216 configMember = new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration); 179 configMember =
180 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
217 configMember.performConfigurationRetrieve(); 181 configMember.performConfigurationRetrieve();
218 } 182 }
219 183
220 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) : 184 public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) :
221 base(regionLocX, regionLocY, internalEndPoint, externalUri) 185 base(regionLocX, regionLocY, internalEndPoint, externalUri)
222 { 186 {
223
224
225 } 187 }
226 188
227 public RegionInfo() 189 public RegionInfo()
228 { 190 {
229
230 } 191 }
231 192
232 //not in use, should swap to nini though. 193 //not in use, should swap to nini though.
233 public void LoadFromNiniSource(IConfigSource source) 194 public void LoadFromNiniSource(IConfigSource source)
234 { 195 {
235 this.LoadFromNiniSource(source, "RegionInfo"); 196 LoadFromNiniSource(source, "RegionInfo");
236 } 197 }
237 198
238 //not in use, should swap to nini though. 199 //not in use, should swap to nini though.
239 public void LoadFromNiniSource(IConfigSource source, string sectionName) 200 public void LoadFromNiniSource(IConfigSource source, string sectionName)
240 { 201 {
241 string errorMessage = ""; 202 string errorMessage = "";
242 this.RegionID = new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated())); 203 RegionID =
243 this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); 204 new LLUUID(source.Configs[sectionName].GetString("Region_ID", LLUUID.Random().ToStringHyphenated()));
244 this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); 205 RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
245 this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); 206 m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
246 this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); 207 m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
208 DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
247 209
248 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); 210 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0");
249 IPAddress ipAddressResult; 211 IPAddress ipAddressResult;
250 if (IPAddress.TryParse(ipAddress, out ipAddressResult)) 212 if (IPAddress.TryParse(ipAddress, out ipAddressResult))
251 { 213 {
252 this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); 214 m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
253 } 215 }
254 else 216 else
255 { 217 {
256 errorMessage = "needs an IP Address (IPAddress)"; 218 errorMessage = "needs an IP Address (IPAddress)";
257 } 219 }
258 this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort); 220 m_internalEndPoint.Port =
221 source.Configs[sectionName].GetInt("internal_ip_port", NetworkServersInfo.DefaultHttpListenerPort);
259 222
260 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); 223 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1");
261 if (externalHost != "SYSTEMIP") 224 if (externalHost != "SYSTEMIP")
262 { 225 {
263 this.m_externalHostName = externalHost; 226 m_externalHostName = externalHost;
264 } 227 }
265 else 228 else
266 { 229 {
267 this.m_externalHostName = Util.GetLocalHost().ToString(); 230 m_externalHostName = Util.GetLocalHost().ToString();
268 } 231 }
269 232
270 this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); 233 MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
271 this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); 234 MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
272 this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); 235 MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
273 236
274 if (errorMessage != "") 237 if (errorMessage != "")
275 { 238 {
@@ -279,17 +242,36 @@ namespace OpenSim.Framework
279 242
280 public void loadConfigurationOptions() 243 public void loadConfigurationOptions()
281 { 244 {
282 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Region (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); 245 configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
283 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Region Name", "OpenSim Test", false); 246 "UUID of Region (Default is recommended, random UUID)",
284 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); 247 LLUUID.Random().ToString(), true);
285 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); 248 configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
286 configMember.addConfigurationOption("datastore", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Filename for local storage", "OpenSim.db", false); 249 "Region Name", "OpenSim Test", false);
287 configMember.addConfigurationOption("internal_ip_address", ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS, "Internal IP Address for incoming UDP client connections", "0.0.0.0", false); 250 configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
288 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Internal IP Port for incoming UDP client connections", NetworkServersInfo.DefaultHttpListenerPort.ToString(), false); 251 "Grid Location (X Axis)", "1000", false);
289 configMember.addConfigurationOption("external_host_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "External Host Name", "127.0.0.1", false); 252 configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
290 configMember.addConfigurationOption("master_avatar_first", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "First Name of Master Avatar", "Test", false); 253 "Grid Location (Y Axis)", "1000", false);
291 configMember.addConfigurationOption("master_avatar_last", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Last Name of Master Avatar", "User", false); 254 configMember.addConfigurationOption("datastore",
292 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "(Sandbox Mode Only)Password for Master Avatar account", "test", false); 255 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
256 "Filename for local storage", "OpenSim.db", false);
257 configMember.addConfigurationOption("internal_ip_address",
258 ConfigurationOption.ConfigurationTypes.TYPE_IP_ADDRESS,
259 "Internal IP Address for incoming UDP client connections", "0.0.0.0",
260 false);
261 configMember.addConfigurationOption("internal_ip_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
262 "Internal IP Port for incoming UDP client connections",
263 NetworkServersInfo.DefaultHttpListenerPort.ToString(), false);
264 configMember.addConfigurationOption("external_host_name",
265 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
266 "External Host Name", "127.0.0.1", false);
267 configMember.addConfigurationOption("master_avatar_first",
268 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
269 "First Name of Master Avatar", "Test", false);
270 configMember.addConfigurationOption("master_avatar_last",
271 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
272 "Last Name of Master Avatar", "User", false);
273 configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
274 "(Sandbox Mode Only)Password for Master Avatar account", "test", false);
293 } 275 }
294 276
295 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 277 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -297,51 +279,50 @@ namespace OpenSim.Framework
297 switch (configuration_key) 279 switch (configuration_key)
298 { 280 {
299 case "sim_UUID": 281 case "sim_UUID":
300 this.RegionID = (LLUUID)configuration_result; 282 RegionID = (LLUUID) configuration_result;
301 break; 283 break;
302 case "sim_name": 284 case "sim_name":
303 this.RegionName = (string)configuration_result; 285 RegionName = (string) configuration_result;
304 break; 286 break;
305 case "sim_location_x": 287 case "sim_location_x":
306 this.m_regionLocX = (uint)configuration_result; 288 m_regionLocX = (uint) configuration_result;
307 break; 289 break;
308 case "sim_location_y": 290 case "sim_location_y":
309 this.m_regionLocY = (uint)configuration_result; 291 m_regionLocY = (uint) configuration_result;
310 break; 292 break;
311 case "datastore": 293 case "datastore":
312 this.DataStore = (string)configuration_result; 294 DataStore = (string) configuration_result;
313 break; 295 break;
314 case "internal_ip_address": 296 case "internal_ip_address":
315 IPAddress address = (IPAddress)configuration_result; 297 IPAddress address = (IPAddress) configuration_result;
316 this.m_internalEndPoint = new IPEndPoint(address, 0); 298 m_internalEndPoint = new IPEndPoint(address, 0);
317 break; 299 break;
318 case "internal_ip_port": 300 case "internal_ip_port":
319 this.m_internalEndPoint.Port = (int)configuration_result; 301 m_internalEndPoint.Port = (int) configuration_result;
320 break; 302 break;
321 case "external_host_name": 303 case "external_host_name":
322 if ((string)configuration_result != "SYSTEMIP") 304 if ((string) configuration_result != "SYSTEMIP")
323 { 305 {
324 this.m_externalHostName = (string)configuration_result; 306 m_externalHostName = (string) configuration_result;
325 } 307 }
326 else 308 else
327 { 309 {
328 this.m_externalHostName = Util.GetLocalHost().ToString(); 310 m_externalHostName = Util.GetLocalHost().ToString();
329 } 311 }
330 break; 312 break;
331 case "master_avatar_first": 313 case "master_avatar_first":
332 this.MasterAvatarFirstName = (string)configuration_result; 314 MasterAvatarFirstName = (string) configuration_result;
333 break; 315 break;
334 case "master_avatar_last": 316 case "master_avatar_last":
335 this.MasterAvatarLastName = (string)configuration_result; 317 MasterAvatarLastName = (string) configuration_result;
336 break; 318 break;
337 case "master_avatar_pass": 319 case "master_avatar_pass":
338 string tempMD5Passwd = (string)configuration_result; 320 string tempMD5Passwd = (string) configuration_result;
339 this.MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); 321 MasterAvatarSandboxPassword = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
340 break; 322 break;
341 } 323 }
342 324
343 return true; 325 return true;
344 } 326 }
345
346 } 327 }
347} 328} \ 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
41 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para> 41 /// <para>When recieving data from the foreign host - run 'Authenticate' against the data and the attached byte[].</para>
42 /// <para>Both hosts should be performing these operations for this to be effective.</para> 42 /// <para>Both hosts should be performing these operations for this to be effective.</para>
43 /// </remarks> 43 /// </remarks>
44 class RemoteDigest 44 internal class RemoteDigest
45 { 45 {
46 private byte[] currentHash; 46 private byte[] currentHash;
47 private byte[] secret; 47 private byte[] secret;
@@ -58,7 +58,7 @@ namespace OpenSim.Framework
58 public RemoteDigest(string sharedSecret, byte[] salt, string challenge) 58 public RemoteDigest(string sharedSecret, byte[] salt, string challenge)
59 { 59 {
60 SHA512 = new SHA512Managed(); 60 SHA512 = new SHA512Managed();
61 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret,salt); 61 Rfc2898DeriveBytes RFC2898 = new Rfc2898DeriveBytes(sharedSecret, salt);
62 secret = RFC2898.GetBytes(512); 62 secret = RFC2898.GetBytes(512);
63 ASCIIEncoding ASCII = new ASCIIEncoding(); 63 ASCIIEncoding ASCII = new ASCIIEncoding();
64 64
@@ -108,7 +108,7 @@ namespace OpenSim.Framework
108 byte[] bytes = new byte[64]; 108 byte[] bytes = new byte[64];
109 RNG.GetBytes(bytes); 109 RNG.GetBytes(bytes);
110 110
111 StringBuilder sb = new StringBuilder(bytes.Length * 2); 111 StringBuilder sb = new StringBuilder(bytes.Length*2);
112 foreach (byte b in bytes) 112 foreach (byte b in bytes)
113 { 113 {
114 sb.AppendFormat("{0:x2}", b); 114 sb.AppendFormat("{0:x2}", b);
@@ -130,6 +130,5 @@ namespace OpenSim.Framework
130 Buffer.BlockCopy(b, 0, c, a.Length, b.Length); 130 Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
131 return c; 131 return c;
132 } 132 }
133
134 } 133 }
135} 134} \ 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;
31 31
32namespace OpenSim.Framework 32namespace OpenSim.Framework
33{ 33{
34 class UUID 34 internal class UUID
35 { 35 {
36 public LLUUID llUUID; 36 public LLUUID llUUID;
37 37
@@ -73,7 +73,7 @@ namespace OpenSim.Framework
73 n = BitConverter.GetBytes(fourth); 73 n = BitConverter.GetBytes(fourth);
74 n.CopyTo(uuid, 12); 74 n.CopyTo(uuid, 12);
75 75
76 llUUID = new LLUUID(uuid,0); 76 llUUID = new LLUUID(uuid, 0);
77 } 77 }
78 78
79 public override string ToString() 79 public override string ToString()
@@ -152,4 +152,4 @@ namespace OpenSim.Framework
152 return !a.Equals(b); 152 return !a.Equals(b);
153 } 153 }
154 } 154 }
155} 155} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32
33namespace OpenSim.Framework 29namespace OpenSim.Framework
34{ 30{
35 /// <summary> 31 /// <summary>
@@ -51,21 +47,30 @@ namespace OpenSim.Framework
51 47
52 public UserConfig(string description, string filename) 48 public UserConfig(string description, string filename)
53 { 49 {
54 configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); 50 configMember =
51 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration);
55 configMember.performConfigurationRetrieve(); 52 configMember.performConfigurationRetrieve();
56 } 53 }
57 54
58 public void loadConfigurationOptions() 55 public void loadConfigurationOptions()
59 { 56 {
60 configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); 57 configMember.addConfigurationOption("default_startup_message",
61 58 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
62 configMember.addConfigurationOption("default_grid_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Grid Server URI", "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false); 59 "Default Startup Message", "Welcome to OGS", false);
63 configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to grid server", "null", false);
64 configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from grid server", "null", false);
65 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
66 60
67 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", DefaultHttpPort.ToString(), false); 61 configMember.addConfigurationOption("default_grid_server",
62 ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
63 "Default Grid Server URI",
64 "http://127.0.0.1:" + GridConfig.DefaultHttpPort.ToString() + "/", false);
65 configMember.addConfigurationOption("grid_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
66 "Key to send to grid server", "null", false);
67 configMember.addConfigurationOption("grid_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
68 "Key to expect from grid server", "null", false);
69 configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
70 "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
68 71
72 configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
73 "Http Listener port", DefaultHttpPort.ToString(), false);
69 } 74 }
70 75
71 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 76 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -73,26 +78,26 @@ namespace OpenSim.Framework
73 switch (configuration_key) 78 switch (configuration_key)
74 { 79 {
75 case "default_startup_message": 80 case "default_startup_message":
76 this.DefaultStartupMsg = (string)configuration_result; 81 DefaultStartupMsg = (string) configuration_result;
77 break; 82 break;
78 case "default_grid_server": 83 case "default_grid_server":
79 this.GridServerURL = (string)configuration_result; 84 GridServerURL = (string) configuration_result;
80 break; 85 break;
81 case "grid_send_key": 86 case "grid_send_key":
82 this.GridSendKey = (string)configuration_result; 87 GridSendKey = (string) configuration_result;
83 break; 88 break;
84 case "grid_recv_key": 89 case "grid_recv_key":
85 this.GridRecvKey = (string)configuration_result; 90 GridRecvKey = (string) configuration_result;
86 break; 91 break;
87 case "database_provider": 92 case "database_provider":
88 this.DatabaseProvider = (string)configuration_result; 93 DatabaseProvider = (string) configuration_result;
89 break; 94 break;
90 case "http_port": 95 case "http_port":
91 HttpPort = (uint)configuration_result; 96 HttpPort = (uint) configuration_result;
92 break; 97 break;
93 } 98 }
94 99
95 return true; 100 return true;
96 } 101 }
97 } 102 }
98} 103} \ 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
44 /// The first component of a users account name 44 /// The first component of a users account name
45 /// </summary> 45 /// </summary>
46 public string username; 46 public string username;
47
47 /// <summary> 48 /// <summary>
48 /// The second component of a users account name 49 /// The second component of a users account name
49 /// </summary> 50 /// </summary>
@@ -54,6 +55,7 @@ namespace OpenSim.Framework
54 /// </summary> 55 /// </summary>
55 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> 56 /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks>
56 public string passwordHash; 57 public string passwordHash;
58
57 /// <summary> 59 /// <summary>
58 /// The salt used for the users hash, should be 32 bytes or longer 60 /// The salt used for the users hash, should be 32 bytes or longer
59 /// </summary> 61 /// </summary>
@@ -64,18 +66,22 @@ namespace OpenSim.Framework
64 /// </summary> 66 /// </summary>
65 public ulong homeRegion 67 public ulong homeRegion
66 { 68 {
67 get { return Helpers.UIntsToLong((homeRegionX * 256), (homeRegionY * 256)); } 69 get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); }
68 set { 70 set
69 homeRegionX = (uint)(value >> 40); 71 {
70 homeRegionY = (((uint)(value)) >> 8); 72 homeRegionX = (uint) (value >> 40);
73 homeRegionY = (((uint) (value)) >> 8);
71 } 74 }
72 } 75 }
76
73 public uint homeRegionX; 77 public uint homeRegionX;
74 public uint homeRegionY; 78 public uint homeRegionY;
79
75 /// <summary> 80 /// <summary>
76 /// The coordinates inside the region of the home location 81 /// The coordinates inside the region of the home location
77 /// </summary> 82 /// </summary>
78 public LLVector3 homeLocation; 83 public LLVector3 homeLocation;
84
79 /// <summary> 85 /// <summary>
80 /// Where the user will be looking when they rez. 86 /// Where the user will be looking when they rez.
81 /// </summary> 87 /// </summary>
@@ -85,6 +91,7 @@ namespace OpenSim.Framework
85 /// A UNIX Timestamp (seconds since epoch) for the users creation 91 /// A UNIX Timestamp (seconds since epoch) for the users creation
86 /// </summary> 92 /// </summary>
87 public int created; 93 public int created;
94
88 /// <summary> 95 /// <summary>
89 /// A UNIX Timestamp for the users last login date / time 96 /// A UNIX Timestamp for the users last login date / time
90 /// </summary> 97 /// </summary>
@@ -96,6 +103,7 @@ namespace OpenSim.Framework
96 /// A URI to the users inventory server, used for foreigners and large grids 103 /// A URI to the users inventory server, used for foreigners and large grids
97 /// </summary> 104 /// </summary>
98 public string userInventoryURI = String.Empty; 105 public string userInventoryURI = String.Empty;
106
99 /// <summary> 107 /// <summary>
100 /// A URI to the users asset server, used for foreigners and large grids. 108 /// A URI to the users asset server, used for foreigners and large grids.
101 /// </summary> 109 /// </summary>
@@ -105,6 +113,7 @@ namespace OpenSim.Framework
105 /// A uint mask containing the "I can do" fields of the users profile 113 /// A uint mask containing the "I can do" fields of the users profile
106 /// </summary> 114 /// </summary>
107 public uint profileCanDoMask; 115 public uint profileCanDoMask;
116
108 /// <summary> 117 /// <summary>
109 /// A uint mask containing the "I want to do" part of the users profile 118 /// A uint mask containing the "I want to do" part of the users profile
110 /// </summary> 119 /// </summary>
@@ -114,6 +123,7 @@ namespace OpenSim.Framework
114 /// The about text listed in a users profile. 123 /// The about text listed in a users profile.
115 /// </summary> 124 /// </summary>
116 public string profileAboutText = String.Empty; 125 public string profileAboutText = String.Empty;
126
117 /// <summary> 127 /// <summary>
118 /// The first life about text listed in a users profile 128 /// The first life about text listed in a users profile
119 /// </summary> 129 /// </summary>
@@ -123,10 +133,12 @@ namespace OpenSim.Framework
123 /// The profile image for an avatar stored on the asset server 133 /// The profile image for an avatar stored on the asset server
124 /// </summary> 134 /// </summary>
125 public LLUUID profileImage; 135 public LLUUID profileImage;
136
126 /// <summary> 137 /// <summary>
127 /// The profile image for the users first life tab 138 /// The profile image for the users first life tab
128 /// </summary> 139 /// </summary>
129 public LLUUID profileFirstImage; 140 public LLUUID profileFirstImage;
141
130 /// <summary> 142 /// <summary>
131 /// The users last registered agent (filled in on the user server) 143 /// The users last registered agent (filled in on the user server)
132 /// </summary> 144 /// </summary>
@@ -142,47 +154,58 @@ namespace OpenSim.Framework
142 /// The UUID of the users avatar (not the agent!) 154 /// The UUID of the users avatar (not the agent!)
143 /// </summary> 155 /// </summary>
144 public LLUUID UUID; 156 public LLUUID UUID;
157
145 /// <summary> 158 /// <summary>
146 /// The IP address of the user 159 /// The IP address of the user
147 /// </summary> 160 /// </summary>
148 public string agentIP = String.Empty; 161 public string agentIP = String.Empty;
162
149 /// <summary> 163 /// <summary>
150 /// The port of the user 164 /// The port of the user
151 /// </summary> 165 /// </summary>
152 public uint agentPort; 166 public uint agentPort;
167
153 /// <summary> 168 /// <summary>
154 /// Is the user online? 169 /// Is the user online?
155 /// </summary> 170 /// </summary>
156 public bool agentOnline; 171 public bool agentOnline;
172
157 /// <summary> 173 /// <summary>
158 /// The session ID for the user (also the agent ID) 174 /// The session ID for the user (also the agent ID)
159 /// </summary> 175 /// </summary>
160 public LLUUID sessionID; 176 public LLUUID sessionID;
177
161 /// <summary> 178 /// <summary>
162 /// The "secure" session ID for the user 179 /// The "secure" session ID for the user
163 /// </summary> 180 /// </summary>
164 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> 181 /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks>
165 public LLUUID secureSessionID; 182 public LLUUID secureSessionID;
183
166 /// <summary> 184 /// <summary>
167 /// The region the user logged into initially 185 /// The region the user logged into initially
168 /// </summary> 186 /// </summary>
169 public LLUUID regionID; 187 public LLUUID regionID;
188
170 /// <summary> 189 /// <summary>
171 /// A unix timestamp from when the user logged in 190 /// A unix timestamp from when the user logged in
172 /// </summary> 191 /// </summary>
173 public int loginTime; 192 public int loginTime;
193
174 /// <summary> 194 /// <summary>
175 /// When this agent expired and logged out, 0 if still online 195 /// When this agent expired and logged out, 0 if still online
176 /// </summary> 196 /// </summary>
177 public int logoutTime; 197 public int logoutTime;
198
178 /// <summary> 199 /// <summary>
179 /// Current region the user is logged into 200 /// Current region the user is logged into
180 /// </summary> 201 /// </summary>
181 public LLUUID currentRegion; 202 public LLUUID currentRegion;
203
182 /// <summary> 204 /// <summary>
183 /// Region handle of the current region the user is in 205 /// Region handle of the current region the user is in
184 /// </summary> 206 /// </summary>
185 public ulong currentHandle; 207 public ulong currentHandle;
208
186 /// <summary> 209 /// <summary>
187 /// The position of the user within the region 210 /// The position of the user within the region
188 /// </summary> 211 /// </summary>
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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data;
30using System.IO; 32using System.IO;
31using System.Security.Cryptography;
32using System.Net; 33using System.Net;
34using System.Net.Sockets;
35using System.Security.Cryptography;
33using System.Text; 36using System.Text;
34using libsecondlife; 37using libsecondlife;
35
36using Nini.Config; 38using Nini.Config;
37 39
38namespace OpenSim.Framework 40namespace OpenSim.Framework
@@ -52,16 +54,13 @@ namespace OpenSim.Framework
52 54
53 public static Random RandomClass 55 public static Random RandomClass
54 { 56 {
55 get 57 get { return randomClass; }
56 {
57 return randomClass;
58 }
59 } 58 }
60 59
61 public static uint GetNextXferID() 60 public static uint GetNextXferID()
62 { 61 {
63 uint id = 0; 62 uint id = 0;
64 lock(XferLock) 63 lock (XferLock)
65 { 64 {
66 id = nextXferID; 65 id = nextXferID;
67 nextXferID++; 66 nextXferID++;
@@ -71,25 +70,24 @@ namespace OpenSim.Framework
71 70
72 public Util() 71 public Util()
73 { 72 {
74
75 } 73 }
76 74
77 public static string GetFileName(string file) 75 public static string GetFileName(string file)
78 { 76 {
79 // Return just the filename on UNIX platforms 77 // Return just the filename on UNIX platforms
80 // TODO: this should be customisable with a prefix, but that's something to do later. 78 // TODO: this should be customisable with a prefix, but that's something to do later.
81 if (System.Environment.OSVersion.Platform == PlatformID.Unix) 79 if (Environment.OSVersion.Platform == PlatformID.Unix)
82 { 80 {
83 return file; 81 return file;
84 } 82 }
85 83
86 // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA 84 // Return %APPDATA%/OpenSim/file for 2K/XP/NT/2K3/VISTA
87 // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData 85 // TODO: Switch this to System.Enviroment.SpecialFolders.ApplicationData
88 if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) 86 if (Environment.OSVersion.Platform == PlatformID.Win32NT)
89 { 87 {
90 if (!System.IO.Directory.Exists("%APPDATA%\\OpenSim\\")) 88 if (!Directory.Exists("%APPDATA%\\OpenSim\\"))
91 { 89 {
92 System.IO.Directory.CreateDirectory("%APPDATA%\\OpenSim"); 90 Directory.CreateDirectory("%APPDATA%\\OpenSim");
93 } 91 }
94 92
95 return "%APPDATA%\\OpenSim\\" + file; 93 return "%APPDATA%\\OpenSim\\" + file;
@@ -103,23 +101,23 @@ namespace OpenSim.Framework
103 public static bool IsEnvironmentSupported(ref string reason) 101 public static bool IsEnvironmentSupported(ref string reason)
104 { 102 {
105 // Must have .NET 2.0 (Generics / libsl) 103 // Must have .NET 2.0 (Generics / libsl)
106 if (System.Environment.Version.Major < 2) 104 if (Environment.Version.Major < 2)
107 { 105 {
108 reason = ".NET 1.0/1.1 lacks components that is used by OpenSim"; 106 reason = ".NET 1.0/1.1 lacks components that is used by OpenSim";
109 return false; 107 return false;
110 } 108 }
111 109
112 // Windows 95/98/ME are unsupported 110 // Windows 95/98/ME are unsupported
113 if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows && 111 if (Environment.OSVersion.Platform == PlatformID.Win32Windows &&
114 System.Environment.OSVersion.Platform != PlatformID.Win32NT) 112 Environment.OSVersion.Platform != PlatformID.Win32NT)
115 { 113 {
116 reason = "Windows 95/98/ME will not run OpenSim"; 114 reason = "Windows 95/98/ME will not run OpenSim";
117 return false; 115 return false;
118 } 116 }
119 117
120 // Windows 2000 / Pre-SP2 XP 118 // Windows 2000 / Pre-SP2 XP
121 if (System.Environment.OSVersion.Version.Major == 5 && ( 119 if (Environment.OSVersion.Version.Major == 5 && (
122 System.Environment.OSVersion.Version.Minor == 0)) 120 Environment.OSVersion.Version.Minor == 0))
123 { 121 {
124 reason = "Please update to Windows XP Service Pack 2 or Server2003"; 122 reason = "Please update to Windows XP Service Pack 2 or Server2003";
125 return false; 123 return false;
@@ -131,7 +129,7 @@ namespace OpenSim.Framework
131 public static int UnixTimeSinceEpoch() 129 public static int UnixTimeSinceEpoch()
132 { 130 {
133 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 131 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
134 int timestamp = (int)t.TotalSeconds; 132 int timestamp = (int) t.TotalSeconds;
135 return timestamp; 133 return timestamp;
136 } 134 }
137 135
@@ -155,10 +153,10 @@ namespace OpenSim.Framework
155 153
156 public static int fast_distance2d(int x, int y) 154 public static int fast_distance2d(int x, int y)
157 { 155 {
158 x = System.Math.Abs(x); 156 x = Math.Abs(x);
159 y = System.Math.Abs(y); 157 y = Math.Abs(y);
160 158
161 int min = System.Math.Min(x, y); 159 int min = Math.Min(x, y);
162 160
163 return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); 161 return (x + y - (min >> 1) - (min >> 2) + (min >> 4));
164 } 162 }
@@ -233,7 +231,7 @@ namespace OpenSim.Framework
233 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++) 231 for (int j = 0; j < 16 && (i + j) < bytes.Length; j++)
234 { 232 {
235 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E) 233 if (bytes[i + j] >= 0x20 && bytes[i + j] < 0x7E)
236 output.Append((char)bytes[i + j]); 234 output.Append((char) bytes[i + j]);
237 else 235 else
238 output.Append("."); 236 output.Append(".");
239 } 237 }
@@ -250,7 +248,6 @@ namespace OpenSim.Framework
250 /// <returns>An IP address, or null</returns> 248 /// <returns>An IP address, or null</returns>
251 public static IPAddress GetHostFromDNS(string dnsAddress) 249 public static IPAddress GetHostFromDNS(string dnsAddress)
252 { 250 {
253
254 // Is it already a valid IP? No need to look it up. 251 // Is it already a valid IP? No need to look it up.
255 IPAddress ipa; 252 IPAddress ipa;
256 if (IPAddress.TryParse(dnsAddress, out ipa)) 253 if (IPAddress.TryParse(dnsAddress, out ipa))
@@ -261,7 +258,7 @@ namespace OpenSim.Framework
261 258
262 foreach (IPAddress host in hosts) 259 foreach (IPAddress host in hosts)
263 { 260 {
264 if (host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 261 if (host.AddressFamily == AddressFamily.InterNetwork)
265 { 262 {
266 return host; 263 return host;
267 } 264 }
@@ -281,7 +278,7 @@ namespace OpenSim.Framework
281 278
282 foreach (IPAddress host in hosts) 279 foreach (IPAddress host in hosts)
283 { 280 {
284 if (!IPAddress.IsLoopback(host) && host.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 281 if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork)
285 { 282 {
286 return host; 283 return host;
287 } 284 }
@@ -302,7 +299,7 @@ namespace OpenSim.Framework
302 string temp; 299 string temp;
303// string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal)); 300// string personal=(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
304// temp = Path.Combine(personal,".OpenSim"); 301// temp = Path.Combine(personal,".OpenSim");
305 temp="."; 302 temp = ".";
306 return temp; 303 return temp;
307 } 304 }
308 305
@@ -349,9 +346,9 @@ namespace OpenSim.Framework
349 } 346 }
350 347
351 // Nini (config) related Methods 348 // Nini (config) related Methods
352 public static IConfigSource ConvertDataRowToXMLConfig(System.Data.DataRow row, string fileName) 349 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
353 { 350 {
354 if(!File.Exists(fileName)) 351 if (!File.Exists(fileName))
355 { 352 {
356 //create new file 353 //create new file
357 } 354 }
@@ -362,13 +359,13 @@ namespace OpenSim.Framework
362 return config; 359 return config;
363 } 360 }
364 361
365 public static void AddDataRowToConfig(IConfigSource config, System.Data.DataRow row) 362 public static void AddDataRowToConfig(IConfigSource config, DataRow row)
366 { 363 {
367 config.Configs.Add((string)row[0]); 364 config.Configs.Add((string) row[0]);
368 for (int i = 0; i < row.Table.Columns.Count; i++) 365 for (int i = 0; i < row.Table.Columns.Count; i++)
369 { 366 {
370 config.Configs[(string)row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); 367 config.Configs[(string) row[0]].Set(row.Table.Columns[i].ColumnName, row[i]);
371 } 368 }
372 } 369 }
373 } 370 }
374} 371} \ 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;
31using System.IO; 31using System.IO;
32using System.Net; 32using System.Net;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions;
35using System.Threading; 34using System.Threading;
35using System.Xml;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using System.Xml;
39 38
40namespace OpenSim.Framework.Servers 39namespace OpenSim.Framework.Servers
41{ 40{
@@ -50,7 +49,7 @@ namespace OpenSim.Framework.Servers
50 49
51 public int Port 50 public int Port
52 { 51 {
53 get { return m_port; } 52 get { return m_port; }
54 } 53 }
55 54
56 public BaseHttpServer(int port) 55 public BaseHttpServer(int port)
@@ -58,11 +57,11 @@ namespace OpenSim.Framework.Servers
58 m_port = port; 57 m_port = port;
59 } 58 }
60 59
61 public void AddStreamHandler( IStreamHandler handler) 60 public void AddStreamHandler(IStreamHandler handler)
62 { 61 {
63 string httpMethod = handler.HttpMethod; 62 string httpMethod = handler.HttpMethod;
64 string path = handler.Path; 63 string path = handler.Path;
65 64
66 string handlerKey = GetHandlerKey(httpMethod, path); 65 string handlerKey = GetHandlerKey(httpMethod, path);
67 m_streamHandlers.Add(handlerKey, handler); 66 m_streamHandlers.Add(handlerKey, handler);
68 } 67 }
@@ -74,9 +73,9 @@ namespace OpenSim.Framework.Servers
74 73
75 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler) 74 public bool AddXmlRPCHandler(string method, XmlRpcMethod handler)
76 { 75 {
77 if (!this.m_rpcHandlers.ContainsKey(method)) 76 if (!m_rpcHandlers.ContainsKey(method))
78 { 77 {
79 this.m_rpcHandlers.Add(method, handler); 78 m_rpcHandlers.Add(method, handler);
80 return true; 79 return true;
81 } 80 }
82 81
@@ -87,7 +86,7 @@ namespace OpenSim.Framework.Servers
87 86
88 public virtual void HandleRequest(Object stateinfo) 87 public virtual void HandleRequest(Object stateinfo)
89 { 88 {
90 HttpListenerContext context = (HttpListenerContext)stateinfo; 89 HttpListenerContext context = (HttpListenerContext) stateinfo;
91 90
92 HttpListenerRequest request = context.Request; 91 HttpListenerRequest request = context.Request;
93 HttpListenerResponse response = context.Response; 92 HttpListenerResponse response = context.Response;
@@ -96,11 +95,11 @@ namespace OpenSim.Framework.Servers
96 response.SendChunked = false; 95 response.SendChunked = false;
97 96
98 string path = request.RawUrl; 97 string path = request.RawUrl;
99 string handlerKey = GetHandlerKey( request.HttpMethod, path ); 98 string handlerKey = GetHandlerKey(request.HttpMethod, path);
100 99
101 IStreamHandler streamHandler; 100 IStreamHandler streamHandler;
102 101
103 if (TryGetStreamHandler( handlerKey, out streamHandler)) 102 if (TryGetStreamHandler(handlerKey, out streamHandler))
104 { 103 {
105 byte[] buffer = streamHandler.Handle(path, request.InputStream); 104 byte[] buffer = streamHandler.Handle(path, request.InputStream);
106 request.InputStream.Close(); 105 request.InputStream.Close();
@@ -159,11 +158,11 @@ namespace OpenSim.Framework.Servers
159 158
160 try 159 try
161 { 160 {
162 xmlRprcRequest = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 161 xmlRprcRequest = (XmlRpcRequest) (new XmlRpcRequestDeserializer()).Deserialize(requestBody);
163 } 162 }
164 catch ( XmlException e ) 163 catch (XmlException e)
165 { 164 {
166 responseString = String.Format( "XmlException:\n{0}",e.Message ); 165 responseString = String.Format("XmlException:\n{0}", e.Message);
167 } 166 }
168 167
169 if (xmlRprcRequest != null) 168 if (xmlRprcRequest != null)
@@ -173,7 +172,7 @@ namespace OpenSim.Framework.Servers
173 XmlRpcResponse xmlRpcResponse; 172 XmlRpcResponse xmlRpcResponse;
174 173
175 XmlRpcMethod method; 174 XmlRpcMethod method;
176 if (this.m_rpcHandlers.TryGetValue(methodName, out method)) 175 if (m_rpcHandlers.TryGetValue(methodName, out method))
177 { 176 {
178 xmlRpcResponse = method(xmlRprcRequest); 177 xmlRpcResponse = method(xmlRprcRequest);
179 } 178 }
@@ -181,7 +180,8 @@ namespace OpenSim.Framework.Servers
181 { 180 {
182 xmlRpcResponse = new XmlRpcResponse(); 181 xmlRpcResponse = new XmlRpcResponse();
183 Hashtable unknownMethodError = new Hashtable(); 182 Hashtable unknownMethodError = new Hashtable();
184 unknownMethodError["reason"] = "XmlRequest"; ; 183 unknownMethodError["reason"] = "XmlRequest";
184 ;
185 unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]"; 185 unknownMethodError["message"] = "Unknown Rpc Request [" + methodName + "]";
186 unknownMethodError["login"] = "false"; 186 unknownMethodError["login"] = "false";
187 xmlRpcResponse.Value = unknownMethodError; 187 xmlRpcResponse.Value = unknownMethodError;
@@ -249,4 +249,4 @@ namespace OpenSim.Framework.Servers
249 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 249 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
250 } 250 }
251 } 251 }
252} 252} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO; 29using System.IO;
33 30
34namespace OpenSim.Framework.Servers 31namespace OpenSim.Framework.Servers
35{ 32{
36 public abstract class BaseStreamHandler : IStreamHandler 33 public abstract class BaseStreamHandler : IStreamHandler
37 { 34 {
38 virtual public string ContentType 35 public virtual string ContentType
39 { 36 {
40 get { return "application/xml"; } 37 get { return "application/xml"; }
41 } 38 }
42 39
43 private string m_httpMethod; 40 private string m_httpMethod;
44 virtual public string HttpMethod 41
42 public virtual string HttpMethod
45 { 43 {
46 get { return m_httpMethod; } 44 get { return m_httpMethod; }
47 } 45 }
48 46
49 private string m_path; 47 private string m_path;
50 virtual public string Path 48
49 public virtual string Path
51 { 50 {
52 get { return m_path; } 51 get { return m_path; }
53 } 52 }
54 53
55 protected string GetParam( string path ) 54 protected string GetParam(string path)
56 { 55 {
57 return path.Substring( m_path.Length ); 56 return path.Substring(m_path.Length);
58 } 57 }
59 58
60 public abstract byte[] Handle(string path, Stream request); 59 public abstract byte[] Handle(string path, Stream request);
61 60
62 protected BaseStreamHandler(string httpMethod, string path) 61 protected BaseStreamHandler(string httpMethod, string path)
@@ -65,4 +64,4 @@ namespace OpenSim.Framework.Servers
65 m_path = path; 64 m_path = path;
66 } 65 }
67 } 66 }
68} 67} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO; 29using System.IO;
30using System.Text;
33 31
34namespace OpenSim.Framework.Servers 32namespace OpenSim.Framework.Servers
35{ 33{
@@ -37,14 +35,14 @@ namespace OpenSim.Framework.Servers
37 35
38 public class BinaryStreamHandler : BaseStreamHandler 36 public class BinaryStreamHandler : BaseStreamHandler
39 { 37 {
40 BinaryMethod m_method; 38 private BinaryMethod m_method;
41 39
42 override public byte[] Handle(string path, Stream request) 40 public override byte[] Handle(string path, Stream request)
43 { 41 {
44 byte[] data = ReadFully(request); 42 byte[] data = ReadFully(request);
45 string param = GetParam(path); 43 string param = GetParam(path);
46 string responseString = m_method(data, path, param); 44 string responseString = m_method(data, path, param);
47 45
48 return Encoding.UTF8.GetBytes(responseString); 46 return Encoding.UTF8.GetBytes(responseString);
49 } 47 }
50 48
@@ -67,11 +65,10 @@ namespace OpenSim.Framework.Servers
67 { 65 {
68 return ms.ToArray(); 66 return ms.ToArray();
69 } 67 }
70 68
71 ms.Write(buffer, 0, read); 69 ms.Write(buffer, 0, read);
72 } 70 }
73 } 71 }
74 } 72 }
75 } 73 }
76 74} \ No newline at end of file
77}
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 @@
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{/* 29{
30 /*
30 public class CheckSumServer : UDPServerBase 31 public class CheckSumServer : UDPServerBase
31 { 32 {
32 //protected ConsoleBase m_log; 33 //protected ConsoleBase m_log;
@@ -123,5 +124,4 @@ namespace OpenSim.Framework.Servers
123 } 124 }
124 * } 125 * }
125 */ 126 */
126
127} \ No newline at end of file 127} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO; 29using System.IO;
33 30
34namespace OpenSim.Framework.Servers 31namespace OpenSim.Framework.Servers
@@ -36,15 +33,15 @@ namespace OpenSim.Framework.Servers
36 public interface IStreamHandler 33 public interface IStreamHandler
37 { 34 {
38 // Handle request stream, return byte array 35 // Handle request stream, return byte array
39 byte[] Handle(string path, Stream request ); 36 byte[] Handle(string path, Stream request);
40 37
41 // Return response content type 38 // Return response content type
42 string ContentType { get; } 39 string ContentType { get; }
43 40
44 // Return required http method 41 // Return required http method
45 string HttpMethod { get;} 42 string HttpMethod { get; }
46 43
47 // Return path 44 // Return path
48 string Path { get; } 45 string Path { get; }
49 } 46 }
50} 47} \ 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 @@
27*/ 27*/
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod( string request, string path, string param ); 30 public delegate string RestMethod(string request, string path, string param);
31} 31} \ 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 @@
26* 26*
27*/ 27*/
28 28
29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.IO; 29using System.IO;
30using System.Text;
33 31
34namespace OpenSim.Framework.Servers 32namespace OpenSim.Framework.Servers
35{ 33{
36 public class RestStreamHandler : BaseStreamHandler 34 public class RestStreamHandler : BaseStreamHandler
37 { 35 {
38 RestMethod m_restMethod; 36 private RestMethod m_restMethod;
39 37
40 override public byte[] Handle(string path, Stream request ) 38 public override byte[] Handle(string path, Stream request)
41 { 39 {
42 Encoding encoding = Encoding.UTF8; 40 Encoding encoding = Encoding.UTF8;
43 StreamReader streamReader = new StreamReader(request, encoding); 41 StreamReader streamReader = new StreamReader(request, encoding);
@@ -46,14 +44,14 @@ namespace OpenSim.Framework.Servers
46 streamReader.Close(); 44 streamReader.Close();
47 45
48 string param = GetParam(path); 46 string param = GetParam(path);
49 string responseString = m_restMethod(requestBody, path, param ); 47 string responseString = m_restMethod(requestBody, path, param);
50 48
51 return Encoding.UTF8.GetBytes(responseString); 49 return Encoding.UTF8.GetBytes(responseString);
52 } 50 }
53 51
54 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base( httpMethod, path ) 52 public RestStreamHandler(string httpMethod, string path, RestMethod restMethod) : base(httpMethod, path)
55 { 53 {
56 m_restMethod = restMethod; 54 m_restMethod = restMethod;
57 } 55 }
58 } 56 }
59} 57} \ 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
51 protected virtual void OnReceivedData(IAsyncResult result) 51 protected virtual void OnReceivedData(IAsyncResult result)
52 { 52 {
53 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 53 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
54 epSender = (EndPoint)ipeSender; 54 epSender = (EndPoint) ipeSender;
55 Packet packet = null; 55 Packet packet = null;
56 int numBytes = Server.EndReceiveFrom(result, ref epSender); 56 int numBytes = Server.EndReceiveFrom(result, ref epSender);
57 int packetEnd = numBytes - 1; 57 int packetEnd = numBytes - 1;
@@ -67,21 +67,18 @@ namespace OpenSim.Framework.Servers
67 67
68 public virtual void ServerListener() 68 public virtual void ServerListener()
69 { 69 {
70
71 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort); 70 ServerIncoming = new IPEndPoint(IPAddress.Parse("0.0.0.0"), listenPort);
72 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); 71 Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
73 Server.Bind(ServerIncoming); 72 Server.Bind(ServerIncoming);
74 73
75 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); 74 ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
76 epSender = (EndPoint)ipeSender; 75 epSender = (EndPoint) ipeSender;
77 ReceivedData = new AsyncCallback(this.OnReceivedData); 76 ReceivedData = new AsyncCallback(OnReceivedData);
78 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); 77 Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
79 } 78 }
80 79
81 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode) 80 public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)
82 { 81 {
83
84 } 82 }
85 } 83 }
86} 84} \ No newline at end of file
87
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;
29 29
30namespace OpenSim.Framework.Servers 30namespace OpenSim.Framework.Servers
31{ 31{
32 public delegate XmlRpcResponse XmlRpcMethod( XmlRpcRequest request ); 32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request);
33} 33} \ No newline at end of file