private static string GetExceptionMessage(uint exceptionCode) { var msg = new Win32Exception((int)exceptionCode).Message.Replace(' ', '_'); foreach (var c in Path.GetInvalidFileNameChars()) { msg = msg.Replace(c, '$'); } return(msg); }