private static void ShowAllFilesAt(string baseDir, int tab = 0) { string tabString = new string(' ', tab * 2); Debug.WriteLine($" {tabString}Files at '{baseDir}':\n"); PhysFS.Instance.Enumerate( baseDir, (string dir, string filename) => { Debug.WriteLine($" {tabString}dir: {dir}, filename: {filename}"); string fullPath; if (dir.EndsWith("/")) { fullPath = string.Concat(dir, filename); } else { fullPath = string.Concat(dir, "/", filename); } if (PhysFS.Stat(fullPath).FileType == PHYSFS_FileType.PHYSFS_FILETYPE_DIRECTORY) { ShowAllFilesAt(fullPath, tab + 1); } return(PHYSFS_EnumerateCallbackResult.PHYSFS_ENUM_OK); } ); }
public static bool Test_Stat() { PhysFS.Initialize(); PhysFS.Instance.Mount(TestFolder, mountPoint: "", appendToPath: true); PHYSFS_Stat stat = PhysFS.Stat("test.txt"); System.DateTimeOffset createTime = System.DateTimeOffset.FromUnixTimeSeconds(stat.CreateTime), modTime = System.DateTimeOffset.FromUnixTimeSeconds(stat.ModTime), accessTime = System.DateTimeOffset.FromUnixTimeSeconds(stat.AccessTime); Debug.WriteLine($" File Size: {stat.FileSize} bytes, ModTime: {modTime}, Create Time: {createTime}, Access Time: {accessTime}, File Type: {stat.FileType}, Is Readonly: {System.Convert.ToBoolean(stat.IsReadonly)}"); PhysFS.Deinitialize(); return(true); }