/// <summary> /// Construct an instance that loads groups/interfaces from the single dir or /// multiple dirs specified and uses the specified encoding. /// </summary> /// <remarks> /// If a specified directory is an absolute path, the full path is used to /// locate the template group or interface file. /// /// If a specified directory is a relative path, the path is taken to be /// relative to the location of the stringtemplate assembly itself. /// /// TODO: Check shadow-copying doesn't knock this outta whack. /// </remarks> public EmbeddedResourceGroupLoader( IStringTemplateGroupFactory factory, IStringTemplateErrorListener errorListener, Assembly assembly, string namespaceRoot) { if (assembly == null) throw new ArgumentNullException("assembly", "An assembly must be specified"); if (namespaceRoot == null) throw new ArgumentNullException("namespaceRoot", "A namespace must be specified"); this.factory = (factory == null) ? new DefaultGroupFactory() : factory; this.errorListener = (errorListener == null) ? NullErrorListener.DefaultNullListener : errorListener; this.assembly = assembly; this.namespaceRoot = namespaceRoot; }
/// <summary> /// Construct an instance that loads groups/interfaces from the single dir or /// multiple dirs specified and uses the specified encoding. /// </summary> /// <remarks> /// If a specified directory is an absolute path, the full path is used to /// locate the template group or interface file. /// /// If a specified directory is a relative path, the path is taken to be /// relative to the location of the stringtemplate assembly itself. /// /// TODO: Check shadow-copying doesn't knock this outta whack. /// </remarks> public CommonGroupLoader( IStringTemplateGroupFactory factory, IStringTemplateErrorListener errorListener, Encoding encoding, params string[] directoryNames) { this.factory = factory; this.errorListener = (errorListener == null) ? new NullErrorListener() : errorListener; this.encoding = encoding; foreach (string directoryName in directoryNames) { string fullpath; if (Path.IsPathRooted(directoryName)) { fullpath = directoryName; } else { fullpath = string.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory, directoryName ); } if ( File.Exists(fullpath) || !Directory.Exists(fullpath) ) { Error("group loader: no such dir " + fullpath); } else { if (directories == null) { directories = new ArrayList(); } directories.Add(fullpath); } } }
public EmbeddedResourceGroupLoader(IStringTemplateGroupFactory factory, Assembly assembly, string namespaceRoot) : this(factory, null, assembly, namespaceRoot) { }