public string ReadTemplateFile(Context context, string templateName) { //var templatePath = (string)context[templateName]; //if (templatePath == null || !Regex.IsMatch(templatePath, @"^[a-zA-Z0-9_]+$")) // throw new FileSystemException("Error - Illegal template name '{0}'", templatePath); //var checkedLocations = new List<string>(); //var viewPath = string.Empty; //var viewFound = false; //foreach (var fullPath in _viewLocations.Select(viewLocation => Path.Combine(viewLocation, string.Format(FileNameFormat, templatePath)))) //{ // if(HostingEnvironment.VirtualPathProvider.FileExists(fullPath)) // { // viewPath = fullPath; // viewFound = true; // break; // } // checkedLocations.Add(fullPath); //} //if (!viewFound) // throw new FileSystemException("Error - No such template. Looked in the following locations:<br />{0}", string.Join("<br />", checkedLocations)); //return VirtualPathProviderHelper.Load(viewPath); var templatePaths = GetTemplatePaths(context, templateName); var themeAssetService = new ThemeAssetService(); var themeAsset = themeAssetService.Find(templatePaths); return(themeAsset.Value); }