diff options
Diffstat (limited to 'OpenGrid.Framework.Data.DB4o/DB4oUserData.cs')
-rw-r--r-- | OpenGrid.Framework.Data.DB4o/DB4oUserData.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs new file mode 100644 index 0000000..c21d7e2 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs | |||
@@ -0,0 +1,75 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenGrid.Framework.Data; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenGrid.Framework.Data.DB4o | ||
8 | { | ||
9 | public class DB4oUserData : IUserData | ||
10 | { | ||
11 | DB4oUserManager manager = new DB4oUserManager("userprofiles.yap"); | ||
12 | |||
13 | public UserProfileData getUserByUUID(LLUUID uuid) | ||
14 | { | ||
15 | if(manager.userProfiles.ContainsKey(uuid)) | ||
16 | return manager.userProfiles[uuid]; | ||
17 | return null; | ||
18 | } | ||
19 | |||
20 | public UserProfileData getUserByName(string name) | ||
21 | { | ||
22 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
23 | } | ||
24 | |||
25 | public UserProfileData getUserByName(string fname, string lname) | ||
26 | { | ||
27 | foreach (UserProfileData profile in manager.userProfiles.Values) | ||
28 | { | ||
29 | if (profile.username == fname && profile.surname == lname) | ||
30 | return profile; | ||
31 | } | ||
32 | return null; | ||
33 | } | ||
34 | |||
35 | public UserAgentData getAgentByUUID(LLUUID uuid) | ||
36 | { | ||
37 | try | ||
38 | { | ||
39 | return getUserByUUID(uuid).currentAgent; | ||
40 | } | ||
41 | catch (Exception e) | ||
42 | { | ||
43 | return null; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | public UserAgentData getAgentByName(string name) | ||
48 | { | ||
49 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
50 | } | ||
51 | |||
52 | public UserAgentData getAgentByName(string fname, string lname) | ||
53 | { | ||
54 | try | ||
55 | { | ||
56 | return getUserByName(fname,lname).currentAgent; | ||
57 | } | ||
58 | catch (Exception e) | ||
59 | { | ||
60 | return null; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | ||
65 | { | ||
66 | return true; | ||
67 | } | ||
68 | |||
69 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | ||
70 | { | ||
71 | return true; | ||
72 | } | ||
73 | |||
74 | } | ||
75 | } | ||