Added a subdir to CP, SickRage, Sonarr and Plex #43

This commit is contained in:
tidusjar 2016-03-21 14:23:55 +00:00
commit 895a0c50eb
10 changed files with 86 additions and 1 deletions

View file

@ -53,7 +53,10 @@ namespace PlexRequests.Helpers
/// </summary>
/// <param name="val">The value.</param>
/// <param name="port">The port.</param>
/// <param name="ssl">if set to <c>true</c> [SSL].</param>
/// <param name="subdir">The subdir.</param>
/// <returns></returns>
/// <exception cref="ApplicationSettingsException">The URI is null, please check your settings to make sure you have configured the applications correctly.</exception>
/// <exception cref="System.Exception"></exception>
public static Uri ReturnUri(this string val, int port, bool ssl = default(bool))
{
@ -93,5 +96,21 @@ namespace PlexRequests.Helpers
throw new Exception(exception.Message, exception);
}
}
public static Uri ReturnUriWithSubDir(this string val, int port, bool ssl, string subDir)
{
var uriBuilder = new UriBuilder(val);
if (ssl)
{
uriBuilder.Scheme = Uri.UriSchemeHttps;
}
if (!string.IsNullOrEmpty(subDir))
{
uriBuilder.Path = subDir;
}
uriBuilder.Port = port;
return uriBuilder.Uri;
}
}
}