protected static Parse ( string source, string markup ) : List |
||
source | string | |
markup | string | |
Résultat | List |
/// <summary> /// Loads and caches the template at the specified path. /// </summary> /// <param name="path"></param> /// <returns></returns> public static IEnumerable <Template> Load(string path) { IEnumerable <Template> t; if (templates.TryGetValue(path.ToLower(), out t)) { return(t); } t = Block.Parse(Path.GetFileName(path), File.ReadAllText(path)).OfType <Template>().ToArray(); templates[path.ToLower()] = t; string directory = Path.GetDirectoryName(path).ToLower(); if (!watchers.ContainsKey(directory)) { var watcher = new FileSystemWatcher(directory); watcher.Changed += (s, e) => templates.Remove(e.FullPath.ToLower()); watcher.EnableRaisingEvents = true; watchers[directory] = watcher; } return(t); }
public override IEnumerable <ITemplate> ParseTemplates(string source, string template) { return(Block.Parse(source, template).OfType <ITemplate>()); }