public static bool Test_Archiver() { PhysFS.Initialize(); TestArchiver archiver = new TestArchiver(); PhysFS.Instance.RegisterArchiver(archiver); PHYSFS_ArchiveInfo[] supportedArchiveTypes = PhysFS.Instance.SupportedArchiveTypes; #if PRINT_INFO foreach (PHYSFS_ArchiveInfo archiveInfo in supportedArchiveTypes) { Debug.WriteLine($" ext: {archiveInfo.Extension} | desc: {archiveInfo.Description} | author: {archiveInfo.Author} | url: {archiveInfo.Url} | sym links: {archiveInfo.SupportsSymlinks == 1}"); } #endif PhysFS.Instance.Mount("folder/hue file.xyz", mountPoint: "", appendToPath: true); ShowAllFilesAt("/"); ShowSearchPaths(); using (PhysFSStream stream = new PhysFSStream(PhysFSFile.OpenRead("file a"))) { byte[] buffer = new byte[stream.Length]; int bytesRead = stream.Read(buffer, 0, buffer.Length); string text = Encoding.UTF8.GetString(buffer); Debug.WriteLine($" File contents:\n{text}"); Debug.WriteLine($" Bytes Read: {bytesRead}"); } PhysFS.Deinitialize(); return(true); }
public static bool Test_PhysFSStreamRead() { PhysFS.Initialize(); PhysFS.Instance.Mount(TestFolder, mountPoint: "", appendToPath: true); Debug.WriteLine($" Reading 'just a text.txt' file"); PhysFSFile file = PhysFSFile.OpenRead("test.txt"); using (PhysFSStream stream = new PhysFSStream(file)) { byte[] buffer = new byte[stream.Length]; int bytesRead = stream.Read(buffer, 0, buffer.Length); string text = Encoding.UTF8.GetString(buffer); //Debug.WriteLine($" File contents:\n{text}"); Debug.WriteLine($" Bytes Read: {bytesRead}"); } PhysFS.Deinitialize(); return(true); }