// --------------------------------------------------------------------------------------------- // Copyright (c) 2021-2023, Jiaqi Liu. All rights reserved. // See LICENSE file in the project root for license information. // --------------------------------------------------------------------------------------------- namespace Core.FileSystem { using System.Collections.Generic; /// /// File system wrapper for CPack archives /// public interface ICpkFileSystem { /// /// Get file system's root path. /// /// Root directory path public string GetRootPath(); /// /// Mount a Cpk archive to the file system. /// /// CPK file relative path /// Codepage CPK file uses for encoding text info public void Mount(string cpkFileRelativePath, int codepage); /// /// Check if file exists in any of the segmented archives using virtual path. /// /// File virtual path {Cpk file name}\{File relative path inside archive} /// Name of the segmented archive if exists /// True if file exists in segmented archive public bool FileExistsInSegmentedArchive(string fileVirtualPath, out string segmentedArchiveName); /// /// Check if file exists in the archive using virtual path. /// /// File virtual path {Cpk file name}\{File relative path inside archive} /// Example: music.cpk\music\PI01.mp3 /// True if file exists public bool FileExists(string fileVirtualPath); /// /// Read all bytes of the given file. /// /// File virtual path inside CPK archive /// Decompressed, ready-to-go file content in byte array public byte[] ReadAllBytes(string fileVirtualPath); /// /// Preload archive into memory for faster read performance. /// public void LoadArchiveIntoMemory(string cpkFileName); /// /// Dispose in-memory archive data. /// public void DisposeInMemoryArchive(string cpkFileName); /// /// Dispose all in-memory archive data. /// public void DisposeAllInMemoryArchives(); /// /// Extract all archives to the specified destination /// public void ExtractTo(string outputFolder); /// /// Search files using keyword. /// /// /// File path enumerable public IEnumerable Search(string keyword = ""); } }