public static void StartTransferLocal(
     UUID transactionID,
     UGUI dstAgent,
     UserAgentServiceInterface dstUserAgentService,
     InventoryServiceInterface dstInventoryService,
     AssetServiceInterface dstAssetService,
     UGUIWithName srcAgent,
     InventoryServiceInterface srcInventoryService,
     AssetServiceInterface srcAssetService,
     AssetType givenAssetType,
     UUID givenInventoryID,
     IMServiceInterface imService,
     Action <UUID> inventoryCreate = null) => StartTransfer(
     transactionID,
     dstAgent,
     dstUserAgentService,
     dstInventoryService,
     dstAssetService,
     srcAgent,
     null,
     srcInventoryService,
     srcAssetService,
     givenAssetType,
     givenInventoryID,
     imService,
     inventoryCreate);
 public InventoryTransferWorkItem(
     UUID transactionID,
     UGUI dstAgent,
     UserAgentServiceInterface dstUserAgentService,
     InventoryServiceInterface dstInventoryService,
     AssetServiceInterface dstAssetService,
     UGUIWithName srcAgent,
     InventoryServiceInterface srcInventoryService,
     AssetServiceInterface srcAssetService,
     UUID assetid,
     InventoryItem item,
     IMServiceInterface imService,
     Action <UUID> inventoryCreate)
     : base(dstAssetService, srcAssetService, assetid, ReferenceSource.Source)
 {
     m_TransactionID       = transactionID;
     m_DstUserAgentService = dstUserAgentService;
     m_DstInventoryService = dstInventoryService;
     m_SrcInventoryService = srcInventoryService;
     m_DestinationAgent    = dstAgent;
     m_Item            = item;
     m_SrcAgent        = srcAgent;
     m_IMService       = imService;
     m_InventoryCreate = inventoryCreate;
 }
        private static bool IsEqual(UGUIWithName uui1, UGUIWithName uui2)
        {
            var mismatches = new List <string>();

            if (uui1.ID != uui2.ID)
            {
                mismatches.Add("ID");
            }
            if (uui1.FirstName != uui2.FirstName)
            {
                mismatches.Add("FirstName");
            }
            if (uui1.LastName != uui2.LastName)
            {
                mismatches.Add("LastName");
            }
            bool uriEqual = uui1.HomeURI?.ToString() == uui2.HomeURI?.ToString();

            if (!uriEqual)
            {
                mismatches.Add("HomeURI");
            }
            if (mismatches.Count != 0)
            {
                m_Log.InfoFormat("Mismatches: {0}", string.Join(" ", mismatches));
            }
            return(mismatches.Count == 0);
        }
示例#4
0
        public void HandleViewerEffect(Message m)
        {
            var ve = (ViewerEffect)m;

            if (ve.AgentID != ve.CircuitAgentID ||
                ve.SessionID != ve.CircuitSessionID)
            {
                return;
            }

            /* we only route valid messages here but keep SessionID from being broadcasted */
            ve.SessionID = UUID.Zero;

            SceneInterface scene     = Scene;
            ViewerAgent    thisAgent = Agent;

            if (thisAgent == null || scene == null)
            {
                return;
            }
            UGUIWithName agentOwner = thisAgent.NamedOwner;

            foreach (var agent in scene.Agents)
            {
                if (agent.Owner.Equals(agentOwner))
                {
                    continue;
                }
                agent.SendMessageAlways(m, scene.ID);
            }
        }
 public override void Store(UGUIWithName value)
 {
     if (value.IsAuthoritative) /* do not store non-authoritative entries */
     {
         m_Data[value.ID] = new UGUIWithName(value);
     }
 }
示例#6
0
 public bool TranslateToUUI(string arg, out UGUIWithName uui)
 {
     uui = UGUIWithName.Unknown;
     if (UGUIWithName.TryParse(arg, out uui))
     {
         return(true);
     }
     else if (arg.Contains("."))
     {
         string[] names = arg.Split(new char[] { '.' }, 2);
         if (names.Length == 1)
         {
             names = new string[] { names[0], string.Empty };
         }
         UGUIWithName founduui;
         if (TryGetValue(names[0], names[1], out founduui))
         {
             uui = founduui;
             return(true);
         }
     }
     else if (UUID.TryParse(arg, out uui.ID))
     {
         UGUIWithName founduui;
         if (TryGetValue(uui.ID, out founduui))
         {
             uui = founduui;
             return(true);
         }
     }
     return(false);
 }
 public static bool StartTransferLocal(
     UUID transactionID,
     UGUI dstAgent,
     IReadOnlyList <IUserAgentServicePlugin> userAgentServicePlugins,
     IReadOnlyList <IInventoryServicePlugin> inventoryServicePlugins,
     IReadOnlyList <IAssetServicePlugin> assetServicePlugins,
     UGUIWithName srcAgent,
     InventoryServiceInterface srcInventoryService,
     AssetServiceInterface srcAssetService,
     AssetType givenAssetType,
     UUID givenInventoryID,
     IMServiceInterface imService,
     Action <UUID> inventoryCreate = null) => StartTransfer(
     transactionID,
     dstAgent,
     userAgentServicePlugins,
     inventoryServicePlugins,
     assetServicePlugins,
     srcAgent,
     null,
     srcInventoryService,
     srcAssetService,
     givenAssetType,
     givenInventoryID,
     imService,
     inventoryCreate);
 public static Map ToMap(this UGUIWithName uui) => new Map
 {
     { "fullname", uui.FullName },
     { "uui", uui.ToString() },
     { "firstname", uui.FirstName },
     { "lastname", uui.LastName }
 };
        private bool CheckNonExistance(int number, UGUIWithName uui)
        {
            UGUIWithName result;

            m_Log.InfoFormat("Testing that entry {0} does not exist by name 1", number);
            if (m_AvatarNameService.TryGetValue(uui.FirstName, uui.LastName, out result))
            {
                return(false);
            }

            m_Log.InfoFormat("Testing that entry {0} does not exist by name 2", number);
            try
            {
                result = m_AvatarNameService[uui.FirstName, uui.LastName];
                return(false);
            }
            catch (KeyNotFoundException)
            {
                /* this is the exception that should happen */
            }

            m_Log.InfoFormat("Testing that entry {0} does not exist by id 1", number);
            if (m_AvatarNameService.TryGetValue(uui.ID, out result))
            {
                return(false);
            }

            m_Log.InfoFormat("Testing that entry {0} does not exist by name 2", number);
            try
            {
                result = m_AvatarNameService[uui.ID];
                return(false);
            }
            catch (KeyNotFoundException)
            {
                /* this is the exception that should happen */
            }

            m_Log.InfoFormat("Testing that entry {0} is not searchable by full name", number);
            List <UGUIWithName> reslist = m_AvatarNameService.Search(new string[] { uui.FirstName, uui.LastName });

            if (reslist.Count != 0)
            {
                m_Log.Info("Result list is not empty");
                return(false);
            }

            m_Log.InfoFormat("Testing that entry {0} is not searchable by first name", number);
            reslist = m_AvatarNameService.Search(new string[] { uui.FirstName });
            if (reslist.Count != 0)
            {
                m_Log.Info("Result list is not empty");
                return(false);
            }

            return(true);
        }
示例#10
0
 public bool TryGetValue(UGUIWithName input, out UGUIWithName uui)
 {
     if (!input.IsAuthoritative &&
         TryGetValue(input.ID, out uui))
     {
         return(true);
     }
     uui = input;
     return(false);
 }
 public override bool TryGetValue(string firstName, string lastName, out UGUIWithName uui)
 {
     foreach (UGUIWithName entry in from data in m_Data where data.Value.FirstName.ToLower() == firstName.ToLower() && data.Value.LastName.ToLower() == lastName.ToLower() select data.Value)
     {
         uui = new UGUIWithName(entry);
         return(true);
     }
     uui = UGUIWithName.Unknown;
     return(false);
 }
示例#12
0
        public bool Run()
        {
            UUID         secureSessionID = new UUID("11223344-1122-1122-1133-112233445566");
            UGUIWithName uguiname        = new UGUIWithName("11223344-1111-1122-1122-112233445566", "http://example.com/;Example Com");
            UGUI         ugui            = new UGUI(uguiname);
            const string clientipaddress = "127.0.0.1";

            m_Log.Info("Creating session");
            UserSessionInfo createdSession = m_UserSessionService.CreateSession(uguiname, clientipaddress, sessionID, secureSessionID);

            m_Log.Info("Creating value 1");
            m_UserSessionService[sessionID, "testassoc1", "testvarname1"] = "testvalue1";

            m_Log.Info("Creating value 2");
            m_UserSessionService[sessionID, "testassoc2", "testvarname2"] = "testvalue2";

            m_Log.Info("Remove matching value 1");
            if (!m_UserSessionService.CompareAndRemove(sessionID, "testassoc1", "testvarname1", "testvalue1"))
            {
                return(false);
            }

            m_Log.Info("Check removal matching value 1");
            if (m_UserSessionService.ContainsKey(sessionID, "testassoc1", "testvarname1"))
            {
                return(false);
            }
            m_Log.Info("Check existence value 2");
            if (!m_UserSessionService.ContainsKey(sessionID, "testassoc2", "testvarname2"))
            {
                return(false);
            }

            m_Log.Info("Try remove non-matching value 2");
            if (m_UserSessionService.CompareAndRemove(sessionID, "testassoc2", "testvarname2", "testvalue1"))
            {
                return(false);
            }

            m_Log.Info("Check existence value 2");
            if (!m_UserSessionService.ContainsKey(sessionID, "testassoc2", "testvarname2"))
            {
                return(false);
            }


            m_Log.Info("Deleting session");
            if (!m_UserSessionService.Remove(sessionID))
            {
                return(false);
            }

            return(true);
        }
示例#13
0
        private void HandleShowNpcs(HttpRequest req, Map jsondata)
        {
            SceneInterface scene = null;

            if (!jsondata.ContainsKey("regionid") ||
                !m_KnownScenes.TryGetValue(jsondata["regionid"].AsUUID, out scene))
            {
                m_AdminWebIF.ErrorResponse(req, AdminWebIfErrorResult.InvalidRequest);
                return;
            }

            var npcs = new AnArray();

            foreach (NpcAgent agent in m_NpcAgents.Values)
            {
                if (agent.CurrentScene != scene)
                {
                    continue;
                }
                UGUIWithName uui   = agent.NamedOwner;
                var          npcid = new Map
                {
                    { "firstname", uui.FirstName },
                    { "lastname", uui.LastName },
                    { "id", uui.ID }
                };
                uui = m_AdminWebIF.ResolveName(agent.NpcOwner);
                var npcowner = new Map
                {
                    { "fullname", uui.FullName },
                    { "firstname", uui.FirstName },
                    { "lastname", uui.LastName },
                    { "id", uui.ID }
                };
                if (uui.HomeURI != null)
                {
                    npcowner.Add("homeuri", uui.HomeURI);
                }

                var npcdata = new Map
                {
                    { "uui", npcid },
                    { "owner", npcowner },
                    { "persistent", (m_NpcPresenceService != null && m_NpcPresenceService[agent.Owner.ID].Count != 0) }
                };
                npcs.Add(npcdata);
            }
            var res = new Map
            {
                ["npcs"] = npcs
            };

            m_AdminWebIF.SuccessResponse(req, res);
        }
示例#14
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            m_UserSessionService = loader.GetService <UserSessionServiceInterface>(config.GetString("UserSessionService", "UserSessionService"));
            m_UserAccountService = loader.GetService <UserAccountServiceInterface>(config.GetString("UserAccountService", "UserAccountService"));
            m_UserID             = new UGUIWithName(config.GetString("User"));
            m_SessionID          = new UUID(config.GetString("SessionID"));
            m_SecureSessionID    = new UUID(config.GetString("SecureSessionID"));
            m_ClientIPAddress    = config.GetString("ClientIPAddress");
        }
示例#15
0
 public bool TryGetValue(UGUI input, out UGUIWithName uui)
 {
     if (TryGetValue(input.ID, out uui))
     {
         if (!input.IsAuthoritative || input.EqualsGrid(uui))
         {
             return(true);
         }
     }
     uui = UGUIWithName.Unknown;
     return(false);
 }
示例#16
0
 public UGUIWithName this[UGUIWithName input]
 {
     get
     {
         UGUIWithName resultuui;
         if (!input.IsAuthoritative &&
             TryGetValue(input.ID, out resultuui))
         {
             return(resultuui);
         }
         return(input);
     }
 }
示例#17
0
 private void WriteAvatarNameData(XmlTextWriter writer, UGUIWithName nd)
 {
     writer.WriteStartElement("map");
     writer.WriteKeyValuePair("username", nd.FullName.Replace(' ', '.'));
     writer.WriteKeyValuePair("display_name", nd.FullName);
     writer.WriteKeyValuePair("display_name_next_update", Date.Now.AddDays(1));
     writer.WriteKeyValuePair("display_name_expires", Date.Now.AddMonths(1));
     writer.WriteKeyValuePair("legacy_first_name", nd.FirstName);
     writer.WriteKeyValuePair("legacy_last_name", nd.LastName);
     writer.WriteKeyValuePair("id", nd.ID);
     writer.WriteKeyValuePair("is_display_name_default", false);
     writer.WriteEndElement();
 }
示例#18
0
        public override bool TryGetValue(UUID key, out UGUIWithName uui)
        {
            uui = null;
            bool notFoundFirst = false;

            foreach (var service in m_ServiceList)
            {
                try
                {
                    if (service.TryGetValue(key, out uui))
                    {
                        uui = service[key];
                        if (!uui.IsAuthoritative)
                        {
                            notFoundFirst = true;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        notFoundFirst = true;
                    }
                }
                catch
                {
                    notFoundFirst = true;
                }
            }
            if (uui == null)
            {
                return(false);
            }
            if (notFoundFirst && uui.IsAuthoritative)
            {
                foreach (AvatarNameServiceInterface service in m_ServiceList)
                {
                    try
                    {
                        service.Store(uui);
                    }
                    catch
                    {
                        /* ignore errors here */
                    }
                }
            }
            return(true);
        }
示例#19
0
 public override void Store(UGUIWithName uui)
 {
     foreach (var service in m_ServiceList)
     {
         try
         {
             service.Store(uui);
         }
         catch
         {
             /* ignore errors here */
         }
     }
 }
示例#20
0
 public UserAccount(UserAccount src)
 {
     Principal      = new UGUIWithName(src.Principal);
     Email          = src.Email;
     Created        = src.Created;
     UserLevel      = src.UserLevel;
     UserFlags      = src.UserFlags;
     UserTitle      = src.UserTitle;
     ServiceURLs    = new Dictionary <string, string>(src.ServiceURLs);
     IsEverLoggedIn = src.IsEverLoggedIn;
     LastLogout     = new Date(src.LastLogout);
     LastRegion     = src.LastRegion?.Clone();
     HomeRegion     = src.HomeRegion?.Clone();
 }
示例#21
0
        private void LoadAppearanceFromNotecardJob(object o)
        {
            var          job   = (RebakeJob)o;
            UGUIWithName npcId = job.Agent.NamedOwner;

            try
            {
                job.Agent.LoadAppearanceFromNotecard(job.Notecard);
            }
            catch
            {
                m_Log.WarnFormat("Failed to load NPC appearance {0} {1} ({2})", npcId.FirstName, npcId.LastName, npcId.ID.ToString());
            }
        }
示例#22
0
 public NpcAgent(
     UGUIWithName npcID,
     AgentServiceList serviceList,
     UUID sceneID)
     : base(npcID.ID, npcID.HomeURI)
 {
     FirstName           = npcID.FirstName;
     LastName            = npcID.LastName;
     m_InventoryService  = serviceList.Get <InventoryServiceInterface>();
     m_ProfileService    = serviceList.Get <ProfileServiceInterface>();
     m_PresenceService   = serviceList.Get <IPresenceServiceInterface>();
     NpcPresenceService  = serviceList.Get <NpcPresenceServiceInterface>();
     m_UpdateInfo        = new AgentUpdateInfo(this, sceneID);
     OnAppearanceUpdate += HandleAppearanceUpdate;
 }
示例#23
0
        private void HandleGetNpc(HttpRequest req, Map jsondata)
        {
            if (!jsondata.ContainsKey("npcid"))
            {
                m_AdminWebIF.ErrorResponse(req, AdminWebIfErrorResult.InvalidRequest);
                return;
            }

            NpcAgent agent;

            if (!m_NpcAgents.TryGetValue(jsondata["npcid"].AsUUID, out agent))
            {
                m_AdminWebIF.ErrorResponse(req, AdminWebIfErrorResult.NotFound);
                return;
            }

            UGUIWithName uui   = agent.NamedOwner;
            var          npcid = new Map
            {
                { "firstname", uui.FirstName },
                { "lastname", uui.LastName },
                { "id", uui.ID }
            };

            uui = m_AdminWebIF.ResolveName(agent.NpcOwner);
            var npcowner = new Map
            {
                { "fullname", uui.FullName },
                { "firstname", uui.FirstName },
                { "lastname", uui.LastName },
                { "id", uui.ID }
            };

            if (uui.HomeURI != null)
            {
                npcowner.Add("homeuri", uui.HomeURI);
            }

            var npcdata = new Map
            {
                { "uui", npcid },
                { "owner", npcowner },
                { "persistent", (m_NpcPresenceService != null && m_NpcPresenceService[agent.Owner.ID].Count != 0) }
            };

            m_AdminWebIF.SuccessResponse(req, npcdata);
        }
        public void HandleLandStatRequest(Message m)
        {
            var req = (LandStatRequest)m;

            if (req.CircuitAgentID != req.AgentID ||
                req.CircuitSessionID != req.SessionID)
            {
                return;
            }

            AgentCircuit circuit;

            if (!Circuits.TryGetValue(req.CircuitSceneID, out circuit))
            {
                return;
            }

            SceneInterface scene = circuit.Scene;

            if (scene == null)
            {
                return;
            }

            UGUIWithName agentID = circuit.Agent.NamedOwner;

            if (!scene.IsRegionOwner(agentID) && !scene.IsEstateOwner(agentID) && !scene.IsEstateManager(agentID))
            {
                return;
            }

            switch (req.ReportType)
            {
            case LandStatReportEnum.TopScripts:
                ProcessTopScripts(circuit, scene, req.RequestFlags, req.Filter);
                break;

            case LandStatReportEnum.TopColliders:
                ProcessTopColliders(circuit, scene, req.RequestFlags, req.Filter);
                break;

            default:
                break;
            }
        }
示例#25
0
        public override void Store(UGUIWithName value)
        {
            if (value.IsAuthoritative) /* do not store non-authoritative entries */
            {
                var data = new Dictionary <string, object>
                {
                    ["AvatarID"]  = value.ID,
                    ["HomeURI"]   = value.HomeURI,
                    ["FirstName"] = value.FirstName,
                    ["LastName"]  = value.LastName
                };
                using (var connection = new SqlConnection(m_ConnectionString))
                {
                    connection.Open();

                    connection.ReplaceInto("avatarnames", data, new string[] { "AvatarID", "HomeURI" });
                }
            }
        }
        public void UserNameLookup(Message m)
        {
            var req = (UUIDNameRequest)m;
            var rep = new UUIDNameReply();

            foreach (var id in req.UUIDNameBlock)
            {
                IAgent agent;
                if (Scene.Agents.TryGetValue(id, out agent) && agent.IsNpc)
                {
                    UGUIWithName nd = agent.NamedOwner;
                    var          d  = new UUIDNameReply.Data
                    {
                        ID        = nd.ID,
                        FirstName = nd.FirstName,
                        LastName  = nd.LastName
                    };
                    rep.UUIDNameBlock.Add(d);
                }
                else
                {
                    try
                    {
                        UGUIWithName nd = Scene.AvatarNameService[id];
                        var          d  = new UUIDNameReply.Data
                        {
                            ID        = nd.ID,
                            FirstName = nd.FirstName,
                            LastName  = nd.LastName
                        };
                        rep.UUIDNameBlock.Add(d);
                    }
                    catch
                    {
                        /* TODO: eventually make up an AvatarName lookup based on ServiceURLs */
                    }
                }
            }
            if (rep.UUIDNameBlock.Count != 0)
            {
                SendMessage(rep);
            }
        }
示例#27
0
        private void AddAdditionalInventory(ObjectPart part, string sectionName)
        {
            IConfig config  = m_Loader.Config.Configs[sectionName];
            var     creator = new UGUIWithName(config.GetString("Creator", m_ObjectCreator.ToString()))
            {
                IsAuthoritative = true
            };
            var owner = new UGUIWithName(config.GetString("Owner", m_ObjectOwner.ToString()))
            {
                IsAuthoritative = true
            };
            var lastOwner = new UGUIWithName(config.GetString("LastOwner", m_ObjectLastOwner.ToString()))
            {
                IsAuthoritative = true
            };

            m_AvatarNameService.Store(creator);
            m_AvatarNameService.Store(owner);
            m_AvatarNameService.Store(lastOwner);
            var item = new ObjectPartInventoryItem(new UUID(config.GetString("ItemID", UUID.Random.ToString())))
            {
                Name              = config.GetString("Name"),
                Description       = config.GetString("Description", string.Empty),
                AssetID           = new UUID(config.GetString("AssetID", UUID.Random.ToString())),
                AssetTypeName     = config.GetString("AssetType"),
                Creator           = creator,
                Owner             = owner,
                LastOwner         = lastOwner,
                InventoryTypeName = config.GetString("InventoryType"),
                Flags             = (InventoryFlags)config.GetInt("Flags", 0),
                IsGroupOwned      = config.GetBoolean("IsGroupOwned", false)
            };

            item.Permissions.Base      = (InventoryPermissionsMask)config.GetInt("BasePermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.Current   = (InventoryPermissionsMask)config.GetInt("CurrentPermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.EveryOne  = (InventoryPermissionsMask)config.GetInt("EveryOnePermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.Group     = (InventoryPermissionsMask)config.GetInt("GroupPermissions", (int)InventoryPermissionsMask.Every);
            item.Permissions.NextOwner = (InventoryPermissionsMask)config.GetInt("NextOwnerPermissions", (int)InventoryPermissionsMask.Every);

            part.Inventory.Add(item);
        }
示例#28
0
 public override bool TryGetValue(UUID key, out UGUIWithName uui)
 {
     uui = null;
     using (var connection = new MySqlConnection(m_ConnectionString))
     {
         connection.Open();
         using (var cmd = new MySqlCommand("SELECT ID, FirstName, LastName FROM useraccounts WHERE ID = @id LIMIT 1", connection))
         {
             cmd.Parameters.AddParameter("@id", key);
             using (MySqlDataReader reader = cmd.ExecuteReader())
             {
                 if (reader.Read())
                 {
                     uui = GetUGUIWithNameFromReader(reader);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
示例#29
0
        private void ShowNpcsCommand(List <string> args, Main.Common.CmdIO.TTY io, UUID limitedToScene)
        {
            if (args[0] == "help")
            {
                io.Write("show npcs - Shows all NPCs in region");
                return;
            }
            UUID selectedScene = io.SelectedScene;

            if (limitedToScene != UUID.Zero)
            {
                selectedScene = limitedToScene;
            }

            SceneInterface scene;

            if (!m_KnownScenes.TryGetValue(selectedScene, out scene))
            {
                io.Write("No region selected");
            }
            else
            {
                var sb = new StringBuilder("NPCs:\n----------------------------------------------\n");
                foreach (NpcAgent agent in m_NpcAgents.Values)
                {
                    if (agent.CurrentScene != scene)
                    {
                        continue;
                    }
                    UGUIWithName npcOwner = m_AdminWebIF.ResolveName(agent.NpcOwner);
                    sb.AppendFormat("Npc {0} {1} ({2})\n- Owner: {3}\n", agent.NamedOwner.FirstName, agent.NamedOwner.LastName, agent.NamedOwner.ID.ToString(), npcOwner.FullName);
                    if (m_NpcPresenceService != null && m_NpcPresenceService[agent.Owner.ID].Count != 0)
                    {
                        sb.AppendFormat("- Persistent NPC\n");
                    }
                }
                io.Write(sb.ToString());
            }
        }
示例#30
0
        public override bool TryGetValue(UUID key, out UGUIWithName uui)
        {
            using (var connection = new SqlConnection(m_ConnectionString))
            {
                connection.Open();

                using (var cmd = new SqlCommand("SELECT TOP(1) * FROM avatarnames WHERE AvatarID = @avatarid", connection))
                {
                    cmd.Parameters.AddParameter("@avatarid", key);
                    using (SqlDataReader dbreader = cmd.ExecuteReader())
                    {
                        if (!dbreader.Read())
                        {
                            uui = default(UGUIWithName);
                            return(false);
                        }
                        uui = ToUUI(dbreader);
                        return(true);
                    }
                }
            }
        }