diff options
* Optimized usings (the 'LL ate my scripts' commit)
* added some licensing info
Diffstat (limited to 'OpenSim/Framework/Data.MySQL/MySQLGridData.cs')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLGridData.cs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs index 43e3054..ef643d2 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLGridData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLGridData.cs | |||
@@ -27,8 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Data; | ||
31 | using System.Security.Cryptography; | ||
30 | using System.Text; | 32 | using System.Text; |
31 | using OpenSim.Framework.Data; | 33 | using libsecondlife; |
32 | 34 | ||
33 | namespace OpenSim.Framework.Data.MySQL | 35 | namespace OpenSim.Framework.Data.MySQL |
34 | { | 36 | { |
@@ -104,8 +106,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
104 | param["?xmax"] = xmax.ToString(); | 106 | param["?xmax"] = xmax.ToString(); |
105 | param["?ymax"] = ymax.ToString(); | 107 | param["?ymax"] = ymax.ToString(); |
106 | 108 | ||
107 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); | 109 | IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); |
108 | System.Data.IDataReader reader = result.ExecuteReader(); | 110 | IDataReader reader = result.ExecuteReader(); |
109 | 111 | ||
110 | SimProfileData row; | 112 | SimProfileData row; |
111 | 113 | ||
@@ -144,8 +146,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
144 | Dictionary<string, string> param = new Dictionary<string, string>(); | 146 | Dictionary<string, string> param = new Dictionary<string, string>(); |
145 | param["?handle"] = handle.ToString(); | 147 | param["?handle"] = handle.ToString(); |
146 | 148 | ||
147 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); | 149 | IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); |
148 | System.Data.IDataReader reader = result.ExecuteReader(); | 150 | IDataReader reader = result.ExecuteReader(); |
149 | 151 | ||
150 | SimProfileData row = database.readSimRow(reader); | 152 | SimProfileData row = database.readSimRow(reader); |
151 | reader.Close(); | 153 | reader.Close(); |
@@ -167,7 +169,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
167 | /// </summary> | 169 | /// </summary> |
168 | /// <param name="uuid">The region UUID</param> | 170 | /// <param name="uuid">The region UUID</param> |
169 | /// <returns>The sim profile</returns> | 171 | /// <returns>The sim profile</returns> |
170 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | 172 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) |
171 | { | 173 | { |
172 | try | 174 | try |
173 | { | 175 | { |
@@ -176,8 +178,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
176 | Dictionary<string, string> param = new Dictionary<string, string>(); | 178 | Dictionary<string, string> param = new Dictionary<string, string>(); |
177 | param["?uuid"] = uuid.ToStringHyphenated(); | 179 | param["?uuid"] = uuid.ToStringHyphenated(); |
178 | 180 | ||
179 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); | 181 | IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); |
180 | System.Data.IDataReader reader = result.ExecuteReader(); | 182 | IDataReader reader = result.ExecuteReader(); |
181 | 183 | ||
182 | SimProfileData row = database.readSimRow(reader); | 184 | SimProfileData row = database.readSimRow(reader); |
183 | reader.Close(); | 185 | reader.Close(); |
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
221 | /// <param name="handle">The attempted regionHandle of the challenger</param> | 223 | /// <param name="handle">The attempted regionHandle of the challenger</param> |
222 | /// <param name="authkey">The secret</param> | 224 | /// <param name="authkey">The secret</param> |
223 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | 225 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> |
224 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | 226 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey) |
225 | { | 227 | { |
226 | bool throwHissyFit = false; // Should be true by 1.0 | 228 | bool throwHissyFit = false; // Should be true by 1.0 |
227 | 229 | ||
@@ -242,10 +244,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
242 | /// <param name="authhash"></param> | 244 | /// <param name="authhash"></param> |
243 | /// <param name="challenge"></param> | 245 | /// <param name="challenge"></param> |
244 | /// <returns></returns> | 246 | /// <returns></returns> |
245 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | 247 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge) |
246 | { | 248 | { |
247 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | 249 | SHA512Managed HashProvider = new SHA512Managed(); |
248 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | 250 | ASCIIEncoding TextProvider = new ASCIIEncoding(); |
249 | 251 | ||
250 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | 252 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); |
251 | byte[] hash = HashProvider.ComputeHash(stream); | 253 | byte[] hash = HashProvider.ComputeHash(stream); |
@@ -262,8 +264,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
262 | Dictionary<string, string> param = new Dictionary<string, string>(); | 264 | Dictionary<string, string> param = new Dictionary<string, string>(); |
263 | param["?x"] = x.ToString(); | 265 | param["?x"] = x.ToString(); |
264 | param["?y"] = y.ToString(); | 266 | param["?y"] = y.ToString(); |
265 | System.Data.IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); | 267 | IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param); |
266 | System.Data.IDataReader reader = result.ExecuteReader(); | 268 | IDataReader reader = result.ExecuteReader(); |
267 | 269 | ||
268 | ReservationData row = database.readReservationRow(reader); | 270 | ReservationData row = database.readReservationRow(reader); |
269 | reader.Close(); | 271 | reader.Close(); |