void UpperLowFileName_HandleFileEvent(FileProcess FileProcess, string filePath) { string destDir = currentProcess.Tag as String; string fileName = Path.GetFileName(filePath); if (this.enableUpLow) { fileName = isUp ? fileName.ToUpper() : fileName.ToLower(); } string newPath = Path.Combine(destDir, fileName); if (File.Exists(newPath)) { File.Delete(newPath); } File.Move(filePath, newPath); ShowInfo(FileProcess.Info); }
private void MoveAndUpperLowFileName(string sourseDir, string destDir) { if (!Directory.Exists(destDir)) { Directory.CreateDirectory(destDir); } string[] files = Directory.GetFiles(sourseDir); string msg = " 移动 "; if (this.enableUpLow) { msg += isUp ? "并 大写文件名 " : "并 小写文件名 "; } string infoHeader = "总进度 " + (allCountProcess) + "/" + allCount + msg; currentProcess = new FileProcess(files, infoHeader, this.ProgressBar); currentProcess.HandleFileEvent += new FileProcess.HandleFileEventHandler(UpperLowFileName_HandleFileEvent); currentProcess.Tag = destDir; currentProcess.Run(); }