public virtual CompiledTemplate LoadTemplateFile(string prefix, string unqualifiedFileName)
{
if (Path.IsPathRooted(unqualifiedFileName))
throw new ArgumentException();
if (Verbose)
Console.WriteLine("loadTemplateFile({0}) in groupdir from {1} prefix={2}", unqualifiedFileName, root, prefix);
string templateName = Path.ChangeExtension(unqualifiedFileName, null);
Uri f;
try
{
f = new Uri(root.LocalPath + prefix + unqualifiedFileName);
}
catch (UriFormatException me)
{
ErrorManager.RuntimeError(null, ErrorType.INVALID_TEMPLATE_NAME, me, Path.Combine(root.LocalPath, unqualifiedFileName));
return null;
}
ANTLRReaderStream fs = null;
try
{
fs = new ANTLRReaderStream(new StreamReader(File.OpenRead(f.LocalPath), Encoding));
fs.name = unqualifiedFileName;
}
catch (IOException)
{
if (Verbose)
Console.WriteLine("{0}/{1} doesn't exist", root, unqualifiedFileName);
//errMgr.IOError(null, ErrorType.NO_SUCH_TEMPLATE, ioe, unqualifiedFileName);
return null;
}
return LoadTemplateFile(prefix, unqualifiedFileName, fs);
}