private void btnOK_Click(object sender, EventArgs e) { if (this.stbProName.Text != "") { RegexInfo myLoginInfo = new RegexInfo(); if (myLoginInfo.isProjectName(this.stbProName.Text)) { if (myLoginInfo.isProjectLocation(this.stbLocation.Text)) { projectLocation = this.stbLocation.Text + "\\" + this.stbProName.Text; if (Array.IndexOf <string>(MainForm.root_paths, projectLocation) != -1) { MessageBox.Show("打开工程名称冲突,请修改工程名称!", "消息提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.IsCreateSolution = true; createFolder(projectLocation); this.txtStatus.ForeColor = Color.Green; this.txtStatus.Text = "创建信息:创建成功!"; this.Close(); this.DialogResult = DialogResult.OK; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,请正确填写项目路径!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,请正确填写项目名称!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,项目名称不能为空!"; } }
private void btnOK_Click(object sender, EventArgs e) { if (this.stbFolderName.Text != "") { RegexInfo myLoginInfo = new RegexInfo(); if (myLoginInfo.isProjectName(this.stbFolderName.Text)) { if (MainForm.selectedNodePath != "") { folderLocation = MainForm.selectedNodePath + "\\" + this.stbFolderName.Text; DirectoryInfo myDirInfo = new DirectoryInfo(MainForm.selectedNodePath); DirectoryInfo [] chldFolders = myDirInfo.GetDirectories(); foreach (DirectoryInfo chldFolder in chldFolders) { newFolderNameList.Add(chldFolder.Name); newFolderName = newFolderNameList.ToArray(); } if (newFolderName != null) { if (Array.IndexOf <string>(newFolderName, this.stbFolderName.Text) != -1) { MessageBox.Show("文件夹名称冲突,请修改工程名称!", "消息提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.IsCreateFolder = true; createFolder(folderLocation); this.txtStatus.ForeColor = Color.Green; this.txtStatus.Text = "创建信息:创建成功!"; this.Close(); this.DialogResult = DialogResult.OK; } } else { this.IsCreateFolder = true; createFolder(folderLocation); this.txtStatus.ForeColor = Color.Green; this.txtStatus.Text = "创建信息:创建成功!"; this.Close(); this.DialogResult = DialogResult.OK; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,所选项目为空!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,请正确填写文件夹名称!"; } } else { this.txtStatus.ForeColor = Color.Red; this.txtStatus.Text = "创建信息:创建失败,文件夹名称不能为空!"; } }