private static bool IsDirectory(string path) { if (XLPack.IsFileExist(path)) { return(false); } var fd = new XLPack.afs_finddata(); var first = XLPack.FindFirst(path, ref fd); var flag = first != -1; XLPack.FindClose(first); return(flag); }
private static bool IsPathExist(string path) { if (XLPack.IsFileExist(path)) { return(true); } var fd = new XLPack.afs_finddata(); var first = XLPack.FindFirst(path, ref fd); var exist = first != -1; XLPack.FindClose(first); return(exist); }
private static List <(string, bool)> GetFiles(string path) { var result = new List <(string, bool)>(); var file = path + "*"; var fd = new XLPack.afs_finddata(); var findHandle = XLPack.FindFirst(file, ref fd); if (findHandle != -1) { do { var fileName = Marshal.PtrToStringAnsi(XLPack.GetFileName(ref fd)); var tempFile = path + fileName; var isDirectory = !XLPack.IsFileExist(tempFile); result.Add((tempFile, isDirectory)); } while (XLPack.FindNext(findHandle, ref fd) != -1); } XLPack.FindClose(findHandle); return(result); }