當前位置: 首頁>>代碼示例>>C#>>正文


C# UserAgentServiceConnector.GetUUID方法代碼示例

本文整理匯總了C#中OpenSim.Services.Connectors.Hypergrid.UserAgentServiceConnector.GetUUID方法的典型用法代碼示例。如果您正苦於以下問題:C# UserAgentServiceConnector.GetUUID方法的具體用法?C# UserAgentServiceConnector.GetUUID怎麽用?C# UserAgentServiceConnector.GetUUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenSim.Services.Connectors.Hypergrid.UserAgentServiceConnector的用法示例。


在下文中一共展示了UserAgentServiceConnector.GetUUID方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: osAvatarName2Key

        public string osAvatarName2Key(string firstname, string lastname)
        {
            CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
            m_host.AddScriptLPS(1);

            if (lastname.Contains("@"))
            {
                String realFirstName; String realLastName; String serverURI;

                realFirstName = firstname.Split('.')[0];
                realLastName = firstname.Split('.')[1];
                serverURI = new Uri("http://" + lastname.Replace("@", "")).ToString();

                try
                {
                    UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);

                    if (userConnection != null)
                    {
                        UUID ruserid = userConnection.GetUUID(realFirstName, realLastName);

                        if (ruserid != null)
                        {
                            IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();

                            if (userManager != null)
                            {
                                //Use the HomeURI from the script to get user infos and then ask the remote gridserver for the real HomeURI.
                                userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
                                serverURI = userManager.GetUserServerURL(ruserid, "HomeURI");
                                userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);

                                return ruserid.ToString();
                            }
                        }
                    }
                }
                catch (Exception osAvatarException)
                {
                    //m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid\n" + osAvatarException.Message);
                }
            }
            else
            {
                UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
                if (account != null) return account.PrincipalID.ToString();
            }

            return UUID.Zero.ToString();
        }
開發者ID:CaseyraeStarfinder,項目名稱:opensim,代碼行數:50,代碼來源:OSSL_Api.cs

示例2: osAvatarName2Key

        public string osAvatarName2Key(string firstname, string lastname)
        {
            CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
            m_host.AddScriptLPS(1);

            IUserManagement userManager = World.RequestModuleInterface<IUserManagement>();
            if (userManager == null)
            {
                OSSLShoutError("osAvatarName2Key: UserManagement module not available");
                return string.Empty;
            }

            // Check if the user is already cached

            UUID userID = userManager.GetUserIdByName(firstname, lastname);
            if (userID != UUID.Zero)
                return userID.ToString();

            // Query for the user

            String realFirstName; String realLastName; String serverURI;
            if (Util.ParseForeignAvatarName(firstname, lastname, out realFirstName, out realLastName, out serverURI))
            {
                try
                {
                    UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);

                    if (userConnection != null)
                    {
                        userID = userConnection.GetUUID(realFirstName, realLastName);
                        if (userID != UUID.Zero)
                        {
                            userManager.AddUser(userID, realFirstName, realLastName, serverURI);
                            return userID.ToString();
                        }
                    }
                }
                catch (Exception /*e*/)
                {
                    // m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid ", e);
                }
            }
            else
            {
                UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
                if (account != null)
                    return account.PrincipalID.ToString();
            }

            return UUID.Zero.ToString();
        }
開發者ID:nebadon2025,項目名稱:opensimulator,代碼行數:51,代碼來源:OSSL_Api.cs

示例3: AddAdditionalUsers

        protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
        {
            if (query.Contains("@"))  // [email protected], maybe?
            {
                string[] words = query.Split(new char[] { '@' });
                if (words.Length != 2)
                {
                    m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query);
                    return;
                }

                words[0] = words[0].Trim(); // it has at least 1
                words[1] = words[1].Trim();

                if (words[0] == String.Empty) // query was @foo.com?
                {
                    foreach (UserData d in m_UserCache.Values)
                    {
                        if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
                            users.Add(d);
                    }

                    // We're done
                    return;
                }

                // words.Length == 2 and words[0] != string.empty
                // [email protected] ?
                foreach (UserData d in m_UserCache.Values)
                {
                    if (d.LastName.StartsWith("@") &&
                        d.FirstName.ToLower().Equals(words[0].ToLower()) &&
                        d.LastName.ToLower().Equals("@" + words[1].ToLower()))
                    {
                        users.Add(d);
                        // It's cached. We're done
                        return;
                    }
                }

                // This is it! Let's ask the other world
                if (words[0].Contains(".")) 
                {
                    string[] names = words[0].Split(new char[] { '.' });
                    if (names.Length >= 2)
                    {

                        string uriStr = "http://" + words[1];
                        // Let's check that the last name is a valid address
                        try
                        {
                            new Uri(uriStr);
                        }
                        catch (UriFormatException)
                        {
                            m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
                            return;
                        }

                        UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
                        UUID userID = uasConn.GetUUID(names[0], names[1]);
                        if (!userID.Equals(UUID.Zero))
                        {
                            UserData ud = new UserData();
                            ud.Id = userID;
                            ud.FirstName = words[0];
                            ud.LastName = "@" + words[1];
                            users.Add(ud);
                            AddUser(userID, names[0], names[1], uriStr);
                            m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
                        }
                        else
                            m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
                    }
                }
            }
            //else
            //{
            //    foreach (UserData d in m_UserCache.Values)
            //    {
            //        if (d.LastName.StartsWith("@") && 
            //            (d.FirstName.ToLower().StartsWith(query.ToLower()) || 
            //             d.LastName.ToLower().StartsWith(query.ToLower())))
            //            users.Add(d);
            //    }
            //}
        }
開發者ID:JAllard,項目名稱:opensim,代碼行數:87,代碼來源:HGUserManagementModule.cs


注:本文中的OpenSim.Services.Connectors.Hypergrid.UserAgentServiceConnector.GetUUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。