判断是否下载指定客户端(遍历硬盘上的全部文件文件夹)
来源:互联网 发布:淘宝创想电玩 编辑:程序博客网 时间:2024/06/06 03:36
public void GetAllFiles(string fpath, string filetype)
{
//System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(fpath); // 遍历指定文件类型的文件
//System.IO.FileInfo[] fs = dir.GetFiles("*" + filetype);
//foreach (System.IO.FileInfo f in fs)
//{
// if (f.Name == "Client.exe")
// {
// res = true;
// finame = f.FullName;
// Label1.Text = finame;
// }
//}
foreach (string f in Directory.GetDirectories(fpath)) // 遍历指定文件夹类型的文件夹
{
DirectoryInfo di = new DirectoryInfo(@f);
if (!IsSystemHidden(di))
{
if (f.IndexOf("Documents and Settings") < 0)
{
if (f.IndexOf("英雄联盟") > 0)
{
string file1 = (f + "\\TCLS\\BackgroundDownloader.exe");
string file2 = (f + "\\TCLS\\Client.exe");
if (File.Exists(file1) && File.Exists(file2))
{
Label1.Text = file2;
}
}
else
{
GetAllFiles(f, filetype);
}
}
}
}
}
private bool IsSystemHidden(DirectoryInfo dirInfo)
{
if (dirInfo.Parent == null)
{
return false;
}
string attributes = dirInfo.Attributes.ToString();
if (attributes.IndexOf("Hidden") > -1 && attributes.IndexOf("System") > -1)
{
return true;
}
return false;
}
protected void Button1_Click(object sender, EventArgs e)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
for (int i = allDrives.Length - 1; i >= 0; i--)
{
if (allDrives[i].Name != "C:\\")
{
if (allDrives[i].DriveType.ToString() == "Fixed")
{
GetAllFiles(allDrives[i].Name, "exe"); //自动寻找目录、
}
}
}
}
{
//System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(fpath); // 遍历指定文件类型的文件
//System.IO.FileInfo[] fs = dir.GetFiles("*" + filetype);
//foreach (System.IO.FileInfo f in fs)
//{
// if (f.Name == "Client.exe")
// {
// res = true;
// finame = f.FullName;
// Label1.Text = finame;
// }
//}
foreach (string f in Directory.GetDirectories(fpath)) // 遍历指定文件夹类型的文件夹
{
DirectoryInfo di = new DirectoryInfo(@f);
if (!IsSystemHidden(di))
{
if (f.IndexOf("Documents and Settings") < 0)
{
if (f.IndexOf("英雄联盟") > 0)
{
string file1 = (f + "\\TCLS\\BackgroundDownloader.exe");
string file2 = (f + "\\TCLS\\Client.exe");
if (File.Exists(file1) && File.Exists(file2))
{
Label1.Text = file2;
}
}
else
{
GetAllFiles(f, filetype);
}
}
}
}
}
private bool IsSystemHidden(DirectoryInfo dirInfo)
{
if (dirInfo.Parent == null)
{
return false;
}
string attributes = dirInfo.Attributes.ToString();
if (attributes.IndexOf("Hidden") > -1 && attributes.IndexOf("System") > -1)
{
return true;
}
return false;
}
protected void Button1_Click(object sender, EventArgs e)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
for (int i = allDrives.Length - 1; i >= 0; i--)
{
if (allDrives[i].Name != "C:\\")
{
if (allDrives[i].DriveType.ToString() == "Fixed")
{
GetAllFiles(allDrives[i].Name, "exe"); //自动寻找目录、
}
}
}
}
0 0
- 判断是否下载指定客户端(遍历硬盘上的全部文件文件夹)
- 用VBA判断指定的文件夹或文件是否存在
- VBA判断指定的文件夹或文件是否存在
- Java遍历文件夹&判断是否存在某一类型的文件
- C#判断硬盘上的文件是否存在方法
- C#判断硬盘上的文件是否存在方法
- C#判断硬盘上的文件是否存在方法
- 移动指定文件夹内的全部文件
- 移动指定文件夹内的全部文件
- Delphi判断文件夹下子文件夹是否为空,及删除子文件夹,遍历文件夹及子文件夹的文件
- 用DirectoryExists和FileExists判断指定路径下是否存在指定的文件夹或文件
- 删除指定文件夹下小于指定大小的全部文件
- 判断指定文件夹是否存在
- php判断指定文件夹里是否含有子文件
- Qt文件操作:遍历文件夹中 指定格式的文件,并添加文件名到comboBox上
- java复制文件夹下全部的文件到指定目录
- 删除指定目录下的全部文件或文件夹
- 读取指定文件夹里面的所有图片取出里面其中一张图片和判断文件夹或文件是否存在
- Android WebView的Js对象注入漏洞解决方案
- iOS沙盒
- 行为型模式-Memento ( 备忘录模式 )
- C# Ajax 在前台调用报出未定义错误
- 禅道一键安装
- 判断是否下载指定客户端(遍历硬盘上的全部文件文件夹)
- 行为型模式-Observer ( 观察者模式 )
- JQuery基础选择器
- 有梦想的人,始终在路上!(记阿里实习生霸面经历,拿到offer)
- spring学习二:根据spring原理自己写个spring
- metasploit 首次渗透测试
- vc6.0 调试中遇到fscanf就结束,跳出窗口显示debug error floating point not load
- 行为型模式-State ( 状态模式 )
- Java集合Map接口与Map.Entry学习