From f95b6081cba084d1b067acea99c0effa2b3bf42c Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 24 May 2007 12:35:32 +0000 Subject: Renamed the new Directories. (removed the "-Source" from the end of them) --- .../OpenGrid.Framework.Data.DB4o/DB4oUserData.cs | 90 ++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs (limited to 'OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs') diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs new file mode 100644 index 0000000..7dd4c51 --- /dev/null +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenGrid.Framework.Data; +using libsecondlife; + +namespace OpenGrid.Framework.Data.DB4o +{ + public class DB4oUserData : IUserData + { + DB4oUserManager manager; + + public void Initialise() + { + manager = new DB4oUserManager("userprofiles.yap"); + } + + public UserProfileData getUserByUUID(LLUUID uuid) + { + if(manager.userProfiles.ContainsKey(uuid)) + return manager.userProfiles[uuid]; + return null; + } + + public UserProfileData getUserByName(string name) + { + return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + public UserProfileData getUserByName(string fname, string lname) + { + foreach (UserProfileData profile in manager.userProfiles.Values) + { + if (profile.username == fname && profile.surname == lname) + return profile; + } + return null; + } + + public UserAgentData getAgentByUUID(LLUUID uuid) + { + try + { + return getUserByUUID(uuid).currentAgent; + } + catch (Exception e) + { + return null; + } + } + + public UserAgentData getAgentByName(string name) + { + return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); + } + + public UserAgentData getAgentByName(string fname, string lname) + { + try + { + return getUserByName(fname,lname).currentAgent; + } + catch (Exception e) + { + return null; + } + } + + public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) + { + return true; + } + + public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) + { + return true; + } + + + public string getName() + { + return "DB4o Userdata"; + } + + public string getVersion() + { + return "0.1"; + } + } +} -- cgit v1.1