日期:2014-05-17 浏览次数:21072 次
foldPath = dialog.SelectedPath;
this.label4.Text = foldPath;
DirectoryInfo TheFolder = new DirectoryInfo(foldPath);
fileName = Path.GetFileName(dialog.SelectedPath);//获取当前打开文件夹名称
foreach (FileInfo NextFile in TheFolder.GetFiles())
{
this.listBox1.Items.Add(NextFile.Name);
string tempStr = File.ReadAllText(NextFile.FullName, Encoding.GetEncoding("GB2312"));//读取txt内容
this.richTextBox1.Text = tempStr;
}
private void ScanAllFolder(string pathName)
{
try
{
if (!Directory.Exists(pathName))
{
return;
}
DirectoryInfo processDirectory = new DirectoryInfo(pathName);
FileSystemInfo[] fileSystemInfos = processDirectory.GetFileSystemInfos();
foreach (FileSystemInfo fileSystemInfo in fileSystemInfos)
{
if (fileSystemInfo is DirectoryInfo &&