Beispiel #1
0
        /// <summary>
        /// Cleanse the project name, by replacing characters like '@', '$' with '_'
        /// </summary>
        /// <param name="projectName">The name to be cleansed</param>
        /// <returns>string</returns>
        static private string CleanseProjectName(string projectName)
        {
            ErrorUtilities.VerifyThrow(projectName != null, "Null strings not allowed.");

            // If there are no special chars, just return the original string immediately.
            // Don't even instantiate the StringBuilder.
            int indexOfChar = projectName.IndexOfAny(s_charsToCleanse);

            if (indexOfChar == -1)
            {
                return(projectName);
            }

            // This is where we're going to work on the final string to return to the caller.
            StringBuilder cleanProjectName = new StringBuilder(projectName);

            // Replace each unclean character with a clean one
            foreach (char uncleanChar in s_charsToCleanse)
            {
                cleanProjectName.Replace(uncleanChar, cleanCharacter);
            }

            return(cleanProjectName.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// Changes the unique name of the project.
        /// </summary>
        internal void UpdateUniqueProjectName(string newUniqueName)
        {
            ErrorUtilities.VerifyThrowArgumentLength(newUniqueName, "newUniqueName");

            _uniqueProjectName = newUniqueName;
        }