Table of Contents

Interface IStorageProvider

Namespace
VpnHood.Net.Toolkit.Storages
Assembly
VpnHood.Net.Toolkit.dll

Represents the platform's part of a Storage: small text files by full path, kept as files or as the entries of a store that keeps no files.

public interface IStorageProvider

Remarks

It is synchronous, as it holds the app's own state, which the app reads as it starts, on the main thread, and writes behind synchronous setters. A store on the network would need a contract of its own: asynchronous, with a local copy and timeouts.

Methods

Delete(string)

Deletes a file; a missing one is passed over.

void Delete(string filePath)

Parameters

filePath string

The file's full path.

GetSignature(string)

Gets a signature of a file, read without its content, which changes when the file is written as a rule: a write that keeps what the signature reads, such as a file's time and length, shows no change.

string GetSignature(string filePath)

Parameters

filePath string

The file's full path.

Returns

string

The signature.

Read(string)

Reads a file's text.

string? Read(string filePath)

Parameters

filePath string

The file's full path.

Returns

string

The text, or null when there is no such file.

Write(string, string)

Writes a file's text, whole or not at all: a write the provider cannot keep fails, and the old text stays.

void Write(string filePath, string content)

Parameters

filePath string

The file's full path.

content string

The text.