// --------------------------------------------------------------------------------------------- // Copyright (c) 2021-2024, Jiaqi (0x7c13) Liu. All rights reserved. // See LICENSE file in the project root for license information. // --------------------------------------------------------------------------------------------- namespace Pal3.Core.FileSystem { using System.Collections.Generic; /// /// Interface for file system operations. /// public interface IFileSystem { /// /// Get file system's root path. /// /// Root directory path public string GetRootPath(); /// /// Check if file exists in the archive or any of the segmented archives using virtual path. /// /// File virtual path /// 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 /// File content in byte array public byte[] ReadAllBytes(string fileVirtualPath); /// /// Searches for files in the file system that match the specified keyword. /// /// The keyword to search for. If empty, all files will be returned. /// A list of file paths that match the specified keyword. public IList Search(string keyword = ""); /// /// Searches for files in the CPK file system that match the specified keywords. /// /// The list of keywords to search for. /// A dictionary where the keys are the file paths of the matching files, /// and the values are the lines in the files that contain the keywords. public IDictionary> BatchSearch(IList keywords); } }