private void toolStripButton11_Click(object sender, EventArgs e) { Initialize(); foreach (TreeNode node in ns.Nodes) { int rowId = dg.Rows.Add(); DataGridViewRow row = dg.Rows[rowId]; row.HeaderCell.Value = rowId.ToString(); row.Cells[0].Value = ns.Text; VSParsers.ProjectItemInfo p = node.Tag as VSParsers.ProjectItemInfo; if (p != null) { if (p.psi != null) { string s = p.psi.Include; row.Cells[1].Value = s; } } GeTNodes(node); } }
public void LoadFromTreeNode(TreeNode ns, TreeNode ng, string name, string newname) { foreach (TreeNode node in ns.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; VSParsers.ProjectItemInfo bb = new VSParsers.ProjectItemInfo(); bb.vs = ps.vs; bb.ps = ps.ps; VSProjectItem pc = new VSProjectItem(); pc.SubType = ps.psi.SubType; pc.ItemType = ps.psi.ItemType; pc.Include = ps.psi.Include.Replace(name, newname); bb.psi = pc; //if (ps == null) // continue; L.Add(ps); TreeNode nodes = new TreeNode(); nodes.Text = node.Text; nodes.Tag = bb; nodes.Checked = true; nodes.SelectedImageKey = node.SelectedImageKey; nodes.ImageKey = node.ImageKey; ng.Nodes.Add(nodes); LoadFromTreeNode(node, nodes, name, newname); } }
public ProjectTypeFromFile(object obs) { VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } EntityDeclaration e = p.mapper; if (e == null) { return; } Name = e.Name; if (e is FieldDeclaration) { FieldDeclaration f = e as FieldDeclaration; Name = f.Name; if (string.IsNullOrEmpty(Name)) { if (f.Variables != null) { if (f.Variables.Count > 0) { Name = f.Variables.ToList()[0].Name; } } } } }
public void GeTNodes(TreeNode node) { foreach (TreeNode ns in node.Nodes) { int rowId = dg.Rows.Add(); DataGridViewRow row = dg.Rows[rowId]; row.HeaderCell.Value = rowId.ToString(); row.Cells[0].Value = ns.Text; VSParsers.ProjectItemInfo p = ns.Tag as VSParsers.ProjectItemInfo; if (p != null) { if (p.psi != null) { string s = p.psi.Include; row.Cells[1].Value = s; } } GeTNodes(ns); } }
public VSProjectItem GetVSProjectItem(TreeNode node) { VSParsers.ProjectItemInfo p = node.Tag as VSParsers.ProjectItemInfo; if (p == null) { return(null); } VSProjectItem pp = p.psi; return(pp); }
public void LoadTreeNode(List <TreeNode> n) { TreeNode nn = n[0]; vp = GetVSProject(nn); tv.Nodes.Clear(); tv.FullRowSelect = true; tv.CheckBoxes = true; L = new ArrayList(); foreach (TreeNode ns in n) { TreeNode ng = new TreeNode(); ng.Text = ns.Text; ng.Checked = true; ng.Tag = ns.Tag; ng.ImageKey = ns.ImageKey; ng.SelectedImageKey = ns.ImageKey; tv.Nodes.Add(ng); nc = ng; textBox1.Text = ng.Text; foreach (TreeNode node in ns.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; if (ps == null) { continue; } L.Add(ps); TreeNode nodes = new TreeNode(); nodes.Text = node.Text; nodes.Tag = ps; nodes.Checked = true; nodes.ImageKey = node.ImageKey; nodes.SelectedImageKey = node.SelectedImageKey; ng.Nodes.Add(nodes); //L.Add(nodes); LoadFromTreeNode(node, nodes); } project_node = ns; } }
public ArrayList RenameItems(ArrayList L, string name) { ArrayList N = new ArrayList(); VSParsers.ProjectItemInfo pp = L[0] as VSParsers.ProjectItemInfo; VSProjectItem b = pp.psi; foreach (VSParsers.ProjectItemInfo p in L) { } return(N); }
public ProjectReferenceItem(object obs) { this.data = obs; VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } if (p.ps == null) { return; } Name = p.Include; }
public VSSolution GetVSSolution(TreeNode b) { foreach (TreeNode node in b.Nodes) { VSParsers.ProjectItemInfo s = node.Tag as VSParsers.ProjectItemInfo; if (s == null) { continue; } return(s.ps.vs); } return(null); }
//[DisplayName("Data")] //[Description("Data")] //[TypeConverter(typeof(ProjectItemInfoConverter))] //public object data //{ // get { return m_data; } // set { m_data = value; } //} public ProjectFolder(object obs) { // this.data = obs; VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } if (p.ps == null) { return; } folderName = p.Include; }
//[DisplayName("Data")] //[Description("Data")] //[TypeConverter(typeof(ProjectItemInfoConverter))] //public object data //{ // get { return m_data; } // set { m_data = value; } //} public SolutionFolder(object obs) { // this.data = obs; VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } if (p.ps == null) { return; } folderName = Path.GetFileName(p.ps.FileName); }
//[DisplayName("Data")] //[Description("Data")] //[TypeConverter(typeof(ProjectItemInfoConverter))] //public object data //{ // get { return m_data; } // set { m_data = value; } //} public ProjectFileData(object obs) { // this.data = obs; VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } if (p.ps == null) { return; } file = Path.GetFileName(p.ps.FileName); filePath = Path.GetDirectoryName(p.ps.FileName); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode node = tv.SelectedNode; if (node == null) { return; } VSParsers.ProjectItemInfo p = node.Tag as VSParsers.ProjectItemInfo;; if (p == null) { return; } pg.SelectedObject = p.psi; }
public VSProject GetVSProject(TreeView b) { TreeNode node = b.SelectedNode; if (node == null) { return(null); } VSParsers.ProjectItemInfo s = node.Tag as VSParsers.ProjectItemInfo; if (s == null) { return(null); } vp = s.ps; return(s.ps); }
public VSSolution GetVSSolution(TreeView b) { foreach (TreeNode node in b.Nodes) { VSParsers.ProjectItemInfo s = node.Tag as VSParsers.ProjectItemInfo; if (s != null) { return(s.ps.vs); } VSSolution v = GetVSSolution(node); if (v != null) { return(v); } } return(null); }
//[DisplayName("Data")] //[Description("Data")] // [TypeConverter(typeof(ProjectItemInfoConverter))] //public object data //{ // get { return m_data; } // set { m_data = value; } //} public SolutionFile(object obs) { // this.data = obs; VSParsers.ProjectItemInfo p = obs as VSParsers.ProjectItemInfo; if (p == null) { return; } if (p.ps != null) { file = Path.GetFileName(p.ps.FileName); filePath = Path.GetDirectoryName(p.ps.FileName);//new StringPropertyDescriptor(Path.GetDirectoryName(p.ps.FileName), null); } VSSolution vs = p.vs; if (vs == null) { return; } Solution c = vs.SolutionParsed; var section = c.GetPresection("SolutionConfigurationPlatforms", "preSolution"); if (section != null) { List <string> b = new List <string>(); foreach (var s in section.Entries) { if (s.Value != "preSolution") { b.Add(s.Key); } } conf = new DropDownListProperty(b); } file = vs.Name; filePath = Path.GetDirectoryName(vs.solutionFileName);// new StringPropertyDescriptor(vs.solutionFileName,null); load = "Default"; startup = ExplorerForms.ef.Command_GetStartupProject(); }
public void LoadFromTreeNode(TreeNode ns, TreeNode ng) { foreach (TreeNode node in ns.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; if (ps == null) { continue; } L.Add(ps); TreeNode nodes = new TreeNode(); nodes.Text = node.Text; nodes.Tag = ps; nodes.Checked = true; nodes.SelectedImageKey = node.SelectedImageKey; nodes.ImageKey = node.ImageKey; ng.Nodes.Add(nodes); LoadFromTreeNode(node, nodes); } }
public void RenameVSProjectItems() { string name = textBox1.Text; ncc = new TreeNode(); ncc.Text = name; if (project_node != null) { project_node.Text = name; } VSParsers.ProjectItemInfo p = nc.Tag as VSParsers.ProjectItemInfo; //VSParsers.ProjectItemInfo psp = new VSParsers.ProjectItemInfo(); if (p.psi != null) { if (p.psi.ItemType == "Folder") { RenameFolder(); return; } } VSProjectItem ppp = null; if (p != null) { ppp = p.psi; } VSParsers.ProjectItemInfo bbb = new VSParsers.ProjectItemInfo(); bbb.vs = p.vs; bbb.ps = p.ps; VSProjectItem pcp = new VSProjectItem(); pcp.SubType = p.psi.SubType; pcp.ItemType = p.psi.ItemType; bbb.psi = pcp; ncc.Tag = bbb; if (p == null) { return; } if (p.psi == null) { return; } string names = p.psi.Include; //string[] cc = names.Split("\\".ToCharArray()); string master;// = GetString(cc); // master = cc[cc.Length - 2]; VSParsers.ProjectItemInfo psp = nc.Tag as VSParsers.ProjectItemInfo; string newname = name; string incc = p.psi.Include; if (psp.psi.Name != null) { master = GetName(psp.psi.Name); newname = name; pcp.Include = incc; incc = incc.Replace(master, newname); pcp.Include = incc; if (vp != null) { vp.RenameItem(pcp.ItemType, psp.psi.Include, pcp.Include); } } else { master = GetName(nc.Text); } foreach (TreeNode node in nc.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; VSProjectItem pp = null; if (ps != null) { pp = ps.psi; } VSParsers.ProjectItemInfo bb = new VSParsers.ProjectItemInfo(); bb.vs = ps.vs; bb.ps = ps.ps; VSProjectItem pc = new VSProjectItem(); pc.SubType = ps.psi.SubType; pc.ItemType = ps.psi.ItemType; if (ps.psi.ItemType == null) { pc.ItemType = ps.psi.SubType; } bb.psi = pc; string inc = ps.psi.Include; //string names = p.psi.Include; string[] d = inc.Split("\\.".ToCharArray()); //master = inc;// GetString(d); //if(d.Length > 1) //d[d.Length - 2] = name; //newname = GetString(d); newname = name; inc = inc.Replace(master, newname); pc.Include = inc; if (vp != null) { vp.RenameItem(pc.ItemType, ps.psi.Include, pc.Include, master, newname); } node.Text = inc; TreeNode nodes = new TreeNode(); nodes.Text = node.Text; nodes.SelectedImageKey = node.SelectedImageKey; nodes.ImageKey = node.ImageKey; nodes.Checked = true; ncc.Nodes.Add(nodes); if (ps != null) { if (bb != null) { pc.Include = inc; nodes.Tag = bb; } } LoadFromTreeNode(node, nodes, master, newname); } LoadTreeNodes(ncc); }
public void RenameFolder() { string name = textBox1.Text; tv.BeginUpdate(); ncc = new TreeNode(); ncc.Text = name; ncc.SelectedImageKey = nc.SelectedImageKey; ncc.ImageKey = nc.ImageKey; VSParsers.ProjectItemInfo p = nc.Tag as VSParsers.ProjectItemInfo; string folder = p.psi.Include; string newfolder = ""; string[] dd = folder.Split("\\".ToCharArray()); if (dd.Length > 0) { dd[dd.Length - 1] = name; newfolder = ""; int a = 0; foreach (string g in dd) { if (a != 0) { newfolder += "\\"; } newfolder += g; a++; } } vp.FolderCreate(newfolder); string newname = newfolder + "\\"; string newnames = newfolder; string master = folder + "\\"; string masters = folder + "\\"; foreach (TreeNode node in nc.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; VSProjectItem pp = null; if (ps != null) { pp = ps.psi; } VSParsers.ProjectItemInfo bb = new VSParsers.ProjectItemInfo(); bb.vs = ps.vs; bb.ps = ps.ps; VSProjectItem pc = new VSProjectItem(); pc.SubType = ps.psi.SubType; pc.ItemType = ps.psi.ItemType; if (ps.psi.ItemType == null) { pc.ItemType = ps.psi.SubType; } bb.psi = pc; string inc = ps.psi.Include; //string[] d = inc.Split("\\.".ToCharArray()); inc = inc.Replace(master, newname); pc.Include = inc; if (vp != null) { vp.RenameItem(pc.ItemType, ps.psi.Include, pc.Include, master, newname); } node.Text = inc; TreeNode nodes = new TreeNode(); nodes.Text = node.Text.Replace(newname, ""); nodes.SelectedImageKey = node.SelectedImageKey; nodes.ImageKey = node.ImageKey; nodes.Checked = true; ncc.Nodes.Add(nodes); if (ps != null) { if (bb != null) { pc.Include = inc; nodes.Tag = bb; } } //LoadFromTreeNode(node, nodes, master, newname); if (node.Nodes.Count > 0) { RenameSubFolders(node, master, newname, nodes); } } //LoadFromTreeNode(node, nodes, master, newname); LoadTreeNodes(ncc); tv.EndUpdate(); }
public void RenameSubFolders(TreeNode nc, string master, string newname, TreeNode ng) { foreach (TreeNode node in nc.Nodes) { VSParsers.ProjectItemInfo ps = node.Tag as VSParsers.ProjectItemInfo; VSProjectItem pp = null; if (ps != null) { pp = ps.psi; } VSParsers.ProjectItemInfo bb = new VSParsers.ProjectItemInfo(); bb.vs = ps.vs; bb.ps = ps.ps; VSProjectItem pc = new VSProjectItem(); pc.SubType = ps.psi.SubType; pc.ItemType = ps.psi.ItemType; if (ps.psi.ItemType == null) { pc.ItemType = ps.psi.SubType; } bb.psi = pc; string inc = ps.psi.Include; //string[] d = inc.Split("\\.".ToCharArray()); inc = inc.Replace(master, newname); pc.Include = inc; if (vp != null) { vp.RenameItem(pc.ItemType, ps.psi.Include, pc.Include, master, newname); } node.Text = inc; TreeNode nodes = new TreeNode(); //nodes.Text = node.Text; nodes.Text = node.Text.Replace(newname, ""); nodes.SelectedImageKey = node.SelectedImageKey; nodes.ImageKey = node.ImageKey; nodes.Checked = true; ng.Nodes.Add(nodes); if (ps != null) { if (bb != null) { pc.Include = inc; nodes.Tag = bb; } } // LoadFromTreeNode(node, nodes, master, newname); if (node.Nodes.Count > 0) { RenameSubFolders(node, master, newname, nodes); } } }