diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs index caf7eb07f9..546713e6ff 100644 --- a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs +++ b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs @@ -15,6 +15,11 @@ namespace OpenGrid.Framework.Data.DB4o manager = new DB4oGridManager("gridserver.yap"); } + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + public SimProfileData GetProfileByHandle(ulong handle) { lock (manager.simProfiles) { diff --git a/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs index 8a93d403d7..0925df1477 100644 --- a/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs +++ b/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs @@ -35,6 +35,11 @@ namespace OpenGrid.Framework.Data.MSSQL return "0.1"; } + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + /// /// Returns a sim profile from it's location /// diff --git a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs index 3dceff6988..46183b4074 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs @@ -14,7 +14,7 @@ namespace OpenGrid.Framework.Data.MySQL /// public void Initialise() { - database = new MySQLManager("server", "database", "username", "password", "false"); + database = new MySQLManager("localhost", "database", "username", "password", "false"); } /// @@ -35,6 +35,43 @@ namespace OpenGrid.Framework.Data.MySQL return "0.1"; } + public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?xmin"] = xmin.ToString(); + param["?ymin"] = ymin.ToString(); + 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(); + + SimProfileData row; + + List rows = new List(); + + while ((row = database.getSimRow(reader)) != null) + { + rows.Add(row); + } + reader.Close(); + result.Dispose(); + + return rows.ToArray(); + + } + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + return null; + } + } + /// /// Returns a sim profile from it's location /// diff --git a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs index 7461b148bb..e4622a8f41 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs @@ -121,7 +121,6 @@ namespace OpenGrid.Framework.Data.MySQL } else { - throw new Exception("Unable to find region at coordinates"); return null; } return retval; diff --git a/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs index 02e153f722..4850f12ad8 100644 --- a/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs +++ b/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs @@ -35,6 +35,11 @@ namespace OpenGrid.Framework.Data.SQLite return "0.1"; } + public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) + { + return null; + } + /// /// Returns a sim profile from it's location /// diff --git a/OpenGrid.Framework.Data/GridData.cs b/OpenGrid.Framework.Data/GridData.cs index d5516b292e..6dad37e2b3 100644 --- a/OpenGrid.Framework.Data/GridData.cs +++ b/OpenGrid.Framework.Data/GridData.cs @@ -31,6 +31,16 @@ namespace OpenGrid.Framework.Data /// A sim profile SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID); + /// + /// Returns all profiles within the specified range + /// + /// Minimum sim coordinate (X) + /// Minimum sim coordinate (Y) + /// Maximum sim coordinate (X) + /// Maximum sim coordinate (Y) + /// An array containing all the sim profiles in the specified range + SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); + /// /// Authenticates a sim by use of it's recv key. /// WARNING: Insecure diff --git a/OpenGridServices.GridServer/Main.cs b/OpenGridServices.GridServer/Main.cs index 0c5aa3d4f9..54db7c6a56 100644 --- a/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices.GridServer/Main.cs @@ -115,7 +115,7 @@ namespace OpenGridServices.GridServer m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(8001); - GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback); + //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback); httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod);