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


C# WebInterface.Redirect方法代码示例

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


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

示例1: 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 username = filename.Split('/').LastOrDefault();
            UserAccount account = null;
            if (httpRequest.Query.ContainsKey("userid"))
            {
                string userid = httpRequest.Query["userid"].ToString();

                account = webInterface.Registry.RequestModuleInterface<IUserAccountService>().
                                       GetUserAccount(null, UUID.Parse(userid));
            }
            else if (httpRequest.Query.ContainsKey("name"))
            {
                string name = httpRequest.Query.ContainsKey("name") ? httpRequest.Query["name"].ToString() : username;
                name = name.Replace('.', ' ');
                name = name.Replace("%20", " ");
                account = webInterface.Registry.RequestModuleInterface<IUserAccountService>().
                                       GetUserAccount(null, name);
            }
            else
            {
                username = username.Replace("%20", " ");
                webInterface.Redirect(httpResponse, "/webprofile/?name=" + username);
                return vars;
            }

            if (account == null)
                return vars;

			/* Allow access to the system user info - needed for Estate owner Profiles of regions
            if ( Utilities.IsSystemUser(account.PrincipalID) )
				return vars;
            */

            vars.Add("UserName", account.Name);
            //  TODO: User Profile inworld shows this as the standard mm/dd/yyyy
            //  Do we want this to be localised into the users Localisation or keep it as standard ?
            //
            //  vars.Add("UserBorn", Culture.LocaleDate(Util.ToDateTime(account.Created)));
            vars.Add("UserBorn", Util.ToDateTime(account.Created).ToShortDateString());

            IUserProfileInfo profile = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector>().
                                              GetUserProfile(account.PrincipalID);
            string picUrl = "../images/icons/no_avatar.jpg";
            if (profile != null)
            {
                vars.Add ("UserType", profile.MembershipGroup == "" ? "Resident" : profile.MembershipGroup);

                if (profile.Partner != UUID.Zero)
                {
                    account = webInterface.Registry.RequestModuleInterface<IUserAccountService> ().
                                           GetUserAccount (null, profile.Partner);
                    vars.Add ("UserPartner", account.Name);
                } else
                    vars.Add ("UserPartner", "No partner");
                vars.Add ("UserAboutMe", profile.AboutText == "" ? "Nothing here" : profile.AboutText);
                IWebHttpTextureService webhttpService =
                    webInterface.Registry.RequestModuleInterface<IWebHttpTextureService> ();
                if (webhttpService != null && profile.Image != UUID.Zero)
                    picUrl = webhttpService.GetTextureURL (profile.Image);
            } else
            {
                // no profile yet
                vars.Add ("UserType", "Guest");
                vars.Add ("UserPartner", "Not specified yet");
                vars.Add ("UserAboutMe", "Nothing here yet");
            }
            vars.Add ("UserPictureURL", picUrl);

            // TODO:  This is only showing online status if you are logged in ??
            UserAccount ourAccount = Authenticator.GetAuthentication(httpRequest);
            if (ourAccount != null)
            {
                IFriendsService friendsService = webInterface.Registry.RequestModuleInterface<IFriendsService>();
                var friends = friendsService.GetFriends(account.PrincipalID);
                UUID friendID = UUID.Zero;
                if (friends.Any(f => UUID.TryParse(f.Friend, out friendID) && friendID == ourAccount.PrincipalID))
                {
                    IAgentInfoService agentInfoService =
                        webInterface.Registry.RequestModuleInterface<IAgentInfoService>();
                    IGridService gridService = webInterface.Registry.RequestModuleInterface<IGridService>();
                    UserInfo ourInfo = agentInfoService.GetUserInfo(account.PrincipalID.ToString());
                    if (ourInfo != null && ourInfo.IsOnline)
                        vars.Add("OnlineLocation", gridService.GetRegionByUUID(null, ourInfo.CurrentRegionID).RegionName);
                    vars.Add("UserIsOnline", ourInfo != null && ourInfo.IsOnline);
                    vars.Add("IsOnline",
                             ourInfo != null && ourInfo.IsOnline
                                 ? translator.GetTranslatedString("Online")
                                 : translator.GetTranslatedString("Offline"));
                }
                else
                {
                    vars.Add("OnlineLocation", "");
                    vars.Add("UserIsOnline", false);
                    vars.Add("IsOnline", translator.GetTranslatedString("Offline"));
//.........这里部分代码省略.........
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:101,代码来源:index.cs

示例2: Fill


//.........这里部分代码省略.........
            // Ban user
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitBanUser") {
                if (agent != null) {
                    agent.Flags |= IAgentFlags.PermBan;
                    agentService.UpdateAgent (agent);
                    response = "User has been banned.";
                } else
                    response = "Agent information is not available! Has the user logged in yet?";

                return null;
            }

            //UnBan user
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitUnbanUser") {

                if (agent != null) {
                    agent.Flags &= ~IAgentFlags.TempBan;
                    agent.Flags &= ~IAgentFlags.PermBan;
                    agent.OtherAgentInformation.Remove ("Temporary BanInfo");
                    agentService.UpdateAgent (agent);
                    response = "User has been unbanned.";
                } else
                    response = "Agent information is not available! Has the user logged in yet?";

                return null;
            }

            // Login as user
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitLoginAsUser") {
                Authenticator.ChangeAuthentication (httpRequest, account);
                webInterface.Redirect (httpResponse, "/");
                return vars;
            }

            // Kick user
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitKickUser") {
                string message = requestParameters ["KickMessage"].ToString ();
                if (account != null) {
                    IGridWideMessageModule messageModule =
                        webInterface.Registry.RequestModuleInterface<IGridWideMessageModule> ();
                    if (messageModule != null)
                        messageModule.KickUser (account.PrincipalID, message);
                    response = "User has been kicked.";
                } else
                    response = "Unable to determine user to  kick!";
                return null;
            }

            // Message user
            if (requestParameters.ContainsKey ("Submit") &&
                requestParameters ["Submit"].ToString () == "SubmitMessageUser") {
                string message = requestParameters ["Message"].ToString ();
                if (account != null) {
                    IGridWideMessageModule messageModule =
                        webInterface.Registry.RequestModuleInterface<IGridWideMessageModule> ();
                    if (messageModule != null) {
                        messageModule.MessageUser (account.PrincipalID, message);
                        response = "User has been sent the message.";
                    }
                } else 
                    response = "User account details are unavailable to send the message!";
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:66,代码来源:edit_user.cs


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