aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Framework.Data.DB4o
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGrid.Framework.Data.DB4o')
-rw-r--r--OpenGrid.Framework.Data.DB4o/DB4oGridData.cs5
-rw-r--r--OpenGrid.Framework.Data.DB4o/DB4oManager.cs29
2 files changed, 32 insertions, 2 deletions
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
index d15e343..c8152f4 100644
--- a/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
+++ b/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs
@@ -39,6 +39,11 @@ namespace OpenGrid.Framework.Data.DB4o
39 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); 39 throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")");
40 } 40 }
41 41
42 public DataResponse AddProfile(SimProfileData profile)
43 {
44 return DataResponse.RESPONSE_OK;
45 }
46
42 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { 47 public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) {
43 if (manager.profiles[uuid].regionRecvKey == key) 48 if (manager.profiles[uuid].regionRecvKey == key)
44 return true; 49 return true;
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
index f889636..3ebcee2 100644
--- a/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
+++ b/OpenGrid.Framework.Data.DB4o/DB4oManager.cs
@@ -10,11 +10,13 @@ namespace OpenGrid.Framework.Data.DB4o
10 class DB4oManager 10 class DB4oManager
11 { 11 {
12 public Dictionary<LLUUID, SimProfileData> profiles = new Dictionary<LLUUID, SimProfileData>(); 12 public Dictionary<LLUUID, SimProfileData> profiles = new Dictionary<LLUUID, SimProfileData>();
13 13 string dbfl;
14
14 public DB4oManager(string db4odb) 15 public DB4oManager(string db4odb)
15 { 16 {
17 dbfl = db4odb;
16 IObjectContainer database; 18 IObjectContainer database;
17 database = Db4oFactory.OpenFile(db4odb); 19 database = Db4oFactory.OpenFile(dbfl);
18 IObjectSet result = database.Get(typeof(SimProfileData)); 20 IObjectSet result = database.Get(typeof(SimProfileData));
19 foreach(SimProfileData row in result) { 21 foreach(SimProfileData row in result) {
20 profiles.Add(row.UUID, row); 22 profiles.Add(row.UUID, row);
@@ -22,6 +24,29 @@ namespace OpenGrid.Framework.Data.DB4o
22 database.Close(); 24 database.Close();
23 } 25 }
24 26
27 /// <summary>
28 /// Adds a new profile to the database (Warning: Probably slow.)
29 /// </summary>
30 /// <param name="row">The profile to add</param>
31 /// <returns>Successful?</returns>
32 public bool AddRow(SimProfileData row)
33 {
34 profiles.Add(row.UUID, row);
35
36 try
37 {
38 IObjectContainer database;
39 database = Db4oFactory.OpenFile(dbfl);
40 database.Set(row);
41 database.Close();
42 return true;
43 }
44 catch (Exception e)
45 {
46 return false;
47 }
48 }
49
25 50
26 } 51 }
27} 52}