diff options
author | MW | 2007-04-02 15:48:01 +0000 |
---|---|---|
committer | MW | 2007-04-02 15:48:01 +0000 |
commit | fdc9ed89b4adaa7f23ca06613b2ee36c30895021 (patch) | |
tree | 3c90368815d37055bac61ee3bdce5b5593715e2a /OpenSim.Framework | |
parent | Added OpenSim.GenericConfig.Xml project, so we can swap to a more generic con... (diff) | |
download | opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.zip opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.gz opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.bz2 opensim-SC-fdc9ed89b4adaa7f23ca06613b2ee36c30895021.tar.xz |
OpenSim no longer uses OpenSim.Config.SimConfigDb4o, it now uses OpenSim.GenericConfig.Xml (or a class implementing IGenericConfig).
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r-- | OpenSim.Framework/IGenericConfig.cs | 15 | ||||
-rw-r--r-- | OpenSim.Framework/UserProfileManagerBase.cs | 62 |
2 files changed, 48 insertions, 29 deletions
diff --git a/OpenSim.Framework/IGenericConfig.cs b/OpenSim.Framework/IGenericConfig.cs new file mode 100644 index 0000000..a853fe4 --- /dev/null +++ b/OpenSim.Framework/IGenericConfig.cs | |||
@@ -0,0 +1,15 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework.Interfaces | ||
6 | { | ||
7 | public interface IGenericConfig | ||
8 | { | ||
9 | void LoadData(); | ||
10 | string GetAttribute(string attributeName); | ||
11 | bool SetAttribute(string attributeName, string attributeValue); | ||
12 | void Commit(); | ||
13 | void Close(); | ||
14 | } | ||
15 | } | ||
diff --git a/OpenSim.Framework/UserProfileManagerBase.cs b/OpenSim.Framework/UserProfileManagerBase.cs index c022feb..4428831 100644 --- a/OpenSim.Framework/UserProfileManagerBase.cs +++ b/OpenSim.Framework/UserProfileManagerBase.cs | |||
@@ -13,36 +13,40 @@ namespace OpenSim.Framework.User | |||
13 | 13 | ||
14 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); | 14 | public Dictionary<LLUUID, UserProfile> UserProfiles = new Dictionary<LLUUID, UserProfile>(); |
15 | 15 | ||
16 | public UserProfileManagerBase() { | 16 | public UserProfileManagerBase() |
17 | } | 17 | { |
18 | } | ||
18 | 19 | ||
19 | public virtual void InitUserProfiles() | 20 | public virtual void InitUserProfiles() |
20 | { | 21 | { |
21 | IObjectContainer db; | 22 | IObjectContainer db; |
22 | db = Db4oFactory.OpenFile("userprofiles.yap"); | 23 | db = Db4oFactory.OpenFile("userprofiles.yap"); |
23 | IObjectSet result = db.Get(typeof(UserProfile)); | 24 | IObjectSet result = db.Get(typeof(UserProfile)); |
24 | foreach (UserProfile userprof in result) { | 25 | foreach (UserProfile userprof in result) |
25 | UserProfiles.Add(userprof.UUID, userprof); | 26 | { |
26 | } | 27 | UserProfiles.Add(userprof.UUID, userprof); |
27 | Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); | 28 | } |
28 | db.Close(); | 29 | Console.WriteLine("UserProfiles.Cs:InitUserProfiles() - Successfully loaded " + result.Count.ToString() + " from database"); |
30 | db.Close(); | ||
29 | } | 31 | } |
30 | 32 | ||
31 | public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT! | 33 | public virtual void SaveUserProfiles() // ZOMG! INEFFICIENT! |
32 | { | 34 | { |
33 | IObjectContainer db; | 35 | IObjectContainer db; |
34 | db = Db4oFactory.OpenFile("userprofiles.yap"); | 36 | db = Db4oFactory.OpenFile("userprofiles.yap"); |
35 | IObjectSet result = db.Get(typeof(UserProfile)); | 37 | IObjectSet result = db.Get(typeof(UserProfile)); |
36 | foreach (UserProfile userprof in result) { | 38 | foreach (UserProfile userprof in result) |
37 | db.Delete(userprof); | 39 | { |
38 | db.Commit(); | 40 | db.Delete(userprof); |
39 | } | 41 | db.Commit(); |
40 | foreach (UserProfile userprof in UserProfiles.Values) { | 42 | } |
41 | db.Set(userprof); | 43 | foreach (UserProfile userprof in UserProfiles.Values) |
42 | db.Commit(); | 44 | { |
43 | } | 45 | db.Set(userprof); |
44 | db.Close(); | 46 | db.Commit(); |
45 | } | 47 | } |
48 | db.Close(); | ||
49 | } | ||
46 | 50 | ||
47 | public UserProfile GetProfileByName(string firstname, string lastname) | 51 | public UserProfile GetProfileByName(string firstname, string lastname) |
48 | { | 52 | { |
@@ -74,13 +78,13 @@ namespace OpenSim.Framework.User | |||
74 | } | 78 | } |
75 | else | 79 | else |
76 | { | 80 | { |
77 | Console.WriteLine("UserProfile - not authorised, password not match "+ TheUser.MD5passwd +" and "+ passwd); | 81 | Console.WriteLine("UserProfile - not authorised, password not match " + TheUser.MD5passwd + " and " + passwd); |
78 | return false; | 82 | return false; |
79 | } | 83 | } |
80 | } | 84 | } |
81 | else | 85 | else |
82 | { | 86 | { |
83 | Console.WriteLine("UserProfile - not authorised , unkown: "+ firstname +" , " + lastname); | 87 | Console.WriteLine("UserProfile - not authorised , unkown: " + firstname + " , " + lastname); |
84 | return false; | 88 | return false; |
85 | } | 89 | } |
86 | 90 | ||
@@ -102,8 +106,8 @@ namespace OpenSim.Framework.User | |||
102 | newprofile.UUID = LLUUID.Random(); | 106 | newprofile.UUID = LLUUID.Random(); |
103 | newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); | 107 | newprofile.Inventory.CreateRootFolder(newprofile.UUID, true); |
104 | this.UserProfiles.Add(newprofile.UUID, newprofile); | 108 | this.UserProfiles.Add(newprofile.UUID, newprofile); |
105 | return newprofile; | 109 | return newprofile; |
106 | } | 110 | } |
107 | 111 | ||
108 | public virtual AgentInventory GetUsersInventory(LLUUID agentID) | 112 | public virtual AgentInventory GetUsersInventory(LLUUID agentID) |
109 | { | 113 | { |