Esempio n. 1
0
 /// <summary>
 /// 获取文件名
 /// </summary>
 /// <param name="path"></param>
 /// <param name="separator"></param>
 /// <returns></returns>
 public static string GetFileName(string path, char separator = '/')
 {
     path = IOExtension.MakePathStandard(path);
     return(path.Substring(path.LastIndexOf(separator) + 1));
 }
Esempio n. 2
0
 /// <summary>
 /// 获取文件夹名
 /// </summary>
 /// <param name="fileName"></param>
 /// <returns></returns>
 public static string GetDirectoryName(string fileName)
 {
     fileName = IOExtension.MakePathStandard(fileName);
     return(fileName.Substring(0, fileName.LastIndexOf('/')));
 }