internal void SetPackage(Package package) { Debug.Assert(package != null, "Package should not be null."); _package = package; }
private void SetupMacrosNode(TreeNode packageNode, Package package) { TreeNode macrosNode = GetContextNode(package.MacroLibraries, packageNode.Nodes); if (macrosNode == null) { macrosNode = packageNode.Nodes.Add("Macro Libraries"); } macrosNode.ImageIndex = Images.Indexes.FolderOpen; macrosNode.SelectedImageIndex = Images.Indexes.FolderOpen; macrosNode.Tag = package.MacroLibraries; foreach (MacroLibrary m in package.MacroLibraries) { TreeNode node = GetContextNode(m, macrosNode.Nodes); if (node == null) { node = macrosNode.Nodes.Add(m.Address); } node.Text = Path.GetFileName(m.Address); //TreeNode node = generatorCommandsNode.Nodes.Add(command.Name); node.ImageIndex = Images.Indexes.DocumentText; node.SelectedImageIndex = Images.Indexes.DocumentText; node.Tag = m; } foreach (TreeNode node in macrosNode.Nodes) { if (node.Tag != null && !package.MacroLibraries.Contains((MacroLibrary)node.Tag)) { node.Remove(); } } }
public CodeGenerator(Package package, Template template) : this(package) { _template = template; }
private void SetupTemplatesNode(TreeNode packageNode, Package package) { TreeNode templatesNode = GetContextNode(package.Templates, packageNode.Nodes); if (templatesNode == null) { templatesNode = packageNode.Nodes.Add("Templates"); } templatesNode.ImageIndex = Images.Indexes.FolderOpen; templatesNode.SelectedImageIndex = Images.Indexes.FolderOpen; templatesNode.Tag = package.Templates; foreach (Template t in package.Templates) { TreeNode node = GetContextNode(t, templatesNode.Nodes); if (node == null) { node = templatesNode.Nodes.Add(t.Name); } node.Text = Path.GetFileName(t.GetFullPath()); //TreeNode node = generatorCommandsNode.Nodes.Add(command.Name); node.ImageIndex = Images.Indexes.DocumentText; node.SelectedImageIndex = Images.Indexes.DocumentText; node.Tag = t; } foreach (TreeNode node in templatesNode.Nodes) { if (node.Tag != null && !package.Templates.Contains((Template)node.Tag)) { node.Remove(); } } }
public CodeGenerator(Package package) { _package = package; _baseFolder = package.BaseFolder; this.Context.Helpers = new HelperCollection(package.Helpers); this.Context.Libraries = new MacroLibraryCollection(package.MacroLibraries); }