From ca785403a10bc0a185d9f2e90479b0f8fb75ca31 Mon Sep 17 00:00:00 2001 From: MW Date: Mon, 7 May 2007 16:53:22 +0000 Subject: [PATCH] merged in missing file from 0.1-prestable --- OpenGrid.Framework.Data.DB4o/DB4oUserData.cs | 75 ++++++++++++++++++++ OpenGrid.Framework.Data/UserData.cs | 24 +++++++ 2 files changed, 99 insertions(+) create mode 100644 OpenGrid.Framework.Data.DB4o/DB4oUserData.cs create mode 100644 OpenGrid.Framework.Data/UserData.cs diff --git a/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs new file mode 100644 index 0000000000..c21d7e22d2 --- /dev/null +++ b/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs @@ -0,0 +1,75 @@ +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 = 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; + } + + } +} diff --git a/OpenGrid.Framework.Data/UserData.cs b/OpenGrid.Framework.Data/UserData.cs new file mode 100644 index 0000000000..6b4f2baa08 --- /dev/null +++ b/OpenGrid.Framework.Data/UserData.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; + +namespace OpenGrid.Framework.Data +{ + public interface IUserData + { + // Retrieval + // User Profiles + UserProfileData getUserByUUID(LLUUID user); + UserProfileData getUserByName(string name); + UserProfileData getUserByName(string fname, string lname); + // User Agents + UserAgentData getAgentByUUID(LLUUID user); + UserAgentData getAgentByName(string name); + UserAgentData getAgentByName(string fname, string lname); + + // Transactional + bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); + bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); + } +}