Show / Hide Table of Contents

Class DataStore

Inheritance
System.Object
DataStore
Implements
System.IDisposable
Namespace: Eco.Core.Serialization
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
Type Description
StorageConfig

Methods

BackupAsync(IFileStorage)

Declaration
public Task BackupAsync(IFileStorage fileStorage)
Parameters
Type Name Description
IFileStorage fileStorage
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
Type Description
IPersistent

Delete(String)

Declaration
public void Delete(string fileName)
Parameters
Type Name Description
System.String fileName

Dispose()

Declaration
public void Dispose()

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
Name Description
T

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
Name Description
T

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)

Loads file asynchronously from DataStore.

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
Type Description
DataStore.ExclusiveAccess

WaitExclusiveAccessAsync()

Declaration
public ValueTask<DataStore.ExclusiveAccess> WaitExclusiveAccessAsync()
Returns
Type Description
System.Threading.Tasks.ValueTask<DataStore.ExclusiveAccess>

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

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾