// --------------------------------------------------------------------------------------------- // Copyright (c) 2021-2022, Jiaqi Liu. All rights reserved. // See LICENSE.txt in the project root for license information. // --------------------------------------------------------------------------------------------- namespace Core.FileSystem { using System.Collections.Generic; using System.IO; /// /// 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 public void Mount(string cpkFileRelativePath); /// /// Check if file exists in the archive using virtual path. /// /// File virtual path inside CPK archive /// True if file exists public bool FileExists(string fileVirtualPath); /// /// Open a stream pointing to the file position and return size /// of the file for caller to consume. /// /// File virtual path inside CPK archive /// Size of the file /// True if file is compressed /// public Stream Open(string fileVirtualPath, out uint size, out bool compressed); /// /// 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(); /// /// Search files using keyword /// /// /// File path enumerable public IEnumerable Search(string keyword = ""); } }