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


C# UserAgentServiceConnector.GetUserInfo方法代碼示例

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


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

示例1: GetUserProfileData

        //
        // Get the UserAccountBits
        //
        private bool GetUserProfileData(UUID userID, out Dictionary<string, object> userInfo)
        {
            IUserManagement uManage = UserManagementModule;
            Dictionary<string,object> info = new Dictionary<string, object>();


            if (!uManage.IsLocalGridUser(userID))
            {
                // Is Foreign
                string home_url = uManage.GetUserServerURL(userID, "HomeURI");

                if (String.IsNullOrEmpty(home_url))
                {
                    info["user_flags"] = 0;
                    info["user_created"] = 0;
                    info["user_title"] = "Unavailable";

                    userInfo = info;
                    return true;
                }

                UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url);

                Dictionary<string, object> account = uConn.GetUserInfo(userID);

                if (account.Count > 0)
                {
                    if (account.ContainsKey("user_flags"))
                        info["user_flags"] = account["user_flags"];
                    else
                        info["user_flags"] = "";

                    if (account.ContainsKey("user_created"))
                        info["user_created"] = account["user_created"];
                    else
                        info["user_created"] = "";

                    info["user_title"] = "HG Visitor";
                }
                else
                {
                   info["user_flags"] = 0;
                   info["user_created"] = 0;
                   info["user_title"] = "HG Visitor";
                }
                userInfo = info;
                return true;
            }
            else
            {
                // Is local
                Scene scene = m_Scenes[0];
                IUserAccountService uas = scene.UserAccountService;
                UserAccount account = uas.GetUserAccount(scene.RegionInfo.ScopeID, userID);

                info["user_flags"] = account.UserFlags;
                info["user_created"] = account.Created;

                if (!String.IsNullOrEmpty(account.UserTitle))
                    info["user_title"] = account.UserTitle;
                else
                    info["user_title"] = "";

                userInfo = info;

                return false;
            }
        }
開發者ID:OS-Development,項目名稱:OpenSim.Profile,代碼行數:71,代碼來源:OpenProfile.cs

示例2: GetUserAccountData

        /// <summary>
        /// Gets the user account data.
        /// </summary>
        /// <returns>
        /// The user profile data.
        /// </returns>
        /// <param name='userID'>
        /// If set to <c>true</c> user I.
        /// </param>
        /// <param name='userInfo'>
        /// If set to <c>true</c> user info.
        /// </param>
        bool GetUserAccountData(UUID userID, out Dictionary<string, object> userInfo)
        {
            Dictionary<string,object> info = new Dictionary<string, object>();

            if (UserManagementModule.IsLocalGridUser(userID))
            {
                // Is local
                IUserAccountService uas = Scene.UserAccountService;
                UserAccount account = uas.GetUserAccount(Scene.RegionInfo.ScopeID, userID);

                info["user_flags"] = account.UserFlags;
                info["user_created"] = account.Created;

                if (!String.IsNullOrEmpty(account.UserTitle))
                    info["user_title"] = account.UserTitle;
                else
                    info["user_title"] = "";

                userInfo = info;

                return false;
            }
            else
            {
                // Is Foreign
                string home_url = UserManagementModule.GetUserServerURL(userID, "HomeURI");

                if (String.IsNullOrEmpty(home_url))
                {
                    info["user_flags"] = 0;
                    info["user_created"] = 0;
                    info["user_title"] = "Unavailable";

                    userInfo = info;
                    return true;
                }

                UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url);

                Dictionary<string, object> account;
                try
                {
                    account = uConn.GetUserInfo(userID);
                }
                catch (Exception e)
                {
                    m_log.Debug("[PROFILES]: GetUserInfo call failed ", e);
                    account = new Dictionary<string, object>();
                }

                if (account.Count > 0)
                {
                    if (account.ContainsKey("user_flags"))
                        info["user_flags"] = account["user_flags"];
                    else
                        info["user_flags"] = "";

                    if (account.ContainsKey("user_created"))
                        info["user_created"] = account["user_created"];
                    else
                        info["user_created"] = "";

                    info["user_title"] = "HG Visitor";
                }
                else
                {
                   info["user_flags"] = 0;
                   info["user_created"] = 0;
                   info["user_title"] = "HG Visitor";
                }
                userInfo = info;
                return true;
            }
        }
開發者ID:RutgersUniversityVirtualWorlds,項目名稱:opensim,代碼行數:86,代碼來源:UserProfileModule.cs

示例3: GetUserInfo

        // This will cache the user data
        // Change this to return bool
        private bool GetUserInfo(UUID userID)
        {
            UserData userdata;
            lock (m_UserCache)
                m_UserCache.TryGetValue(userID, out userdata);

            if (userdata != null)
            {
//                m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID);

                if (userdata.Flags >= 0)
                {
                    // This is already populated
                    return true;
                }

                if (userdata.HomeURL != null && userdata.HomeURL != string.Empty)
                {
                    m_log.DebugFormat(
                        "[USER MANAGEMENT MODULE]: Requesting user flags from '{0}' for {1}",
                        userdata.HomeURL, userID);

                    UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL);
                    Dictionary<string, object> info = uConn.GetUserInfo(userID);

                    // Pull our data now
                    if (info["result"].ToString() == "success")
                    {
                        userdata.Flags = (int)info["user_flags"];
                        userdata.Created = (int)info["user_created"];
                        userdata.Title = (string)info["user_title"];

                        return true;
                    }
                }
            }

            return false;
        }
開發者ID:4U2NV,項目名稱:opensim,代碼行數:41,代碼來源:UserManagementModule.cs


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