private static string RemoveDangerousCharacters(string name)
{
var dangerousCharacters = new List<char>();
dangerousCharacters.AddRange(PathUtilities.GetInvalidOSIndependentFileNameChars());
//dangerousCharacters.Add('.'); Moved this to a trim because SHRP uses names like "SHRP 2.3" (term 2, week 3)
foreach (char c in dangerousCharacters)
{
name = name.Replace(c, ' ');
}
name = name.TrimStart(new [] {'.',' ','\t'});
// Windows does not allow directory names ending in period.
// If we give it a chance, it will make a directory without the dots,
// but all our code that thinks the folder name has the dots will break (e.g., BL-
name = name.TrimEnd(new[] {'.'});
return name.Trim();
}