BlackLinks.Templates.TemplateSource.FromFile C# (CSharp) Method

FromFile() public static method

public static FromFile ( string filePath, string discoveryPath ) : TemplateSource
filePath string
discoveryPath string
return TemplateSource
        public static TemplateSource FromFile(string filePath, string discoveryPath)
        {
            FileInfo fileInfo = new FileInfo(filePath);
            if(!fileInfo.Exists)
            {
                throw new TemplateSourceException(string.Format("Template file '{0}' does not exists",filePath));
            }
            TemplateSource source = new TemplateSource ();
            source.DiscoveryPath = discoveryPath;
            source.ReferenceFilePath = filePath;
            source.SourceStream = File.OpenRead (filePath);
            source.TemplateFileExtension = fileInfo.Extension;
            return source;
        }