|
|
|
@ -120,21 +120,24 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates |
|
|
|
|
|
|
|
|
|
|
|
// filter 'illegal' chars from standard namespace
|
|
|
|
// filter 'illegal' chars from standard namespace
|
|
|
|
if (newProjectName != null && newProjectName.Length > 0) { |
|
|
|
if (newProjectName != null && newProjectName.Length > 0) { |
|
|
|
char ch = newProjectName[0]; |
|
|
|
char ch = '.'; |
|
|
|
// can only begin with a letter or '_'
|
|
|
|
for (int i = 0; i < newProjectName.Length; ++i) { |
|
|
|
if (!Char.IsLetter(ch)) { |
|
|
|
if (ch == '.') { |
|
|
|
standardNamespace.Append('_'); |
|
|
|
// at beginning or after '.', only a letter or '_' is allowed
|
|
|
|
} else { |
|
|
|
ch = newProjectName[i]; |
|
|
|
standardNamespace.Append(ch); |
|
|
|
if (!Char.IsLetter(ch)) { |
|
|
|
} |
|
|
|
standardNamespace.Append('_'); |
|
|
|
for (int i = 1; i < newProjectName.Length; ++i) { |
|
|
|
} else { |
|
|
|
ch = newProjectName[i]; |
|
|
|
standardNamespace.Append(ch); |
|
|
|
// can only contain letters, digits or '_'
|
|
|
|
} |
|
|
|
if (!Char.IsLetterOrDigit(ch) && ch != '.') { |
|
|
|
|
|
|
|
standardNamespace.Append('_'); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
standardNamespace.Append(ch); |
|
|
|
ch = newProjectName[i]; |
|
|
|
|
|
|
|
// can only contain letters, digits or '_'
|
|
|
|
|
|
|
|
if (!Char.IsLetterOrDigit(ch) && ch != '.') { |
|
|
|
|
|
|
|
standardNamespace.Append('_'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
standardNamespace.Append(ch); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|