Finished adding Db4o support to user profile manager

This commit is contained in:
gareth
2007-04-02 11:41:45 +00:00
parent 1ea4ba3a18
commit 906526bb9a
7 changed files with 16 additions and 27 deletions

View File

@@ -45,6 +45,7 @@
<include name="System.dll" />
<include name="System.Xml.dll" />
<include name="../bin/libsecondlife.dll" />
<include name="../bin/Db4objects.Db4o.dll" />
</references>
</csc>
<echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />

View File

@@ -4,6 +4,7 @@ using System.Text;
using libsecondlife;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Inventory;
using Db4objects.Db4o;
namespace OpenSim.Framework.User
{
@@ -12,13 +13,19 @@ namespace OpenSim.Framework.User
public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>();
public UserProfileManagerBase()
{
}
public UserProfileManagerBase() {
}
public virtual void InitUserProfiles()
{
// TODO: need to load from database
IObjectContainer db;
db = Db4oFactory.OpenFile("userprofiles.yap");
IObjectSet result = db.Get(typeof(UserProfile));
foreach (UserProfile userprof in result) {
UserProfiles.Add(userprof.UUID, userprof);
}
Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database");
db.Close();
}
public UserProfile GetProfileByName(string firstname, string lastname)