diff options
Finished adding Db4o support to user profile manager
Diffstat (limited to 'OpenSim.Framework/UserProfileManagerBase.cs')
-rw-r--r-- | OpenSim.Framework/UserProfileManagerBase.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs index 218a98c..73f325d 100644 --- a/OpenSim.Framework/UserProfileManagerBase.cs +++ b/OpenSim.Framework/UserProfileManagerBase.cs | |||
@@ -4,6 +4,7 @@ using System.Text; | |||
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | using OpenSim.Framework.Utilities; | 5 | using OpenSim.Framework.Utilities; |
6 | using OpenSim.Framework.Inventory; | 6 | using OpenSim.Framework.Inventory; |
7 | using Db4objects.Db4o; | ||
7 | 8 | ||
8 | namespace OpenSim.Framework.User | 9 | namespace OpenSim.Framework.User |
9 | { | 10 | { |
@@ -12,13 +13,19 @@ namespace OpenSim.Framework.User | |||
12 | 13 | ||
13 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); | 14 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); |
14 | 15 | ||
15 | public UserProfileManagerBase() | 16 | public UserProfileManagerBase() { |
16 | { | 17 | } |
17 | } | ||
18 | 18 | ||
19 | public virtual void InitUserProfiles() | 19 | public virtual void InitUserProfiles() |
20 | { | 20 | { |
21 | // TODO: need to load from database | 21 | IObjectContainer db; |
22 | db = Db4oFactory.OpenFile("userprofiles.yap"); | ||
23 | IObjectSet result = db.Get(typeof(UserProfile)); | ||
24 | foreach (UserProfile userprof in result) { | ||
25 | UserProfiles.Add(userprof.UUID, userprof); | ||
26 | } | ||
27 | Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); | ||
28 | db.Close(); | ||
22 | } | 29 | } |
23 | 30 | ||
24 | public UserProfile GetProfileByName(string firstname, string lastname) | 31 | public UserProfile GetProfileByName(string firstname, string lastname) |