using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace formTest
{
public partial class Form3 : Form
{
SCItemSet itemSet = new SCItemSet();
public Form3()
{
InitializeComponent();
}
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form3());
}
private void btnBrowse_Click(object sender, EventArgs e)
{
FolderBrowserDialog browse = new FolderBrowserDialog();
browse.ShowDialog();
txtShowPath.Text = browse.SelectedPath;
}
private void detail_Click(object sender, EventArgs e)
{
txtShowDetail.Text = string.Empty;
string ShowInfo="";
//string ShowPath = txtShowPath.Text.ToString().Replace("//", @"/");
getDirFiles(txtShowPath.Text);
for(int i=0;i<itemSet.Count;i++)
{
ShowInfo += itemSet[i].Name+"/r/n";
}
txtShowDetail.Text = ShowInfo.ToString();
}
public void getDirFiles(string strPaths)
{
DirectoryInfo d = new DirectoryInfo(strPaths);
DirectoryInfo[] dis = d.GetDirectories();
FileInfo[] fis = d.GetFiles();
foreach (FileInfo fi in fis)
{
SCItem item = new SCItem();
item.Name = fi.Name;
itemSet.Add(item);
}
string strPath;
foreach (DirectoryInfo di in dis)
{
strPath=strPaths+" //"+di.Name;
getDirFiles(strPath);
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace formTest
{
public partial class Form3 : Form
{
SCItemSet itemSet = new SCItemSet();
public Form3()
{
InitializeComponent();
}
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form3());
}
private void btnBrowse_Click(object sender, EventArgs e)
{
FolderBrowserDialog browse = new FolderBrowserDialog();
browse.ShowDialog();
txtShowPath.Text = browse.SelectedPath;
}
private void detail_Click(object sender, EventArgs e)
{
txtShowDetail.Text = string.Empty;
string ShowInfo="";
//string ShowPath = txtShowPath.Text.ToString().Replace("//", @"/");
getDirFiles(txtShowPath.Text);
for(int i=0;i<itemSet.Count;i++)
{
ShowInfo += itemSet[i].Name+"/r/n";
}
txtShowDetail.Text = ShowInfo.ToString();
}
public void getDirFiles(string strPaths)
{
DirectoryInfo d = new DirectoryInfo(strPaths);
DirectoryInfo[] dis = d.GetDirectories();
FileInfo[] fis = d.GetFiles();
foreach (FileInfo fi in fis)
{
SCItem item = new SCItem();
item.Name = fi.Name;
itemSet.Add(item);
}
string strPath;
foreach (DirectoryInfo di in dis)
{
strPath=strPaths+" //"+di.Name;
getDirFiles(strPath);
}
}
}
}
}