src/Form1.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace PictureCategory
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread imageThread;
Task imageTask;
CancellationToken token = new CancellationToken();
private void button1_Click(object sender, EventArgs e)
{
//获取输入目录的所有文件
if (string.IsNullOrEmpty(textBox_inputPicPath.Text) || !Directory.Exists(textBox_inputPicPath.Text))
{
MessageBox.Show("输入目录不能为空/路径不存在");
return;
}
//获取输入目录的所有文件
if (string.IsNullOrEmpty(textBox_outPutPath.Text) || !Directory.Exists(textBox_outPutPath.Text))
{
MessageBox.Show("输出目录不能为空/路径不存在");
return;
}
var files = GetAllPictures(textBox_inputPicPath.Text, "");
string errorPath = Path.Combine(textBox_outPutPath.Text, "errorPic");
if (!Directory.Exists(errorPath))
{
Directory.CreateDirectory(errorPath);
}
imageThread = new Thread(() => moveFiles(files, errorPath));
imageThread.Start();
//当前按钮禁用
this.start_btn.Text = "暂停整理";
this.end_btn.Enabled = true;
//imageTask = new Task(() => moveFiles(files, errorPath), token);
}
private void moveFiles(List<string> files, string errorPath)
{
int startIndex = 0;
//将文件拷贝至对应目录
foreach (var file in files)
{
FileInfo fi = new FileInfo(file);
var YearPath = Path.Combine(textBox_outPutPath.Text, fi.LastWriteTime.Year.ToString());
if (!Directory.Exists(YearPath))
后面还有 55 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。