FileManager

Namespace: Murder.Serialization
Assembly: Murder.dll

public class FileManager

FileHelper which will do OS operations. This is system-agnostic.

⭐ Constructors

public FileManager()

⭐ Methods

FileExistsWithCaseInsensitive(String&)

protected virtual bool FileExistsWithCaseInsensitive(String& path)

Parameters
path string&

Returns
bool

DeleteDirectoryIfExists(String&)

public bool DeleteDirectoryIfExists(String& path)

Parameters
path string&

Returns
bool

DeleteFileIfExists(String&)

public bool DeleteFileIfExists(String& path)

Parameters
path string&

Returns
bool

Exists(String&)

public bool Exists(String& path)

Parameters
path string&

Returns
bool

GetOrCreateDirectory(String&)

public DirectoryInfo GetOrCreateDirectory(String& path)

Parameters
path string&

Returns
DirectoryInfo

ListAllDirectories(string)

public IEnumerable<T> ListAllDirectories(string path)

Parameters
path string

Returns
IEnumerable<T>

SaveSerialized(T, string)

public string SaveSerialized(T value, string path)

Parameters
value T
path string

Returns
string

SerializeToJson(T)

public string SerializeToJson(T value)

Parameters
value T

Returns
string

DeserializeAsset(string)

public T DeserializeAsset(string path)

Parameters
path string

Returns
T

DeserializeFromJson(Stream)

public T DeserializeFromJson(Stream stream)

Parameters
stream Stream

Returns
T

DeserializeFromJson(string)

public T DeserializeFromJson(string json)

Parameters
json string

Returns
T

DeserializeGeneric(string, bool)

public T DeserializeGeneric(string path, bool warnOnErrors)

Parameters
path string
warnOnErrors bool

Returns
T

UnpackContent(string)

public T UnpackContent(string path)

Unpack content from a zip format. This reduces the overhead on IO time.

Parameters
path string

Returns
T

PackContentAsync(string, string)

public Task PackContentAsync(string json, string path)

Pack json content into a zip format that will be compressed and reduce IO time.

Parameters
json string
path string

Returns
Task

SaveTextAsync(string, string)

public Task SaveTextAsync(string fullpath, string content)

Parameters
fullpath string
content string

Returns
Task

DeserializeAssetAsync(string)

public Task<TResult> DeserializeAssetAsync(string path)

Deserialize and asset asynchronously. Assumes that is valid.

Parameters
path string

Returns
Task<TResult>

SaveSerializedAsync(T, string)

public ValueTask<TResult> SaveSerializedAsync(T value, string path)

Parameters
value T
path string

Returns
ValueTask<TResult>

CreateDirectoryPathIfNotExists(string)

public void CreateDirectoryPathIfNotExists(string filePath)

This will create a directory on the root of this , if the directory is not available.

Parameters
filePath string

DeleteContent(String&, bool)

public void DeleteContent(String& fullpath, bool deleteRootFiles)

Parameters
fullpath string&
deleteRootFiles bool

PackContent(T, string)

public void PackContent(T data, string path)

Parameters
data T
path string

SaveText(String&, String&)

public void SaveText(String& fullpath, String& content)

Parameters
fullpath string&
content string&

SerializeToJson(Stream, T)

public void SerializeToJson(Stream stream, T value)

Parameters
stream Stream
value T