예제 #1
0
        private void SetFileSystem()
        {
            char   separator      = Path.DirectorySeparatorChar;
            string templateFolder = BemolUtil.NormalizePath(Config.TemplateFolder);
            string fullPath       = Path.GetFullPath($".{separator}{templateFolder}");

            Template.FileSystem = new LocalFileSystem(fullPath);
        }
예제 #2
0
        private Template GetTemplate(string filePath)
        {
            char   separator      = Path.DirectorySeparatorChar;
            string templateFolder = BemolUtil.NormalizePath(Config.TemplateFolder);

            filePath = BemolUtil.NormalizePath(filePath);
            string fullPath = Path.GetFullPath($".{separator}{templateFolder}{separator}{filePath}");
            string text     = File.ReadAllTextAsync(fullPath).Result;
            int    hash     = text.GetHashCode();

            if (!Cache.ContainsKey(hash))
            {
                Cache[hash] = Template.Parse(text);
            }
            return(Cache[hash]);
        }