Ejemplo n.º 1
0
        /// <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);
        }