Class DataStore
Inheritance
System.Object
DataStore
Implements
System.IDisposable
Assembly: Eco.Core.dll
Syntax
public sealed class DataStore : Object, IDisposable
Constructors
DataStore(String, StorageConfig)
Declaration
public DataStore(string name, StorageConfig storageConfig)
Parameters
Type |
Name |
Description |
System.String |
name |
|
StorageConfig |
storageConfig |
|
Properties
Filename
Declaration
public string Filename { get; }
Property Value
Type |
Description |
System.String |
|
Name
Declaration
public string Name { get; }
Property Value
Type |
Description |
System.String |
|
NumEntries
Declaration
public int NumEntries { get; }
Property Value
Type |
Description |
System.Int32 |
|
ReadOnly
Declaration
public bool ReadOnly { get; }
Property Value
Type |
Description |
System.Boolean |
|
StorageConfig
Declaration
public StorageConfig StorageConfig { get; }
Property Value
Methods
BackupAsync(IFileStorage)
Declaration
public Task BackupAsync(IFileStorage fileStorage)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
CreateStorageHandle(String, String)
Declaration
public IPersistent CreateStorageHandle(string folder, string name)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.String |
name |
|
Returns
Delete(String)
Declaration
public void Delete(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Dispose()
Declaration
FolderExists(String)
Checks if non-empty folder
exists in the zip archive.
Declaration
public bool FolderExists(string folder)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
Returns
Type |
Description |
System.Boolean |
|
GetFileName(String)
Declaration
public string GetFileName(string saveName)
Parameters
Type |
Name |
Description |
System.String |
saveName |
|
Returns
Type |
Description |
System.String |
|
GetFileNames(String)
Returns file names in zip archive's folder
.
Declaration
public List<string> GetFileNames(string folder)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
Returns
Type |
Description |
System.Collections.Generic.List<System.String> |
|
Load<T>(String, Action<T>, Boolean)
Declaration
public void Load<T>(string folder, Action<T> onLoad, bool migrate = true)
where T : IStorage
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.Action<T> |
onLoad |
|
System.Boolean |
migrate |
|
Type Parameters
LoadAsync<T>(String, Action<T>)
Declaration
public void LoadAsync<T>(string folder, Action<T> onLoad)
where T : IStorage
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.Action<T> |
onLoad |
|
Type Parameters
LoadFileAsStream(String)
Load a singular entry from the zip file.
Declaration
public MemoryStream LoadFileAsStream(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
Type |
Description |
System.IO.MemoryStream |
|
LoadFileAsStreamAsync(String)
Declaration
public ValueTask<MemoryStream> LoadFileAsStreamAsync(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.IO.MemoryStream> |
|
LoadFileAsStringAsync(String)
Loads file asynchronously from DataStore as a string.
Declaration
public ValueTask<string> LoadFileAsStringAsync(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask<System.String> |
|
OpenZipFile()
Declaration
public void OpenZipFile()
WaitExclusiveAccess()
Declaration
public DataStore.ExclusiveAccess WaitExclusiveAccess()
Returns
WaitExclusiveAccessAsync()
Declaration
public ValueTask<DataStore.ExclusiveAccess> WaitExclusiveAccessAsync()
Returns
WriteAsync(String, String)
Writes content
to the entry with name fileName
.
Declaration
public ValueTask WriteAsync(string fileName, string content)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
System.String |
content |
|
Returns
Type |
Description |
System.Threading.Tasks.ValueTask |
|
Implements
System.IDisposable
Extension Methods