public void MaybeUseAlternateTemplate(Dictionary<string, object> args)
{
try
{
if (args == null)
return;
string template = null;
if (this.default_args.ContainsKey("template")) // look for hub default
template = (string)default_args["template"];
if (args.Keys.Contains("template") && ! String.IsNullOrEmpty((string)args["template"]) ) // look for url override
template = (string) args["template"];
if ( ! String.IsNullOrEmpty(template) )
{
try
{
Uri template_uri;
if (template.StartsWith("http://"))
template_uri = new Uri(template);
else
template_uri = BlobStorage.MakeAzureBlobUri("admin", template);
this.template_html = HttpUtils.FetchUrl(template_uri).DataAsString();
}
catch (Exception e)
{
GenUtils.LogMsg("exception", "MaybeUseAlternateTemplate", e.Message);
this.template_html = this.default_template_html;
}
}
else
{
this.template_html = this.default_template_html;
}
}
catch (Exception e)
{
GenUtils.LogMsg("exception", "UseTestTemplate", e.Message + e.StackTrace);
return;
}
}