Assembly CompileLocal()
{
if (String.IsNullOrEmpty(virtualPath))
{
return(null);
}
Assembly cached = GetCachedLocalResourcesAssembly(virtualPath);
if (cached != null)
{
return(cached);
}
string prefix;
if (virtualPath == "/")
{
prefix = "App_LocalResources.root";
}
else
{
prefix = "App_LocalResources" + virtualPath.Replace('/', '.');
}
string assemblyPath = FileUtils.CreateTemporaryFile(TempDirectory,
prefix,
"dll",
OnCreateRandomFile) as string;
if (assemblyPath == null)
{
throw new ApplicationException("Failed to create local resources assembly");
}
List <AppResourceFileInfo> files = this.files.Files;
foreach (AppResourceFileInfo arfi in files)
{
GetResourceFile(arfi, true);
}
AppResourcesAssemblyBuilder builder = new AppResourcesAssemblyBuilder("App_LocalResources", assemblyPath,
this);
builder.Build();
Assembly ret = builder.MainAssembly;
if (ret != null)
{
AddAssemblyToCache(virtualPath, ret);
}
return(ret);
}