using System.Collections.Immutable;
namespace Barotrauma.LuaCs.Services.Safe;
public interface ISafeStorageService : IStorageService, ISafeStorageValidation { }
public interface ISafeStorageValidation
{
///
/// Checks the given file path to see if it can be read. This includes any permissions, whitelists and OS checks.
///
/// The absolute path to the file.
/// Whether to only check for read permissions only, or full RWM if false.
/// Whether to only check if the file is safe to access, without checking accessibility at the OS level.
/// Whether the file is accessible.
bool IsFileAccessible(string path, bool readOnly, bool checkWhitelistOnly = true);
///
/// Adds the given path to the specified whitelists.
///
/// The path to the file, exactly as it will be passed to the Try(Load|Save) methods in .
/// Whether to add it to the read whitelist only, or Read+Write whitelists.
void AddFileToWhitelist(string path, bool readOnly = true);
///
/// Adds the given collection of file paths to whitelists (Read|+Write)
///
/// The paths to the files, formatted exactly as it will be passed to the Try(Load|Save) methods in .
/// Whether to add it to the read whitelist only, or Read+Write whitelists.
void AddFilesToWhitelist(ImmutableArray paths, bool readOnly = true);
///
/// Removes the given path from all whitelists (Read|+Write).
///
///
void RemoveFileFromAllWhitelists(string path);
///
/// Sets the whitelist filtering for read-only file permissions for the instance. Overwrites previous list.
///
/// List of file paths allowed, as will be passed to the Try(Load|Save) methods.
FluentResults.Result SetReadOnlyWhitelist(ImmutableArray filePaths);
///
/// Sets the whitelist filtering for read & write file permissions for the instance. Overwrites previous lists.
///
/// List of file paths allowed, as will be passed to the Try(Load|Save) methods.
FluentResults.Result SetReadWriteWhitelist(ImmutableArray filePaths);
///
/// Deletes all paths from all white lists.
///
void ClearAllWhitelists();
}