private static string ShortenFileName([NotNull] string fileName)
{
if (fileName == null)
{
throw new ArgumentNullException(nameof(fileName));
}
if (fileName.Length < 30)
{
return fileName;
}
var proposed = Path.GetFileName(fileName);
var drive = Path.GetPathRoot(fileName);
if (proposed.Length < 30)
{
return drive + "...\\" + proposed;
}
return drive + "...\\" + proposed.Substring(proposed.Length - 30);
}
}