//------------------------------------------------------------ // Game Framework // Copyright © 2013-2021 loyalsoft. All rights reserved. // Homepage: http://www.game7000.com/ // Feedback: http://www.game7000.com/ //------------------------------------------------------------ using System.Collections.Generic; using System.IO; namespace GameFramework.FileSystem { /// /// 文件系统接口。 /// public interface IFileSystem { /// /// 获取文件系统完整路径。 /// string FullPath { get; } /// /// 获取文件系统访问方式。 /// FileSystemAccess Access { get; } /// /// 获取文件数量。 /// int FileCount { get; } /// /// 获取最大文件数量。 /// int MaxFileCount { get; } /// /// 获取文件信息。 /// /// 要获取文件信息的文件名称。 /// 获取的文件信息。 FileInfo GetFileInfo(string name); /// /// 获取所有文件信息。 /// /// 获取的所有文件信息。 FileInfo[] GetAllFileInfos(); /// /// 获取所有文件信息。 /// /// 获取的所有文件信息。 void GetAllFileInfos(List results); /// /// 检查是否存在指定文件。 /// /// 要检查的文件名称。 /// 是否存在指定文件。 bool HasFile(string name); /// /// 读取指定文件。 /// /// 要读取的文件名称。 /// 存储读取文件内容的二进制流。 byte[] ReadFile(string name); /// /// 读取指定文件。 /// /// 要读取的文件名称。 /// 存储读取文件内容的二进制流。 /// 实际读取了多少字节。 int ReadFile(string name, byte[] buffer); /// /// 读取指定文件。 /// /// 要读取的文件名称。 /// 存储读取文件内容的二进制流。 /// 存储读取文件内容的二进制流的起始位置。 /// 实际读取了多少字节。 int ReadFile(string name, byte[] buffer, int startIndex); /// /// 读取指定文件。 /// /// 要读取的文件名称。 /// 存储读取文件内容的二进制流。 /// 存储读取文件内容的二进制流的起始位置。 /// 存储读取文件内容的二进制流的长度。 /// 实际读取了多少字节。 int ReadFile(string name, byte[] buffer, int startIndex, int length); /// /// 读取指定文件。 /// /// 要读取的文件名称。 /// 存储读取文件内容的二进制流。 /// 实际读取了多少字节。 int ReadFile(string name, Stream stream); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的长度。 /// 存储读取文件片段内容的二进制流。 byte[] ReadFileSegment(string name, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的偏移。 /// 要读取片段的长度。 /// 存储读取文件片段内容的二进制流。 byte[] ReadFileSegment(string name, int offset, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 存储读取文件片段内容的二进制流。 /// 实际读取了多少字节。 int ReadFileSegment(string name, byte[] buffer); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 存储读取文件片段内容的二进制流。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, byte[] buffer, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 存储读取文件片段内容的二进制流。 /// 存储读取文件片段内容的二进制流的起始位置。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, byte[] buffer, int startIndex, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的偏移。 /// 存储读取文件片段内容的二进制流。 /// 实际读取了多少字节。 int ReadFileSegment(string name, int offset, byte[] buffer); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的偏移。 /// 存储读取文件片段内容的二进制流。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, int offset, byte[] buffer, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的偏移。 /// 存储读取文件片段内容的二进制流。 /// 存储读取文件片段内容的二进制流的起始位置。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, int offset, byte[] buffer, int startIndex, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 存储读取文件片段内容的二进制流。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, Stream stream, int length); /// /// 读取指定文件的指定片段。 /// /// 要读取片段的文件名称。 /// 要读取片段的偏移。 /// 存储读取文件片段内容的二进制流。 /// 要读取片段的长度。 /// 实际读取了多少字节。 int ReadFileSegment(string name, int offset, Stream stream, int length); /// /// 写入指定文件。 /// /// 要写入的文件名称。 /// 存储写入文件内容的二进制流。 /// 是否写入指定文件成功。 bool WriteFile(string name, byte[] buffer); /// /// 写入指定文件。 /// /// 要写入的文件名称。 /// 存储写入文件内容的二进制流。 /// 存储写入文件内容的二进制流的起始位置。 /// 是否写入指定文件成功。 bool WriteFile(string name, byte[] buffer, int startIndex); /// /// 写入指定文件。 /// /// 要写入的文件名称。 /// 存储写入文件内容的二进制流。 /// 存储写入文件内容的二进制流的起始位置。 /// 存储写入文件内容的二进制流的长度。 /// 是否写入指定文件成功。 bool WriteFile(string name, byte[] buffer, int startIndex, int length); /// /// 写入指定文件。 /// /// 要写入的文件名称。 /// 存储写入文件内容的二进制流。 /// 是否写入指定文件成功。 bool WriteFile(string name, Stream stream); /// /// 写入指定文件。 /// /// 要写入的文件名称。 /// 存储写入文件内容的文件路径。 /// 是否写入指定文件成功。 bool WriteFile(string name, string filePath); /// /// 将指定文件另存为物理文件。 /// /// 要另存为的文件名称。 /// 存储写入文件内容的文件路径。 /// 是否将指定文件另存为物理文件成功。 bool SaveAsFile(string name, string filePath); /// /// 重命名指定文件。 /// /// 要重命名的文件名称。 /// 重命名后的文件名称。 /// 是否重命名指定文件成功。 bool RenameFile(string oldName, string newName); /// /// 删除指定文件。 /// /// 要删除的文件名称。 /// 是否删除指定文件成功。 bool DeleteFile(string name); } }