mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
* Optimized usings (the 'LL ate my scripts' commit)
* added some licensing info
This commit is contained in:
@@ -27,8 +27,10 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Data;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data.MySQL
|
||||
{
|
||||
@@ -104,8 +106,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
param["?xmax"] = xmax.ToString();
|
||||
param["?ymax"] = ymax.ToString();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
SimProfileData row;
|
||||
|
||||
@@ -144,8 +146,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?handle"] = handle.ToString();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
SimProfileData row = database.readSimRow(reader);
|
||||
reader.Close();
|
||||
@@ -167,7 +169,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
/// </summary>
|
||||
/// <param name="uuid">The region UUID</param>
|
||||
/// <returns>The sim profile</returns>
|
||||
public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
|
||||
public SimProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -176,8 +178,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = uuid.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
SimProfileData row = database.readSimRow(reader);
|
||||
reader.Close();
|
||||
@@ -221,7 +223,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||
/// <param name="authkey">The secret</param>
|
||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||
public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey)
|
||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
|
||||
{
|
||||
bool throwHissyFit = false; // Should be true by 1.0
|
||||
|
||||
@@ -242,10 +244,10 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
/// <param name="authhash"></param>
|
||||
/// <param name="challenge"></param>
|
||||
/// <returns></returns>
|
||||
public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge)
|
||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
|
||||
{
|
||||
System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed();
|
||||
System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding();
|
||||
SHA512Managed HashProvider = new SHA512Managed();
|
||||
ASCIIEncoding TextProvider = new ASCIIEncoding();
|
||||
|
||||
byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge);
|
||||
byte[] hash = HashProvider.ComputeHash(stream);
|
||||
@@ -262,8 +264,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?x"] = x.ToString();
|
||||
param["?y"] = y.ToString();
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
ReservationData row = database.readReservationRow(reader);
|
||||
reader.Close();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data.MySQL
|
||||
@@ -98,8 +98,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = folderID.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryItemBase> items = database.readInventoryItems(reader);
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
param["?uuid"] = user.ToStringHyphenated();
|
||||
param["?zero"] = LLUUID.Zero.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryFolderBase> items = database.readInventoryFolders(reader);
|
||||
|
||||
@@ -165,8 +165,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = parentID.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryFolderBase> items = database.readInventoryFolders(reader);
|
||||
|
||||
@@ -198,8 +198,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = item.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryItemBase> items = database.readInventoryItems(reader);
|
||||
|
||||
@@ -238,8 +238,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = folder.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
List<InventoryFolderBase> items = database.readInventoryFolders(reader);
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
*
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework.Data.MySQL
|
||||
{
|
||||
|
||||
@@ -27,17 +27,10 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
|
||||
// MySQL Native
|
||||
using MySql;
|
||||
using MySql.Data;
|
||||
using MySql.Data.Types;
|
||||
using libsecondlife;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
using OpenSim.Framework.Data;
|
||||
|
||||
namespace OpenSim.Framework.Data.MySQL
|
||||
{
|
||||
/// <summary>
|
||||
@@ -71,7 +64,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
|
||||
dbcon.Open();
|
||||
|
||||
System.Console.WriteLine("MySQL connection established");
|
||||
Console.WriteLine("MySQL connection established");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -187,7 +180,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
// Region Main
|
||||
retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString());
|
||||
retval.regionName = (string)reader["regionName"];
|
||||
retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]);
|
||||
retval.UUID = new LLUUID((string)reader["uuid"]);
|
||||
|
||||
// Secrets
|
||||
retval.regionRecvKey = (string)reader["regionRecvKey"];
|
||||
@@ -226,11 +219,11 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
string tempRegionMap = reader["regionMapTexture"].ToString();
|
||||
if (tempRegionMap != "")
|
||||
{
|
||||
retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap);
|
||||
retval.regionMapTextureID = new LLUUID(tempRegionMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval.regionMapTextureID = new libsecondlife.LLUUID();
|
||||
retval.regionMapTextureID = new LLUUID();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -259,7 +252,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
retval.reservationMinY = (int)reader["resYMin"];
|
||||
retval.reservationName = (string)reader["resName"];
|
||||
retval.status = (bool)reader["status"];
|
||||
retval.userUUID = new libsecondlife.LLUUID((string)reader["userUUID"]);
|
||||
retval.userUUID = new LLUUID((string)reader["userUUID"]);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -280,9 +273,9 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
if (reader.Read())
|
||||
{
|
||||
// Agent IDs
|
||||
retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
|
||||
retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]);
|
||||
retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]);
|
||||
retval.UUID = new LLUUID((string)reader["UUID"]);
|
||||
retval.sessionID = new LLUUID((string)reader["sessionID"]);
|
||||
retval.secureSessionID = new LLUUID((string)reader["secureSessionID"]);
|
||||
|
||||
// Agent Who?
|
||||
retval.agentIP = (string)reader["agentIP"];
|
||||
@@ -296,7 +289,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
// Current position
|
||||
retval.currentRegion = (string)reader["currentRegion"];
|
||||
retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString());
|
||||
libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
|
||||
LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,7 +309,7 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
|
||||
if (reader.Read())
|
||||
{
|
||||
retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]);
|
||||
retval.UUID = new LLUUID((string)reader["UUID"]);
|
||||
retval.username = (string)reader["username"];
|
||||
retval.surname = (string)reader["lastname"];
|
||||
|
||||
@@ -324,11 +317,11 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
retval.passwordSalt = (string)reader["passwordSalt"];
|
||||
|
||||
retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString());
|
||||
retval.homeLocation = new libsecondlife.LLVector3(
|
||||
retval.homeLocation = new LLVector3(
|
||||
Convert.ToSingle(reader["homeLocationX"].ToString()),
|
||||
Convert.ToSingle(reader["homeLocationY"].ToString()),
|
||||
Convert.ToSingle(reader["homeLocationZ"].ToString()));
|
||||
retval.homeLookAt = new libsecondlife.LLVector3(
|
||||
retval.homeLookAt = new LLVector3(
|
||||
Convert.ToSingle(reader["homeLookAtX"].ToString()),
|
||||
Convert.ToSingle(reader["homeLookAtY"].ToString()),
|
||||
Convert.ToSingle(reader["homeLookAtZ"].ToString()));
|
||||
@@ -345,8 +338,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
retval.profileAboutText = (string)reader["profileAboutText"];
|
||||
retval.profileFirstText = (string)reader["profileFirstText"];
|
||||
|
||||
retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]);
|
||||
retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]);
|
||||
retval.profileImage = new LLUUID((string)reader["profileImage"]);
|
||||
retval.profileFirstImage = new LLUUID((string)reader["profileFirstImage"]);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -371,9 +364,9 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
|
||||
folder.agentID = new libsecondlife.LLUUID((string)reader["agentID"]);
|
||||
folder.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
|
||||
folder.folderID = new libsecondlife.LLUUID((string)reader["folderID"]);
|
||||
folder.agentID = new LLUUID((string)reader["agentID"]);
|
||||
folder.parentID = new LLUUID((string)reader["parentFolderID"]);
|
||||
folder.folderID = new LLUUID((string)reader["folderID"]);
|
||||
folder.name = (string)reader["folderName"];
|
||||
|
||||
rows.Add(folder);
|
||||
@@ -402,14 +395,14 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
|
||||
item.assetID = new libsecondlife.LLUUID((string)reader["assetID"]);
|
||||
item.avatarID = new libsecondlife.LLUUID((string)reader["avatarID"]);
|
||||
item.assetID = new LLUUID((string)reader["assetID"]);
|
||||
item.avatarID = new LLUUID((string)reader["avatarID"]);
|
||||
item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString());
|
||||
item.inventoryDescription = (string)reader["inventoryDescription"];
|
||||
item.inventoryID = new libsecondlife.LLUUID((string)reader["inventoryID"]);
|
||||
item.inventoryID = new LLUUID((string)reader["inventoryID"]);
|
||||
item.inventoryName = (string)reader["inventoryName"];
|
||||
item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString());
|
||||
item.parentFolderID = new libsecondlife.LLUUID((string)reader["parentFolderID"]);
|
||||
item.parentFolderID = new LLUUID((string)reader["parentFolderID"]);
|
||||
item.type = Convert.ToInt32(reader["type"].ToString());
|
||||
|
||||
rows.Add(item);
|
||||
|
||||
@@ -27,8 +27,7 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Framework.Data;
|
||||
using System.Data;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data.MySQL
|
||||
@@ -87,8 +86,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
param["?first"] = user;
|
||||
param["?second"] = last;
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
UserProfileData row = database.readUserRow(reader);
|
||||
|
||||
@@ -120,8 +119,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = uuid.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
UserProfileData row = database.readUserRow(reader);
|
||||
|
||||
@@ -175,8 +174,8 @@ namespace OpenSim.Framework.Data.MySQL
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
param["?uuid"] = uuid.ToStringHyphenated();
|
||||
|
||||
System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
|
||||
System.Data.IDataReader reader = result.ExecuteReader();
|
||||
IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param);
|
||||
IDataReader reader = result.ExecuteReader();
|
||||
|
||||
UserAgentData row = database.readAgentRow(reader);
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
Reference in New Issue
Block a user