private string GetTableText(string address) { var components = UrlHelpers.CrackUrl(address); var content = MultiTypeResponse.GetContent(address); switch (content) { case Content.Triggers: return(base.GetResponseText(ref address)); case Content.Channels: if (Convert.ToInt32(components["id"]) >= 4000) { return(new ChannelResponse(channels).GetResponseText(ref address)); } return(new ChannelResponse().GetResponseText(ref address)); case Content.Notifications: return(new NotificationActionResponse(new NotificationActionItem("301"), new NotificationActionItem("302"), new NotificationActionItem("303")).GetResponseText(ref address)); case Content.Schedules: return(new ScheduleResponse(new ScheduleItem()).GetResponseText(ref address)); default: throw new NotImplementedException($"Unknown content '{content}' requested from {nameof(NotificationTriggerResponse)}"); } }
public override string GetResponseText(ref string address) { var function = MultiTypeResponse.GetFunction(address); switch (function) { case nameof(XmlFunction.TableData): return(GetTableText(address)); case nameof(JsonFunction.Triggers): if (json.Length == 1) { jsonIndex = 0; } else { jsonIndex++; } return(new NotificationTriggerJsonResponse(json[jsonIndex]).GetResponseText(ref address)); case nameof(HtmlFunction.ObjectData): return(GetObjectDataResponse(address).GetResponseText(ref address)); case nameof(HtmlFunction.ChannelEdit): return(new ChannelResponse().GetResponseText(ref address)); default: throw new NotImplementedException($"Unknown function '{function}' passed to {nameof(NotificationTriggerResponse)}"); } }
public string GetResponseText(ref string address) { var function = MultiTypeResponse.GetFunction(address); switch (function) { case nameof(JsonFunction.TableData): return(GetSystemInfo(address)); default: throw new NotImplementedException(); } }
public override string GetResponseText(ref string address) { var function = MultiTypeResponse.GetFunction(address); switch (function) { case nameof(XmlFunction.TableData): return(GetTableText(address)); case nameof(HtmlFunction.ChannelEdit): return(new ChannelResponse(channels).GetResponseText(ref address)); case nameof(HtmlFunction.EditNotification): case nameof(HtmlFunction.ObjectData): return(GetObjectDataResponse(address).GetResponseText(ref address)); default: throw new NotImplementedException($"Unknown function '{function}' passed to {nameof(NotificationTriggerResponse)}"); } }
public string GetResponseText(ref string address) { var func = MultiTypeResponse.GetFunctionEnum(address); if (func.Equals(CommandFunction.AddSensor2)) { return("<div class=\"errormsg\"><p>PRTG Network Monitor has discovered a problem. Your last request could not be processed properly.</p><h3>Error message: Sorry, a read-only user account is not allowed to access this web page.</h3><small style=\"padding:5px;text-align:left\">Url: /controls/addsensor2.htm<br>Params: id=2055&sensortype=exexml&username=prtguser&passhash=***&</small></div>"); } var htmlFunc = func as HtmlFunction?; var response = normalResponse.GetResponseText(ref address); if (htmlFunc != null) { return(CleanResponse(response)); } return(response); }
public string GetResponseText(ref string address) { var func = MultiTypeResponse.GetFunctionEnum(address); if (func.Equals(CommandFunction.AddSensor2)) { return(string.Empty); } var htmlFunc = func as HtmlFunction?; var response = normalResponse.GetResponseText(ref address); if (htmlFunc != null) { return(CleanResponse(response)); } return(response); }
private string GetTableText(string address) { var components = UrlUtilities.CrackUrl(address); var content = MultiTypeResponse.GetContent(address); switch (content) { case Content.Triggers: if (xml.Length == 1) { xmlIndex = 0; } else { xmlIndex++; } Items = xml[xmlIndex].ToList(); return(base.GetResponseText(ref address)); case Content.Channels: return(new ChannelResponse(new[] { new ChannelItem() }).GetResponseText(ref address)); case Content.Objects: if (Convert.ToInt32(components["filter_objid"]) >= 4000) { return(new ObjectResponse(new SensorItem()).GetResponseText(ref address)); } return(new ObjectResponse(new DeviceItem()).GetResponseText(ref address)); case Content.Notifications: case Content.Schedules: return(new NotificationActionResponse(new NotificationActionItem("301"), new NotificationActionItem("302"), new NotificationActionItem("303")).GetResponseText(ref address)); default: throw new NotImplementedException($"Unknown content '{content}' requested from {nameof(NotificationTriggerResponse)}"); } }