public string ExecuteRazorPage(string page)
{
try
{
if (AvailableScripts.hasKey(page))
{
var csFile = AvailableScripts[page];
var fileContents = csFile.fileContents();
var fileContentsHash = fileContents.hash();
if (TemplateService.HasTemplate(csFile).isFalse() || ScriptContentHashes.contains(fileContentsHash).isFalse())
{
Razor.Compile(fileContents, csFile);
ScriptContentHashes.add(fileContentsHash);
}
return Razor.Run(csFile, TmRest);
}
}
catch (Exception ex)
{
if (ex.Message =="Thread was being aborted.")
return "";
ex.log("[TBot Brain] [ExecuteRazorPage] {0} : {1}".format(page, ex.Message));
return "Opps: Something went wrong: {0}".format(ex.Message);
}
return "";
}