private void AppendContent(StringBuilder buffer, ProjectItemCollection items, int count) { string indent = new string(' ', count * 2); ProjectItemCollection.Enumerator e = items.GetEnumerator(); while (e.MoveNext()) { ProjectItem item = e.Current; if (item.IsDirectory) { buffer.Append(indent + "Begin Folder = \"" + item.Name + "\"" + CR); AppendContent(buffer, item.Items, count + 1); buffer.Append(indent + "End" + CR); } else { if (Path.GetExtension(item.Name).Equals(".sql")) { buffer.Append(indent + "Script = \"" + item.Name + "\"" + CR); } else { buffer.Append(indent + "Node = \"" + item.Name + "\"" + CR); } } } }
//======================================================================================== // PopulateProject() //======================================================================================== private void PopulateProject(ProjectItemCollection items, TreeNodeCollection nodes) { ProjectItemCollection.Enumerator e = items.GetEnumerator(); while (e.MoveNext()) { ProjectItem item = e.Current; TreeNode node = CreateNode(item); nodes.Add(node); if (item.IsDirectory) { PopulateProject(item.Items, node.Nodes); } } }
private void DumpProject(ProjectItem root, int count) { string indent = new string('.', count * 2); Console.WriteLine(root.Name + " - " + root.Path); ProjectItemCollection.Enumerator e = root.Items.GetEnumerator(); while (e.MoveNext()) { ProjectItem item = e.Current; if (item.IsDirectory) { DumpProject(item, count + 1); } else { Console.WriteLine(indent + item.Name + " - " + item.Path); } } }