private IWebResponse TotalLogsResponse() { int count; if (!(CountOverride != null && CountOverride.TryGetValue(Content.Logs, out count))) { count = 1000000; } return(new BasicResponse(new XElement("messages", new XAttribute("listend", 1), new XAttribute("totalcount", count), new XElement("prtg-version", "1.2.3.4"), null ).ToString())); }
private int GetCount(NameValueCollection components, Content?content) { var count = 2; if (FixedCountOverride != null) { return(FixedCountOverride.Value); } if (CountOverride == null) //question: will this cause issues with streaming cos the second page have the wrong count { var countStr = components["count"]; if (countStr != null && countStr != "0" && countStr != "500" && countStr != "*") { count = Convert.ToInt32(countStr); } if (components["filter_objid"] != null) { count = 1; var values = components.GetValues("filter_objid"); if (values?.Length > 1) { count = 2; } else { if (values?.First() == "-2") { if (content != Content.Devices) { count = 0; } } if (values?.First() == "-3") { if (content != Content.Groups) { count = 0; } } else if (values?.First() == "-4") { count = 0; } } } } else { if (content != null && CountOverride.ContainsKey(content.Value)) { count = CountOverride[content.Value]; } } return(count); }