当前位置: 首页>>代码示例>>C#>>正文


C# WebInterface.UserFlagToType方法代码示例

本文整理汇总了C#中Universe.Modules.Web.WebInterface.UserFlagToType方法的典型用法代码示例。如果您正苦于以下问题:C# WebInterface.UserFlagToType方法的具体用法?C# WebInterface.UserFlagToType怎么用?C# WebInterface.UserFlagToType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Universe.Modules.Web.WebInterface的用法示例。


在下文中一共展示了WebInterface.UserFlagToType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Fill


//.........这里部分代码省略.........
                        /*if (activationRequired)
                        {
                            UUID activationToken = UUID.Random();
                            agent.OtherAgentInformation["WebUIActivationToken"] = Util.Md5Hash(activationToken.ToString() + ":" + PasswordHash);
                            resp["WebUIActivationToken"] = activationToken;
                        }*/
                        con.UpdateAgent (agent);

                        // create user profile details
                        IProfileConnector profileData =
                            Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> ();
                        if (profileData != null)
                        {
                            IUserProfileInfo profile = profileData.GetUserProfile (userID);
                            if (profile == null)
                            {
                                profileData.CreateNewProfile (userID);
                                profile = profileData.GetUserProfile (userID);
                            }

                            if (AvatarArchive != "")
                            {
                                profile.AArchiveName = AvatarArchive;

                                List<AvatarArchive> avarchives = webInterface.Registry.RequestModuleInterface<IAvatarAppearanceArchiver>().GetAvatarArchives();
                                UUID snapshotUUID = UUID.Zero;
                                foreach (var archive in avarchives)
                                    if (archive.FolderName == AvatarArchive)
                                        snapshotUUID = archive.Snapshot;

                                if (snapshotUUID != UUID.Zero)
                                    profile.Image = snapshotUUID;
                            }
                            profile.MembershipGroup = webInterface.UserFlagToType (UserFlags, webInterface.EnglishTranslator);    // membership is english
                            profile.IsNewUser = true;
                            profileData.UpdateUserProfile (profile);
                        }

                        IAgentInfoService agentInfoService = webInterface.Registry.RequestModuleInterface<IAgentInfoService> ();
                        Vector3 position = new Vector3 (128, 128, 25);
                        Vector3 lookAt = new Vector3 (0, 0, 22);

                        if (agentInfoService != null)
                            agentInfoService.SetHomePosition (userID.ToString (), (UUID) UserHomeRegion, position, lookAt);

                        vars.Add ("ErrorMessage", "Successfully created account, redirecting to main page");
                        response = "<h3>Successfully created account, redirecting to main page</h3>" +
                        "<script language=\"javascript\">" +
                        "setTimeout(function() {window.location.href = \"index.html\";}, 3000);" +
                        "</script>";
                    } else
                    {
                        vars.Add ("ErrorMessage", "<h3>" + error + "</h3>");
                        response = "<h3>" + error + "</h3>";
                    }
                }
                else
                    response = "<h3>You did not accept the Terms of Service agreement.</h3>";
                return null;
            }

            List<Dictionary<string, object>> daysArgs = new List<Dictionary<string, object>>();
            for (int i = 1; i <= 31; i++)
                daysArgs.Add(new Dictionary<string, object> {{"Value", i}});

            List<Dictionary<string, object>> monthsArgs = new List<Dictionary<string, object>>();
开发者ID:VirtualReality,项目名称:Universe,代码行数:67,代码来源:register.cs

示例2: Fill

        public Dictionary<string, object> Fill (WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                               OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
                                               ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary<string, object> ();

            string error = "";
            UUID userID = httpRequest.Query.ContainsKey ("userid")
                            ? UUID.Parse (httpRequest.Query ["userid"].ToString ())
                            : UUID.Parse (requestParameters ["userid"].ToString ());

            IUserAccountService userService = webInterface.Registry.RequestModuleInterface<IUserAccountService> ();
            UserAccount account = null;

            if (userService != null)
                account = userService.GetUserAccount (null, userID);

            var agentService = Framework.Utilities.DataManager.RequestPlugin<IAgentConnector> ();
            IAgentInfo agent = agentService.GetAgent (userID);

            if (agent == null)
                error = "No agent information is available";

            // Set user type
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitSetUserType") {

                string UserType = requestParameters ["UserType"].ToString ();
                int UserFlags = webInterface.UserTypeToUserFlags (UserType);

                // set the user account type
                if (account != null) {
                    account.UserFlags = UserFlags;
                    userService.StoreUserAccount (account);
                } else {
                    response = "User account not found - Unable to update!'";
                    return null;
                }

                if (agent != null) {
                    agent.OtherAgentInformation ["UserFlags"] = UserFlags;
                    agentService.UpdateAgent (agent);
                } else {
                    response = "Agent information is not available! Has the user logged in yet?";
                    return null;
                }

                IProfileConnector profileData =
                    Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> ();
                if (profileData != null) {
                    IUserProfileInfo profile = profileData.GetUserProfile (userID);
                    if (profile == null) {
                        profileData.CreateNewProfile (userID);
                        profile = profileData.GetUserProfile (userID);
                    }

                    profile.MembershipGroup = webInterface.UserFlagToType (UserFlags, webInterface.EnglishTranslator);    // membership is english
                    profileData.UpdateUserProfile (profile);
                }

                response = "User account has been updated.";
                return null;
            }

            // Password change
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitPasswordChange") {
                string password = requestParameters ["password"].ToString ();
                string passwordconf = requestParameters ["passwordconf"].ToString ();

                if (password != passwordconf)
                    response = "Passwords do not match";
                else {
                    IAuthenticationService authService =
                        webInterface.Registry.RequestModuleInterface<IAuthenticationService> ();
                    if (authService != null)
                        response = authService.SetPassword (userID, "UserAccount", password)
                                       ? "Successfully set password"
                                       : "Failed to set your password, try again later";
                    else
                        response = "No authentication service was available to change the account passwor!";
                }
                return null;
            }

            // Email change
            if (requestParameters.ContainsKey ("Submit") &&
                     requestParameters ["Submit"].ToString () == "SubmitEmailChange") {
                string email = requestParameters ["email"].ToString ();

                if (account != null) {
                    account.Email = email;
                    userService.StoreUserAccount (account);
                    response = "Successfully updated email";
                } else
                    response = "No authentication service was available to change the email details!";
                return null;
            }

//.........这里部分代码省略.........
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:101,代码来源:edit_user.cs


注:本文中的Universe.Modules.Web.WebInterface.UserFlagToType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。