internal static void CheckInvalidPathChars(string path, bool checkAdditional = false) { if (path != null) { if (!Path2.HasIllegalCharacters(path, checkAdditional)) { return; } else { throw new ArgumentException("The path has invalid characters.", "path"); } } else { throw new ArgumentNullException("path"); } }
public static string GetFileName(string path) { char chr; if (path != null) { Path2.CheckInvalidPathChars(path, false); int length = path.Length; int num = length; do { int num1 = num - 1; num = num1; if (num1 < 0) { return(path); } chr = path[num]; }while (chr != Path2.DirectorySeparatorChar && chr != Path2.AltDirectorySeparatorChar && chr != Path2.VolumeSeparatorChar); return(path.Substring(num + 1, length - num - 1)); } return(path); }