/// <summary> /// 递归创建 /// </summary> /// <param name="node"></param> private void makeWebPacker(TreeNode node) { if (node.Checked) { if (node.Tag != null) { string tag = node.Tag.ToString(); string tp = tag.Substring(0, 1); //文件节点 if (tp == "2") { string filePath = tag.Substring(1); //string content = File.ReadAllText(filePath, Encoding.GetEncoding("GB2312")); WebPackager pack = WebPackager.FromFile(filePath, packageControl1); lstPacker.Add(pack); } } } //子节点 if (node.Nodes.Count > 0) { foreach (TreeNode item in node.Nodes) { makeWebPacker(item); } } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = e.Node; if (node.Tag != null) { string str = node.Tag.ToString(); if (str.Substring(0, 1) == "2") { string file = str.Substring(1); WebPackager packager = WebPackager.FromFile(file); FileInfo info = new FileInfo(file); this.packageControl1.WebPackager = packager; this.packageControl1.FilePath = file; } } }
private void makeWebPacker(TreeNode node) { if (node.Checked && (node.Tag != null)) { string str = node.Tag.ToString(); if (str.Substring(0, 1) == "2") { WebPackager item = WebPackager.FromFile(str.Substring(1)); this.lstPacker.Add(item); } } if (node.Nodes.Count > 0) { foreach (TreeNode node2 in node.Nodes) { this.makeWebPacker(node2); } } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = e.Node; if (node.Tag == null) { return; } string tag = node.Tag.ToString(); string tp = tag.Substring(0, 1); //文件节点 if (tp == "2") { string filePath = tag.Substring(1); //string content = File.ReadAllText(filePath, Encoding.GetEncoding("GB2312")); WebPackager pack = WebPackager.FromFile(filePath, packageControl1); FileInfo file = new FileInfo(filePath); packageControl1.WebPackager = pack; packageControl1.FilePath = filePath; } }