Browse Source

Ensure project name is valid before creating solution.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1472 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
09165fa450
  1. 24
      src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs

24
src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs

@ -251,11 +251,6 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs @@ -251,11 +251,6 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
((ListView)ControlDictionary["templateListView"]).View = ((RadioButton)ControlDictionary["smallIconsRadioButton"]).Checked ? View.List : View.LargeIcon;
}
public bool IsFilenameAvailable(string fileName)
{
return true;
}
public string NewProjectLocation;
public string NewCombineLocation;
@ -271,12 +266,25 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs @@ -271,12 +266,25 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
string solution = ((TextBox)ControlDictionary["solutionNameTextBox"]).Text;
string name = ((TextBox)ControlDictionary["nameTextBox"]).Text;
string location = ((TextBox)ControlDictionary["locationTextBox"]).Text;
if (!FileUtility.IsValidFileName(solution) || solution.IndexOf(Path.DirectorySeparatorChar) >= 0 ||
!FileUtility.IsValidFileName(name) || name.IndexOf(Path.DirectorySeparatorChar) >= 0 ||
!FileUtility.IsValidFileName(location)) {
if (!FileUtility.IsValidFileName(solution)
|| solution.IndexOf(Path.DirectorySeparatorChar) >= 0
|| solution.IndexOf(Path.AltDirectorySeparatorChar) >= 0
|| !FileUtility.IsValidFileName(name)
|| name.IndexOf(Path.AltDirectorySeparatorChar) >= 0
|| name.IndexOf(Path.DirectorySeparatorChar) >= 0
|| !FileUtility.IsValidFileName(location))
{
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.IllegalProjectNameError}");
return;
}
if (!char.IsLetter(name[0]) && name[0] != '_') {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.ProjectNameMustStartWithLetter}");
return;
}
if (name.EndsWith(".")) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Gui.Dialogs.NewProjectDialog.ProjectNameMustNotEndWithDot}");
return;
}
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.NewProjectDialog.AutoCreateProjectSubdir", ((CheckBox)ControlDictionary["autoCreateSubDirCheckBox"]).Checked);
if (((ListView)ControlDictionary["templateListView"]).SelectedItems.Count == 1 && ((TextBox)ControlDictionary["locationTextBox"]).Text.Length > 0 && ((TextBox)ControlDictionary["solutionNameTextBox"]).Text.Length > 0) {

Loading…
Cancel
Save