Ejemplo n.º 1
0
 private IEnumerable<CodeSnippet> AllCodeSnippet(CodeSnippetGroup group, string physicalPath)
 {
     return Directory.EnumerateFiles(physicalPath, "*" + FileExtension).Select(it =>
         new CodeSnippet()
         {
             Group = group,
             ViewEngine = group.ViewEngine,
             Name = Path.GetFileNameWithoutExtension(it),
             Code = IO.IOUtility.ReadAsString(it)
         });
 }
Ejemplo n.º 2
0
 public virtual CodeSnippetGroup All(string viewEngine)
 {
     var physicalPath = Path.Combine(BasePath, viewEngine);
     CodeSnippetGroup root = new CodeSnippetGroup() { Name = "root", Parent = null, ViewEngine = viewEngine };
     if (Directory.Exists(physicalPath))
     {
         root.ChildGroups = AllGroups(viewEngine, root, physicalPath);
         root.CodeSnippets = AllCodeSnippet(root, physicalPath);
     }
     return root;
 }
Ejemplo n.º 3
0
 private IEnumerable<CodeSnippetGroup> AllGroups(string viewEngine, CodeSnippetGroup parent, string physicalPath)
 {
     var dir = Directory.GetDirectories(physicalPath);
     if (dir.Length != 0)
     {
         foreach (var item in dir.ExcludeSvn())
         {
             var group = new CodeSnippetGroup()
             {
                 ViewEngine = viewEngine,
                 Name = Path.GetFileNameWithoutExtension(item),
                 Parent = parent
             };
             group.ChildGroups = AllGroups(viewEngine, parent, item);
             group.CodeSnippets = AllCodeSnippet(group, item);
             yield return group;
         }
     }
 }