Class StorageManager
Inheritance
System.Object
StorageManager
Implements
System.IDisposable
Assembly: Eco.Core.dll
Syntax
[Priority(-200)]
public sealed class StorageManager : Singleton<StorageManager>, IDisplayablePlugin, IHasDisplayTabs, IDisplayTab, IConfigurablePlugin, IEditablePlugin, IGUIPlugin, ICommandablePlugin, IThreadedPlugin, IShutdownablePlugin, IServerPlugin, IStorageManager, IDisposable
Constructors
StorageManager()
Declaration
StorageManager(PluginConfig<StorageConfig>, IFileStorage, Boolean)
Declaration
public StorageManager(PluginConfig<StorageConfig> config, IFileStorage baseStorage, bool enableBackups = false)
Parameters
Fields
GeneratingNewWorld
Declaration
public static bool GeneratingNewWorld
Field Value
Type |
Description |
System.Boolean |
|
Properties
Config
Declaration
public static StorageConfig Config { get; }
Property Value
ParamChanged
Declaration
public ThreadSafeAction<object, string> ParamChanged { get; set; }
Property Value
PluginConfig
Declaration
public IPluginConfig PluginConfig { get; }
Property Value
SaveName
Declaration
public static string SaveName { get; }
Property Value
Type |
Description |
System.String |
|
Storage
Declaration
public static IFileStorage Storage { get; }
Property Value
Methods
ClearDirtyState(IStorage)
Declaration
public void ClearDirtyState(IStorage storage)
Parameters
CreateStorageHandle(String, String)
Declaration
public IPersistent CreateStorageHandle(string folder, string name)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.String |
name |
|
Returns
CreateTransientHandle()
Declaration
public IPersistent CreateTransientHandle()
Returns
Delete(String)
Declaration
public static void Delete(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Dispose()
Declaration
FolderExists(String)
Declaration
public static bool FolderExists(string folder)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
Returns
Type |
Description |
System.Boolean |
|
GetCategory()
Declaration
public string GetCategory()
Returns
Type |
Description |
System.String |
|
GetCommands(Dictionary<String, Action>)
Declaration
public void GetCommands(Dictionary<string, Action> nameToFunction)
Parameters
Type |
Name |
Description |
System.Collections.Generic.Dictionary<System.String, System.Action> |
nameToFunction |
|
GetDisplayText()
Declaration
public string GetDisplayText()
Returns
Type |
Description |
System.String |
|
GetEditObject()
Declaration
public object GetEditObject()
Returns
Type |
Description |
System.Object |
|
GetFiles(String)
Declaration
public static List<string> GetFiles(string folder)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
Returns
Type |
Description |
System.Collections.Generic.List<System.String> |
|
GetStatus()
Declaration
public string GetStatus()
Returns
Type |
Description |
System.String |
|
IsDirty(IStorage)
Declaration
public bool IsDirty(IStorage storage)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Load(String)
Declaration
public static Stream Load(string fileName)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
Returns
Type |
Description |
System.IO.Stream |
|
Load<T>(String, Action<T>)
Declaration
public static void Load<T>(string folder, Action<T> onLoad)
where T : IStorage
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.Action<T> |
onLoad |
|
Type Parameters
LoadAndRemove<T>(String, Action<T, String>)
Loads object and removes entries from Eco.Core.Plugins.StorageManager.dataStore. May be used during conversion pass from old zip entries to new zip entries.
Declaration
public void LoadAndRemove<T>(string folder, Action<T, string> onLoad)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.Action<T, System.String> |
onLoad |
|
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
LoadOrCreate<TStorageType>(String, Action<TStorageType>)
Declaration
public static TStorageType LoadOrCreate<TStorageType>(string folder, Action<TStorageType> onCreate = null)
where TStorageType : class, IStorage
Parameters
Type |
Name |
Description |
System.String |
folder |
|
System.Action<TStorageType> |
onCreate |
|
Returns
Type |
Description |
TStorageType |
|
Type Parameters
Name |
Description |
TStorageType |
|
MarkDirty(IStorage)
Declaration
public void MarkDirty(IStorage storage)
Parameters
OnEditObjectChanged(Object, String)
Declaration
public void OnEditObjectChanged(object o, string param)
Parameters
Type |
Name |
Description |
System.Object |
o |
|
System.String |
param |
|
PersistAsync()
Persists all pending storages asynchronously.
Declaration
public Task<TimeSpan> PersistAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task<System.TimeSpan> |
|
PurgeAsync(String)
Declaration
public static Task PurgeAsync(string folder)
Parameters
Type |
Name |
Description |
System.String |
folder |
|
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
Remove(IStorage)
Declaration
public void Remove(IStorage storage)
Parameters
Run()
Declaration
Save(String, Stream)
Declaration
public static void Save(string fileName, Stream data)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
System.IO.Stream |
data |
|
Save(String, String)
Declaration
public static void Save(string fileName, string data)
Parameters
Type |
Name |
Description |
System.String |
fileName |
|
System.String |
data |
|
SaveAndFlushAsync()
Declaration
public static Task SaveAndFlushAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
ShutdownAsync()
Declaration
public Task ShutdownAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
TempStorageManager(IFileStorage)
Declaration
public static Singleton<StorageManager>.Temp TempStorageManager(IFileStorage fileStorage)
Parameters
Returns
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
UnlockSaveAndFlushAsync()
Declaration
public static Task UnlockSaveAndFlushAsync()
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
WithTempStorageManager(IFileStorage, Action)
Declaration
public static void WithTempStorageManager(IFileStorage fileStorage, Action action)
Parameters
Type |
Name |
Description |
IFileStorage |
fileStorage |
|
System.Action |
action |
|
Events
OnPersistAsync
Declaration
public static event Action OnPersistAsync
Event Type
Type |
Description |
System.Action |
|
OnSaveAllComplete
Declaration
public static event Action OnSaveAllComplete
Event Type
Type |
Description |
System.Action |
|
Implements
System.IDisposable
Extension Methods