private static string CleanName(string input)
{
var ext = Path.GetExtension(input);
const StringComparison ord = StringComparison.Ordinal;
input = input.Remove(input.LastIndexOf(ext, StringComparison.OrdinalIgnoreCase), ext.Length);
// Remove all [ and ending ]
while (input.IndexOf("[", ord) != -1 && input.IndexOf("]", ord) != -1)
input = input.Replace(input.Substring(input.IndexOf("[", ord), (input.IndexOf("]", ord) - input.IndexOf("[", ord) + 1)), "");
//Remove all { and ending }
while (input.IndexOf("{", ord) != -1 && input.IndexOf("}", ord) != -1)
input = input.Replace(input.Substring(input.IndexOf("{", ord), (input.IndexOf("}", ord) - input.IndexOf("{", ord) + 1)), "");
input = input.Replace("_", " ");
return input.Trim() + ext;
}