private static string Fixup(string name)
{
string fixedUpName;
if (fixedupNameDictionary.TryGetValue(name, out fixedUpName))
{
return fixedUpName;
}
fixedUpName = name.Replace('.', '_');
// don't use encoded <> in filename, as browsers re-encode it in links to %3C
// and the link fails
fixedUpName = fixedUpName.Replace("<", "!").Replace(">", "!");
fixedUpName = fixedUpName.Replace("Amazon", "");
fixedUpName = fixedUpName.Replace("_Model_", "");
fixedUpName = fixedUpName.Replace("_Begin", "");
fixedUpName = fixedUpName.Replace("_End", "");
fixedUpName = fixedUpName.Replace("Client_", "");
fixedUpName = fixedUpName.Replace("+", "");
fixedUpName = fixedUpName.Replace("_", "");
foreach (var k in ServiceNamespaceContractions.Keys)
{
fixedUpName = fixedUpName.Replace(k, ServiceNamespaceContractions[k]);
}
if (fixedUpName.Length > MAX_FILE_SIZE)
{
throw new ApplicationException(string.Format("Filename: {0} is too long", fixedUpName));
}
fixedupNameDictionary[name] = fixedUpName;
return fixedUpName;
}