public static string CreateUrl(IParameters parameters, bool truncate = true) { var url = new PrtgUrl(new ConnectionDetails("prtg.example.com", "username", "12345678"), XmlFunction.TableData, parameters); if (truncate) { var suffix = "https://prtg.example.com/api/table.xml?"; var prefix = $"&username=username&passhash=12345678"; try { Assert.IsTrue(url.Url.StartsWith(suffix), "URL did not start with suffix"); } catch { Assert.IsTrue(url.Url.StartsWith(suffix.Substring(0, suffix.Length - 1) + "&")); } Assert.IsTrue(url.Url.EndsWith(prefix), "URL did not end with prefix"); var length = url.Url.Length - (suffix.Length + prefix.Length); if (length == -1) { return(string.Empty); } return(url.Url.Substring(suffix.Length, length)); } return(url.Url); }
private void Server_Prefix(string server, string prefixedServer) { var url = new PrtgUrl(new ConnectionDetails(server, "username", "password"), XmlFunction.TableData, new BaseParameters()); Assert.IsTrue(url.Url.StartsWith(prefixedServer)); }
private void ExecuteOperation(PrtgObject obj, string url) { var server = PrtgUrl.AddUrlPrefix(client.Server); ExecuteOperation(() => Process.Start($"{server}{url}"), $"Opening {PrtgProgressCmdlet.GetTypeDescription(obj)} '{obj.Name}'"); }
private string CreateUrl(Parameters.Parameters parameters) { var url = new PrtgUrl("prtg.example.com", "username", "password", XmlFunction.TableData, parameters); return(url.Url); }