Example #1
0
 public RazorTemplate(TemplateFile file)
 {
     var text = file.OpenText();
     Output = GetOutput(text);
     Mode = GetGenerateMode(text);
     Template = GetTemplate(text, file.DirectoryName);
 }
Example #2
0
 public FileNode(TemplateFile file)
 {
     templateFile = file;
     Text = templateFile.Name;
     ImageKey = "template";
     SelectedImageKey = "template";
     templateFile.Renamed += new EventHandler(templateFile_Renamed);
 }
 public TemplateDocument(TemplateFile file, IDockForm dockForm)
 {
     InitializeComponent();
     DockForm = dockForm;
     Handler.EditHandler = this;
     Handler.ZoomHandler = this;
     Handler.TextFormatHandler = this;
     Handler.Compile += new EventHandler(Handler_Compile);
     template = file;
     template.Renamed += new EventHandler(template_StateChanged);
     template.StateChanged += new EventHandler(template_StateChanged);
     UpdateName();
     LoadFile();
 }
 void LoadFiles(TreeNode node, DirectoryInfo dir, IEnumerable<TemplateFile> openedFiles)
 {
     foreach (var d in dir.GetDirectories())
     {
         if ((d.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
             continue;
         FolderNode folder = new FolderNode(new TemplateFolder(d));
         node.Nodes.Add(folder);
         LoadFiles(folder, d, openedFiles);
     }
     foreach (var f in dir.GetFiles("*" + TemplateFile.Extension))
     {
         var file = openedFiles.FirstOrDefault(p => p.FullName == f.FullName);
         if(file == null)
             file = new TemplateFile(f);
         FileNode fileNode = new FileNode(file);
         node.Nodes.Add(fileNode);
     }
 }
Example #5
0
 bool IsTemplateSelected(TemplateFile f)
 {
     return lsbTemplate.Items.Cast<ValueTextPair>()
         .Any(p => ((TemplateFile)p.Value).FullName == f.FullName);
 }