// TODO we can eliminate the TemplateResolver here once we remove it as a requirement for the Template class
 public TemplateInfo(IFileProvider source, string path, string name, TemplateParameterInfo[] parameters, TemplateInfo inheritedTemplate)
 {
     this.Source = source;
     this.Name = name;
     this.Parameters = parameters;
     this.Path = path;
     this.Inherits = inheritedTemplate;
 }
Example #2
0
        public virtual void Load(TemplateInfo templateInfo)
        {
            this._templateInfo = templateInfo;
            this._templateSourcePath = null;
            using (Stream str = this._templateInfo.Source.OpenFile(templateInfo.Path, FileMode.Open))
                _templateDefinition = XDocument.Load(str, LoadOptions.SetLineInfo);

            this._basePath = Path.GetDirectoryName(templateInfo.Path);
        }
        public bool TryResolve(string name, out TemplateInfo templateInfo)
        {
            string path = Path.Combine(name, Template.TemplateDefinitionFileName);
            IFileProvider fileProvider;
            bool ret = this.FileExists(path, out fileProvider);
            if (ret)
                templateInfo = TemplateInfo.Load(this, fileProvider, name);
            else
                templateInfo = null;

            return ret;
        }