/// <summary> /// 执行 /// </summary> /// <returns></returns> public override bool Do() { var reader = new IoParamReader(this.OperationInfo.ParamFilePath); foreach (var item in reader) { this.CurrentParam = item; if (File.Exists(item.OutputPath)) { if (item.IsOverwrite) { var Message = "文件(夹)已存在,即将覆盖 " + item.OutputPath; this.OnStatedMessageProduced(StatedMessage.GetProcessing(Message)); } else { var Message = "文件(夹)已存在,复制操作取消 " + item.OutputPath; this.OnStatedMessageProduced(StatedMessage.GetProcessing(Message)); } } if (Geo.Utils.FileUtil.CopyFileOrDirectory(item.InputPath, item.OutputPath, item.IsOverwrite)) { var Message = "已复制 " + item.InputPath + " 到 " + item.OutputPath; this.OnStatedMessageProduced(StatedMessage.GetProcessing(Message)); } } return(true); }
/// <summary> /// 执行 /// </summary> /// <returns></returns> public override bool Do() { var reader = new IoParamReader(this.OperationInfo.ParamFilePath); reader.ItemSpliters = new string[] { "\t" }; foreach (var item in reader) { this.CurrentParam = item; if (File.Exists(item.OutputPath)) { if (item.IsOverwrite) { this.StatedMessage = StatedMessage.Processing; this.StatedMessage.Message = "文件(夹)已存在,即将覆盖 " + item.OutputPath; this.OnStatedMessageProduced(); } else { this.StatedMessage = StatedMessage.Processing; this.StatedMessage.Message = "文件(夹)已存在,操作取消 " + item.OutputPath; this.OnStatedMessageProduced(); } } string directory = Geo.Utils.FileUtil.GetDirectory(item.OutputPath); GnsserProject Project = new GnsserProject(); Project.ProjectDirectory = directory; Project.CheckOrCreateProjectDirectories(); //添加工作流 Project.SetWorkflowFiles(item.InputPath); Project.SaveToFile(); this.StatedMessage = StatedMessage.Processing; this.StatedMessage.Message = "已在 " + directory + " 创建工程目录 "; this.OnStatedMessageProduced(); //if (Geo.Utils.FileUtil.MoveFileOrDirectory(key.InputPath, key.OutputPath, key.IsOverwrite)) //{ // this.StatedMessage = StatedMessage.Processing; // this.StatedMessage.Message = "已移动 " + key.InputPath + " 到 " + key.OutputPath; // this.OnStatedMessageProduced(); //} } return(true); }
/// <summary> /// 执行 /// </summary> /// <returns></returns> public override bool Do() { var reader = new IoParamReader(this.OperationInfo.ParamFilePath); foreach (var item in reader) { this.CurrentParam = item; var inPath = item.InputPath; var outPath = item.OutputPath; var outFile = BuildOutputFilePath(outPath, inPath); CheckOrExecute(inPath, outFile, item.IsOverwrite); var Message = "已执行 " + item.InputPath + " 到 " + item.OutputPath; this.OnStatedMessageProduced(StatedMessage.GetProcessed(Message)); } return(true); }