当前位置: 首页>>代码示例>>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;未经允许,请勿转载。