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


C# OSHttpRequest类代码示例

本文整理汇总了C#中OSHttpRequest的典型用法代码示例。如果您正苦于以下问题:C# OSHttpRequest类的具体用法?C# OSHttpRequest怎么用?C# OSHttpRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OSHttpRequest类属于命名空间,在下文中一共展示了OSHttpRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>();

            // Style Switcher
            vars.Add("styles1", translator.GetTranslatedString("styles1"));
            vars.Add("styles2", translator.GetTranslatedString("styles2"));
            vars.Add("styles3", translator.GetTranslatedString("styles3"));
            vars.Add("styles4", translator.GetTranslatedString("styles4"));
            vars.Add("styles5", translator.GetTranslatedString("styles5"));

            vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
            vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
            vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));

            // Language Switcher
            vars.Add("en", translator.GetTranslatedString("en"));
            vars.Add("fr", translator.GetTranslatedString("fr"));
            vars.Add("de", translator.GetTranslatedString("de"));
            vars.Add("it", translator.GetTranslatedString("it"));
            vars.Add("es", translator.GetTranslatedString("es"));

            return vars;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:27,代码来源:index.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>();
            var usersList = new List<Dictionary<string, object>>();

            uint amountPerQuery = 10;
            int start = httpRequest.Query.ContainsKey("Start") ? int.Parse(httpRequest.Query["Start"].ToString()) : 0;
            uint count = Framework.Utilities.DataManager.RequestPlugin<IAgentInfoConnector>().RecentlyOnline(5*60, true);
            int maxPages = (int) (count/amountPerQuery) - 1;

            if (start == -1)
                start = (int) (maxPages < 0 ? 0 : maxPages);

            vars.Add("CurrentPage", start);
            vars.Add("NextOne", start + 1 > maxPages ? start : start + 1);
            vars.Add("BackOne", start - 1 < 0 ? 0 : start - 1);

            var users = Framework.Utilities.DataManager.RequestPlugin<IAgentInfoConnector>()
                                   .RecentlyOnline(5*60, true, new Dictionary<string, bool>(), (uint) start,
                                                   amountPerQuery);
            IUserAccountService accountService = webInterface.Registry.RequestModuleInterface<IUserAccountService>();
            IGridService gridService = webInterface.Registry.RequestModuleInterface<IGridService>();
            foreach (var user in users)
            {
                var region = gridService.GetRegionByUUID(null, user.CurrentRegionID);
                var account = accountService.GetUserAccount(region.AllScopeIDs, UUID.Parse(user.UserID));
                if (account != null && region != null)
                    usersList.Add(new Dictionary<string, object>
                                      {
                                          {"UserName", account.Name},
                                          {"UserRegion", region.RegionName},
                                          {"UserID", user.UserID},
                                          {"UserRegionID", region.RegionID}
                                      });
            }
            if (requestParameters.ContainsKey("Order"))
            {
                if (requestParameters["Order"].ToString() == "RegionName")
                    usersList.Sort((a, b) => a["UserRegion"].ToString().CompareTo(b["UserRegion"].ToString()));
                if (requestParameters["Order"].ToString() == "UserName")
                    usersList.Sort((a, b) => a["UserName"].ToString().CompareTo(b["UserName"].ToString()));
            }

            vars.Add("UsersOnlineList", usersList);
            vars.Add("OnlineUsersText", translator.GetTranslatedString("OnlineUsersText"));
            vars.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
            vars.Add("RegionNameText", translator.GetTranslatedString("RegionNameText"));
            vars.Add("MoreInfoText", translator.GetTranslatedString("MoreInfoText"));

            vars.Add("FirstText", translator.GetTranslatedString("FirstText"));
            vars.Add("BackText", translator.GetTranslatedString("BackText"));
            vars.Add("NextText", translator.GetTranslatedString("NextText"));
            vars.Add("LastText", translator.GetTranslatedString("LastText"));
            vars.Add("CurrentPageText", translator.GetTranslatedString("CurrentPageText"));

            return vars;
        }
开发者ID:emperorstarfinder,项目名称:My-Aurora-Sim,代码行数:60,代码来源:online_users.cs

示例3: 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>();
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
                GridNewsItem item = new GridNewsItem {Text = text, Time = DateTime.Now, Title = title};
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                response = "<h3>News item added successfully, redirecting to main page</h3>" +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                           "</script>";
                return null;
            }

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return vars;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:28,代码来源:add_news.cs

示例4: 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>();

            if (requestParameters.ContainsKey("ResetMenu"))
            {
                PagesMigrator.ResetToDefaults();
                response = translator.GetTranslatedString("ChangesSavedSuccessfully");
                return null;
            }
            if (requestParameters.ContainsKey("ResetSettings"))
            {
                SettingsMigrator.ResetToDefaults();
                response = translator.GetTranslatedString("ChangesSavedSuccessfully");
                return null;
            }

            vars.Add("FactoryReset", translator.GetTranslatedString("FactoryReset"));
            vars.Add("ResetMenuText", translator.GetTranslatedString("ResetMenuText"));
            vars.Add("ResetSettingsText", translator.GetTranslatedString("ResetSettingsText"));
            vars.Add("ResetMenuInfoText", translator.GetTranslatedString("ResetMenuText"));
            vars.Add("ResetSettingsInfoText", translator.GetTranslatedString("ResetSettingsInfoText"));
            vars.Add("Reset", translator.GetTranslatedString("Reset"));

            return vars;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:29,代码来源:factory_reset.cs

示例5: 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>();
     IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
     if (httpRequest.Query.Contains("delete"))
     {
         string newsID = httpRequest.Query["delete"].ToString();
         connector.RemoveGeneric(UUID.Zero, "WebGridNews", newsID);
         vars["Success"] = "Successfully deleted the news item";
     }
     else
         vars["Success"] = "";
     var newsItems = connector.GetGenerics<GridNewsItem>(UUID.Zero, "WebGridNews");
     vars.Add("News", newsItems.ConvertAll<Dictionary<string, object>>(item => item.ToDictionary()));
     vars.Add("NewsManager", translator.GetTranslatedString("NewsManager"));
     vars.Add("EditNewsItem", translator.GetTranslatedString("EditNewsItem"));
     vars.Add("AddNewsItem", translator.GetTranslatedString("AddNewsItem"));
     vars.Add("DeleteNewsItem", translator.GetTranslatedString("DeleteNewsItem"));
     vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText"));
     vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText"));
     vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
     vars.Add("DeleteNewsText", translator.GetTranslatedString("DeleteNewsText"));
     return vars;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:27,代码来源:news_manager.cs

示例6: GroupMemberData

        public byte[] GroupMemberData(string path, Stream request, OSHttpRequest httpRequest,
                                      OSHttpResponse httpResponse)
        {
            try
            {
                //MainConsole.Instance.Debug("[CAPS]: UploadBakedTexture Request in region: " +
                //        m_regionName);

                OSDMap rm = (OSDMap) OSDParser.DeserializeLLSDXml(request);
                UUID groupID = rm["group_id"].AsUUID();

                OSDMap defaults = new OSDMap();
                ulong EveryonePowers = (ulong) (GroupPowers.AllowSetHome |
                                                GroupPowers.Accountable |
                                                GroupPowers.JoinChat |
                                                GroupPowers.AllowVoiceChat |
                                                GroupPowers.ReceiveNotices |
                                                GroupPowers.StartProposal |
                                                GroupPowers.VoteOnProposal);
                defaults["default_powers"] = EveryonePowers;

                List<string> titles = new List<string>();
                OSDMap members = new OSDMap();
                int count = 0;
                foreach (GroupMembersData gmd in m_groupService.GetGroupMembers(m_service.AgentID, groupID))
                {
                    OSDMap member = new OSDMap();
                    member["donated_square_meters"] = gmd.Contribution;
                    member["owner"] = (gmd.IsOwner ? "Y" : "N");
                    member["last_login"] = gmd.OnlineStatus;
                    if (titles.Contains(gmd.Title))
                    {
                        member["title"] = titles.FindIndex((s) => s == gmd.Title);
                    }
                    else
                    {
                        titles.Add(gmd.Title);
                        member["title"] = titles.Count-1;
                    }
                    member["powers"] = gmd.AgentPowers;
                    count++;
                    members[gmd.AgentID.ToString()] = member;
                }

                OSDMap map = new OSDMap();
                map["member_count"] = count;
                map["group_id"] = groupID;
                map["defaults"] = defaults;
                map["titles"] = titles.ToOSDArray();
                map["members"] = members;
                return OSDParser.SerializeLLSDXmlBytes(map);
            }
            catch (Exception e)
            {
                MainConsole.Instance.Error("[CAPS]: " + e);
            }

            return null;
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:59,代码来源:GroupCAPS.cs

示例7: 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>();
     vars.Add("ForgotPassword", translator.GetTranslatedString("ForgotPassword"));
     return vars;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:9,代码来源:forgot_pass.cs

示例8: 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>();
            IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
            var settings = connector.GetGeneric<GridSettings>(UUID.Zero, "WebSettings", "Settings");

            if (requestParameters.ContainsKey("Submit"))
            {
                settings.MapCenter.X = int.Parse(requestParameters["GridCenterX"].ToString());
                settings.MapCenter.Y = int.Parse(requestParameters["GridCenterY"].ToString());
                settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1";
                settings.HideStyleBar = requestParameters["HideStyleBar"].ToString() == "1";
                connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());

                response = "Successfully updated settings.";

                return null;
            }
            else if (requestParameters.ContainsKey("IgnorePagesUpdates"))
            {
                settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());
            }
            else if (requestParameters.ContainsKey("IgnoreSettingsUpdates"))
            {
                settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                connector.AddGeneric(UUID.Zero, "WebSettings", "Settings", settings.ToOSD());
            }
            vars.Add("GridCenterX", settings.MapCenter.X);
            vars.Add("GridCenterY", settings.MapCenter.Y);
            vars.Add("HideLanguageBarNo", !settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideLanguageBarYes", settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarNo", !settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarYes", settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("IgnorePagesUpdates",
                     PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored)
                         ? ""
                         : "checked");
            vars.Add("IgnoreSettingsUpdates",
                     settings.LastSettingsVersionUpdateIgnored != SettingsMigrator.CurrentVersion ? "" : "checked");

            vars.Add("SettingsManager", translator.GetTranslatedString("SettingsManager"));
            vars.Add("IgnorePagesUpdatesText", translator.GetTranslatedString("IgnorePagesUpdatesText"));
            vars.Add("IgnoreSettingsUpdatesText", translator.GetTranslatedString("IgnoreSettingsUpdatesText"));
            vars.Add("GridCenterXText", translator.GetTranslatedString("GridCenterXText"));
            vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText"));
            vars.Add("HideLanguageBarText", translator.GetTranslatedString("HideLanguageBarText"));
            vars.Add("HideStyleBarText", translator.GetTranslatedString("HideStyleBarText"));
            vars.Add("Save", translator.GetTranslatedString("Save"));
            vars.Add("No", translator.GetTranslatedString("No"));
            vars.Add("Yes", translator.GetTranslatedString("Yes"));

            return vars;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:57,代码来源:settings_manager.cs

示例9: CheckAuthentication

 public static bool CheckAuthentication(OSHttpRequest request)
 {
     if (request.Cookies["SessionID"] != null)
     {
         if (_authenticatedUsers.ContainsKey(UUID.Parse(request.Cookies["SessionID"].Value)))
             return true;
     }
     return false;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:9,代码来源:Authenticator.cs

示例10: GetAuthentication

 public static UserAccount GetAuthentication(OSHttpRequest request)
 {
     if (request.Cookies["SessionID"] != null)
     {
         UUID sessionID = UUID.Parse(request.Cookies["SessionID"].Value);
         if (_authenticatedUsers.ContainsKey(sessionID))
             return _authenticatedUsers[sessionID];
     }
     return null;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:10,代码来源:Authenticator.cs

示例11: ChangeAuthentication

 public static void ChangeAuthentication(OSHttpRequest request, UserAccount account)
 {
     if (request.Cookies["SessionID"] != null)
     {
         UUID sessionID = UUID.Parse(request.Cookies["SessionID"].Value);
         if (_authenticatedUsers.ContainsKey(sessionID))
             _authenticatedUsers[sessionID] = account;
         if (_authenticatedAdminUsers.ContainsKey(sessionID))
             _authenticatedAdminUsers[sessionID] = account;
     }
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:11,代码来源:Authenticator.cs

示例12: 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>();
     vars.Add("Error505Text", translator.GetTranslatedString("Error505Text"));
     vars.Add("Error505InfoText", translator.GetTranslatedString("Error505InfoText"));
     vars.Add("HomePage505Text", translator.GetTranslatedString("HomePage505Text"));
     return vars;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:11,代码来源:http_505.cs

示例13: 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>();
            IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();

            if (requestParameters.ContainsKey("Submit"))
            {
                GridWelcomeScreen submittedInfo = new GridWelcomeScreen();
                submittedInfo.SpecialWindowMessageTitle = requestParameters["SpecialWindowTitle"].ToString();
                submittedInfo.SpecialWindowMessageText = requestParameters["SpecialWindowText"].ToString();
                submittedInfo.SpecialWindowMessageColor = requestParameters["SpecialWindowColor"].ToString();
                submittedInfo.SpecialWindowActive = requestParameters["SpecialWindowStatus"].ToString() == "1";
                submittedInfo.GridStatus = requestParameters["GridStatus"].ToString() == "1";

                connector.AddGeneric(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen", submittedInfo.ToOSD());

                response = "Successfully saved data";
                return null;
            }

            GridWelcomeScreen welcomeInfo = connector.GetGeneric<GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen",
                                                                                    "GridWelcomeScreen");
            if (welcomeInfo == null)
                welcomeInfo = GridWelcomeScreen.Default;
            vars.Add("OpenNewsManager", translator.GetTranslatedString("OpenNewsManager"));
            vars.Add("SpecialWindowTitleText", translator.GetTranslatedString("SpecialWindowTitleText"));
            vars.Add("SpecialWindowTextText", translator.GetTranslatedString("SpecialWindowTextText"));
            vars.Add("SpecialWindowColorText", translator.GetTranslatedString("SpecialWindowColorText"));
            vars.Add("SpecialWindowStatusText", translator.GetTranslatedString("SpecialWindowStatusText"));
            vars.Add("WelcomeScreenManagerFor", translator.GetTranslatedString("WelcomeScreenManagerFor"));
            vars.Add("GridStatus", translator.GetTranslatedString("GridStatus"));
            vars.Add("Online", translator.GetTranslatedString("Online"));
            vars.Add("Offline", translator.GetTranslatedString("Offline"));
            vars.Add("Enabled", translator.GetTranslatedString("Enabled"));
            vars.Add("Disabled", translator.GetTranslatedString("Disabled"));

            vars.Add("SpecialWindowTitle", welcomeInfo.SpecialWindowMessageTitle);
            vars.Add("SpecialWindowMessage", welcomeInfo.SpecialWindowMessageText);
            vars.Add("SpecialWindowActive", welcomeInfo.SpecialWindowActive ? "selected" : "");
            vars.Add("SpecialWindowInactive", welcomeInfo.SpecialWindowActive ? "" : "selected");
            vars.Add("GridActive", welcomeInfo.GridStatus ? "selected" : "");
            vars.Add("GridInactive", welcomeInfo.GridStatus ? "" : "selected");
            vars.Add("SpecialWindowColorRed", welcomeInfo.SpecialWindowMessageColor == "red" ? "selected" : "");
            vars.Add("SpecialWindowColorYellow", welcomeInfo.SpecialWindowMessageColor == "yellow" ? "selected" : "");
            vars.Add("SpecialWindowColorGreen", welcomeInfo.SpecialWindowMessageColor == "green" ? "selected" : "");
            vars.Add("SpecialWindowColorWhite", welcomeInfo.SpecialWindowMessageColor == "white" ? "selected" : "");
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return vars;
        }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:53,代码来源:welcomescreen_manager.cs

示例14: CheckAdminAuthentication

 public static bool CheckAdminAuthentication(OSHttpRequest request, int adminLevelRequired)
 {
     if (request.Cookies["SessionID"] != null)
     {
         var session =
             _authenticatedAdminUsers.FirstOrDefault(
                 (acc) => acc.Key == UUID.Parse(request.Cookies["SessionID"].Value));
         if (session.Value != null && session.Value.UserLevel >= adminLevelRequired)
             return true;
     }
     return false;
 }
开发者ID:KSLcom,项目名称:Aurora-Sim,代码行数:12,代码来源:Authenticator.cs

示例15: ViewerStatsReport

        /// <summary>
        ///     Callback for a viewerstats cap
        /// </summary>
        /// <param name="request"></param>
        /// <param name="path"></param>
        /// <param name="httpRequest"></param>
        /// <param name="httpResponse"></param>
        /// <returns></returns>
        public byte[] ViewerStatsReport(string path, Stream request, OSHttpRequest httpRequest,
                                        OSHttpResponse httpResponse)
        {
            IUserStatsDataConnector dataConnector =
                Framework.Utilities.DataManager.RequestPlugin<IUserStatsDataConnector>();

            OpenMetaverse.Messages.Linden.ViewerStatsMessage vsm =
                new OpenMetaverse.Messages.Linden.ViewerStatsMessage();
            vsm.Deserialize((OSDMap) OSDParser.DeserializeLLSDXml(request));
            dataConnector.UpdateUserStats(vsm, m_service.AgentID, m_service.Region.RegionID);

            return MainServer.BlankResponse;
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:21,代码来源:UserStatsCAPS.cs


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