From 685f2456a594df2771ffd3216a499b90aaed7f21 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 19 Dec 2022 00:26:39 +0000 Subject: [PATCH] Add OpenFile and CloseFile methods to IReadOnlyFilesystem. --- Interfaces/IReadOnlyFilesystem.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Interfaces/IReadOnlyFilesystem.cs b/Interfaces/IReadOnlyFilesystem.cs index 21ab419af..b16c447d7 100644 --- a/Interfaces/IReadOnlyFilesystem.cs +++ b/Interfaces/IReadOnlyFilesystem.cs @@ -125,4 +125,26 @@ public interface IReadOnlyFilesystem : IFilesystem /// Link path. /// Link destination. ErrorNumber ReadLink(string path, out string dest); + + /// Opens a file for reading. + /// Path to the file. + /// Represents the opened file and is needed for other file-related operations. + /// Error number + ErrorNumber OpenFile(string path, out IFileNode node); + + /// Closes an file, freeing any private data allocated on opening. + /// The file node. + /// Error number. + ErrorNumber CloseFile(IFileNode node); +} + +/// Represents an opened file from a filesystem +public interface IFileNode +{ + /// Path to the file + string Path { get; } + /// File length + long Length { get; } + /// Current position in file + long Offset { get; } } \ No newline at end of file